@fluidframework/datastore 2.0.0-dev.3.1.0.125672 → 2.0.0-dev.4.2.0.153917

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +38 -0
  3. package/dist/channelContext.d.ts +2 -2
  4. package/dist/channelContext.d.ts.map +1 -1
  5. package/dist/channelContext.js +2 -2
  6. package/dist/channelContext.js.map +1 -1
  7. package/dist/dataStoreRuntime.d.ts +14 -9
  8. package/dist/dataStoreRuntime.d.ts.map +1 -1
  9. package/dist/dataStoreRuntime.js +47 -48
  10. package/dist/dataStoreRuntime.js.map +1 -1
  11. package/dist/packageVersion.d.ts +1 -1
  12. package/dist/packageVersion.js +1 -1
  13. package/dist/packageVersion.js.map +1 -1
  14. package/dist/remoteChannelContext.d.ts +2 -2
  15. package/dist/remoteChannelContext.d.ts.map +1 -1
  16. package/dist/remoteChannelContext.js +41 -60
  17. package/dist/remoteChannelContext.js.map +1 -1
  18. package/lib/channelContext.d.ts +2 -2
  19. package/lib/channelContext.d.ts.map +1 -1
  20. package/lib/channelContext.js +2 -2
  21. package/lib/channelContext.js.map +1 -1
  22. package/lib/dataStoreRuntime.d.ts +14 -9
  23. package/lib/dataStoreRuntime.d.ts.map +1 -1
  24. package/lib/dataStoreRuntime.js +48 -49
  25. package/lib/dataStoreRuntime.js.map +1 -1
  26. package/lib/packageVersion.d.ts +1 -1
  27. package/lib/packageVersion.js +1 -1
  28. package/lib/packageVersion.js.map +1 -1
  29. package/lib/remoteChannelContext.d.ts +2 -2
  30. package/lib/remoteChannelContext.d.ts.map +1 -1
  31. package/lib/remoteChannelContext.js +41 -60
  32. package/lib/remoteChannelContext.js.map +1 -1
  33. package/package.json +58 -59
  34. package/src/channelContext.ts +8 -1
  35. package/src/dataStoreRuntime.ts +77 -68
  36. package/src/packageVersion.ts +1 -1
  37. package/src/remoteChannelContext.ts +49 -60
@@ -11,7 +11,6 @@ import {
11
11
  IChannel,
12
12
  IChannelAttributes,
13
13
  IFluidDataStoreRuntime,
14
- IChannelFactory,
15
14
  } from "@fluidframework/datastore-definitions";
16
15
  import { IDocumentStorageService } from "@fluidframework/driver-definitions";
17
16
  import { readAndParse } from "@fluidframework/driver-utils";
@@ -20,7 +19,7 @@ import {
20
19
  CreateChildSummarizerNodeFn,
21
20
  IFluidDataStoreContext,
22
21
  IGarbageCollectionData,
23
- IGarbageCollectionDetailsBase,
22
+ IExperimentalIncrementalSummaryContext,
24
23
  ISummarizeInternalResult,
25
24
  ISummarizeResult,
26
25
  ISummarizerNodeWithGC,
@@ -63,7 +62,6 @@ export class RemoteChannelContext implements IChannelContext {
63
62
  private readonly registry: ISharedObjectRegistry,
64
63
  extraBlobs: Map<string, ArrayBufferLike> | undefined,
65
64
  createSummarizerNode: CreateChildSummarizerNodeFn,
66
- getBaseGCDetails: () => Promise<IGarbageCollectionDetailsBase>,
67
65
  private readonly attachMessageType?: string,
68
66
  ) {
69
67
  assert(!this.id.includes("/"), 0x310 /* Channel context ID cannot contain slashes */);
@@ -86,12 +84,18 @@ export class RemoteChannelContext implements IChannelContext {
86
84
  fullTree: boolean,
87
85
  trackState: boolean,
88
86
  telemetryContext?: ITelemetryContext,
89
- ) => this.summarizeInternal(fullTree, trackState, telemetryContext);
87
+ incrementalSummaryContext?: IExperimentalIncrementalSummaryContext,
88
+ ) =>
89
+ this.summarizeInternal(
90
+ fullTree,
91
+ trackState,
92
+ telemetryContext,
93
+ incrementalSummaryContext,
94
+ );
90
95
 
91
96
  this.summarizerNode = createSummarizerNode(
92
97
  thisSummarizeInternal,
93
98
  async (fullGC?: boolean) => this.getGCDataInternal(fullGC),
94
- async () => getBaseGCDetails(),
95
99
  );
96
100
 
97
101
  this.thresholdOpsCounter = new ThresholdCounter(
@@ -170,6 +174,7 @@ export class RemoteChannelContext implements IChannelContext {
170
174
  fullTree: boolean,
171
175
  trackState: boolean,
172
176
  telemetryContext?: ITelemetryContext,
177
+ incrementalSummaryContext?: IExperimentalIncrementalSummaryContext,
173
178
  ): Promise<ISummarizeInternalResult> {
174
179
  const channel = await this.getChannel();
175
180
  const summarizeResult = await summarizeChannelAsync(
@@ -177,6 +182,7 @@ export class RemoteChannelContext implements IChannelContext {
177
182
  fullTree,
178
183
  trackState,
179
184
  telemetryContext,
185
+ incrementalSummaryContext,
180
186
  );
181
187
  return { ...summarizeResult, id: this.id };
182
188
  }
@@ -195,62 +201,45 @@ export class RemoteChannelContext implements IChannelContext {
195
201
  );
196
202
  }
197
203
 
198
- let factory: IChannelFactory | undefined;
199
- // this is a backward compatibility case where
200
- // the attach message doesn't include
201
- // the attributes. Since old attach messages
202
- // will not have attributes we need to keep
203
- // this as long as we support old attach messages
204
- if (attributes === undefined) {
205
- if (this.attachMessageType === undefined) {
206
- // TODO: dataStoreId may require a different tag from PackageData #7488
207
- throw new DataCorruptionError("channelTypeNotAvailable", {
208
- channelId: {
209
- value: this.id,
210
- tag: TelemetryDataTag.CodeArtifact,
211
- },
212
- dataStoreId: {
213
- value: this.dataStoreContext.id,
214
- tag: TelemetryDataTag.CodeArtifact,
215
- },
216
- dataStorePackagePath: this.dataStoreContext.packagePath.join("/"),
217
- });
218
- }
219
- factory = this.registry.get(this.attachMessageType);
220
- if (factory === undefined) {
221
- // TODO: dataStoreId may require a different tag from PackageData #7488
222
- throw new DataCorruptionError("channelFactoryNotRegisteredForAttachMessageType", {
223
- channelId: {
224
- value: this.id,
225
- tag: TelemetryDataTag.CodeArtifact,
226
- },
227
- dataStoreId: {
228
- value: this.dataStoreContext.id,
229
- tag: TelemetryDataTag.CodeArtifact,
230
- },
231
- dataStorePackagePath: this.dataStoreContext.packagePath.join("/"),
232
- channelFactoryType: this.attachMessageType,
233
- });
234
- }
235
- attributes = factory.attributes;
236
- } else {
237
- factory = this.registry.get(attributes.type);
238
- if (factory === undefined) {
239
- // TODO: dataStoreId may require a different tag from PackageData #7488
240
- throw new DataCorruptionError("channelFactoryNotRegisteredForGivenType", {
241
- channelId: {
242
- value: this.id,
243
- tag: TelemetryDataTag.CodeArtifact,
244
- },
245
- dataStoreId: {
246
- value: this.dataStoreContext.id,
247
- tag: TelemetryDataTag.CodeArtifact,
248
- },
249
- dataStorePackagePath: this.dataStoreContext.packagePath.join("/"),
250
- channelFactoryType: attributes.type,
251
- });
252
- }
204
+ // This is a backward compatibility case where the attach message doesn't include attributes. They must
205
+ // include attach message type.
206
+ // Since old attach messages will not have attributes, we need to keep this as long as we support old attach
207
+ // messages.
208
+ const channelFactoryType = attributes ? attributes.type : this.attachMessageType;
209
+ if (channelFactoryType === undefined) {
210
+ throw new DataCorruptionError("channelTypeNotAvailable", {
211
+ channelId: {
212
+ value: this.id,
213
+ tag: TelemetryDataTag.CodeArtifact,
214
+ },
215
+ dataStoreId: {
216
+ value: this.dataStoreContext.id,
217
+ tag: TelemetryDataTag.CodeArtifact,
218
+ },
219
+ dataStorePackagePath: this.dataStoreContext.packagePath.join("/"),
220
+ channelFactoryType: this.attachMessageType,
221
+ });
253
222
  }
223
+ const factory = this.registry.get(channelFactoryType);
224
+ if (factory === undefined) {
225
+ // TODO: dataStoreId may require a different tag from PackageData #7488
226
+ throw new DataCorruptionError("channelFactoryNotRegisteredForGivenType", {
227
+ channelId: {
228
+ value: this.id,
229
+ tag: TelemetryDataTag.CodeArtifact,
230
+ },
231
+ dataStoreId: {
232
+ value: this.dataStoreContext.id,
233
+ tag: TelemetryDataTag.CodeArtifact,
234
+ },
235
+ dataStorePackagePath: this.dataStoreContext.packagePath.join("/"),
236
+ channelFactoryType,
237
+ });
238
+ }
239
+
240
+ // This is a backward compatibility case where the attach message doesn't include attributes. Get the attributes
241
+ // from the factory.
242
+ attributes = attributes ?? factory.attributes;
254
243
 
255
244
  // Compare snapshot version to collaborative object version
256
245
  if (