@fluidframework/datastore 2.0.0-internal.3.1.0 → 2.0.0-internal.3.2.0
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.
- package/dist/dataStoreRuntime.d.ts +14 -9
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/dataStoreRuntime.js +45 -45
- package/dist/dataStoreRuntime.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/remoteChannelContext.d.ts +2 -2
- package/dist/remoteChannelContext.d.ts.map +1 -1
- package/dist/remoteChannelContext.js +2 -2
- package/dist/remoteChannelContext.js.map +1 -1
- package/lib/dataStoreRuntime.d.ts +14 -9
- package/lib/dataStoreRuntime.d.ts.map +1 -1
- package/lib/dataStoreRuntime.js +49 -49
- package/lib/dataStoreRuntime.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/remoteChannelContext.d.ts +2 -2
- package/lib/remoteChannelContext.d.ts.map +1 -1
- package/lib/remoteChannelContext.js +2 -2
- package/lib/remoteChannelContext.js.map +1 -1
- package/package.json +112 -112
- package/src/dataStoreRuntime.ts +76 -68
- package/src/packageVersion.ts +1 -1
- package/src/remoteChannelContext.ts +0 -3
|
@@ -52,7 +52,6 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
|
|
|
52
52
|
private readonly contexts;
|
|
53
53
|
private readonly contextsDeferred;
|
|
54
54
|
private readonly pendingAttach;
|
|
55
|
-
private bindState;
|
|
56
55
|
private readonly deferredAttached;
|
|
57
56
|
private readonly localChannelContextQueue;
|
|
58
57
|
private readonly notBoundedChannelContextSet;
|
|
@@ -64,8 +63,14 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
|
|
|
64
63
|
readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
|
|
65
64
|
private readonly quorum;
|
|
66
65
|
private readonly audience;
|
|
67
|
-
readonly
|
|
68
|
-
|
|
66
|
+
private readonly mc;
|
|
67
|
+
get logger(): ITelemetryLogger;
|
|
68
|
+
/**
|
|
69
|
+
* If the summarizer makes local changes, a telemetry event is logged. This has the potential to be very noisy.
|
|
70
|
+
* So, adding a count of how many telemetry events are logged per data store context. This can be
|
|
71
|
+
* controlled via feature flags.
|
|
72
|
+
*/
|
|
73
|
+
private localChangesTelemetryCount;
|
|
69
74
|
/**
|
|
70
75
|
* Invokes the given callback and expects that no ops are submitted
|
|
71
76
|
* until execution finishes. If an op is submitted, an error will be raised.
|
|
@@ -172,12 +177,6 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
|
|
|
172
177
|
* @param outboundHandle - The handle of the outbound node that is referenced.
|
|
173
178
|
*/
|
|
174
179
|
private addedGCOutboundReference;
|
|
175
|
-
/**
|
|
176
|
-
* Returns the base GC details for the channel with the given id. This is used to initialize its GC state.
|
|
177
|
-
* @param channelId - The id of the channel context that is asked for the initial GC details.
|
|
178
|
-
* @returns the requested channel's base GC details.
|
|
179
|
-
*/
|
|
180
|
-
private getChannelBaseGCDetails;
|
|
181
180
|
/**
|
|
182
181
|
* Returns a summary at the current sequence number.
|
|
183
182
|
* @param fullTree - true to bypass optimizations and force a full summary tree
|
|
@@ -217,6 +216,12 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
|
|
|
217
216
|
private processChannelOp;
|
|
218
217
|
private attachListener;
|
|
219
218
|
private verifyNotClosed;
|
|
219
|
+
/**
|
|
220
|
+
* Summarizer client should not have local changes. These changes can become part of the summary and can break
|
|
221
|
+
* eventual consistency. For example, the next summary (say at ref seq# 100) may contain these changes whereas
|
|
222
|
+
* other clients that are up-to-date till seq# 100 may not have them yet.
|
|
223
|
+
*/
|
|
224
|
+
private identifyLocalChangeInSummarizer;
|
|
220
225
|
}
|
|
221
226
|
/**
|
|
222
227
|
* Mixin class that adds request handler to FluidDataStoreRuntime
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreRuntime.d.ts","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EACN,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,SAAS,EACT,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACN,SAAS,EACT,aAAa,EACb,WAAW,EACX,cAAc,EACd,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAIN,iBAAiB,EAEjB,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"dataStoreRuntime.d.ts","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EACN,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,SAAS,EACT,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACN,SAAS,EACT,aAAa,EACb,WAAW,EACX,cAAc,EACd,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAIN,iBAAiB,EAEjB,MAAM,8BAA8B,CAAC;AAWtC,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EAIzB,cAAc,EACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAIN,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,MAAM,qCAAqC,CAAC;AAa7C,OAAO,EACN,QAAQ,EACR,sBAAsB,EACtB,4BAA4B,EAC5B,eAAe,EACf,MAAM,uCAAuC,CAAC;AAY/C,oBAAY,oBAAoB;IAE/B,MAAM,WAAW;IACjB,SAAS,OAAO;CAChB;AA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Q,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO;IAwBlF;;;;OAIG;IACI,QAAQ,CAAC,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO;IAoBtE,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;IAQ3D,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,gBAAgB;IAqBxB,OAAO,CAAC,cAAc;IA0CtB,OAAO,CAAC,eAAe;IAMvB;;;;OAIG;IACH,OAAO,CAAC,+BAA+B;CA8BvC;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,6BACL,QAAQ,WAAW,qBAAqB,KAAK,QAAQ,SAAS,CAAC,SACnF,4BAA4B,iCAUD,CAAC;AAEnC;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,sBAErB,qBAAqB,KAC1B,QAAQ;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAAC,SACvD,4BAA4B,iCAkCD,CAAC"}
|
package/dist/dataStoreRuntime.js
CHANGED
|
@@ -41,6 +41,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
41
41
|
* and the primary way of interacting with some Fluid objects, and should be used if possible.
|
|
42
42
|
*/
|
|
43
43
|
constructor(dataStoreContext, sharedObjectRegistry, existing, initializeEntryPoint) {
|
|
44
|
+
var _a;
|
|
44
45
|
super();
|
|
45
46
|
this.dataStoreContext = dataStoreContext;
|
|
46
47
|
this.sharedObjectRegistry = sharedObjectRegistry;
|
|
@@ -55,19 +56,15 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
55
56
|
// store becomes visible.
|
|
56
57
|
this.pendingHandlesToMakeVisible = new Set();
|
|
57
58
|
(0, common_utils_1.assert)(!dataStoreContext.id.includes("/"), 0x30e /* Id cannot contain slashes. DataStoreContext should have validated this. */);
|
|
58
|
-
this.
|
|
59
|
+
this.mc = (0, telemetry_utils_1.loggerToMonitoringContext)(telemetry_utils_1.ChildLogger.create(dataStoreContext.logger, "FluidDataStoreRuntime", {
|
|
59
60
|
all: { dataStoreId: (0, uuid_1.v4)() },
|
|
60
|
-
});
|
|
61
|
+
}));
|
|
61
62
|
this.id = dataStoreContext.id;
|
|
62
63
|
this.options = dataStoreContext.options;
|
|
63
64
|
this.deltaManager = dataStoreContext.deltaManager;
|
|
64
65
|
this.quorum = dataStoreContext.getQuorum();
|
|
65
66
|
this.audience = dataStoreContext.getAudience();
|
|
66
67
|
const tree = dataStoreContext.baseSnapshot;
|
|
67
|
-
this.channelsBaseGCDetails = new common_utils_1.LazyPromise(async () => {
|
|
68
|
-
const baseGCDetails = await this.dataStoreContext.getBaseGCDetails();
|
|
69
|
-
return (0, garbage_collector_1.unpackChildNodesGCDetails)(baseGCDetails);
|
|
70
|
-
});
|
|
71
68
|
// Must always receive the data store type inside of the attributes
|
|
72
69
|
if ((tree === null || tree === void 0 ? void 0 : tree.trees) !== undefined) {
|
|
73
70
|
Object.keys(tree.trees).forEach((path) => {
|
|
@@ -95,7 +92,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
95
92
|
else {
|
|
96
93
|
channelContext = new remoteChannelContext_1.RemoteChannelContext(this, dataStoreContext, dataStoreContext.storage, (content, localOpMetadata) => this.submitChannelOp(path, content, localOpMetadata), (address) => this.setChannelDirty(address), (srcHandle, outboundHandle) => this.addedGCOutboundReference(srcHandle, outboundHandle), path, tree.trees[path], this.sharedObjectRegistry, undefined /* extraBlobs */, this.dataStoreContext.getCreateChildSummarizerNodeFn(path, {
|
|
97
94
|
type: runtime_definitions_1.CreateSummarizerNodeSource.FromSummary,
|
|
98
|
-
})
|
|
95
|
+
}));
|
|
99
96
|
}
|
|
100
97
|
const deferred = new common_utils_1.Deferred();
|
|
101
98
|
deferred.resolve(channelContext);
|
|
@@ -108,8 +105,6 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
108
105
|
this.entryPoint = new fluidHandle_1.FluidObjectHandle(promise, "", this.objectsRoutingContext);
|
|
109
106
|
}
|
|
110
107
|
this.attachListener();
|
|
111
|
-
// If exists on storage or loaded from a snapshot, it should already be bound.
|
|
112
|
-
this.bindState = existing ? runtime_definitions_1.BindState.Bound : runtime_definitions_1.BindState.NotBound;
|
|
113
108
|
this._attachState = dataStoreContext.attachState;
|
|
114
109
|
/**
|
|
115
110
|
* If existing flag is false, this is a new data store and is not visible. The existing flag can be true in two
|
|
@@ -134,6 +129,9 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
134
129
|
if (existing) {
|
|
135
130
|
this.deferredAttached.resolve();
|
|
136
131
|
}
|
|
132
|
+
// By default, a data store can log maximum 10 local changes telemetry in summarizer.
|
|
133
|
+
this.localChangesTelemetryCount =
|
|
134
|
+
(_a = this.mc.config.getNumber("Fluid.Telemetry.LocalChangesTelemetryCount")) !== null && _a !== void 0 ? _a : 10;
|
|
137
135
|
}
|
|
138
136
|
/**
|
|
139
137
|
* @deprecated - Instantiate the class using its constructor instead.
|
|
@@ -185,6 +183,9 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
185
183
|
get disposed() {
|
|
186
184
|
return this._disposed;
|
|
187
185
|
}
|
|
186
|
+
get logger() {
|
|
187
|
+
return this.mc.logger;
|
|
188
|
+
}
|
|
188
189
|
/**
|
|
189
190
|
* Invokes the given callback and expects that no ops are submitted
|
|
190
191
|
* until execution finishes. If an op is submitted, an error will be raised.
|
|
@@ -226,7 +227,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
226
227
|
return { mimeType: "fluid/object", status: 200, value: channel };
|
|
227
228
|
}
|
|
228
229
|
catch (error) {
|
|
229
|
-
this.logger.sendErrorEvent({ eventName: "GetChannelFailedInRequest" }, error);
|
|
230
|
+
this.mc.logger.sendErrorEvent({ eventName: "GetChannelFailedInRequest" }, error);
|
|
230
231
|
return (0, runtime_utils_1.createResponseError)(500, `Failed to get Channel: ${error}`, request);
|
|
231
232
|
}
|
|
232
233
|
}
|
|
@@ -268,6 +269,8 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
268
269
|
deferred.resolve(context);
|
|
269
270
|
this.contextsDeferred.set(id, deferred);
|
|
270
271
|
}
|
|
272
|
+
// Channels (DDS) should not be created in summarizer client.
|
|
273
|
+
this.identifyLocalChangeInSummarizer("DDSCreatedInSummarizer", id, type);
|
|
271
274
|
(0, common_utils_1.assert)(!!context.channel, 0x17a /* "Channel should be loaded when created!!" */);
|
|
272
275
|
return context.channel;
|
|
273
276
|
}
|
|
@@ -317,7 +320,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
317
320
|
handle.attachGraph();
|
|
318
321
|
});
|
|
319
322
|
this.pendingHandlesToMakeVisible.clear();
|
|
320
|
-
this.
|
|
323
|
+
this.dataStoreContext.makeLocallyVisible();
|
|
321
324
|
}
|
|
322
325
|
/**
|
|
323
326
|
* This function is called when a handle to this data store is added to a visible DDS.
|
|
@@ -333,12 +336,7 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
333
336
|
* 2. Attaching the graph if the data store becomes attached.
|
|
334
337
|
*/
|
|
335
338
|
bindToContext() {
|
|
336
|
-
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
this.bindState = runtime_definitions_1.BindState.Binding;
|
|
340
|
-
this.dataStoreContext.bindToContext();
|
|
341
|
-
this.bindState = runtime_definitions_1.BindState.Bound;
|
|
339
|
+
this.makeVisibleAndAttachGraph();
|
|
342
340
|
}
|
|
343
341
|
bind(handle) {
|
|
344
342
|
// If visible, attach the incoming handle's graph. Else, this will be done when we become visible.
|
|
@@ -380,16 +378,14 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
380
378
|
this.pendingAttach.delete(id);
|
|
381
379
|
}
|
|
382
380
|
else {
|
|
383
|
-
(0, common_utils_1.assert)(!this.contexts.has(id), 0x17d /*
|
|
384
|
-
is in pendingAttach set: ${this.pendingAttach.has(id)},
|
|
385
|
-
is local channel contexts: ${this.contexts.get(id) instanceof LocalChannelContextBase}` */);
|
|
381
|
+
(0, common_utils_1.assert)(!this.contexts.has(id), 0x17d /* "Unexpected attach channel OP" */);
|
|
386
382
|
const flatBlobs = new Map();
|
|
387
383
|
const snapshotTree = (0, driver_utils_1.buildSnapshotTree)(attachMessage.snapshot.entries, flatBlobs);
|
|
388
384
|
const remoteChannelContext = new remoteChannelContext_1.RemoteChannelContext(this, this.dataStoreContext, this.dataStoreContext.storage, (content, localContentMetadata) => this.submitChannelOp(id, content, localContentMetadata), (address) => this.setChannelDirty(address), (srcHandle, outboundHandle) => this.addedGCOutboundReference(srcHandle, outboundHandle), id, snapshotTree, this.sharedObjectRegistry, flatBlobs, this.dataStoreContext.getCreateChildSummarizerNodeFn(id, {
|
|
389
385
|
type: runtime_definitions_1.CreateSummarizerNodeSource.FromAttach,
|
|
390
386
|
sequenceNumber: message.sequenceNumber,
|
|
391
387
|
snapshot: attachMessage.snapshot,
|
|
392
|
-
}),
|
|
388
|
+
}), attachMessage.type);
|
|
393
389
|
this.contexts.set(id, remoteChannelContext);
|
|
394
390
|
if (this.contextsDeferred.has(id)) {
|
|
395
391
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -515,30 +511,6 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
515
511
|
var _a, _b;
|
|
516
512
|
(_b = (_a = this.dataStoreContext).addedGCOutboundReference) === null || _b === void 0 ? void 0 : _b.call(_a, srcHandle, outboundHandle);
|
|
517
513
|
}
|
|
518
|
-
/**
|
|
519
|
-
* Returns the base GC details for the channel with the given id. This is used to initialize its GC state.
|
|
520
|
-
* @param channelId - The id of the channel context that is asked for the initial GC details.
|
|
521
|
-
* @returns the requested channel's base GC details.
|
|
522
|
-
*/
|
|
523
|
-
async getChannelBaseGCDetails(channelId) {
|
|
524
|
-
var _a;
|
|
525
|
-
let channelBaseGCDetails = (await this.channelsBaseGCDetails).get(channelId);
|
|
526
|
-
if (channelBaseGCDetails === undefined) {
|
|
527
|
-
channelBaseGCDetails = {};
|
|
528
|
-
}
|
|
529
|
-
else if (((_a = channelBaseGCDetails.gcData) === null || _a === void 0 ? void 0 : _a.gcNodes) !== undefined) {
|
|
530
|
-
// Note: if the child channel has an explicit handle route to its parent, it will be removed here and
|
|
531
|
-
// expected to be added back by the parent when getGCData is called.
|
|
532
|
-
(0, garbage_collector_1.removeRouteFromAllNodes)(channelBaseGCDetails.gcData.gcNodes, this.absolutePath);
|
|
533
|
-
}
|
|
534
|
-
// Currently, channel context's are always considered used. So, it there are no used routes for it, we still
|
|
535
|
-
// need to mark it as used. Add self-route (empty string) to the channel context's used routes.
|
|
536
|
-
if (channelBaseGCDetails.usedRoutes === undefined ||
|
|
537
|
-
channelBaseGCDetails.usedRoutes.length === 0) {
|
|
538
|
-
channelBaseGCDetails.usedRoutes = [""];
|
|
539
|
-
}
|
|
540
|
-
return channelBaseGCDetails;
|
|
541
|
-
}
|
|
542
514
|
/**
|
|
543
515
|
* Returns a summary at the current sequence number.
|
|
544
516
|
* @param fullTree - true to bypass optimizations and force a full summary tree
|
|
@@ -754,6 +726,34 @@ class FluidDataStoreRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
754
726
|
throw new telemetry_utils_1.LoggingError("Runtime is closed");
|
|
755
727
|
}
|
|
756
728
|
}
|
|
729
|
+
/**
|
|
730
|
+
* Summarizer client should not have local changes. These changes can become part of the summary and can break
|
|
731
|
+
* eventual consistency. For example, the next summary (say at ref seq# 100) may contain these changes whereas
|
|
732
|
+
* other clients that are up-to-date till seq# 100 may not have them yet.
|
|
733
|
+
*/
|
|
734
|
+
identifyLocalChangeInSummarizer(eventName, channelId, channelType) {
|
|
735
|
+
if (this.clientDetails.type !== "summarizer" || this.localChangesTelemetryCount <= 0) {
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
// Log a telemetry if there are local changes in the summarizer. This will give us data on how often
|
|
739
|
+
// this is happening and which data stores do this. The eventual goal is to disallow local changes
|
|
740
|
+
// in the summarizer and the data will help us plan this.
|
|
741
|
+
this.mc.logger.sendTelemetryEvent({
|
|
742
|
+
eventName,
|
|
743
|
+
channelType,
|
|
744
|
+
channelId: {
|
|
745
|
+
value: channelId,
|
|
746
|
+
tag: telemetry_utils_1.TelemetryDataTag.CodeArtifact,
|
|
747
|
+
},
|
|
748
|
+
fluidDataStoreId: {
|
|
749
|
+
value: this.id,
|
|
750
|
+
tag: telemetry_utils_1.TelemetryDataTag.CodeArtifact,
|
|
751
|
+
},
|
|
752
|
+
fluidDataStorePackagePath: (0, runtime_utils_1.packagePathToTelemetryProperty)(this.dataStoreContext.packagePath),
|
|
753
|
+
stack: (0, telemetry_utils_1.generateStack)(),
|
|
754
|
+
});
|
|
755
|
+
this.localChangesTelemetryCount--;
|
|
756
|
+
}
|
|
757
757
|
}
|
|
758
758
|
exports.FluidDataStoreRuntime = FluidDataStoreRuntime;
|
|
759
759
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreRuntime.js","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAUH,iFAK+C;AAC/C,qEAAkF;AAClF,+DAMsC;AACtC,qEAAiG;AACjG,+DAAiE;AACjE,+EAQ8C;AAC9C,6EAa6C;AAC7C,iEAUuC;AAOvC,yEAK2C;AAC3C,+BAAkC;AAClC,qDAAqE;AACrE,+DAI+B;AAC/B,iEAA8D;AAC9D,+CAAkD;AAElD,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC/B,wBAAwB;IACxB,yCAAiB,CAAA;IACjB,wCAAgB,CAAA;AACjB,CAAC,EAJW,oBAAoB,GA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AAE,CAAC;SAC9B;QACD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,GAAG,IAAW;QAC7B,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;QAC/C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,OAAO,KAAK,SAAS,EAAE;YAC1B,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;SACrD;QACD,OAAO,OAAO,CAAC;IAChB,CAAC;CAC+B,CAAC;AAtCtB,QAAA,mBAAmB,uBAsCG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport {\n\tFluidObject,\n\tIFluidHandle,\n\tIFluidHandleContext,\n\tIRequest,\n\tIResponse,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tIAudience,\n\tIDeltaManager,\n\tAttachState,\n\tILoaderOptions,\n} from \"@fluidframework/container-definitions\";\nimport { DataProcessingError, UsageError } from \"@fluidframework/container-utils\";\nimport {\n\tassert,\n\tDeferred,\n\tLazyPromise,\n\tTypedEventEmitter,\n\tunreachableCase,\n} from \"@fluidframework/common-utils\";\nimport { ChildLogger, LoggingError, raiseConnectedEvent } from \"@fluidframework/telemetry-utils\";\nimport { buildSnapshotTree } from \"@fluidframework/driver-utils\";\nimport {\n\tIClientDetails,\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tSummaryType,\n\tISummaryBlob,\n\tISummaryTree,\n\tIQuorumClients,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n\tBindState,\n\tCreateSummarizerNodeSource,\n\tIAttachMessage,\n\tIEnvelope,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreChannel,\n\tIGarbageCollectionData,\n\tIGarbageCollectionDetailsBase,\n\tIInboundSignalMessage,\n\tISummaryTreeWithStats,\n\tVisibilityState,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertSummaryTreeToITree,\n\tgenerateHandleContextPath,\n\tRequestParser,\n\tSummaryTreeBuilder,\n\tcreate404Response,\n\tcreateResponseError,\n\texceptionToResponse,\n\trequestFluidObject,\n} from \"@fluidframework/runtime-utils\";\nimport {\n\tIChannel,\n\tIFluidDataStoreRuntime,\n\tIFluidDataStoreRuntimeEvents,\n\tIChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n\tGCDataBuilder,\n\tremoveRouteFromAllNodes,\n\tunpackChildNodesGCDetails,\n\tunpackChildNodesUsedRoutes,\n} from \"@fluidframework/garbage-collector\";\nimport { v4 as uuid } from \"uuid\";\nimport { IChannelContext, summarizeChannel } from \"./channelContext\";\nimport {\n\tLocalChannelContext,\n\tLocalChannelContextBase,\n\tRehydratedLocalChannelContext,\n} from \"./localChannelContext\";\nimport { RemoteChannelContext } from \"./remoteChannelContext\";\nimport { FluidObjectHandle } from \"./fluidHandle\";\n\nexport enum DataStoreMessageType {\n\t// Creates a new channel\n\tAttach = \"attach\",\n\tChannelOp = \"op\",\n}\n\nexport interface ISharedObjectRegistry {\n\t// TODO consider making this async. A consequence is that either the creation of a distributed data type\n\t// is async or we need a new API to split the synchronous vs. asynchronous creation.\n\tget(name: string): IChannelFactory | undefined;\n}\n\n/**\n * Base data store class\n */\nexport class FluidDataStoreRuntime\n\textends TypedEventEmitter<IFluidDataStoreRuntimeEvents>\n\timplements IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext\n{\n\t/**\n\t * @deprecated - Instantiate the class using its constructor instead.\n\t *\n\t * Loads the data store runtime\n\t * @param context - The data store context\n\t * @param sharedObjectRegistry - The registry of shared objects used by this data store\n\t * @param existing - If loading from an existing file.\n\t */\n\tpublic static load(\n\t\tcontext: IFluidDataStoreContext,\n\t\tsharedObjectRegistry: ISharedObjectRegistry,\n\t\texisting: boolean,\n\t): FluidDataStoreRuntime {\n\t\treturn new FluidDataStoreRuntime(\n\t\t\tcontext,\n\t\t\tsharedObjectRegistry,\n\t\t\texisting,\n\t\t\tasync (dataStoreRuntime) => requestFluidObject(dataStoreRuntime, \"/\"),\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IFluidDataStoreRuntime.entryPoint}\n\t */\n\tpublic readonly entryPoint?: IFluidHandle<FluidObject>;\n\n\tpublic get IFluidRouter() {\n\t\treturn this;\n\t}\n\n\tpublic get connected(): boolean {\n\t\treturn this.dataStoreContext.connected;\n\t}\n\n\tpublic get clientId(): string | undefined {\n\t\treturn this.dataStoreContext.clientId;\n\t}\n\n\tpublic get clientDetails(): IClientDetails {\n\t\treturn this.dataStoreContext.clientDetails;\n\t}\n\n\tpublic get isAttached(): boolean {\n\t\treturn this.attachState !== AttachState.Detached;\n\t}\n\n\tpublic get attachState(): AttachState {\n\t\treturn this._attachState;\n\t}\n\n\tpublic get absolutePath(): string {\n\t\treturn generateHandleContextPath(this.id, this.routeContext);\n\t}\n\n\tpublic get routeContext(): IFluidHandleContext {\n\t\treturn this.dataStoreContext.IFluidHandleContext;\n\t}\n\n\tpublic get IFluidHandleContext() {\n\t\treturn this;\n\t}\n\n\tpublic get rootRoutingContext() {\n\t\treturn this;\n\t}\n\tpublic get channelsRoutingContext() {\n\t\treturn this;\n\t}\n\tpublic get objectsRoutingContext() {\n\t\treturn this;\n\t}\n\n\tprivate _disposed = false;\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\n\tprivate readonly contexts = new Map<string, IChannelContext>();\n\tprivate readonly contextsDeferred = new Map<string, Deferred<IChannelContext>>();\n\tprivate readonly pendingAttach = new Map<string, IAttachMessage>();\n\n\tprivate bindState: BindState;\n\tprivate readonly deferredAttached = new Deferred<void>();\n\tprivate readonly localChannelContextQueue = new Map<string, LocalChannelContextBase>();\n\tprivate readonly notBoundedChannelContextSet = new Set<string>();\n\tprivate _attachState: AttachState;\n\tpublic visibilityState: VisibilityState;\n\t// A list of handles that are bound when the data store is not visible. We have to make them visible when the data\n\t// store becomes visible.\n\tprivate readonly pendingHandlesToMakeVisible: Set<IFluidHandle> = new Set();\n\n\tpublic readonly id: string;\n\tpublic readonly options: ILoaderOptions;\n\tpublic readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n\tprivate readonly quorum: IQuorumClients;\n\tprivate readonly audience: IAudience;\n\tpublic readonly logger: ITelemetryLogger;\n\n\t// A map of child channel context ids to the their base GC details. This is used to initialize the GC state of the\n\t// channel contexts.\n\tprivate readonly channelsBaseGCDetails: LazyPromise<Map<string, IGarbageCollectionDetailsBase>>;\n\n\t/**\n\t * Invokes the given callback and expects that no ops are submitted\n\t * until execution finishes. If an op is submitted, an error will be raised.\n\t *\n\t * Can be disabled by feature gate `Fluid.ContainerRuntime.DisableOpReentryCheck`\n\t *\n\t * @param callback - the callback to be invoked\n\t */\n\tpublic ensureNoDataModelChanges<T>(callback: () => T): T {\n\t\t// back-compat ADO:2309\n\t\treturn this.dataStoreContext.ensureNoDataModelChanges === undefined\n\t\t\t? callback()\n\t\t\t: this.dataStoreContext.ensureNoDataModelChanges(callback);\n\t}\n\n\t/**\n\t * Create an instance of a DataStore runtime.\n\t *\n\t * @param dataStoreContext - Context object for the runtime.\n\t * @param sharedObjectRegistry - The registry of shared objects that this data store will be able to instantiate.\n\t * @param existing - Pass 'true' if loading this datastore from an existing file; pass 'false' otherwise.\n\t * @param initializeEntryPoint - Function to initialize the entryPoint object for the data store runtime. The\n\t * handle to this data store runtime will point to the object returned by this function. If this function is not\n\t * provided, the handle will be left undefined. This is here so we can start making handles a first-class citizen\n\t * and the primary way of interacting with some Fluid objects, and should be used if possible.\n\t */\n\tpublic constructor(\n\t\tprivate readonly dataStoreContext: IFluidDataStoreContext,\n\t\tprivate readonly sharedObjectRegistry: ISharedObjectRegistry,\n\t\texisting: boolean,\n\t\tinitializeEntryPoint?: (runtime: IFluidDataStoreRuntime) => Promise<FluidObject>,\n\t) {\n\t\tsuper();\n\n\t\tassert(\n\t\t\t!dataStoreContext.id.includes(\"/\"),\n\t\t\t0x30e /* Id cannot contain slashes. DataStoreContext should have validated this. */,\n\t\t);\n\n\t\tthis.logger = ChildLogger.create(dataStoreContext.logger, \"FluidDataStoreRuntime\", {\n\t\t\tall: { dataStoreId: uuid() },\n\t\t});\n\n\t\tthis.id = dataStoreContext.id;\n\t\tthis.options = dataStoreContext.options;\n\t\tthis.deltaManager = dataStoreContext.deltaManager;\n\t\tthis.quorum = dataStoreContext.getQuorum();\n\t\tthis.audience = dataStoreContext.getAudience();\n\n\t\tconst tree = dataStoreContext.baseSnapshot;\n\n\t\tthis.channelsBaseGCDetails = new LazyPromise(async () => {\n\t\t\tconst baseGCDetails = await this.dataStoreContext.getBaseGCDetails();\n\t\t\treturn unpackChildNodesGCDetails(baseGCDetails);\n\t\t});\n\n\t\t// Must always receive the data store type inside of the attributes\n\t\tif (tree?.trees !== undefined) {\n\t\t\tObject.keys(tree.trees).forEach((path) => {\n\t\t\t\t// Issue #4414\n\t\t\t\tif (path === \"_search\") {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet channelContext: IChannelContext;\n\t\t\t\t// If already exists on storage, then create a remote channel. However, if it is case of rehydrating a\n\t\t\t\t// container from snapshot where we load detached container from a snapshot, isLocalDataStore would be\n\t\t\t\t// true. In this case create a RehydratedLocalChannelContext.\n\t\t\t\tif (dataStoreContext.isLocalDataStore) {\n\t\t\t\t\tchannelContext = new RehydratedLocalChannelContext(\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\tthis.sharedObjectRegistry,\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\tthis.dataStoreContext,\n\t\t\t\t\t\tthis.dataStoreContext.storage,\n\t\t\t\t\t\tthis.logger,\n\t\t\t\t\t\t(content, localOpMetadata) =>\n\t\t\t\t\t\t\tthis.submitChannelOp(path, content, localOpMetadata),\n\t\t\t\t\t\t(address: string) => this.setChannelDirty(address),\n\t\t\t\t\t\t(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n\t\t\t\t\t\t\tthis.addedGCOutboundReference(srcHandle, outboundHandle),\n\t\t\t\t\t\ttree.trees[path],\n\t\t\t\t\t);\n\t\t\t\t\t// This is the case of rehydrating a detached container from snapshot. Now due to delay loading of\n\t\t\t\t\t// data store, if the data store is loaded after the container is attached, then we missed making\n\t\t\t\t\t// the channel visible. So do it now. Otherwise, add it to local channel context queue, so\n\t\t\t\t\t// that it can be make it visible later with the data store.\n\t\t\t\t\tif (dataStoreContext.attachState !== AttachState.Detached) {\n\t\t\t\t\t\t(channelContext as LocalChannelContextBase).makeVisible();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.localChannelContextQueue.set(\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tchannelContext as LocalChannelContextBase,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tchannelContext = new RemoteChannelContext(\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\tdataStoreContext,\n\t\t\t\t\t\tdataStoreContext.storage,\n\t\t\t\t\t\t(content, localOpMetadata) =>\n\t\t\t\t\t\t\tthis.submitChannelOp(path, content, localOpMetadata),\n\t\t\t\t\t\t(address: string) => this.setChannelDirty(address),\n\t\t\t\t\t\t(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n\t\t\t\t\t\t\tthis.addedGCOutboundReference(srcHandle, outboundHandle),\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\ttree.trees[path],\n\t\t\t\t\t\tthis.sharedObjectRegistry,\n\t\t\t\t\t\tundefined /* extraBlobs */,\n\t\t\t\t\t\tthis.dataStoreContext.getCreateChildSummarizerNodeFn(path, {\n\t\t\t\t\t\t\ttype: CreateSummarizerNodeSource.FromSummary,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tasync () => this.getChannelBaseGCDetails(path),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst deferred = new Deferred<IChannelContext>();\n\t\t\t\tdeferred.resolve(channelContext);\n\n\t\t\t\tthis.contexts.set(path, channelContext);\n\t\t\t\tthis.contextsDeferred.set(path, deferred);\n\t\t\t});\n\t\t}\n\n\t\tif (initializeEntryPoint) {\n\t\t\tconst promise = new LazyPromise(async () => initializeEntryPoint(this));\n\t\t\tthis.entryPoint = new FluidObjectHandle<FluidObject>(\n\t\t\t\tpromise,\n\t\t\t\t\"\",\n\t\t\t\tthis.objectsRoutingContext,\n\t\t\t);\n\t\t}\n\n\t\tthis.attachListener();\n\t\t// If exists on storage or loaded from a snapshot, it should already be bound.\n\t\tthis.bindState = existing ? BindState.Bound : BindState.NotBound;\n\t\tthis._attachState = dataStoreContext.attachState;\n\n\t\t/**\n\t\t * If existing flag is false, this is a new data store and is not visible. The existing flag can be true in two\n\t\t * conditions:\n\t\t *\n\t\t * 1. It's a local data store that is created when a detached container is rehydrated. In this case, the data\n\t\t * store is locally visible because the snapshot it is loaded from contains locally visible data stores only.\n\t\t *\n\t\t * 2. It's a remote data store that is created when an attached container is loaded is loaded from snapshot or\n\t\t * when an attach op comes in. In both these cases, the data store is already globally visible.\n\t\t */\n\t\tif (existing) {\n\t\t\tthis.visibilityState =\n\t\t\t\tdataStoreContext.attachState === AttachState.Detached\n\t\t\t\t\t? VisibilityState.LocallyVisible\n\t\t\t\t\t: VisibilityState.GloballyVisible;\n\t\t} else {\n\t\t\tthis.visibilityState = VisibilityState.NotVisible;\n\t\t}\n\n\t\t// If it's existing we know it has been attached.\n\t\tif (existing) {\n\t\t\tthis.deferredAttached.resolve();\n\t\t}\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this._disposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._disposed = true;\n\n\t\tthis.emit(\"dispose\");\n\t\tthis.removeAllListeners();\n\t}\n\n\tpublic async resolveHandle(request: IRequest): Promise<IResponse> {\n\t\treturn this.request(request);\n\t}\n\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\ttry {\n\t\t\tconst parser = RequestParser.create(request);\n\t\t\tconst id = parser.pathParts[0];\n\n\t\t\tif (id === \"_channels\" || id === \"_custom\") {\n\t\t\t\treturn this.request(parser.createSubRequest(1));\n\t\t\t}\n\n\t\t\t// Check for a data type reference first\n\t\t\tif (this.contextsDeferred.has(id) && parser.isLeaf(1)) {\n\t\t\t\ttry {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst value = await this.contextsDeferred.get(id)!.promise;\n\t\t\t\t\tconst channel = await value.getChannel();\n\n\t\t\t\t\treturn { mimeType: \"fluid/object\", status: 200, value: channel };\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"GetChannelFailedInRequest\" }, error);\n\n\t\t\t\t\treturn createResponseError(500, `Failed to get Channel: ${error}`, request);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Otherwise defer to an attached request handler\n\t\t\treturn create404Response(request);\n\t\t} catch (error) {\n\t\t\treturn exceptionToResponse(error);\n\t\t}\n\t}\n\n\tpublic async getChannel(id: string): Promise<IChannel> {\n\t\tthis.verifyNotClosed();\n\n\t\t// TODO we don't assume any channels (even root) in the runtime. If you request a channel that doesn't exist\n\t\t// we will never resolve the promise. May want a flag to getChannel that doesn't wait for the promise if\n\t\t// it doesn't exist\n\t\tif (!this.contextsDeferred.has(id)) {\n\t\t\tthis.contextsDeferred.set(id, new Deferred<IChannelContext>());\n\t\t}\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tconst context = await this.contextsDeferred.get(id)!.promise;\n\t\tconst channel = await context.getChannel();\n\n\t\treturn channel;\n\t}\n\n\tpublic createChannel(id: string = uuid(), type: string): IChannel {\n\t\tif (id.includes(\"/\")) {\n\t\t\tthrow new UsageError(`Id cannot contain slashes: ${id}`);\n\t\t}\n\n\t\tthis.verifyNotClosed();\n\n\t\tassert(!this.contexts.has(id), 0x179 /* \"createChannel() with existing ID\" */);\n\t\tthis.notBoundedChannelContextSet.add(id);\n\t\tconst context = new LocalChannelContext(\n\t\t\tid,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\ttype,\n\t\t\tthis,\n\t\t\tthis.dataStoreContext,\n\t\t\tthis.dataStoreContext.storage,\n\t\t\tthis.logger,\n\t\t\t(content, localOpMetadata) => this.submitChannelOp(id, content, localOpMetadata),\n\t\t\t(address: string) => this.setChannelDirty(address),\n\t\t\t(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n\t\t\t\tthis.addedGCOutboundReference(srcHandle, outboundHandle),\n\t\t);\n\t\tthis.contexts.set(id, context);\n\n\t\tif (this.contextsDeferred.has(id)) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tthis.contextsDeferred.get(id)!.resolve(context);\n\t\t} else {\n\t\t\tconst deferred = new Deferred<IChannelContext>();\n\t\t\tdeferred.resolve(context);\n\t\t\tthis.contextsDeferred.set(id, deferred);\n\t\t}\n\n\t\tassert(!!context.channel, 0x17a /* \"Channel should be loaded when created!!\" */);\n\t\treturn context.channel;\n\t}\n\n\t/**\n\t * Binds a channel with the runtime. If the runtime is attached we will attach the channel right away.\n\t * If the runtime is not attached we will defer the attach until the runtime attaches.\n\t * @param channel - channel to be registered.\n\t */\n\tpublic bindChannel(channel: IChannel): void {\n\t\tassert(\n\t\t\tthis.notBoundedChannelContextSet.has(channel.id),\n\t\t\t0x17b /* \"Channel to be binded should be in not bounded set\" */,\n\t\t);\n\t\tthis.notBoundedChannelContextSet.delete(channel.id);\n\t\t// If our data store is attached, then attach the channel.\n\t\tif (this.isAttached) {\n\t\t\tthis.attachChannel(channel);\n\t\t\treturn;\n\t\t}\n\n\t\t/**\n\t\t * If this channel is already waiting to be made visible, do nothing. This can happen during attachGraph() when\n\t\t * a channel's graph is attached. It calls bindToContext on the shared object which will end up back here.\n\t\t */\n\t\tif (this.pendingHandlesToMakeVisible.has(channel.handle)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.bind(channel.handle);\n\n\t\t// If our data store is local then add the channel to the queue\n\t\tif (!this.localChannelContextQueue.has(channel.id)) {\n\t\t\tthis.localChannelContextQueue.set(\n\t\t\t\tchannel.id,\n\t\t\t\tthis.contexts.get(channel.id) as LocalChannelContextBase,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * This function is called when a data store becomes root. It does the following:\n\t *\n\t * 1. Marks the data store locally visible in the container.\n\t *\n\t * 2. Attaches the graph of all the handles bound to it.\n\t *\n\t * 3. Calls into the data store context to mark it visible in the container too. If the container is globally\n\t * visible, it will mark us globally visible. Otherwise, it will mark us globally visible when it becomes\n\t * globally visible.\n\t */\n\tpublic makeVisibleAndAttachGraph() {\n\t\tif (this.visibilityState !== VisibilityState.NotVisible) {\n\t\t\treturn;\n\t\t}\n\t\tthis.visibilityState = VisibilityState.LocallyVisible;\n\n\t\tthis.pendingHandlesToMakeVisible.forEach((handle) => {\n\t\t\thandle.attachGraph();\n\t\t});\n\t\tthis.pendingHandlesToMakeVisible.clear();\n\t\tthis.bindToContext();\n\t}\n\n\t/**\n\t * This function is called when a handle to this data store is added to a visible DDS.\n\t */\n\tpublic attachGraph() {\n\t\tthis.makeVisibleAndAttachGraph();\n\t}\n\n\t/**\n\t * @deprecated - Not necessary if consumers add a new dataStore to the container by storing its handle.\n\t * Binds this runtime to the container\n\t * This includes the following:\n\t * 1. Sending an Attach op that includes all existing state\n\t * 2. Attaching the graph if the data store becomes attached.\n\t */\n\tpublic bindToContext() {\n\t\tif (this.bindState !== BindState.NotBound) {\n\t\t\treturn;\n\t\t}\n\t\tthis.bindState = BindState.Binding;\n\t\tthis.dataStoreContext.bindToContext();\n\t\tthis.bindState = BindState.Bound;\n\t}\n\n\tpublic bind(handle: IFluidHandle): void {\n\t\t// If visible, attach the incoming handle's graph. Else, this will be done when we become visible.\n\t\tif (this.visibilityState !== VisibilityState.NotVisible) {\n\t\t\thandle.attachGraph();\n\t\t\treturn;\n\t\t}\n\t\tthis.pendingHandlesToMakeVisible.add(handle);\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\n\t\tthis.verifyNotClosed();\n\n\t\tfor (const [, object] of this.contexts) {\n\t\t\tobject.setConnectionState(connected, clientId);\n\t\t}\n\n\t\traiseConnectedEvent(this.logger, this, connected, clientId);\n\t}\n\n\tpublic getQuorum(): IQuorumClients {\n\t\treturn this.quorum;\n\t}\n\n\tpublic getAudience(): IAudience {\n\t\treturn this.audience;\n\t}\n\n\tpublic async uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>> {\n\t\tthis.verifyNotClosed();\n\n\t\treturn this.dataStoreContext.uploadBlob(blob);\n\t}\n\n\tpublic process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n\t\tthis.verifyNotClosed();\n\n\t\ttry {\n\t\t\t// catches as data processing error whether or not they come from async pending queues\n\t\t\tswitch (message.type) {\n\t\t\t\tcase DataStoreMessageType.Attach: {\n\t\t\t\t\tconst attachMessage = message.contents as IAttachMessage;\n\t\t\t\t\tconst id = attachMessage.id;\n\n\t\t\t\t\t// If a non-local operation then go and create the object\n\t\t\t\t\t// Otherwise mark it as officially attached.\n\t\t\t\t\tif (local) {\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tthis.pendingAttach.has(id),\n\t\t\t\t\t\t\t0x17c /* \"Unexpected attach (local) channel OP\" */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.pendingAttach.delete(id);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t!this.contexts.has(id),\n\t\t\t\t\t\t\t0x17d /* `Unexpected attach channel OP,\n is in pendingAttach set: ${this.pendingAttach.has(id)},\n is local channel contexts: ${this.contexts.get(id) instanceof LocalChannelContextBase}` */,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst flatBlobs = new Map<string, ArrayBufferLike>();\n\t\t\t\t\t\tconst snapshotTree = buildSnapshotTree(\n\t\t\t\t\t\t\tattachMessage.snapshot.entries,\n\t\t\t\t\t\t\tflatBlobs,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst remoteChannelContext = new RemoteChannelContext(\n\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\tthis.dataStoreContext,\n\t\t\t\t\t\t\tthis.dataStoreContext.storage,\n\t\t\t\t\t\t\t(content, localContentMetadata) =>\n\t\t\t\t\t\t\t\tthis.submitChannelOp(id, content, localContentMetadata),\n\t\t\t\t\t\t\t(address: string) => this.setChannelDirty(address),\n\t\t\t\t\t\t\t(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n\t\t\t\t\t\t\t\tthis.addedGCOutboundReference(srcHandle, outboundHandle),\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\tsnapshotTree,\n\t\t\t\t\t\t\tthis.sharedObjectRegistry,\n\t\t\t\t\t\t\tflatBlobs,\n\t\t\t\t\t\t\tthis.dataStoreContext.getCreateChildSummarizerNodeFn(id, {\n\t\t\t\t\t\t\t\ttype: CreateSummarizerNodeSource.FromAttach,\n\t\t\t\t\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t\t\t\t\t\tsnapshot: attachMessage.snapshot,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tasync () => this.getChannelBaseGCDetails(id),\n\t\t\t\t\t\t\tattachMessage.type,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tthis.contexts.set(id, remoteChannelContext);\n\t\t\t\t\t\tif (this.contextsDeferred.has(id)) {\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\t\tthis.contextsDeferred.get(id)!.resolve(remoteChannelContext);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst deferred = new Deferred<IChannelContext>();\n\t\t\t\t\t\t\tdeferred.resolve(remoteChannelContext);\n\t\t\t\t\t\t\tthis.contextsDeferred.set(id, deferred);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase DataStoreMessageType.ChannelOp:\n\t\t\t\t\tthis.processChannelOp(message, local, localOpMetadata);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t}\n\n\t\t\tthis.emit(\"op\", message);\n\t\t} catch (error) {\n\t\t\tthrow DataProcessingError.wrapIfUnrecognized(\n\t\t\t\terror,\n\t\t\t\t\"fluidDataStoreRuntimeFailedToProcessMessage\",\n\t\t\t\tmessage,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic processSignal(message: IInboundSignalMessage, local: boolean) {\n\t\tthis.emit(\"signal\", message, local);\n\t}\n\n\tprivate isChannelAttached(id: string): boolean {\n\t\treturn (\n\t\t\t// Added in createChannel\n\t\t\t// Removed when bindChannel is called\n\t\t\t!this.notBoundedChannelContextSet.has(id) &&\n\t\t\t// Added in bindChannel only if this is not attached yet\n\t\t\t// Removed when this is attached by calling attachGraph\n\t\t\t!this.localChannelContextQueue.has(id) &&\n\t\t\t// Added in attachChannel called by bindChannel\n\t\t\t// Removed when attach op is broadcast\n\t\t\t!this.pendingAttach.has(id)\n\t\t);\n\t}\n\n\t/**\n\t * Returns the outbound routes of this channel. Currently, all contexts in this channel are considered\n\t * referenced and are hence outbound. This will change when we have root and non-root channel contexts.\n\t * The only root contexts will be considered as referenced.\n\t */\n\tprivate getOutboundRoutes(): string[] {\n\t\tconst outboundRoutes: string[] = [];\n\t\tfor (const [contextId] of this.contexts) {\n\t\t\toutboundRoutes.push(`${this.absolutePath}/${contextId}`);\n\t\t}\n\t\treturn outboundRoutes;\n\t}\n\n\t/**\n\t * Updates the GC nodes of this channel. It does the following:\n\t * - Adds a back route to self to all its child GC nodes.\n\t * - Adds a node for this channel.\n\t * @param builder - The builder that contains the GC nodes for this channel's children.\n\t */\n\tprivate updateGCNodes(builder: GCDataBuilder) {\n\t\t// Add a back route to self in each child's GC nodes. If any child is referenced, then its parent should\n\t\t// be considered referenced as well.\n\t\tbuilder.addRouteToAllNodes(this.absolutePath);\n\n\t\t// Get the outbound routes and add a GC node for this channel.\n\t\tbuilder.addNode(\"/\", this.getOutboundRoutes());\n\t}\n\n\t/**\n\t * Generates data used for garbage collection. This includes a list of GC nodes that represent this channel\n\t * including any of its child channel contexts. Each node has a set of outbound routes to other GC nodes in the\n\t * document. It does the following:\n\t *\n\t * 1. Calls into each child context to get its GC data.\n\t *\n\t * 2. Prefixes the child context's id to the GC nodes in the child's GC data. This makes sure that the node can be\n\t * identified as belonging to the child.\n\t *\n\t * 3. Adds a GC node for this channel to the nodes received from the children. All these nodes together represent\n\t * the GC data of this channel.\n\t *\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst builder = new GCDataBuilder();\n\t\t// Iterate over each channel context and get their GC data.\n\t\tawait Promise.all(\n\t\t\tArray.from(this.contexts)\n\t\t\t\t.filter(([contextId, _]) => {\n\t\t\t\t\t// Get GC data only for attached contexts. Detached contexts are not connected in the GC reference\n\t\t\t\t\t// graph so any references they might have won't be connected as well.\n\t\t\t\t\treturn this.isChannelAttached(contextId);\n\t\t\t\t})\n\t\t\t\t.map(async ([contextId, context]) => {\n\t\t\t\t\tconst contextGCData = await context.getGCData(fullGC);\n\t\t\t\t\t// Prefix the child's id to the ids of its GC nodes so they can be identified as belonging to the child.\n\t\t\t\t\t// This also gradually builds the id of each node to be a path from the root.\n\t\t\t\t\tbuilder.prefixAndAddNodes(contextId, contextGCData.gcNodes);\n\t\t\t\t}),\n\t\t);\n\n\t\tthis.updateGCNodes(builder);\n\t\treturn builder.getGCData();\n\t}\n\n\t/**\n\t * After GC has run, called to notify this channel of routes that are used in it. It calls the child contexts to\n\t * update their used routes.\n\t * @param usedRoutes - The routes that are used in all contexts in this channel.\n\t */\n\tpublic updateUsedRoutes(usedRoutes: string[]) {\n\t\t// Get a map of channel ids to routes used in it.\n\t\tconst usedContextRoutes = unpackChildNodesUsedRoutes(usedRoutes);\n\n\t\t// Verify that the used routes are correct.\n\t\tfor (const [id] of usedContextRoutes) {\n\t\t\tassert(\n\t\t\t\tthis.contexts.has(id),\n\t\t\t\t0x17e /* \"Used route does not belong to any known context\" */,\n\t\t\t);\n\t\t}\n\n\t\t// Update the used routes in each context. Used routes is empty for unused context.\n\t\tfor (const [contextId, context] of this.contexts) {\n\t\t\tcontext.updateUsedRoutes(usedContextRoutes.get(contextId) ?? []);\n\t\t}\n\t}\n\n\t/**\n\t * Called when a new outbound reference is added to another node. This is used by garbage collection to identify\n\t * all references added in the system.\n\t * @param srcHandle - The handle of the node that added the reference.\n\t * @param outboundHandle - The handle of the outbound node that is referenced.\n\t */\n\tprivate addedGCOutboundReference(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) {\n\t\tthis.dataStoreContext.addedGCOutboundReference?.(srcHandle, outboundHandle);\n\t}\n\n\t/**\n\t * Returns the base GC details for the channel with the given id. This is used to initialize its GC state.\n\t * @param channelId - The id of the channel context that is asked for the initial GC details.\n\t * @returns the requested channel's base GC details.\n\t */\n\tprivate async getChannelBaseGCDetails(\n\t\tchannelId: string,\n\t): Promise<IGarbageCollectionDetailsBase> {\n\t\tlet channelBaseGCDetails = (await this.channelsBaseGCDetails).get(channelId);\n\t\tif (channelBaseGCDetails === undefined) {\n\t\t\tchannelBaseGCDetails = {};\n\t\t} else if (channelBaseGCDetails.gcData?.gcNodes !== undefined) {\n\t\t\t// Note: if the child channel has an explicit handle route to its parent, it will be removed here and\n\t\t\t// expected to be added back by the parent when getGCData is called.\n\t\t\tremoveRouteFromAllNodes(channelBaseGCDetails.gcData.gcNodes, this.absolutePath);\n\t\t}\n\n\t\t// Currently, channel context's are always considered used. So, it there are no used routes for it, we still\n\t\t// need to mark it as used. Add self-route (empty string) to the channel context's used routes.\n\t\tif (\n\t\t\tchannelBaseGCDetails.usedRoutes === undefined ||\n\t\t\tchannelBaseGCDetails.usedRoutes.length === 0\n\t\t) {\n\t\t\tchannelBaseGCDetails.usedRoutes = [\"\"];\n\t\t}\n\t\treturn channelBaseGCDetails;\n\t}\n\n\t/**\n\t * Returns a summary at the current sequence number.\n\t * @param fullTree - true to bypass optimizations and force a full summary tree\n\t * @param trackState - This tells whether we should track state from this summary.\n\t * @param telemetryContext - summary data passed through the layers for telemetry purposes\n\t */\n\tpublic async summarize(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = true,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats> {\n\t\tconst summaryBuilder = new SummaryTreeBuilder();\n\n\t\t// Iterate over each data store and ask it to summarize\n\t\tawait Promise.all(\n\t\t\tArray.from(this.contexts)\n\t\t\t\t.filter(([contextId, _]) => {\n\t\t\t\t\tconst isAttached = this.isChannelAttached(contextId);\n\t\t\t\t\t// We are not expecting local dds! Summary may not capture local state.\n\t\t\t\t\tassert(\n\t\t\t\t\t\tisAttached,\n\t\t\t\t\t\t0x17f /* \"Not expecting detached channels during summarize\" */,\n\t\t\t\t\t);\n\t\t\t\t\t// If the object is registered - and we have received the sequenced op creating the object\n\t\t\t\t\t// (i.e. it has a base mapping) - then we go ahead and summarize\n\t\t\t\t\treturn isAttached;\n\t\t\t\t})\n\t\t\t\t.map(async ([contextId, context]) => {\n\t\t\t\t\tconst contextSummary = await context.summarize(\n\t\t\t\t\t\tfullTree,\n\t\t\t\t\t\ttrackState,\n\t\t\t\t\t\ttelemetryContext,\n\t\t\t\t\t);\n\t\t\t\t\tsummaryBuilder.addWithStats(contextId, contextSummary);\n\t\t\t\t}),\n\t\t);\n\n\t\treturn summaryBuilder.getSummaryTree();\n\t}\n\n\tpublic getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {\n\t\t/**\n\t\t * back-compat 0.59.1000 - getAttachSummary() is called when making a data store globally visible (previously\n\t\t * attaching state). Ideally, attachGraph() should have already be called making it locally visible. However,\n\t\t * before visibility state was added, this may not have been the case and getAttachSummary() could be called:\n\t\t *\n\t\t * 1. Before attaching the data store - When a detached container is attached.\n\t\t *\n\t\t * 2. After attaching the data store - When a data store is created and bound in an attached container.\n\t\t *\n\t\t * The basic idea is that all local object should become locally visible before they are globally visible.\n\t\t */\n\t\tthis.attachGraph();\n\n\t\t// This assert cannot be added now due to back-compat. To be uncommented when the following issue is fixed -\n\t\t// https://github.com/microsoft/FluidFramework/issues/9688.\n\t\t//\n\t\t// assert(this.visibilityState === VisibilityState.LocallyVisible,\n\t\t// \"The data store should be locally visible when generating attach summary\",\n\t\t// );\n\n\t\tconst summaryBuilder = new SummaryTreeBuilder();\n\n\t\t// Craft the .attributes file for each shared object\n\t\tfor (const [contextId, context] of this.contexts) {\n\t\t\tif (!(context instanceof LocalChannelContextBase)) {\n\t\t\t\tthrow new LoggingError(\"Should only be called with local channel handles\");\n\t\t\t}\n\n\t\t\tif (!this.notBoundedChannelContextSet.has(contextId)) {\n\t\t\t\tlet summaryTree: ISummaryTreeWithStats;\n\t\t\t\tif (context.isLoaded) {\n\t\t\t\t\tconst contextSummary = context.getAttachSummary(telemetryContext);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tcontextSummary.summary.type === SummaryType.Tree,\n\t\t\t\t\t\t0x180 /* \"getAttachSummary should always return a tree\" */,\n\t\t\t\t\t);\n\t\t\t\t\tsummaryTree = { stats: contextSummary.stats, summary: contextSummary.summary };\n\t\t\t\t} else {\n\t\t\t\t\t// If this channel is not yet loaded, then there should be no changes in the snapshot from which\n\t\t\t\t\t// it was created as it is detached container. So just use the previous snapshot.\n\t\t\t\t\tassert(\n\t\t\t\t\t\t!!this.dataStoreContext.baseSnapshot,\n\t\t\t\t\t\t0x181 /* \"BaseSnapshot should be there as detached container loaded from snapshot\" */,\n\t\t\t\t\t);\n\t\t\t\t\tsummaryTree = convertSnapshotTreeToSummaryTree(\n\t\t\t\t\t\tthis.dataStoreContext.baseSnapshot.trees[contextId],\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tsummaryBuilder.addWithStats(contextId, summaryTree);\n\t\t\t}\n\t\t}\n\n\t\treturn summaryBuilder.getSummaryTree();\n\t}\n\n\tpublic submitMessage(type: DataStoreMessageType, content: any, localOpMetadata: unknown) {\n\t\tthis.submit(type, content, localOpMetadata);\n\t}\n\n\tpublic submitSignal(type: string, content: any) {\n\t\tthis.verifyNotClosed();\n\t\treturn this.dataStoreContext.submitSignal(type, content);\n\t}\n\n\t/**\n\t * Will return when the data store is attached.\n\t */\n\tpublic async waitAttached(): Promise<void> {\n\t\treturn this.deferredAttached.promise;\n\t}\n\n\t/**\n\t * Attach channel should only be called after the data store has been attached\n\t */\n\tprivate attachChannel(channel: IChannel): void {\n\t\tthis.verifyNotClosed();\n\t\t// If this handle is already attached no need to attach again.\n\t\tif (channel.handle.isAttached) {\n\t\t\treturn;\n\t\t}\n\n\t\tchannel.handle.attachGraph();\n\n\t\tassert(this.isAttached, 0x182 /* \"Data store should be attached to attach the channel.\" */);\n\t\tassert(\n\t\t\tthis.visibilityState === VisibilityState.GloballyVisible,\n\t\t\t0x2d0 /* \"Data store should be globally visible to attach channels.\" */,\n\t\t);\n\n\t\tconst summarizeResult = summarizeChannel(\n\t\t\tchannel,\n\t\t\ttrue /* fullTree */,\n\t\t\tfalse /* trackState */,\n\t\t);\n\t\t// Attach message needs the summary in ITree format. Convert the ISummaryTree into an ITree.\n\t\tconst snapshot = convertSummaryTreeToITree(summarizeResult.summary);\n\n\t\tconst message: IAttachMessage = {\n\t\t\tid: channel.id,\n\t\t\tsnapshot,\n\t\t\ttype: channel.attributes.type,\n\t\t};\n\t\tthis.pendingAttach.set(channel.id, message);\n\t\tthis.submit(DataStoreMessageType.Attach, message);\n\n\t\tconst context = this.contexts.get(channel.id) as LocalChannelContextBase;\n\t\tcontext.makeVisible();\n\t}\n\n\tprivate submitChannelOp(address: string, contents: any, localOpMetadata: unknown) {\n\t\tconst envelope: IEnvelope = { address, contents };\n\t\tthis.submit(DataStoreMessageType.ChannelOp, envelope, localOpMetadata);\n\t}\n\n\tprivate submit(\n\t\ttype: DataStoreMessageType,\n\t\tcontent: any,\n\t\tlocalOpMetadata: unknown = undefined,\n\t): void {\n\t\tthis.verifyNotClosed();\n\t\tthis.dataStoreContext.submitMessage(type, content, localOpMetadata);\n\t}\n\n\t/**\n\t * For messages of type MessageType.Operation, finds the right channel and asks it to resubmit the message.\n\t * For all other messages, just submit it again.\n\t * This typically happens when we reconnect and there are unacked messages.\n\t * @param content - The content of the original message.\n\t * @param localOpMetadata - The local metadata associated with the original message.\n\t */\n\tpublic reSubmit(type: DataStoreMessageType, content: any, localOpMetadata: unknown) {\n\t\tthis.verifyNotClosed();\n\n\t\tswitch (type) {\n\t\t\tcase DataStoreMessageType.ChannelOp: {\n\t\t\t\t// For Operations, find the right channel and trigger resubmission on it.\n\t\t\t\tconst envelope = content as IEnvelope;\n\t\t\t\tconst channelContext = this.contexts.get(envelope.address);\n\t\t\t\tassert(\n\t\t\t\t\t!!channelContext,\n\t\t\t\t\t0x183 /* \"There should be a channel context for the op\" */,\n\t\t\t\t);\n\t\t\t\tchannelContext.reSubmit(envelope.contents, localOpMetadata);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase DataStoreMessageType.Attach:\n\t\t\t\t// For Attach messages, just submit them again.\n\t\t\t\tthis.submit(type, content, localOpMetadata);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tunreachableCase(type);\n\t\t}\n\t}\n\n\t/**\n\t * Revert a local op.\n\t * @param content - The content of the original message.\n\t * @param localOpMetadata - The local metadata associated with the original message.\n\t */\n\tpublic rollback?(type: DataStoreMessageType, content: any, localOpMetadata: unknown) {\n\t\tthis.verifyNotClosed();\n\n\t\tswitch (type) {\n\t\t\tcase DataStoreMessageType.ChannelOp: {\n\t\t\t\t// For Operations, find the right channel and trigger resubmission on it.\n\t\t\t\tconst envelope = content as IEnvelope;\n\t\t\t\tconst channelContext = this.contexts.get(envelope.address);\n\t\t\t\tassert(\n\t\t\t\t\t!!channelContext,\n\t\t\t\t\t0x2ed /* \"There should be a channel context for the op\" */,\n\t\t\t\t);\n\t\t\t\tchannelContext.rollback(envelope.contents, localOpMetadata);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tthrow new LoggingError(`Can't rollback ${type} message`);\n\t\t}\n\t}\n\n\tpublic async applyStashedOp(content: any): Promise<unknown> {\n\t\tconst envelope = content as IEnvelope;\n\t\tconst channelContext = this.contexts.get(envelope.address);\n\t\tassert(!!channelContext, 0x184 /* \"There should be a channel context for the op\" */);\n\t\tawait channelContext.getChannel();\n\t\treturn channelContext.applyStashedOp(envelope.contents);\n\t}\n\n\tprivate setChannelDirty(address: string): void {\n\t\tthis.verifyNotClosed();\n\t\tthis.dataStoreContext.setChannelDirty(address);\n\t}\n\n\tprivate processChannelOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t) {\n\t\tthis.verifyNotClosed();\n\n\t\tconst envelope = message.contents as IEnvelope;\n\n\t\tconst transformed: ISequencedDocumentMessage = {\n\t\t\t...message,\n\t\t\tcontents: envelope.contents,\n\t\t};\n\n\t\tconst channelContext = this.contexts.get(envelope.address);\n\t\tassert(!!channelContext, 0x185 /* \"Channel not found\" */);\n\t\tchannelContext.processOp(transformed, local, localOpMetadata);\n\n\t\treturn channelContext;\n\t}\n\n\tprivate attachListener() {\n\t\tthis.setMaxListeners(Number.MAX_SAFE_INTEGER);\n\t\tthis.dataStoreContext.once(\"attaching\", () => {\n\t\t\t/**\n\t\t\t * back-compat 0.59.1000 - Ideally, attachGraph() should have already been called making the data store\n\t\t\t * locally visible. However, before visibility state was added, this may not have been the case and data\n\t\t\t * store can move to \"attaching\" state in 2 scenarios:\n\t\t\t * 1) Before attachGraph() is called - When a data store is created and bound in an attached container.\n\t\t\t * 2) After attachGraph() is called - When a detached container is attached.\n\t\t\t *\n\t\t\t * The basic idea is that all local object should become locally visible before they are globally visible.\n\t\t\t */\n\t\t\tthis.attachGraph();\n\n\t\t\tthis._attachState = AttachState.Attaching;\n\n\t\t\tassert(\n\t\t\t\tthis.visibilityState === VisibilityState.LocallyVisible,\n\t\t\t\t0x2d1 /* \"Data store should be locally visible before it can become globally visible.\" */,\n\t\t\t);\n\n\t\t\t// Mark the data store globally visible and make its child channels visible as well.\n\t\t\tthis.visibilityState = VisibilityState.GloballyVisible;\n\t\t\tthis.localChannelContextQueue.forEach((channel) => {\n\t\t\t\tchannel.makeVisible();\n\t\t\t});\n\t\t\tthis.localChannelContextQueue.clear();\n\n\t\t\t// This promise resolution will be moved to attached event once we fix the scheduler.\n\t\t\tthis.deferredAttached.resolve();\n\t\t\tthis.emit(\"attaching\");\n\t\t});\n\t\tthis.dataStoreContext.once(\"attached\", () => {\n\t\t\tassert(\n\t\t\t\tthis.visibilityState === VisibilityState.GloballyVisible,\n\t\t\t\t0x2d2 /* \"Data store should be globally visible when its attached.\" */,\n\t\t\t);\n\t\t\tthis._attachState = AttachState.Attached;\n\t\t\tthis.emit(\"attached\");\n\t\t});\n\t}\n\n\tprivate verifyNotClosed() {\n\t\tif (this._disposed) {\n\t\t\tthrow new LoggingError(\"Runtime is closed\");\n\t\t}\n\t}\n}\n\n/**\n * Mixin class that adds request handler to FluidDataStoreRuntime\n * Request handler is only called when data store can't resolve request, i.e. for custom requests.\n * @param Base - base class, inherits from FluidDataStoreRuntime\n * @param requestHandler - request handler to mix in\n */\nexport const mixinRequestHandler = (\n\trequestHandler: (request: IRequest, runtime: FluidDataStoreRuntime) => Promise<IResponse>,\n\tBase: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n) =>\n\tclass RuntimeWithRequestHandler extends Base {\n\t\tpublic async request(request: IRequest) {\n\t\t\tconst response = await super.request(request);\n\t\t\tif (response.status === 404) {\n\t\t\t\treturn requestHandler(request, this);\n\t\t\t}\n\t\t\treturn response;\n\t\t}\n\t} as typeof FluidDataStoreRuntime;\n\n/**\n * Mixin class that adds await for DataObject to finish initialization before we proceed to summary.\n * @param handler - handler that returns info about blob to be added to summary.\n * Or undefined not to add anything to summary.\n * @param Base - base class, inherits from FluidDataStoreRuntime\n */\nexport const mixinSummaryHandler = (\n\thandler: (\n\t\truntime: FluidDataStoreRuntime,\n\t) => Promise<{ path: string[]; content: string } | undefined>,\n\tBase: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n) =>\n\tclass RuntimeWithSummarizerHandler extends Base {\n\t\tprivate addBlob(summary: ISummaryTreeWithStats, path: string[], content: string) {\n\t\t\tconst firstName = path.shift();\n\t\t\tif (firstName === undefined) {\n\t\t\t\tthrow new LoggingError(\"Path can't be empty\");\n\t\t\t}\n\n\t\t\tlet blob: ISummaryTree | ISummaryBlob = {\n\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\tcontent,\n\t\t\t};\n\t\t\tsummary.stats.blobNodeCount++;\n\t\t\tsummary.stats.totalBlobSize += content.length;\n\n\t\t\tfor (const name of path.reverse()) {\n\t\t\t\tblob = {\n\t\t\t\t\ttype: SummaryType.Tree,\n\t\t\t\t\ttree: { [name]: blob },\n\t\t\t\t};\n\t\t\t\tsummary.stats.treeNodeCount++;\n\t\t\t}\n\t\t\tsummary.summary.tree[firstName] = blob;\n\t\t}\n\n\t\tasync summarize(...args: any[]) {\n\t\t\tconst summary = await super.summarize(...args);\n\t\t\tconst content = await handler(this);\n\t\t\tif (content !== undefined) {\n\t\t\t\tthis.addBlob(summary, content.path, content.content);\n\t\t\t}\n\t\t\treturn summary;\n\t\t}\n\t} as typeof FluidDataStoreRuntime;\n"]}
|
|
1
|
+
{"version":3,"file":"dataStoreRuntime.js","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAUH,iFAK+C;AAC/C,qEAAkF;AAClF,+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OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,GAAG,IAAW;QAC7B,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;QAC/C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,OAAO,KAAK,SAAS,EAAE;YAC1B,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;SACrD;QACD,OAAO,OAAO,CAAC;IAChB,CAAC;CAC+B,CAAC;AAtCtB,QAAA,mBAAmB,uBAsCG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport {\n\tFluidObject,\n\tIFluidHandle,\n\tIFluidHandleContext,\n\tIRequest,\n\tIResponse,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tIAudience,\n\tIDeltaManager,\n\tAttachState,\n\tILoaderOptions,\n} from \"@fluidframework/container-definitions\";\nimport { DataProcessingError, UsageError } from \"@fluidframework/container-utils\";\nimport {\n\tassert,\n\tDeferred,\n\tLazyPromise,\n\tTypedEventEmitter,\n\tunreachableCase,\n} from \"@fluidframework/common-utils\";\nimport {\n\tChildLogger,\n\tgenerateStack,\n\tLoggingError,\n\tloggerToMonitoringContext,\n\tMonitoringContext,\n\traiseConnectedEvent,\n\tTelemetryDataTag,\n} from \"@fluidframework/telemetry-utils\";\nimport { buildSnapshotTree } from \"@fluidframework/driver-utils\";\nimport {\n\tIClientDetails,\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tSummaryType,\n\tISummaryBlob,\n\tISummaryTree,\n\tIQuorumClients,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n\tCreateSummarizerNodeSource,\n\tIAttachMessage,\n\tIEnvelope,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreChannel,\n\tIGarbageCollectionData,\n\tIInboundSignalMessage,\n\tISummaryTreeWithStats,\n\tVisibilityState,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertSummaryTreeToITree,\n\tgenerateHandleContextPath,\n\tRequestParser,\n\tSummaryTreeBuilder,\n\tcreate404Response,\n\tcreateResponseError,\n\texceptionToResponse,\n\trequestFluidObject,\n\tpackagePathToTelemetryProperty,\n} from \"@fluidframework/runtime-utils\";\nimport {\n\tIChannel,\n\tIFluidDataStoreRuntime,\n\tIFluidDataStoreRuntimeEvents,\n\tIChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { GCDataBuilder, unpackChildNodesUsedRoutes } from \"@fluidframework/garbage-collector\";\nimport { v4 as uuid } from \"uuid\";\nimport { IChannelContext, summarizeChannel } from \"./channelContext\";\nimport {\n\tLocalChannelContext,\n\tLocalChannelContextBase,\n\tRehydratedLocalChannelContext,\n} from \"./localChannelContext\";\nimport { RemoteChannelContext } from \"./remoteChannelContext\";\nimport { FluidObjectHandle } from \"./fluidHandle\";\n\nexport enum DataStoreMessageType {\n\t// Creates a new channel\n\tAttach = \"attach\",\n\tChannelOp = \"op\",\n}\n\nexport interface ISharedObjectRegistry {\n\t// TODO consider making this async. A consequence is that either the creation of a distributed data type\n\t// is async or we need a new API to split the synchronous vs. asynchronous creation.\n\tget(name: string): IChannelFactory | undefined;\n}\n\n/**\n * Base data store class\n */\nexport class FluidDataStoreRuntime\n\textends TypedEventEmitter<IFluidDataStoreRuntimeEvents>\n\timplements IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext\n{\n\t/**\n\t * @deprecated - Instantiate the class using its constructor instead.\n\t *\n\t * Loads the data store runtime\n\t * @param context - The data store context\n\t * @param sharedObjectRegistry - The registry of shared objects used by this data store\n\t * @param existing - If loading from an existing file.\n\t */\n\tpublic static load(\n\t\tcontext: IFluidDataStoreContext,\n\t\tsharedObjectRegistry: ISharedObjectRegistry,\n\t\texisting: boolean,\n\t): FluidDataStoreRuntime {\n\t\treturn new FluidDataStoreRuntime(\n\t\t\tcontext,\n\t\t\tsharedObjectRegistry,\n\t\t\texisting,\n\t\t\tasync (dataStoreRuntime) => requestFluidObject(dataStoreRuntime, \"/\"),\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IFluidDataStoreRuntime.entryPoint}\n\t */\n\tpublic readonly entryPoint?: IFluidHandle<FluidObject>;\n\n\tpublic get IFluidRouter() {\n\t\treturn this;\n\t}\n\n\tpublic get connected(): boolean {\n\t\treturn this.dataStoreContext.connected;\n\t}\n\n\tpublic get clientId(): string | undefined {\n\t\treturn this.dataStoreContext.clientId;\n\t}\n\n\tpublic get clientDetails(): IClientDetails {\n\t\treturn this.dataStoreContext.clientDetails;\n\t}\n\n\tpublic get isAttached(): boolean {\n\t\treturn this.attachState !== AttachState.Detached;\n\t}\n\n\tpublic get attachState(): AttachState {\n\t\treturn this._attachState;\n\t}\n\n\tpublic get absolutePath(): string {\n\t\treturn generateHandleContextPath(this.id, this.routeContext);\n\t}\n\n\tpublic get routeContext(): IFluidHandleContext {\n\t\treturn this.dataStoreContext.IFluidHandleContext;\n\t}\n\n\tpublic get IFluidHandleContext() {\n\t\treturn this;\n\t}\n\n\tpublic get rootRoutingContext() {\n\t\treturn this;\n\t}\n\tpublic get channelsRoutingContext() {\n\t\treturn this;\n\t}\n\tpublic get objectsRoutingContext() {\n\t\treturn this;\n\t}\n\n\tprivate _disposed = false;\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\n\tprivate readonly contexts = new Map<string, IChannelContext>();\n\tprivate readonly contextsDeferred = new Map<string, Deferred<IChannelContext>>();\n\tprivate readonly pendingAttach = new Map<string, IAttachMessage>();\n\n\tprivate readonly deferredAttached = new Deferred<void>();\n\tprivate readonly localChannelContextQueue = new Map<string, LocalChannelContextBase>();\n\tprivate readonly notBoundedChannelContextSet = new Set<string>();\n\tprivate _attachState: AttachState;\n\tpublic visibilityState: VisibilityState;\n\t// A list of handles that are bound when the data store is not visible. We have to make them visible when the data\n\t// store becomes visible.\n\tprivate readonly pendingHandlesToMakeVisible: Set<IFluidHandle> = new Set();\n\n\tpublic readonly id: string;\n\tpublic readonly options: ILoaderOptions;\n\tpublic readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n\tprivate readonly quorum: IQuorumClients;\n\tprivate readonly audience: IAudience;\n\tprivate readonly mc: MonitoringContext;\n\tpublic get logger(): ITelemetryLogger {\n\t\treturn this.mc.logger;\n\t}\n\n\t/**\n\t * If the summarizer makes local changes, a telemetry event is logged. This has the potential to be very noisy.\n\t * So, adding a count of how many telemetry events are logged per data store context. This can be\n\t * controlled via feature flags.\n\t */\n\tprivate localChangesTelemetryCount: number;\n\n\t/**\n\t * Invokes the given callback and expects that no ops are submitted\n\t * until execution finishes. If an op is submitted, an error will be raised.\n\t *\n\t * Can be disabled by feature gate `Fluid.ContainerRuntime.DisableOpReentryCheck`\n\t *\n\t * @param callback - the callback to be invoked\n\t */\n\tpublic ensureNoDataModelChanges<T>(callback: () => T): T {\n\t\t// back-compat ADO:2309\n\t\treturn this.dataStoreContext.ensureNoDataModelChanges === undefined\n\t\t\t? callback()\n\t\t\t: this.dataStoreContext.ensureNoDataModelChanges(callback);\n\t}\n\n\t/**\n\t * Create an instance of a DataStore runtime.\n\t *\n\t * @param dataStoreContext - Context object for the runtime.\n\t * @param sharedObjectRegistry - The registry of shared objects that this data store will be able to instantiate.\n\t * @param existing - Pass 'true' if loading this datastore from an existing file; pass 'false' otherwise.\n\t * @param initializeEntryPoint - Function to initialize the entryPoint object for the data store runtime. The\n\t * handle to this data store runtime will point to the object returned by this function. If this function is not\n\t * provided, the handle will be left undefined. This is here so we can start making handles a first-class citizen\n\t * and the primary way of interacting with some Fluid objects, and should be used if possible.\n\t */\n\tpublic constructor(\n\t\tprivate readonly dataStoreContext: IFluidDataStoreContext,\n\t\tprivate readonly sharedObjectRegistry: ISharedObjectRegistry,\n\t\texisting: boolean,\n\t\tinitializeEntryPoint?: (runtime: IFluidDataStoreRuntime) => Promise<FluidObject>,\n\t) {\n\t\tsuper();\n\n\t\tassert(\n\t\t\t!dataStoreContext.id.includes(\"/\"),\n\t\t\t0x30e /* Id cannot contain slashes. DataStoreContext should have validated this. */,\n\t\t);\n\n\t\tthis.mc = loggerToMonitoringContext(\n\t\t\tChildLogger.create(dataStoreContext.logger, \"FluidDataStoreRuntime\", {\n\t\t\t\tall: { dataStoreId: uuid() },\n\t\t\t}),\n\t\t);\n\n\t\tthis.id = dataStoreContext.id;\n\t\tthis.options = dataStoreContext.options;\n\t\tthis.deltaManager = dataStoreContext.deltaManager;\n\t\tthis.quorum = dataStoreContext.getQuorum();\n\t\tthis.audience = dataStoreContext.getAudience();\n\n\t\tconst tree = dataStoreContext.baseSnapshot;\n\n\t\t// Must always receive the data store type inside of the attributes\n\t\tif (tree?.trees !== undefined) {\n\t\t\tObject.keys(tree.trees).forEach((path) => {\n\t\t\t\t// Issue #4414\n\t\t\t\tif (path === \"_search\") {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet channelContext: IChannelContext;\n\t\t\t\t// If already exists on storage, then create a remote channel. However, if it is case of rehydrating a\n\t\t\t\t// container from snapshot where we load detached container from a snapshot, isLocalDataStore would be\n\t\t\t\t// true. In this case create a RehydratedLocalChannelContext.\n\t\t\t\tif (dataStoreContext.isLocalDataStore) {\n\t\t\t\t\tchannelContext = new RehydratedLocalChannelContext(\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\tthis.sharedObjectRegistry,\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\tthis.dataStoreContext,\n\t\t\t\t\t\tthis.dataStoreContext.storage,\n\t\t\t\t\t\tthis.logger,\n\t\t\t\t\t\t(content, localOpMetadata) =>\n\t\t\t\t\t\t\tthis.submitChannelOp(path, content, localOpMetadata),\n\t\t\t\t\t\t(address: string) => this.setChannelDirty(address),\n\t\t\t\t\t\t(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n\t\t\t\t\t\t\tthis.addedGCOutboundReference(srcHandle, outboundHandle),\n\t\t\t\t\t\ttree.trees[path],\n\t\t\t\t\t);\n\t\t\t\t\t// This is the case of rehydrating a detached container from snapshot. Now due to delay loading of\n\t\t\t\t\t// data store, if the data store is loaded after the container is attached, then we missed making\n\t\t\t\t\t// the channel visible. So do it now. Otherwise, add it to local channel context queue, so\n\t\t\t\t\t// that it can be make it visible later with the data store.\n\t\t\t\t\tif (dataStoreContext.attachState !== AttachState.Detached) {\n\t\t\t\t\t\t(channelContext as LocalChannelContextBase).makeVisible();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.localChannelContextQueue.set(\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tchannelContext as LocalChannelContextBase,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tchannelContext = new RemoteChannelContext(\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\tdataStoreContext,\n\t\t\t\t\t\tdataStoreContext.storage,\n\t\t\t\t\t\t(content, localOpMetadata) =>\n\t\t\t\t\t\t\tthis.submitChannelOp(path, content, localOpMetadata),\n\t\t\t\t\t\t(address: string) => this.setChannelDirty(address),\n\t\t\t\t\t\t(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n\t\t\t\t\t\t\tthis.addedGCOutboundReference(srcHandle, outboundHandle),\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\ttree.trees[path],\n\t\t\t\t\t\tthis.sharedObjectRegistry,\n\t\t\t\t\t\tundefined /* extraBlobs */,\n\t\t\t\t\t\tthis.dataStoreContext.getCreateChildSummarizerNodeFn(path, {\n\t\t\t\t\t\t\ttype: CreateSummarizerNodeSource.FromSummary,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst deferred = new Deferred<IChannelContext>();\n\t\t\t\tdeferred.resolve(channelContext);\n\n\t\t\t\tthis.contexts.set(path, channelContext);\n\t\t\t\tthis.contextsDeferred.set(path, deferred);\n\t\t\t});\n\t\t}\n\n\t\tif (initializeEntryPoint) {\n\t\t\tconst promise = new LazyPromise(async () => initializeEntryPoint(this));\n\t\t\tthis.entryPoint = new FluidObjectHandle<FluidObject>(\n\t\t\t\tpromise,\n\t\t\t\t\"\",\n\t\t\t\tthis.objectsRoutingContext,\n\t\t\t);\n\t\t}\n\n\t\tthis.attachListener();\n\t\tthis._attachState = dataStoreContext.attachState;\n\n\t\t/**\n\t\t * If existing flag is false, this is a new data store and is not visible. The existing flag can be true in two\n\t\t * conditions:\n\t\t *\n\t\t * 1. It's a local data store that is created when a detached container is rehydrated. In this case, the data\n\t\t * store is locally visible because the snapshot it is loaded from contains locally visible data stores only.\n\t\t *\n\t\t * 2. It's a remote data store that is created when an attached container is loaded is loaded from snapshot or\n\t\t * when an attach op comes in. In both these cases, the data store is already globally visible.\n\t\t */\n\t\tif (existing) {\n\t\t\tthis.visibilityState =\n\t\t\t\tdataStoreContext.attachState === AttachState.Detached\n\t\t\t\t\t? VisibilityState.LocallyVisible\n\t\t\t\t\t: VisibilityState.GloballyVisible;\n\t\t} else {\n\t\t\tthis.visibilityState = VisibilityState.NotVisible;\n\t\t}\n\n\t\t// If it's existing we know it has been attached.\n\t\tif (existing) {\n\t\t\tthis.deferredAttached.resolve();\n\t\t}\n\n\t\t// By default, a data store can log maximum 10 local changes telemetry in summarizer.\n\t\tthis.localChangesTelemetryCount =\n\t\t\tthis.mc.config.getNumber(\"Fluid.Telemetry.LocalChangesTelemetryCount\") ?? 10;\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this._disposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._disposed = true;\n\n\t\tthis.emit(\"dispose\");\n\t\tthis.removeAllListeners();\n\t}\n\n\tpublic async resolveHandle(request: IRequest): Promise<IResponse> {\n\t\treturn this.request(request);\n\t}\n\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\ttry {\n\t\t\tconst parser = RequestParser.create(request);\n\t\t\tconst id = parser.pathParts[0];\n\n\t\t\tif (id === \"_channels\" || id === \"_custom\") {\n\t\t\t\treturn this.request(parser.createSubRequest(1));\n\t\t\t}\n\n\t\t\t// Check for a data type reference first\n\t\t\tif (this.contextsDeferred.has(id) && parser.isLeaf(1)) {\n\t\t\t\ttry {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst value = await this.contextsDeferred.get(id)!.promise;\n\t\t\t\t\tconst channel = await value.getChannel();\n\n\t\t\t\t\treturn { mimeType: \"fluid/object\", status: 200, value: channel };\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t\t\t\t{ eventName: \"GetChannelFailedInRequest\" },\n\t\t\t\t\t\terror,\n\t\t\t\t\t);\n\n\t\t\t\t\treturn createResponseError(500, `Failed to get Channel: ${error}`, request);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Otherwise defer to an attached request handler\n\t\t\treturn create404Response(request);\n\t\t} catch (error) {\n\t\t\treturn exceptionToResponse(error);\n\t\t}\n\t}\n\n\tpublic async getChannel(id: string): Promise<IChannel> {\n\t\tthis.verifyNotClosed();\n\n\t\t// TODO we don't assume any channels (even root) in the runtime. If you request a channel that doesn't exist\n\t\t// we will never resolve the promise. May want a flag to getChannel that doesn't wait for the promise if\n\t\t// it doesn't exist\n\t\tif (!this.contextsDeferred.has(id)) {\n\t\t\tthis.contextsDeferred.set(id, new Deferred<IChannelContext>());\n\t\t}\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tconst context = await this.contextsDeferred.get(id)!.promise;\n\t\tconst channel = await context.getChannel();\n\n\t\treturn channel;\n\t}\n\n\tpublic createChannel(id: string = uuid(), type: string): IChannel {\n\t\tif (id.includes(\"/\")) {\n\t\t\tthrow new UsageError(`Id cannot contain slashes: ${id}`);\n\t\t}\n\n\t\tthis.verifyNotClosed();\n\n\t\tassert(!this.contexts.has(id), 0x179 /* \"createChannel() with existing ID\" */);\n\t\tthis.notBoundedChannelContextSet.add(id);\n\t\tconst context = new LocalChannelContext(\n\t\t\tid,\n\t\t\tthis.sharedObjectRegistry,\n\t\t\ttype,\n\t\t\tthis,\n\t\t\tthis.dataStoreContext,\n\t\t\tthis.dataStoreContext.storage,\n\t\t\tthis.logger,\n\t\t\t(content, localOpMetadata) => this.submitChannelOp(id, content, localOpMetadata),\n\t\t\t(address: string) => this.setChannelDirty(address),\n\t\t\t(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n\t\t\t\tthis.addedGCOutboundReference(srcHandle, outboundHandle),\n\t\t);\n\t\tthis.contexts.set(id, context);\n\n\t\tif (this.contextsDeferred.has(id)) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tthis.contextsDeferred.get(id)!.resolve(context);\n\t\t} else {\n\t\t\tconst deferred = new Deferred<IChannelContext>();\n\t\t\tdeferred.resolve(context);\n\t\t\tthis.contextsDeferred.set(id, deferred);\n\t\t}\n\n\t\t// Channels (DDS) should not be created in summarizer client.\n\t\tthis.identifyLocalChangeInSummarizer(\"DDSCreatedInSummarizer\", id, type);\n\n\t\tassert(!!context.channel, 0x17a /* \"Channel should be loaded when created!!\" */);\n\t\treturn context.channel;\n\t}\n\n\t/**\n\t * Binds a channel with the runtime. If the runtime is attached we will attach the channel right away.\n\t * If the runtime is not attached we will defer the attach until the runtime attaches.\n\t * @param channel - channel to be registered.\n\t */\n\tpublic bindChannel(channel: IChannel): void {\n\t\tassert(\n\t\t\tthis.notBoundedChannelContextSet.has(channel.id),\n\t\t\t0x17b /* \"Channel to be binded should be in not bounded set\" */,\n\t\t);\n\t\tthis.notBoundedChannelContextSet.delete(channel.id);\n\t\t// If our data store is attached, then attach the channel.\n\t\tif (this.isAttached) {\n\t\t\tthis.attachChannel(channel);\n\t\t\treturn;\n\t\t}\n\n\t\t/**\n\t\t * If this channel is already waiting to be made visible, do nothing. This can happen during attachGraph() when\n\t\t * a channel's graph is attached. It calls bindToContext on the shared object which will end up back here.\n\t\t */\n\t\tif (this.pendingHandlesToMakeVisible.has(channel.handle)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.bind(channel.handle);\n\n\t\t// If our data store is local then add the channel to the queue\n\t\tif (!this.localChannelContextQueue.has(channel.id)) {\n\t\t\tthis.localChannelContextQueue.set(\n\t\t\t\tchannel.id,\n\t\t\t\tthis.contexts.get(channel.id) as LocalChannelContextBase,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * This function is called when a data store becomes root. It does the following:\n\t *\n\t * 1. Marks the data store locally visible in the container.\n\t *\n\t * 2. Attaches the graph of all the handles bound to it.\n\t *\n\t * 3. Calls into the data store context to mark it visible in the container too. If the container is globally\n\t * visible, it will mark us globally visible. Otherwise, it will mark us globally visible when it becomes\n\t * globally visible.\n\t */\n\tpublic makeVisibleAndAttachGraph() {\n\t\tif (this.visibilityState !== VisibilityState.NotVisible) {\n\t\t\treturn;\n\t\t}\n\t\tthis.visibilityState = VisibilityState.LocallyVisible;\n\n\t\tthis.pendingHandlesToMakeVisible.forEach((handle) => {\n\t\t\thandle.attachGraph();\n\t\t});\n\t\tthis.pendingHandlesToMakeVisible.clear();\n\t\tthis.dataStoreContext.makeLocallyVisible();\n\t}\n\n\t/**\n\t * This function is called when a handle to this data store is added to a visible DDS.\n\t */\n\tpublic attachGraph() {\n\t\tthis.makeVisibleAndAttachGraph();\n\t}\n\n\t/**\n\t * @deprecated - Not necessary if consumers add a new dataStore to the container by storing its handle.\n\t * Binds this runtime to the container\n\t * This includes the following:\n\t * 1. Sending an Attach op that includes all existing state\n\t * 2. Attaching the graph if the data store becomes attached.\n\t */\n\tpublic bindToContext() {\n\t\tthis.makeVisibleAndAttachGraph();\n\t}\n\n\tpublic bind(handle: IFluidHandle): void {\n\t\t// If visible, attach the incoming handle's graph. Else, this will be done when we become visible.\n\t\tif (this.visibilityState !== VisibilityState.NotVisible) {\n\t\t\thandle.attachGraph();\n\t\t\treturn;\n\t\t}\n\t\tthis.pendingHandlesToMakeVisible.add(handle);\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\n\t\tthis.verifyNotClosed();\n\n\t\tfor (const [, object] of this.contexts) {\n\t\t\tobject.setConnectionState(connected, clientId);\n\t\t}\n\n\t\traiseConnectedEvent(this.logger, this, connected, clientId);\n\t}\n\n\tpublic getQuorum(): IQuorumClients {\n\t\treturn this.quorum;\n\t}\n\n\tpublic getAudience(): IAudience {\n\t\treturn this.audience;\n\t}\n\n\tpublic async uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>> {\n\t\tthis.verifyNotClosed();\n\n\t\treturn this.dataStoreContext.uploadBlob(blob);\n\t}\n\n\tpublic process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n\t\tthis.verifyNotClosed();\n\n\t\ttry {\n\t\t\t// catches as data processing error whether or not they come from async pending queues\n\t\t\tswitch (message.type) {\n\t\t\t\tcase DataStoreMessageType.Attach: {\n\t\t\t\t\tconst attachMessage = message.contents as IAttachMessage;\n\t\t\t\t\tconst id = attachMessage.id;\n\n\t\t\t\t\t// If a non-local operation then go and create the object\n\t\t\t\t\t// Otherwise mark it as officially attached.\n\t\t\t\t\tif (local) {\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tthis.pendingAttach.has(id),\n\t\t\t\t\t\t\t0x17c /* \"Unexpected attach (local) channel OP\" */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.pendingAttach.delete(id);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tassert(!this.contexts.has(id), 0x17d /* \"Unexpected attach channel OP\" */);\n\n\t\t\t\t\t\tconst flatBlobs = new Map<string, ArrayBufferLike>();\n\t\t\t\t\t\tconst snapshotTree = buildSnapshotTree(\n\t\t\t\t\t\t\tattachMessage.snapshot.entries,\n\t\t\t\t\t\t\tflatBlobs,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst remoteChannelContext = new RemoteChannelContext(\n\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\tthis.dataStoreContext,\n\t\t\t\t\t\t\tthis.dataStoreContext.storage,\n\t\t\t\t\t\t\t(content, localContentMetadata) =>\n\t\t\t\t\t\t\t\tthis.submitChannelOp(id, content, localContentMetadata),\n\t\t\t\t\t\t\t(address: string) => this.setChannelDirty(address),\n\t\t\t\t\t\t\t(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) =>\n\t\t\t\t\t\t\t\tthis.addedGCOutboundReference(srcHandle, outboundHandle),\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\tsnapshotTree,\n\t\t\t\t\t\t\tthis.sharedObjectRegistry,\n\t\t\t\t\t\t\tflatBlobs,\n\t\t\t\t\t\t\tthis.dataStoreContext.getCreateChildSummarizerNodeFn(id, {\n\t\t\t\t\t\t\t\ttype: CreateSummarizerNodeSource.FromAttach,\n\t\t\t\t\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t\t\t\t\t\tsnapshot: attachMessage.snapshot,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tattachMessage.type,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tthis.contexts.set(id, remoteChannelContext);\n\t\t\t\t\t\tif (this.contextsDeferred.has(id)) {\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\t\tthis.contextsDeferred.get(id)!.resolve(remoteChannelContext);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst deferred = new Deferred<IChannelContext>();\n\t\t\t\t\t\t\tdeferred.resolve(remoteChannelContext);\n\t\t\t\t\t\t\tthis.contextsDeferred.set(id, deferred);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase DataStoreMessageType.ChannelOp:\n\t\t\t\t\tthis.processChannelOp(message, local, localOpMetadata);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t}\n\n\t\t\tthis.emit(\"op\", message);\n\t\t} catch (error) {\n\t\t\tthrow DataProcessingError.wrapIfUnrecognized(\n\t\t\t\terror,\n\t\t\t\t\"fluidDataStoreRuntimeFailedToProcessMessage\",\n\t\t\t\tmessage,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic processSignal(message: IInboundSignalMessage, local: boolean) {\n\t\tthis.emit(\"signal\", message, local);\n\t}\n\n\tprivate isChannelAttached(id: string): boolean {\n\t\treturn (\n\t\t\t// Added in createChannel\n\t\t\t// Removed when bindChannel is called\n\t\t\t!this.notBoundedChannelContextSet.has(id) &&\n\t\t\t// Added in bindChannel only if this is not attached yet\n\t\t\t// Removed when this is attached by calling attachGraph\n\t\t\t!this.localChannelContextQueue.has(id) &&\n\t\t\t// Added in attachChannel called by bindChannel\n\t\t\t// Removed when attach op is broadcast\n\t\t\t!this.pendingAttach.has(id)\n\t\t);\n\t}\n\n\t/**\n\t * Returns the outbound routes of this channel. Currently, all contexts in this channel are considered\n\t * referenced and are hence outbound. This will change when we have root and non-root channel contexts.\n\t * The only root contexts will be considered as referenced.\n\t */\n\tprivate getOutboundRoutes(): string[] {\n\t\tconst outboundRoutes: string[] = [];\n\t\tfor (const [contextId] of this.contexts) {\n\t\t\toutboundRoutes.push(`${this.absolutePath}/${contextId}`);\n\t\t}\n\t\treturn outboundRoutes;\n\t}\n\n\t/**\n\t * Updates the GC nodes of this channel. It does the following:\n\t * - Adds a back route to self to all its child GC nodes.\n\t * - Adds a node for this channel.\n\t * @param builder - The builder that contains the GC nodes for this channel's children.\n\t */\n\tprivate updateGCNodes(builder: GCDataBuilder) {\n\t\t// Add a back route to self in each child's GC nodes. If any child is referenced, then its parent should\n\t\t// be considered referenced as well.\n\t\tbuilder.addRouteToAllNodes(this.absolutePath);\n\n\t\t// Get the outbound routes and add a GC node for this channel.\n\t\tbuilder.addNode(\"/\", this.getOutboundRoutes());\n\t}\n\n\t/**\n\t * Generates data used for garbage collection. This includes a list of GC nodes that represent this channel\n\t * including any of its child channel contexts. Each node has a set of outbound routes to other GC nodes in the\n\t * document. It does the following:\n\t *\n\t * 1. Calls into each child context to get its GC data.\n\t *\n\t * 2. Prefixes the child context's id to the GC nodes in the child's GC data. This makes sure that the node can be\n\t * identified as belonging to the child.\n\t *\n\t * 3. Adds a GC node for this channel to the nodes received from the children. All these nodes together represent\n\t * the GC data of this channel.\n\t *\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst builder = new GCDataBuilder();\n\t\t// Iterate over each channel context and get their GC data.\n\t\tawait Promise.all(\n\t\t\tArray.from(this.contexts)\n\t\t\t\t.filter(([contextId, _]) => {\n\t\t\t\t\t// Get GC data only for attached contexts. Detached contexts are not connected in the GC reference\n\t\t\t\t\t// graph so any references they might have won't be connected as well.\n\t\t\t\t\treturn this.isChannelAttached(contextId);\n\t\t\t\t})\n\t\t\t\t.map(async ([contextId, context]) => {\n\t\t\t\t\tconst contextGCData = await context.getGCData(fullGC);\n\t\t\t\t\t// Prefix the child's id to the ids of its GC nodes so they can be identified as belonging to the child.\n\t\t\t\t\t// This also gradually builds the id of each node to be a path from the root.\n\t\t\t\t\tbuilder.prefixAndAddNodes(contextId, contextGCData.gcNodes);\n\t\t\t\t}),\n\t\t);\n\n\t\tthis.updateGCNodes(builder);\n\t\treturn builder.getGCData();\n\t}\n\n\t/**\n\t * After GC has run, called to notify this channel of routes that are used in it. It calls the child contexts to\n\t * update their used routes.\n\t * @param usedRoutes - The routes that are used in all contexts in this channel.\n\t */\n\tpublic updateUsedRoutes(usedRoutes: string[]) {\n\t\t// Get a map of channel ids to routes used in it.\n\t\tconst usedContextRoutes = unpackChildNodesUsedRoutes(usedRoutes);\n\n\t\t// Verify that the used routes are correct.\n\t\tfor (const [id] of usedContextRoutes) {\n\t\t\tassert(\n\t\t\t\tthis.contexts.has(id),\n\t\t\t\t0x17e /* \"Used route does not belong to any known context\" */,\n\t\t\t);\n\t\t}\n\n\t\t// Update the used routes in each context. Used routes is empty for unused context.\n\t\tfor (const [contextId, context] of this.contexts) {\n\t\t\tcontext.updateUsedRoutes(usedContextRoutes.get(contextId) ?? []);\n\t\t}\n\t}\n\n\t/**\n\t * Called when a new outbound reference is added to another node. This is used by garbage collection to identify\n\t * all references added in the system.\n\t * @param srcHandle - The handle of the node that added the reference.\n\t * @param outboundHandle - The handle of the outbound node that is referenced.\n\t */\n\tprivate addedGCOutboundReference(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) {\n\t\tthis.dataStoreContext.addedGCOutboundReference?.(srcHandle, outboundHandle);\n\t}\n\n\t/**\n\t * Returns a summary at the current sequence number.\n\t * @param fullTree - true to bypass optimizations and force a full summary tree\n\t * @param trackState - This tells whether we should track state from this summary.\n\t * @param telemetryContext - summary data passed through the layers for telemetry purposes\n\t */\n\tpublic async summarize(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = true,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats> {\n\t\tconst summaryBuilder = new SummaryTreeBuilder();\n\n\t\t// Iterate over each data store and ask it to summarize\n\t\tawait Promise.all(\n\t\t\tArray.from(this.contexts)\n\t\t\t\t.filter(([contextId, _]) => {\n\t\t\t\t\tconst isAttached = this.isChannelAttached(contextId);\n\t\t\t\t\t// We are not expecting local dds! Summary may not capture local state.\n\t\t\t\t\tassert(\n\t\t\t\t\t\tisAttached,\n\t\t\t\t\t\t0x17f /* \"Not expecting detached channels during summarize\" */,\n\t\t\t\t\t);\n\t\t\t\t\t// If the object is registered - and we have received the sequenced op creating the object\n\t\t\t\t\t// (i.e. it has a base mapping) - then we go ahead and summarize\n\t\t\t\t\treturn isAttached;\n\t\t\t\t})\n\t\t\t\t.map(async ([contextId, context]) => {\n\t\t\t\t\tconst contextSummary = await context.summarize(\n\t\t\t\t\t\tfullTree,\n\t\t\t\t\t\ttrackState,\n\t\t\t\t\t\ttelemetryContext,\n\t\t\t\t\t);\n\t\t\t\t\tsummaryBuilder.addWithStats(contextId, contextSummary);\n\t\t\t\t}),\n\t\t);\n\n\t\treturn summaryBuilder.getSummaryTree();\n\t}\n\n\tpublic getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {\n\t\t/**\n\t\t * back-compat 0.59.1000 - getAttachSummary() is called when making a data store globally visible (previously\n\t\t * attaching state). Ideally, attachGraph() should have already be called making it locally visible. However,\n\t\t * before visibility state was added, this may not have been the case and getAttachSummary() could be called:\n\t\t *\n\t\t * 1. Before attaching the data store - When a detached container is attached.\n\t\t *\n\t\t * 2. After attaching the data store - When a data store is created and bound in an attached container.\n\t\t *\n\t\t * The basic idea is that all local object should become locally visible before they are globally visible.\n\t\t */\n\t\tthis.attachGraph();\n\n\t\t// This assert cannot be added now due to back-compat. To be uncommented when the following issue is fixed -\n\t\t// https://github.com/microsoft/FluidFramework/issues/9688.\n\t\t//\n\t\t// assert(this.visibilityState === VisibilityState.LocallyVisible,\n\t\t// \"The data store should be locally visible when generating attach summary\",\n\t\t// );\n\n\t\tconst summaryBuilder = new SummaryTreeBuilder();\n\n\t\t// Craft the .attributes file for each shared object\n\t\tfor (const [contextId, context] of this.contexts) {\n\t\t\tif (!(context instanceof LocalChannelContextBase)) {\n\t\t\t\tthrow new LoggingError(\"Should only be called with local channel handles\");\n\t\t\t}\n\n\t\t\tif (!this.notBoundedChannelContextSet.has(contextId)) {\n\t\t\t\tlet summaryTree: ISummaryTreeWithStats;\n\t\t\t\tif (context.isLoaded) {\n\t\t\t\t\tconst contextSummary = context.getAttachSummary(telemetryContext);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tcontextSummary.summary.type === SummaryType.Tree,\n\t\t\t\t\t\t0x180 /* \"getAttachSummary should always return a tree\" */,\n\t\t\t\t\t);\n\t\t\t\t\tsummaryTree = { stats: contextSummary.stats, summary: contextSummary.summary };\n\t\t\t\t} else {\n\t\t\t\t\t// If this channel is not yet loaded, then there should be no changes in the snapshot from which\n\t\t\t\t\t// it was created as it is detached container. So just use the previous snapshot.\n\t\t\t\t\tassert(\n\t\t\t\t\t\t!!this.dataStoreContext.baseSnapshot,\n\t\t\t\t\t\t0x181 /* \"BaseSnapshot should be there as detached container loaded from snapshot\" */,\n\t\t\t\t\t);\n\t\t\t\t\tsummaryTree = convertSnapshotTreeToSummaryTree(\n\t\t\t\t\t\tthis.dataStoreContext.baseSnapshot.trees[contextId],\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tsummaryBuilder.addWithStats(contextId, summaryTree);\n\t\t\t}\n\t\t}\n\n\t\treturn summaryBuilder.getSummaryTree();\n\t}\n\n\tpublic submitMessage(type: DataStoreMessageType, content: any, localOpMetadata: unknown) {\n\t\tthis.submit(type, content, localOpMetadata);\n\t}\n\n\tpublic submitSignal(type: string, content: any) {\n\t\tthis.verifyNotClosed();\n\t\treturn this.dataStoreContext.submitSignal(type, content);\n\t}\n\n\t/**\n\t * Will return when the data store is attached.\n\t */\n\tpublic async waitAttached(): Promise<void> {\n\t\treturn this.deferredAttached.promise;\n\t}\n\n\t/**\n\t * Attach channel should only be called after the data store has been attached\n\t */\n\tprivate attachChannel(channel: IChannel): void {\n\t\tthis.verifyNotClosed();\n\t\t// If this handle is already attached no need to attach again.\n\t\tif (channel.handle.isAttached) {\n\t\t\treturn;\n\t\t}\n\n\t\tchannel.handle.attachGraph();\n\n\t\tassert(this.isAttached, 0x182 /* \"Data store should be attached to attach the channel.\" */);\n\t\tassert(\n\t\t\tthis.visibilityState === VisibilityState.GloballyVisible,\n\t\t\t0x2d0 /* \"Data store should be globally visible to attach channels.\" */,\n\t\t);\n\n\t\tconst summarizeResult = summarizeChannel(\n\t\t\tchannel,\n\t\t\ttrue /* fullTree */,\n\t\t\tfalse /* trackState */,\n\t\t);\n\t\t// Attach message needs the summary in ITree format. Convert the ISummaryTree into an ITree.\n\t\tconst snapshot = convertSummaryTreeToITree(summarizeResult.summary);\n\n\t\tconst message: IAttachMessage = {\n\t\t\tid: channel.id,\n\t\t\tsnapshot,\n\t\t\ttype: channel.attributes.type,\n\t\t};\n\t\tthis.pendingAttach.set(channel.id, message);\n\t\tthis.submit(DataStoreMessageType.Attach, message);\n\n\t\tconst context = this.contexts.get(channel.id) as LocalChannelContextBase;\n\t\tcontext.makeVisible();\n\t}\n\n\tprivate submitChannelOp(address: string, contents: any, localOpMetadata: unknown) {\n\t\tconst envelope: IEnvelope = { address, contents };\n\t\tthis.submit(DataStoreMessageType.ChannelOp, envelope, localOpMetadata);\n\t}\n\n\tprivate submit(\n\t\ttype: DataStoreMessageType,\n\t\tcontent: any,\n\t\tlocalOpMetadata: unknown = undefined,\n\t): void {\n\t\tthis.verifyNotClosed();\n\t\tthis.dataStoreContext.submitMessage(type, content, localOpMetadata);\n\t}\n\n\t/**\n\t * For messages of type MessageType.Operation, finds the right channel and asks it to resubmit the message.\n\t * For all other messages, just submit it again.\n\t * This typically happens when we reconnect and there are unacked messages.\n\t * @param content - The content of the original message.\n\t * @param localOpMetadata - The local metadata associated with the original message.\n\t */\n\tpublic reSubmit(type: DataStoreMessageType, content: any, localOpMetadata: unknown) {\n\t\tthis.verifyNotClosed();\n\n\t\tswitch (type) {\n\t\t\tcase DataStoreMessageType.ChannelOp: {\n\t\t\t\t// For Operations, find the right channel and trigger resubmission on it.\n\t\t\t\tconst envelope = content as IEnvelope;\n\t\t\t\tconst channelContext = this.contexts.get(envelope.address);\n\t\t\t\tassert(\n\t\t\t\t\t!!channelContext,\n\t\t\t\t\t0x183 /* \"There should be a channel context for the op\" */,\n\t\t\t\t);\n\t\t\t\tchannelContext.reSubmit(envelope.contents, localOpMetadata);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase DataStoreMessageType.Attach:\n\t\t\t\t// For Attach messages, just submit them again.\n\t\t\t\tthis.submit(type, content, localOpMetadata);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tunreachableCase(type);\n\t\t}\n\t}\n\n\t/**\n\t * Revert a local op.\n\t * @param content - The content of the original message.\n\t * @param localOpMetadata - The local metadata associated with the original message.\n\t */\n\tpublic rollback?(type: DataStoreMessageType, content: any, localOpMetadata: unknown) {\n\t\tthis.verifyNotClosed();\n\n\t\tswitch (type) {\n\t\t\tcase DataStoreMessageType.ChannelOp: {\n\t\t\t\t// For Operations, find the right channel and trigger resubmission on it.\n\t\t\t\tconst envelope = content as IEnvelope;\n\t\t\t\tconst channelContext = this.contexts.get(envelope.address);\n\t\t\t\tassert(\n\t\t\t\t\t!!channelContext,\n\t\t\t\t\t0x2ed /* \"There should be a channel context for the op\" */,\n\t\t\t\t);\n\t\t\t\tchannelContext.rollback(envelope.contents, localOpMetadata);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tthrow new LoggingError(`Can't rollback ${type} message`);\n\t\t}\n\t}\n\n\tpublic async applyStashedOp(content: any): Promise<unknown> {\n\t\tconst envelope = content as IEnvelope;\n\t\tconst channelContext = this.contexts.get(envelope.address);\n\t\tassert(!!channelContext, 0x184 /* \"There should be a channel context for the op\" */);\n\t\tawait channelContext.getChannel();\n\t\treturn channelContext.applyStashedOp(envelope.contents);\n\t}\n\n\tprivate setChannelDirty(address: string): void {\n\t\tthis.verifyNotClosed();\n\t\tthis.dataStoreContext.setChannelDirty(address);\n\t}\n\n\tprivate processChannelOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t) {\n\t\tthis.verifyNotClosed();\n\n\t\tconst envelope = message.contents as IEnvelope;\n\n\t\tconst transformed: ISequencedDocumentMessage = {\n\t\t\t...message,\n\t\t\tcontents: envelope.contents,\n\t\t};\n\n\t\tconst channelContext = this.contexts.get(envelope.address);\n\t\tassert(!!channelContext, 0x185 /* \"Channel not found\" */);\n\t\tchannelContext.processOp(transformed, local, localOpMetadata);\n\n\t\treturn channelContext;\n\t}\n\n\tprivate attachListener() {\n\t\tthis.setMaxListeners(Number.MAX_SAFE_INTEGER);\n\t\tthis.dataStoreContext.once(\"attaching\", () => {\n\t\t\t/**\n\t\t\t * back-compat 0.59.1000 - Ideally, attachGraph() should have already been called making the data store\n\t\t\t * locally visible. However, before visibility state was added, this may not have been the case and data\n\t\t\t * store can move to \"attaching\" state in 2 scenarios:\n\t\t\t * 1) Before attachGraph() is called - When a data store is created and bound in an attached container.\n\t\t\t * 2) After attachGraph() is called - When a detached container is attached.\n\t\t\t *\n\t\t\t * The basic idea is that all local object should become locally visible before they are globally visible.\n\t\t\t */\n\t\t\tthis.attachGraph();\n\n\t\t\tthis._attachState = AttachState.Attaching;\n\n\t\t\tassert(\n\t\t\t\tthis.visibilityState === VisibilityState.LocallyVisible,\n\t\t\t\t0x2d1 /* \"Data store should be locally visible before it can become globally visible.\" */,\n\t\t\t);\n\n\t\t\t// Mark the data store globally visible and make its child channels visible as well.\n\t\t\tthis.visibilityState = VisibilityState.GloballyVisible;\n\t\t\tthis.localChannelContextQueue.forEach((channel) => {\n\t\t\t\tchannel.makeVisible();\n\t\t\t});\n\t\t\tthis.localChannelContextQueue.clear();\n\n\t\t\t// This promise resolution will be moved to attached event once we fix the scheduler.\n\t\t\tthis.deferredAttached.resolve();\n\t\t\tthis.emit(\"attaching\");\n\t\t});\n\t\tthis.dataStoreContext.once(\"attached\", () => {\n\t\t\tassert(\n\t\t\t\tthis.visibilityState === VisibilityState.GloballyVisible,\n\t\t\t\t0x2d2 /* \"Data store should be globally visible when its attached.\" */,\n\t\t\t);\n\t\t\tthis._attachState = AttachState.Attached;\n\t\t\tthis.emit(\"attached\");\n\t\t});\n\t}\n\n\tprivate verifyNotClosed() {\n\t\tif (this._disposed) {\n\t\t\tthrow new LoggingError(\"Runtime is closed\");\n\t\t}\n\t}\n\n\t/**\n\t * Summarizer client should not have local changes. These changes can become part of the summary and can break\n\t * eventual consistency. For example, the next summary (say at ref seq# 100) may contain these changes whereas\n\t * other clients that are up-to-date till seq# 100 may not have them yet.\n\t */\n\tprivate identifyLocalChangeInSummarizer(\n\t\teventName: string,\n\t\tchannelId: string,\n\t\tchannelType: string,\n\t) {\n\t\tif (this.clientDetails.type !== \"summarizer\" || this.localChangesTelemetryCount <= 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Log a telemetry if there are local changes in the summarizer. This will give us data on how often\n\t\t// this is happening and which data stores do this. The eventual goal is to disallow local changes\n\t\t// in the summarizer and the data will help us plan this.\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName,\n\t\t\tchannelType,\n\t\t\tchannelId: {\n\t\t\t\tvalue: channelId,\n\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t},\n\t\t\tfluidDataStoreId: {\n\t\t\t\tvalue: this.id,\n\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t},\n\t\t\tfluidDataStorePackagePath: packagePathToTelemetryProperty(\n\t\t\t\tthis.dataStoreContext.packagePath,\n\t\t\t),\n\t\t\tstack: generateStack(),\n\t\t});\n\t\tthis.localChangesTelemetryCount--;\n\t}\n}\n\n/**\n * Mixin class that adds request handler to FluidDataStoreRuntime\n * Request handler is only called when data store can't resolve request, i.e. for custom requests.\n * @param Base - base class, inherits from FluidDataStoreRuntime\n * @param requestHandler - request handler to mix in\n */\nexport const mixinRequestHandler = (\n\trequestHandler: (request: IRequest, runtime: FluidDataStoreRuntime) => Promise<IResponse>,\n\tBase: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n) =>\n\tclass RuntimeWithRequestHandler extends Base {\n\t\tpublic async request(request: IRequest) {\n\t\t\tconst response = await super.request(request);\n\t\t\tif (response.status === 404) {\n\t\t\t\treturn requestHandler(request, this);\n\t\t\t}\n\t\t\treturn response;\n\t\t}\n\t} as typeof FluidDataStoreRuntime;\n\n/**\n * Mixin class that adds await for DataObject to finish initialization before we proceed to summary.\n * @param handler - handler that returns info about blob to be added to summary.\n * Or undefined not to add anything to summary.\n * @param Base - base class, inherits from FluidDataStoreRuntime\n */\nexport const mixinSummaryHandler = (\n\thandler: (\n\t\truntime: FluidDataStoreRuntime,\n\t) => Promise<{ path: string[]; content: string } | undefined>,\n\tBase: typeof FluidDataStoreRuntime = FluidDataStoreRuntime,\n) =>\n\tclass RuntimeWithSummarizerHandler extends Base {\n\t\tprivate addBlob(summary: ISummaryTreeWithStats, path: string[], content: string) {\n\t\t\tconst firstName = path.shift();\n\t\t\tif (firstName === undefined) {\n\t\t\t\tthrow new LoggingError(\"Path can't be empty\");\n\t\t\t}\n\n\t\t\tlet blob: ISummaryTree | ISummaryBlob = {\n\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\tcontent,\n\t\t\t};\n\t\t\tsummary.stats.blobNodeCount++;\n\t\t\tsummary.stats.totalBlobSize += content.length;\n\n\t\t\tfor (const name of path.reverse()) {\n\t\t\t\tblob = {\n\t\t\t\t\ttype: SummaryType.Tree,\n\t\t\t\t\ttree: { [name]: blob },\n\t\t\t\t};\n\t\t\t\tsummary.stats.treeNodeCount++;\n\t\t\t}\n\t\t\tsummary.summary.tree[firstName] = blob;\n\t\t}\n\n\t\tasync summarize(...args: any[]) {\n\t\t\tconst summary = await super.summarize(...args);\n\t\t\tconst content = await handler(this);\n\t\t\tif (content !== undefined) {\n\t\t\t\tthis.addBlob(summary, content.path, content.content);\n\t\t\t}\n\t\t\treturn summary;\n\t\t}\n\t} as typeof FluidDataStoreRuntime;\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/datastore";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-internal.3.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.3.2.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/datastore";
|
|
11
|
-
exports.pkgVersion = "2.0.0-internal.3.
|
|
11
|
+
exports.pkgVersion = "2.0.0-internal.3.2.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,2BAA2B,CAAC;AACtC,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/datastore\";\nexport const pkgVersion = \"2.0.0-internal.3.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,2BAA2B,CAAC;AACtC,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/datastore\";\nexport const pkgVersion = \"2.0.0-internal.3.2.0\";\n"]}
|