@fluidframework/datastore 2.0.0-internal.6.4.0 → 2.0.0-internal.7.1.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/CHANGELOG.md +69 -0
- package/api-extractor.json +1 -1
- package/api-report/datastore.api.md +172 -0
- package/dist/channelDeltaConnection.js +6 -6
- package/dist/channelDeltaConnection.js.map +1 -1
- package/dist/channelStorageService.js +10 -10
- package/dist/channelStorageService.js.map +1 -1
- package/dist/dataStoreRuntime.d.ts +15 -11
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/dataStoreRuntime.js +86 -90
- package/dist/dataStoreRuntime.js.map +1 -1
- package/dist/datastore-alpha.d.ts +327 -0
- package/dist/datastore-beta.d.ts +327 -0
- package/dist/datastore-public.d.ts +327 -0
- package/dist/datastore.d.ts +326 -0
- package/dist/fluidHandle.d.ts +2 -0
- package/dist/fluidHandle.d.ts.map +1 -1
- package/dist/fluidHandle.js +21 -19
- package/dist/fluidHandle.js.map +1 -1
- package/dist/remoteChannelContext.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/channelDeltaConnection.js +6 -6
- package/lib/channelDeltaConnection.js.map +1 -1
- package/lib/channelStorageService.js +10 -10
- package/lib/channelStorageService.js.map +1 -1
- package/lib/dataStoreRuntime.d.ts +15 -11
- package/lib/dataStoreRuntime.d.ts.map +1 -1
- package/lib/dataStoreRuntime.js +86 -90
- package/lib/dataStoreRuntime.js.map +1 -1
- package/lib/fluidHandle.d.ts +2 -0
- package/lib/fluidHandle.d.ts.map +1 -1
- package/lib/fluidHandle.js +21 -19
- package/lib/fluidHandle.js.map +1 -1
- package/lib/remoteChannelContext.js.map +1 -1
- package/package.json +25 -26
- package/src/dataStoreRuntime.ts +21 -24
- package/src/fluidHandle.ts +2 -0
package/dist/fluidHandle.js
CHANGED
|
@@ -8,27 +8,10 @@ exports.FluidObjectHandle = void 0;
|
|
|
8
8
|
const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
9
9
|
/**
|
|
10
10
|
* Handle for a shared {@link @fluidframework/core-interfaces#FluidObject}.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
11
13
|
*/
|
|
12
14
|
class FluidObjectHandle {
|
|
13
|
-
/**
|
|
14
|
-
* Creates a new `FluidObjectHandle`.
|
|
15
|
-
*
|
|
16
|
-
* @param value - The {@link @fluidframework/core-interfaces#FluidObject} object this handle is for.
|
|
17
|
-
* @param path - The path to this handle relative to the `routeContext`.
|
|
18
|
-
* @param routeContext - The parent {@link @fluidframework/core-interfaces#IFluidHandleContext} that has a route
|
|
19
|
-
* to this handle.
|
|
20
|
-
*/
|
|
21
|
-
constructor(value, path, routeContext) {
|
|
22
|
-
this.value = value;
|
|
23
|
-
this.path = path;
|
|
24
|
-
this.routeContext = routeContext;
|
|
25
|
-
this.pendingHandlesToMakeVisible = new Set();
|
|
26
|
-
/**
|
|
27
|
-
* Tracks whether this handle is locally visible in the container.
|
|
28
|
-
*/
|
|
29
|
-
this.locallyVisible = false;
|
|
30
|
-
this.absolutePath = (0, runtime_utils_1.generateHandleContextPath)(path, this.routeContext);
|
|
31
|
-
}
|
|
32
15
|
/**
|
|
33
16
|
* {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}
|
|
34
17
|
*/
|
|
@@ -59,6 +42,25 @@ class FluidObjectHandle {
|
|
|
59
42
|
*/
|
|
60
43
|
return this.isAttached || this.locallyVisible;
|
|
61
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Creates a new `FluidObjectHandle`.
|
|
47
|
+
*
|
|
48
|
+
* @param value - The {@link @fluidframework/core-interfaces#FluidObject} object this handle is for.
|
|
49
|
+
* @param path - The path to this handle relative to the `routeContext`.
|
|
50
|
+
* @param routeContext - The parent {@link @fluidframework/core-interfaces#IFluidHandleContext} that has a route
|
|
51
|
+
* to this handle.
|
|
52
|
+
*/
|
|
53
|
+
constructor(value, path, routeContext) {
|
|
54
|
+
this.value = value;
|
|
55
|
+
this.path = path;
|
|
56
|
+
this.routeContext = routeContext;
|
|
57
|
+
this.pendingHandlesToMakeVisible = new Set();
|
|
58
|
+
/**
|
|
59
|
+
* Tracks whether this handle is locally visible in the container.
|
|
60
|
+
*/
|
|
61
|
+
this.locallyVisible = false;
|
|
62
|
+
this.absolutePath = (0, runtime_utils_1.generateHandleContextPath)(path, this.routeContext);
|
|
63
|
+
}
|
|
62
64
|
/**
|
|
63
65
|
* {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.get}
|
|
64
66
|
*/
|
package/dist/fluidHandle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidHandle.js","sourceRoot":"","sources":["../src/fluidHandle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,iEAA0E;AAE1E
|
|
1
|
+
{"version":3,"file":"fluidHandle.js","sourceRoot":"","sources":["../src/fluidHandle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,iEAA0E;AAE1E;;;;GAIG;AACH,MAAa,iBAAiB;IAQ7B;;OAEG;IACH,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,IAAY,OAAO;QAClB;;;;;;;;;;;WAWG;QACH,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,cAAc,CAAC;IAC/C,CAAC;IAOD;;;;;;;OAOG;IACH,YACoB,KAAqB,EACxB,IAAY,EACZ,YAAiC;QAF9B,UAAK,GAAL,KAAK,CAAgB;QACxB,SAAI,GAAJ,IAAI,CAAQ;QACZ,iBAAY,GAAZ,YAAY,CAAqB;QAxDjC,gCAA2B,GAAsB,IAAI,GAAG,EAAE,CAAC;QAwC5E;;WAEG;QACK,mBAAc,GAAY,KAAK,CAAC;QAevC,IAAI,CAAC,YAAY,GAAG,IAAA,yCAAyB,EAAC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IACxE,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,GAAG;QACf,yGAAyG;QACzG,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IAED;;OAEG;IACI,WAAW;QACjB,IAAI,IAAI,CAAC,OAAO,EAAE;YACjB,OAAO;SACP;QAED,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YACnD,MAAM,CAAC,WAAW,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,2BAA2B,CAAC,KAAK,EAAE,CAAC;QACzC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,IAAI,CAAC,MAAoB;QAC/B,8EAA8E;QAC9E,IAAI,IAAI,CAAC,OAAO,EAAE;YACjB,MAAM,CAAC,WAAW,EAAE,CAAC;YACrB,OAAO;SACP;QACD,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;CACD;AAjGD,8CAiGC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle, IFluidHandleContext, FluidObject } from \"@fluidframework/core-interfaces\";\nimport { generateHandleContextPath } from \"@fluidframework/runtime-utils\";\n\n/**\n * Handle for a shared {@link @fluidframework/core-interfaces#FluidObject}.\n *\n * @public\n */\nexport class FluidObjectHandle<T extends FluidObject = FluidObject> implements IFluidHandle {\n\tprivate readonly pendingHandlesToMakeVisible: Set<IFluidHandle> = new Set();\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.absolutePath}\n\t */\n\tpublic readonly absolutePath: string;\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}\n\t */\n\tpublic get IFluidHandle(): IFluidHandle {\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.isAttached}\n\t */\n\tpublic get isAttached(): boolean {\n\t\treturn this.routeContext.isAttached;\n\t}\n\n\t/**\n\t * Tells whether the object of this handle is visible in the container locally or globally.\n\t */\n\tprivate get visible(): boolean {\n\t\t/**\n\t\t * If the object of this handle is attached, it is visible in the container. Ideally, checking local visibility\n\t\t * should be enough for a handle. However, there are scenarios where the object becomes locally visible but the\n\t\t * handle does not know this - This will happen is attachGraph is never called on the handle. Couple of examples\n\t\t * where this can happen:\n\t\t *\n\t\t * 1. Handles to DDS other than the default handle won't know if the DDS becomes visible after the handle was\n\t\t * created.\n\t\t *\n\t\t * 2. Handles to root data stores will never know that it was visible because the handle will not be stores in\n\t\t * another DDS and so, attachGraph will never be called on it.\n\t\t */\n\t\treturn this.isAttached || this.locallyVisible;\n\t}\n\n\t/**\n\t * Tracks whether this handle is locally visible in the container.\n\t */\n\tprivate locallyVisible: boolean = false;\n\n\t/**\n\t * Creates a new `FluidObjectHandle`.\n\t *\n\t * @param value - The {@link @fluidframework/core-interfaces#FluidObject} object this handle is for.\n\t * @param path - The path to this handle relative to the `routeContext`.\n\t * @param routeContext - The parent {@link @fluidframework/core-interfaces#IFluidHandleContext} that has a route\n\t * to this handle.\n\t */\n\tconstructor(\n\t\tprotected readonly value: T | Promise<T>,\n\t\tpublic readonly path: string,\n\t\tpublic readonly routeContext: IFluidHandleContext,\n\t) {\n\t\tthis.absolutePath = generateHandleContextPath(path, this.routeContext);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.get}\n\t */\n\tpublic async get(): Promise<any> {\n\t\t// Note that this return works whether we received a T or a Promise<T> for this.value in the constructor.\n\t\treturn this.value;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.attachGraph }\n\t */\n\tpublic attachGraph(): void {\n\t\tif (this.visible) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.locallyVisible = true;\n\t\tthis.pendingHandlesToMakeVisible.forEach((handle) => {\n\t\t\thandle.attachGraph();\n\t\t});\n\t\tthis.pendingHandlesToMakeVisible.clear();\n\t\tthis.routeContext.attachGraph();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.bind}\n\t */\n\tpublic bind(handle: IFluidHandle) {\n\t\t// If this handle is visible, attach the graph of the incoming handle as well.\n\t\tif (this.visible) {\n\t\t\thandle.attachGraph();\n\t\t\treturn;\n\t\t}\n\t\tthis.pendingHandlesToMakeVisible.add(handle);\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteChannelContext.js","sourceRoot":"","sources":["../src/remoteChannelContext.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAiE;AAejE,qEAIyC;AACzC,qDAO0B;AAG1B,MAAa,oBAAoB;IAWhC,YACC,OAA+B,EAC/B,gBAAwC,EACxC,cAAuC,EACvC,QAA0D,EAC1D,OAAkC,EAClC,0BAA2F,EAC1E,EAAU,EAC3B,YAA2B,EAC3B,QAA+B,EAC/B,UAAoD,EACpD,oBAAiD,EACjD,iBAA0B;QALT,OAAE,GAAF,EAAE,CAAQ;QAjBpB,aAAQ,GAAG,KAAK,CAAC;QACjB,YAAO,GAA4C,EAAE,CAAC;QAuB7D,IAAA,mBAAM,EAAC,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,+CAA+C,CAAC,CAAC;QAEtF,IAAI,CAAC,SAAS,GAAG,IAAA,mCAAiB,EAAC;YAClC,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,SAAS,EAAE,sBAAsB;SACjC,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,GAAG,IAAA,8CAA6B,EAC5C,gBAAgB,CAAC,SAAS,EAC1B,Q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CACzB,CAAC;QACF,OAAO,EAAE,GAAG,eAAe,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;IAC5C,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,SAAS,CAAC,SAAkB,KAAK;QAC7C,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACK,KAAK,CAAC,iBAAiB,CAAC,SAAkB,KAAK;QACtD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,OAAO,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAEM,gBAAgB,CAAC,UAAoB;QAC3C;;;;;WAKG;QACH,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC;;AAvNF,oDAwNC;AA/MwB,6CAAwB,GAAG,IAAI,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, LazyPromise } from \"@fluidframework/core-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { IChannel, IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n\tCreateChildSummarizerNodeFn,\n\tIFluidDataStoreContext,\n\tIGarbageCollectionData,\n\tIExperimentalIncrementalSummaryContext,\n\tISummarizeInternalResult,\n\tISummarizeResult,\n\tISummarizerNodeWithGC,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n\tcreateChildLogger,\n\tITelemetryLoggerExt,\n\tThresholdCounter,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n\tChannelServiceEndpoints,\n\tcreateChannelServiceEndpoints,\n\tIChannelContext,\n\tloadChannel,\n\tloadChannelFactoryAndAttributes,\n\tsummarizeChannelAsync,\n} from \"./channelContext\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime\";\n\nexport class RemoteChannelContext implements IChannelContext {\n\tprivate isLoaded = false;\n\tprivate pending: ISequencedDocumentMessage[] | undefined = [];\n\tprivate readonly channelP: Promise<IChannel>;\n\tprivate channel: IChannel | undefined;\n\tprivate readonly services: ChannelServiceEndpoints;\n\tprivate readonly summarizerNode: ISummarizerNodeWithGC;\n\tprivate readonly subLogger: ITelemetryLoggerExt;\n\tprivate readonly thresholdOpsCounter: ThresholdCounter;\n\tprivate static readonly pendingOpsCountThreshold = 1000;\n\n\tconstructor(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IDocumentStorageService,\n\t\tsubmitFn: (content: any, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t\taddedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n\t\tprivate readonly id: string,\n\t\tbaseSnapshot: ISnapshotTree,\n\t\tregistry: ISharedObjectRegistry,\n\t\textraBlobs: Map<string, ArrayBufferLike> | undefined,\n\t\tcreateSummarizerNode: CreateChildSummarizerNodeFn,\n\t\tattachMessageType?: string,\n\t) {\n\t\tassert(!this.id.includes(\"/\"), 0x310 /* Channel context ID cannot contain slashes */);\n\n\t\tthis.subLogger = createChildLogger({\n\t\t\tlogger: runtime.logger,\n\t\t\tnamespace: \"RemoteChannelContext\",\n\t\t});\n\n\t\tthis.services = createChannelServiceEndpoints(\n\t\t\tdataStoreContext.connected,\n\t\t\tsubmitFn,\n\t\t\t() => dirtyFn(this.id),\n\t\t\taddedGCOutboundReferenceFn,\n\t\t\tstorageService,\n\t\t\tthis.subLogger,\n\t\t\tbaseSnapshot,\n\t\t\textraBlobs,\n\t\t);\n\n\t\tthis.channelP = new LazyPromise<IChannel>(async () => {\n\t\t\tconst { attributes, factory } = await loadChannelFactoryAndAttributes(\n\t\t\t\tdataStoreContext,\n\t\t\t\tthis.services,\n\t\t\t\tthis.id,\n\t\t\t\tregistry,\n\t\t\t\tattachMessageType,\n\t\t\t);\n\n\t\t\tconst channel = await loadChannel(\n\t\t\t\truntime,\n\t\t\t\tattributes,\n\t\t\t\tfactory,\n\t\t\t\tthis.services,\n\t\t\t\tthis.subLogger,\n\t\t\t\tthis.id,\n\t\t\t);\n\n\t\t\t// Send all pending messages to the channel\n\t\t\tassert(this.pending !== undefined, 0x23f /* \"pending undefined\" */);\n\t\t\tfor (const message of this.pending) {\n\t\t\t\tthis.services.deltaConnection.process(\n\t\t\t\t\tmessage,\n\t\t\t\t\tfalse,\n\t\t\t\t\tundefined /* localOpMetadata */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tthis.thresholdOpsCounter.send(\"ProcessPendingOps\", this.pending.length);\n\n\t\t\t// Commit changes.\n\t\t\tthis.channel = channel;\n\t\t\tthis.pending = undefined;\n\t\t\tthis.isLoaded = true;\n\n\t\t\t// Because have some await between we created the service and here, the connection state might have changed\n\t\t\t// and we don't propagate the connection state when we are not loaded. So we have to set it again here.\n\t\t\tthis.services.deltaConnection.setConnectionState(dataStoreContext.connected);\n\t\t\treturn this.channel;\n\t\t});\n\n\t\tconst thisSummarizeInternal = async (\n\t\t\tfullTree: boolean,\n\t\t\ttrackState: boolean,\n\t\t\ttelemetryContext?: ITelemetryContext,\n\t\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t\t) =>\n\t\t\tthis.summarizeInternal(\n\t\t\t\tfullTree,\n\t\t\t\ttrackState,\n\t\t\t\ttelemetryContext,\n\t\t\t\tincrementalSummaryContext,\n\t\t\t);\n\n\t\tthis.summarizerNode = createSummarizerNode(\n\t\t\tthisSummarizeInternal,\n\t\t\tasync (fullGC?: boolean) => this.getGCDataInternal(fullGC),\n\t\t);\n\n\t\tthis.thresholdOpsCounter = new ThresholdCounter(\n\t\t\tRemoteChannelContext.pendingOpsCountThreshold,\n\t\t\tthis.subLogger,\n\t\t);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\tpublic getChannel(): Promise<IChannel> {\n\t\treturn this.channelP;\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\n\t\t// Connection events are ignored if the data store is not yet loaded\n\t\tif (!this.isLoaded) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.services.deltaConnection.setConnectionState(connected);\n\t}\n\n\tpublic applyStashedOp(content: any): unknown {\n\t\tassert(this.isLoaded, 0x194 /* \"Remote channel must be loaded when rebasing op\" */);\n\t\treturn this.services.deltaConnection.applyStashedOp(content);\n\t}\n\n\tpublic processOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.summarizerNode.invalidate(message.sequenceNumber);\n\n\t\tif (this.isLoaded) {\n\t\t\tthis.services.deltaConnection.process(message, local, localOpMetadata);\n\t\t} else {\n\t\t\tassert(!local, 0x195 /* \"Remote channel must not be local when processing op\" */);\n\t\t\tassert(this.pending !== undefined, 0x23e /* \"pending is undefined\" */);\n\t\t\tthis.pending.push(message);\n\t\t\tthis.thresholdOpsCounter.sendIfMultiple(\"StorePendingOps\", this.pending.length);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: any, localOpMetadata: unknown) {\n\t\tassert(this.isLoaded, 0x196 /* \"Remote channel must be loaded when resubmitting op\" */);\n\n\t\tthis.services.deltaConnection.reSubmit(content, localOpMetadata);\n\t}\n\n\tpublic rollback(content: any, localOpMetadata: unknown) {\n\t\tassert(this.isLoaded, 0x2f0 /* \"Remote channel must be loaded when rolling back op\" */);\n\n\t\tthis.services.deltaConnection.rollback(content, localOpMetadata);\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<ISummarizeResult> {\n\t\treturn this.summarizerNode.summarize(fullTree, trackState, telemetryContext);\n\t}\n\n\tprivate async summarizeInternal(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): Promise<ISummarizeInternalResult> {\n\t\tconst channel = await this.getChannel();\n\t\tconst summarizeResult = await summarizeChannelAsync(\n\t\t\tchannel,\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\ttelemetryContext,\n\t\t\tincrementalSummaryContext,\n\t\t);\n\t\treturn { ...summarizeResult, id: this.id };\n\t}\n\n\t/**\n\t * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n\t * Each node has a set of outbound routes to other GC nodes in the document.\n\t * If there is no new data in this context since the last summary, previous GC data is used.\n\t * If there is new data, the GC data is generated again (by calling getGCDataInternal).\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\treturn this.summarizerNode.getGCData(fullGC);\n\t}\n\n\t/**\n\t * Generates the data used for garbage collection. This is called when there is new data since last summary. It\n\t * loads the context and calls into the channel to get its GC data.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tprivate async getGCDataInternal(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst channel = await this.getChannel();\n\t\treturn channel.getGCData(fullGC);\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]) {\n\t\t/**\n\t\t * Currently, DDSes are always considered referenced and are not garbage collected. Update the summarizer node's\n\t\t * used routes to contain a route to this channel context.\n\t\t * Once we have GC at DDS level, this will be updated to use the passed usedRoutes. See -\n\t\t * https://github.com/microsoft/FluidFramework/issues/4611\n\t\t */\n\t\tthis.summarizerNode.updateUsedRoutes([\"\"]);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"remoteChannelContext.js","sourceRoot":"","sources":["../src/remoteChannelContext.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAiE;AAejE,qEAIyC;AACzC,qDAO0B;AAG1B,MAAa,oBAAoB;IAWhC,YACC,OAA+B,EAC/B,gBAAwC,EACxC,cAAuC,EACvC,QAA0D,EAC1D,OAAkC,EAClC,0BAA2F,EAC1E,EAAU,EAC3B,YAA2B,EAC3B,QAA+B,EAC/B,UAAoD,EACpD,oBAAiD,EACjD,iBAA0B;QALT,OAAE,GAAF,EAAE,CAAQ;QAjBpB,aAAQ,GAAG,KAAK,CAAC;QACjB,YAAO,GAA4C,EAAE,CAAC;QAuB7D,IAAA,mBAAM,EAAC,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,+CAA+C,CAAC,CAAC;QAEtF,IAAI,CAAC,SAAS,GAAG,IAAA,mCAAiB,EAAC;YAClC,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,SAAS,EAAE,sBAAsB;SACjC,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,GAAG,IAAA,8CAA6B,EAC5C,gBAAgB,CAAC,SAAS,EAC1B,QAAQ,EACR,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EACtB,0BAA0B,EAC1B,cAAc,EACd,IAAI,CAAC,SAAS,EACd,YAAY,EACZ,UAAU,CACV,CAAC;QAEF,IAAI,CAAC,QAAQ,GAAG,IAAI,wBAAW,CAAW,KAAK,IAAI,EAAE;YACpD,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,gDAA+B,EACpE,gBAAgB,EAChB,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,EAAE,EACP,QAAQ,EACR,iBAAiB,CACjB,CAAC;YAEF,MAA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,MAAM,CAAC,CAAC;IAClC,CAAC;IAEM,gBAAgB,CAAC,UAAoB;QAC3C;;;;;WAKG;QACH,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC;;AAvNF,oDAwNC;AA/MwB,6CAAwB,GAAG,IAAI,AAAP,CAAQ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, LazyPromise } from \"@fluidframework/core-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { IChannel, IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n\tCreateChildSummarizerNodeFn,\n\tIFluidDataStoreContext,\n\tIGarbageCollectionData,\n\tIExperimentalIncrementalSummaryContext,\n\tISummarizeInternalResult,\n\tISummarizeResult,\n\tISummarizerNodeWithGC,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n\tcreateChildLogger,\n\tITelemetryLoggerExt,\n\tThresholdCounter,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n\tChannelServiceEndpoints,\n\tcreateChannelServiceEndpoints,\n\tIChannelContext,\n\tloadChannel,\n\tloadChannelFactoryAndAttributes,\n\tsummarizeChannelAsync,\n} from \"./channelContext\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime\";\n\nexport class RemoteChannelContext implements IChannelContext {\n\tprivate isLoaded = false;\n\tprivate pending: ISequencedDocumentMessage[] | undefined = [];\n\tprivate readonly channelP: Promise<IChannel>;\n\tprivate channel: IChannel | undefined;\n\tprivate readonly services: ChannelServiceEndpoints;\n\tprivate readonly summarizerNode: ISummarizerNodeWithGC;\n\tprivate readonly subLogger: ITelemetryLoggerExt;\n\tprivate readonly thresholdOpsCounter: ThresholdCounter;\n\tprivate static readonly pendingOpsCountThreshold = 1000;\n\n\tconstructor(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IDocumentStorageService,\n\t\tsubmitFn: (content: any, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t\taddedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n\t\tprivate readonly id: string,\n\t\tbaseSnapshot: ISnapshotTree,\n\t\tregistry: ISharedObjectRegistry,\n\t\textraBlobs: Map<string, ArrayBufferLike> | undefined,\n\t\tcreateSummarizerNode: CreateChildSummarizerNodeFn,\n\t\tattachMessageType?: string,\n\t) {\n\t\tassert(!this.id.includes(\"/\"), 0x310 /* Channel context ID cannot contain slashes */);\n\n\t\tthis.subLogger = createChildLogger({\n\t\t\tlogger: runtime.logger,\n\t\t\tnamespace: \"RemoteChannelContext\",\n\t\t});\n\n\t\tthis.services = createChannelServiceEndpoints(\n\t\t\tdataStoreContext.connected,\n\t\t\tsubmitFn,\n\t\t\t() => dirtyFn(this.id),\n\t\t\taddedGCOutboundReferenceFn,\n\t\t\tstorageService,\n\t\t\tthis.subLogger,\n\t\t\tbaseSnapshot,\n\t\t\textraBlobs,\n\t\t);\n\n\t\tthis.channelP = new LazyPromise<IChannel>(async () => {\n\t\t\tconst { attributes, factory } = await loadChannelFactoryAndAttributes(\n\t\t\t\tdataStoreContext,\n\t\t\t\tthis.services,\n\t\t\t\tthis.id,\n\t\t\t\tregistry,\n\t\t\t\tattachMessageType,\n\t\t\t);\n\n\t\t\tconst channel = await loadChannel(\n\t\t\t\truntime,\n\t\t\t\tattributes,\n\t\t\t\tfactory,\n\t\t\t\tthis.services,\n\t\t\t\tthis.subLogger,\n\t\t\t\tthis.id,\n\t\t\t);\n\n\t\t\t// Send all pending messages to the channel\n\t\t\tassert(this.pending !== undefined, 0x23f /* \"pending undefined\" */);\n\t\t\tfor (const message of this.pending) {\n\t\t\t\tthis.services.deltaConnection.process(\n\t\t\t\t\tmessage,\n\t\t\t\t\tfalse,\n\t\t\t\t\tundefined /* localOpMetadata */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tthis.thresholdOpsCounter.send(\"ProcessPendingOps\", this.pending.length);\n\n\t\t\t// Commit changes.\n\t\t\tthis.channel = channel;\n\t\t\tthis.pending = undefined;\n\t\t\tthis.isLoaded = true;\n\n\t\t\t// Because have some await between we created the service and here, the connection state might have changed\n\t\t\t// and we don't propagate the connection state when we are not loaded. So we have to set it again here.\n\t\t\tthis.services.deltaConnection.setConnectionState(dataStoreContext.connected);\n\t\t\treturn this.channel;\n\t\t});\n\n\t\tconst thisSummarizeInternal = async (\n\t\t\tfullTree: boolean,\n\t\t\ttrackState: boolean,\n\t\t\ttelemetryContext?: ITelemetryContext,\n\t\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t\t) =>\n\t\t\tthis.summarizeInternal(\n\t\t\t\tfullTree,\n\t\t\t\ttrackState,\n\t\t\t\ttelemetryContext,\n\t\t\t\tincrementalSummaryContext,\n\t\t\t);\n\n\t\tthis.summarizerNode = createSummarizerNode(\n\t\t\tthisSummarizeInternal,\n\t\t\tasync (fullGC?: boolean) => this.getGCDataInternal(fullGC),\n\t\t);\n\n\t\tthis.thresholdOpsCounter = new ThresholdCounter(\n\t\t\tRemoteChannelContext.pendingOpsCountThreshold,\n\t\t\tthis.subLogger,\n\t\t);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\tpublic getChannel(): Promise<IChannel> {\n\t\treturn this.channelP;\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\n\t\t// Connection events are ignored if the data store is not yet loaded\n\t\tif (!this.isLoaded) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.services.deltaConnection.setConnectionState(connected);\n\t}\n\n\tpublic applyStashedOp(content: any): unknown {\n\t\tassert(this.isLoaded, 0x194 /* \"Remote channel must be loaded when rebasing op\" */);\n\t\treturn this.services.deltaConnection.applyStashedOp(content);\n\t}\n\n\tpublic processOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.summarizerNode.invalidate(message.sequenceNumber);\n\n\t\tif (this.isLoaded) {\n\t\t\tthis.services.deltaConnection.process(message, local, localOpMetadata);\n\t\t} else {\n\t\t\tassert(!local, 0x195 /* \"Remote channel must not be local when processing op\" */);\n\t\t\tassert(this.pending !== undefined, 0x23e /* \"pending is undefined\" */);\n\t\t\tthis.pending.push(message);\n\t\t\tthis.thresholdOpsCounter.sendIfMultiple(\"StorePendingOps\", this.pending.length);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: any, localOpMetadata: unknown) {\n\t\tassert(this.isLoaded, 0x196 /* \"Remote channel must be loaded when resubmitting op\" */);\n\n\t\tthis.services.deltaConnection.reSubmit(content, localOpMetadata);\n\t}\n\n\tpublic rollback(content: any, localOpMetadata: unknown) {\n\t\tassert(this.isLoaded, 0x2f0 /* \"Remote channel must be loaded when rolling back op\" */);\n\n\t\tthis.services.deltaConnection.rollback(content, localOpMetadata);\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<ISummarizeResult> {\n\t\treturn this.summarizerNode.summarize(fullTree, trackState, telemetryContext);\n\t}\n\n\tprivate async summarizeInternal(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): Promise<ISummarizeInternalResult> {\n\t\tconst channel = await this.getChannel();\n\t\tconst summarizeResult = await summarizeChannelAsync(\n\t\t\tchannel,\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\ttelemetryContext,\n\t\t\tincrementalSummaryContext,\n\t\t);\n\t\treturn { ...summarizeResult, id: this.id };\n\t}\n\n\t/**\n\t * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n\t * Each node has a set of outbound routes to other GC nodes in the document.\n\t * If there is no new data in this context since the last summary, previous GC data is used.\n\t * If there is new data, the GC data is generated again (by calling getGCDataInternal).\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\treturn this.summarizerNode.getGCData(fullGC);\n\t}\n\n\t/**\n\t * Generates the data used for garbage collection. This is called when there is new data since last summary. It\n\t * loads the context and calls into the channel to get its GC data.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tprivate async getGCDataInternal(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst channel = await this.getChannel();\n\t\treturn channel.getGCData(fullGC);\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]) {\n\t\t/**\n\t\t * Currently, DDSes are always considered referenced and are not garbage collected. Update the summarizer node's\n\t\t * used routes to contain a route to this channel context.\n\t\t * Once we have GC at DDS level, this will be updated to use the passed usedRoutes. See -\n\t\t * https://github.com/microsoft/FluidFramework/issues/4611\n\t\t */\n\t\tthis.summarizerNode.updateUsedRoutes([\"\"]);\n\t}\n}\n"]}
|
package/dist/tsdoc-metadata.json
CHANGED
|
@@ -5,12 +5,6 @@
|
|
|
5
5
|
import { assert } from "@fluidframework/core-utils";
|
|
6
6
|
import { DataProcessingError } from "@fluidframework/telemetry-utils";
|
|
7
7
|
export class ChannelDeltaConnection {
|
|
8
|
-
constructor(_connected, submit, dirty, addedGCOutboundReference) {
|
|
9
|
-
this._connected = _connected;
|
|
10
|
-
this.submit = submit;
|
|
11
|
-
this.dirty = dirty;
|
|
12
|
-
this.addedGCOutboundReference = addedGCOutboundReference;
|
|
13
|
-
}
|
|
14
8
|
get handler() {
|
|
15
9
|
assert(!!this._handler, 0x177 /* "Missing delta handler" */);
|
|
16
10
|
return this._handler;
|
|
@@ -18,6 +12,12 @@ export class ChannelDeltaConnection {
|
|
|
18
12
|
get connected() {
|
|
19
13
|
return this._connected;
|
|
20
14
|
}
|
|
15
|
+
constructor(_connected, submit, dirty, addedGCOutboundReference) {
|
|
16
|
+
this._connected = _connected;
|
|
17
|
+
this.submit = submit;
|
|
18
|
+
this.dirty = dirty;
|
|
19
|
+
this.addedGCOutboundReference = addedGCOutboundReference;
|
|
20
|
+
}
|
|
21
21
|
attach(handler) {
|
|
22
22
|
assert(this._handler === undefined, 0x178 /* "Missing delta handler on attach" */);
|
|
23
23
|
this._handler = handler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelDeltaConnection.js","sourceRoot":"","sources":["../src/channelDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGtE,MAAM,OAAO,sBAAsB;
|
|
1
|
+
{"version":3,"file":"channelDeltaConnection.js","sourceRoot":"","sources":["../src/channelDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGtE,MAAM,OAAO,sBAAsB;IAGlC,IAAY,OAAO;QAClB,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAC7D,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IACD,IAAW,SAAS;QACnB,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAED,YACS,UAAmB,EACX,MAAwD,EACxD,KAAiB,EACj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Content":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { IDeltaConnection, IDeltaHandler } from \"@fluidframework/datastore-definitions\";\nimport { DataProcessingError } from \"@fluidframework/telemetry-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\n\nexport class ChannelDeltaConnection implements IDeltaConnection {\n\tprivate _handler: IDeltaHandler | undefined;\n\n\tprivate get handler(): IDeltaHandler {\n\t\tassert(!!this._handler, 0x177 /* \"Missing delta handler\" */);\n\t\treturn this._handler;\n\t}\n\tpublic get connected(): boolean {\n\t\treturn this._connected;\n\t}\n\n\tconstructor(\n\t\tprivate _connected: boolean,\n\t\tpublic readonly submit: (content: any, localOpMetadata: unknown) => void,\n\t\tpublic readonly dirty: () => void,\n\t\tpublic readonly addedGCOutboundReference: (\n\t\t\tsrcHandle: IFluidHandle,\n\t\t\toutboundHandle: IFluidHandle,\n\t\t) => void,\n\t) {}\n\n\tpublic attach(handler: IDeltaHandler) {\n\t\tassert(this._handler === undefined, 0x178 /* \"Missing delta handler on attach\" */);\n\t\tthis._handler = handler;\n\t}\n\n\tpublic setConnectionState(connected: boolean) {\n\t\tthis._connected = connected;\n\t\tthis.handler.setConnectionState(connected);\n\t}\n\n\tpublic process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n\t\ttry {\n\t\t\t// catches as data processing error whether or not they come from async pending queues\n\t\t\tthis.handler.process(message, local, localOpMetadata);\n\t\t} catch (error) {\n\t\t\tthrow DataProcessingError.wrapIfUnrecognized(\n\t\t\t\terror,\n\t\t\t\t\"channelDeltaConnectionFailedToProcessMessage\",\n\t\t\t\tmessage,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: any, localOpMetadata: unknown) {\n\t\tthis.handler.reSubmit(content, localOpMetadata);\n\t}\n\n\tpublic rollback(content: any, localOpMetadata: unknown) {\n\t\tif (this.handler.rollback === undefined) {\n\t\t\tthrow new Error(\"Handler doesn't support rollback\");\n\t\t}\n\t\tthis.handler.rollback(content, localOpMetadata);\n\t}\n\n\tpublic applyStashedOp(content: any): unknown {\n\t\treturn this.handler.applyStashedOp(content);\n\t}\n}\n"]}
|
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { getNormalizedObjectStoragePathParts } from "@fluidframework/runtime-utils";
|
|
6
6
|
export class ChannelStorageService {
|
|
7
|
+
static flattenTree(base, tree, results) {
|
|
8
|
+
// eslint-disable-next-line guard-for-in, no-restricted-syntax
|
|
9
|
+
for (const path in tree.trees) {
|
|
10
|
+
ChannelStorageService.flattenTree(`${base}${path}/`, tree.trees[path], results);
|
|
11
|
+
}
|
|
12
|
+
// eslint-disable-next-line guard-for-in, no-restricted-syntax
|
|
13
|
+
for (const blob in tree.blobs) {
|
|
14
|
+
results[`${base}${blob}`] = tree.blobs[blob];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
7
17
|
constructor(tree, storage, logger, extraBlobs) {
|
|
8
18
|
this.tree = tree;
|
|
9
19
|
this.storage = storage;
|
|
@@ -15,16 +25,6 @@ export class ChannelStorageService {
|
|
|
15
25
|
ChannelStorageService.flattenTree("", tree, this.flattenedTree);
|
|
16
26
|
}
|
|
17
27
|
}
|
|
18
|
-
static flattenTree(base, tree, results) {
|
|
19
|
-
// eslint-disable-next-line guard-for-in, no-restricted-syntax
|
|
20
|
-
for (const path in tree.trees) {
|
|
21
|
-
ChannelStorageService.flattenTree(`${base}${path}/`, tree.trees[path], results);
|
|
22
|
-
}
|
|
23
|
-
// eslint-disable-next-line guard-for-in, no-restricted-syntax
|
|
24
|
-
for (const blob in tree.blobs) {
|
|
25
|
-
results[`${base}${blob}`] = tree.blobs[blob];
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
28
|
async contains(path) {
|
|
29
29
|
return this.flattenedTree[path] !== undefined;
|
|
30
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelStorageService.js","sourceRoot":"","sources":["../src/channelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,mCAAmC,EAAE,MAAM,+BAA+B,CAAC;AAGpF,MAAM,OAAO,qBAAqB;
|
|
1
|
+
{"version":3,"file":"channelStorageService.js","sourceRoot":"","sources":["../src/channelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,mCAAmC,EAAE,MAAM,+BAA+B,CAAC;AAGpF,MAAM,OAAO,qBAAqB;IACzB,MAAM,CAAC,WAAW,CACzB,IAAY,EACZ,IAAmB,EACnB,OAAmC;QAEnC,8DAA8D;QAC9D,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE;YAC9B,qBAAqB,CAAC,WAAW,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;SAChF;QAED,8DAA8D;QAC9D,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE;YAC9B,OAAO,CAAC,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SAC7C;IACF,CAAC;IAID,YACkB,IAA+B,EAC/B,OAAkD,EAClD,MAA2B,EAC3B,UAAyC;QAHzC,SAAI,GAAJ,IAAI,CAA2B;QAC/B,YAAO,GAAP,OAAO,CAA2C;QAClD,WAAM,GAAN,MAAM,CAAqB;QAC3B,eAAU,GAAV,UAAU,CAA+B;QAE1D,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QACxB,mCAAmC;QACnC,IAAI,IAAI,KAAK,SAAS,EAAE;YACvB,qBAAqB,CAAC,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;SAChE;IACF,CAAC;IAEM,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AE,KAAK,IAAI,EAAE,CAAC,CAAC;IACvC,CAAC;IAEO,KAAK,CAAC,YAAY,CAAC,IAAY;QACtC,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport { IChannelStorageService } from \"@fluidframework/datastore-definitions\";\nimport { getNormalizedObjectStoragePathParts } from \"@fluidframework/runtime-utils\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\n\nexport class ChannelStorageService implements IChannelStorageService {\n\tprivate static flattenTree(\n\t\tbase: string,\n\t\ttree: ISnapshotTree,\n\t\tresults: { [path: string]: string },\n\t) {\n\t\t// eslint-disable-next-line guard-for-in, no-restricted-syntax\n\t\tfor (const path in tree.trees) {\n\t\t\tChannelStorageService.flattenTree(`${base}${path}/`, tree.trees[path], results);\n\t\t}\n\n\t\t// eslint-disable-next-line guard-for-in, no-restricted-syntax\n\t\tfor (const blob in tree.blobs) {\n\t\t\tresults[`${base}${blob}`] = tree.blobs[blob];\n\t\t}\n\t}\n\n\tprivate readonly flattenedTree: { [path: string]: string };\n\n\tconstructor(\n\t\tprivate readonly tree: ISnapshotTree | undefined,\n\t\tprivate readonly storage: Pick<IDocumentStorageService, \"readBlob\">,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly extraBlobs?: Map<string, ArrayBufferLike>,\n\t) {\n\t\tthis.flattenedTree = {};\n\t\t// Create a map from paths to blobs\n\t\tif (tree !== undefined) {\n\t\t\tChannelStorageService.flattenTree(\"\", tree, this.flattenedTree);\n\t\t}\n\t}\n\n\tpublic async contains(path: string): Promise<boolean> {\n\t\treturn this.flattenedTree[path] !== undefined;\n\t}\n\n\tpublic async readBlob(path: string): Promise<ArrayBufferLike> {\n\t\tconst id = await this.getIdForPath(path);\n\t\tconst blob = this.extraBlobs !== undefined ? this.extraBlobs.get(id) : undefined;\n\n\t\tif (blob !== undefined) {\n\t\t\treturn blob;\n\t\t}\n\t\tconst blobP = this.storage.readBlob(id);\n\t\tblobP.catch((error) =>\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"ChannelStorageBlobError\" }, error),\n\t\t);\n\n\t\treturn blobP;\n\t}\n\n\tpublic async list(path: string): Promise<string[]> {\n\t\tlet tree = this.tree;\n\t\tconst pathParts = getNormalizedObjectStoragePathParts(path);\n\t\twhile (tree !== undefined && pathParts.length > 0) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst part = pathParts.shift()!;\n\t\t\ttree = tree.trees[part];\n\t\t}\n\t\tif (tree === undefined || pathParts.length !== 0) {\n\t\t\tthrow new Error(\"path does not exist\");\n\t\t}\n\n\t\treturn Object.keys(tree?.blobs ?? {});\n\t}\n\n\tprivate async getIdForPath(path: string): Promise<string> {\n\t\treturn this.flattenedTree[path];\n\t}\n}\n"]}
|
|
@@ -9,15 +9,23 @@ import { IAudience, IDeltaManager, AttachState, ILoaderOptions } from "@fluidfra
|
|
|
9
9
|
import { IClientDetails, IDocumentMessage, ISequencedDocumentMessage, IQuorumClients } from "@fluidframework/protocol-definitions";
|
|
10
10
|
import { IFluidDataStoreContext, IFluidDataStoreChannel, IGarbageCollectionData, IInboundSignalMessage, ISummaryTreeWithStats, VisibilityState, ITelemetryContext, IIdCompressor } from "@fluidframework/runtime-definitions";
|
|
11
11
|
import { IChannel, IFluidDataStoreRuntime, IFluidDataStoreRuntimeEvents, IChannelFactory } from "@fluidframework/datastore-definitions";
|
|
12
|
+
/**
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
12
15
|
export declare enum DataStoreMessageType {
|
|
13
16
|
Attach = "attach",
|
|
14
17
|
ChannelOp = "op"
|
|
15
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
16
22
|
export interface ISharedObjectRegistry {
|
|
17
23
|
get(name: string): IChannelFactory | undefined;
|
|
18
24
|
}
|
|
19
25
|
/**
|
|
20
26
|
* Base data store class
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
21
29
|
*/
|
|
22
30
|
export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataStoreRuntimeEvents> implements IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext {
|
|
23
31
|
private readonly dataStoreContext;
|
|
@@ -34,7 +42,7 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
|
|
|
34
42
|
/**
|
|
35
43
|
* {@inheritDoc @fluidframework/datastore-definitions#IFluidDataStoreRuntime.entryPoint}
|
|
36
44
|
*/
|
|
37
|
-
readonly entryPoint
|
|
45
|
+
readonly entryPoint: IFluidHandle<FluidObject>;
|
|
38
46
|
/**
|
|
39
47
|
* @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
40
48
|
*/
|
|
@@ -89,12 +97,12 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
|
|
|
89
97
|
* @param dataStoreContext - Context object for the runtime.
|
|
90
98
|
* @param sharedObjectRegistry - The registry of shared objects that this data store will be able to instantiate.
|
|
91
99
|
* @param existing - Pass 'true' if loading this datastore from an existing file; pass 'false' otherwise.
|
|
92
|
-
* @param
|
|
100
|
+
* @param provideEntryPoint - Function to initialize the entryPoint object for the data store runtime. The
|
|
93
101
|
* handle to this data store runtime will point to the object returned by this function. If this function is not
|
|
94
102
|
* provided, the handle will be left undefined. This is here so we can start making handles a first-class citizen
|
|
95
103
|
* and the primary way of interacting with some Fluid objects, and should be used if possible.
|
|
96
104
|
*/
|
|
97
|
-
constructor(dataStoreContext: IFluidDataStoreContext, sharedObjectRegistry: ISharedObjectRegistry, existing: boolean,
|
|
105
|
+
constructor(dataStoreContext: IFluidDataStoreContext, sharedObjectRegistry: ISharedObjectRegistry, existing: boolean, provideEntryPoint: (runtime: IFluidDataStoreRuntime) => Promise<FluidObject>);
|
|
98
106
|
dispose(): void;
|
|
99
107
|
resolveHandle(request: IRequest): Promise<IResponse>;
|
|
100
108
|
request(request: IRequest): Promise<IResponse>;
|
|
@@ -122,14 +130,6 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
|
|
|
122
130
|
* This function is called when a handle to this data store is added to a visible DDS.
|
|
123
131
|
*/
|
|
124
132
|
attachGraph(): void;
|
|
125
|
-
/**
|
|
126
|
-
* @deprecated - Not necessary if consumers add a new dataStore to the container by storing its handle.
|
|
127
|
-
* Binds this runtime to the container
|
|
128
|
-
* This includes the following:
|
|
129
|
-
* 1. Sending an Attach op that includes all existing state
|
|
130
|
-
* 2. Attaching the graph if the data store becomes attached.
|
|
131
|
-
*/
|
|
132
|
-
bindToContext(): void;
|
|
133
133
|
bind(handle: IFluidHandle): void;
|
|
134
134
|
setConnectionState(connected: boolean, clientId?: string): void;
|
|
135
135
|
getQuorum(): IQuorumClients;
|
|
@@ -232,6 +232,8 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
|
|
|
232
232
|
* Request handler is only called when data store can't resolve request, i.e. for custom requests.
|
|
233
233
|
* @param Base - base class, inherits from FluidDataStoreRuntime
|
|
234
234
|
* @param requestHandler - request handler to mix in
|
|
235
|
+
*
|
|
236
|
+
* @public
|
|
235
237
|
*/
|
|
236
238
|
export declare const mixinRequestHandler: (requestHandler: (request: IRequest, runtime: FluidDataStoreRuntime) => Promise<IResponse>, Base?: typeof FluidDataStoreRuntime) => typeof FluidDataStoreRuntime;
|
|
237
239
|
/**
|
|
@@ -239,6 +241,8 @@ export declare const mixinRequestHandler: (requestHandler: (request: IRequest, r
|
|
|
239
241
|
* @param handler - handler that returns info about blob to be added to summary.
|
|
240
242
|
* Or undefined not to add anything to summary.
|
|
241
243
|
* @param Base - base class, inherits from FluidDataStoreRuntime
|
|
244
|
+
*
|
|
245
|
+
* @public
|
|
242
246
|
*/
|
|
243
247
|
export declare const mixinSummaryHandler: (handler: (runtime: FluidDataStoreRuntime) => Promise<{
|
|
244
248
|
path: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreRuntime.d.ts","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAEN,mBAAmB,EAQnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACN,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,SAAS,EACT,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACN,SAAS,EACT,aAAa,EACb,WAAW,EACX,cAAc,EACd,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EAIzB,cAAc,EACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAKN,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"dataStoreRuntime.d.ts","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAEN,mBAAmB,EAQnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACN,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,SAAS,EACT,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACN,SAAS,EACT,aAAa,EACb,WAAW,EACX,cAAc,EACd,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,yBAAyB,E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
import { buildSnapshotTree } from "@fluidframework/driver-utils";
|
|
10
10
|
import { SummaryType, } from "@fluidframework/protocol-definitions";
|
|
11
11
|
import { CreateSummarizerNodeSource, VisibilityState, } from "@fluidframework/runtime-definitions";
|
|
12
|
-
import { convertSnapshotTreeToSummaryTree, convertSummaryTreeToITree, generateHandleContextPath, RequestParser, SummaryTreeBuilder, create404Response, createResponseError, exceptionToResponse, GCDataBuilder,
|
|
12
|
+
import { convertSnapshotTreeToSummaryTree, convertSummaryTreeToITree, generateHandleContextPath, RequestParser, SummaryTreeBuilder, create404Response, createResponseError, exceptionToResponse, GCDataBuilder, unpackChildNodesUsedRoutes, } from "@fluidframework/runtime-utils";
|
|
13
13
|
import { v4 as uuid } from "uuid";
|
|
14
14
|
import { summarizeChannel } from "./channelContext";
|
|
15
15
|
import { LocalChannelContext, LocalChannelContextBase, RehydratedLocalChannelContext, } from "./localChannelContext";
|
|
16
16
|
import { RemoteChannelContext } from "./remoteChannelContext";
|
|
17
17
|
import { FluidObjectHandle } from "./fluidHandle";
|
|
18
|
+
/**
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
18
21
|
export var DataStoreMessageType;
|
|
19
22
|
(function (DataStoreMessageType) {
|
|
20
23
|
// Creates a new channel
|
|
@@ -23,20 +26,95 @@ export var DataStoreMessageType;
|
|
|
23
26
|
})(DataStoreMessageType || (DataStoreMessageType = {}));
|
|
24
27
|
/**
|
|
25
28
|
* Base data store class
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
26
31
|
*/
|
|
27
32
|
export class FluidDataStoreRuntime extends TypedEventEmitter {
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated - Instantiate the class using its constructor instead.
|
|
35
|
+
*
|
|
36
|
+
* Loads the data store runtime
|
|
37
|
+
* @param context - The data store context
|
|
38
|
+
* @param sharedObjectRegistry - The registry of shared objects used by this data store
|
|
39
|
+
* @param existing - If loading from an existing file.
|
|
40
|
+
*/
|
|
41
|
+
static load(context, sharedObjectRegistry, existing) {
|
|
42
|
+
return new FluidDataStoreRuntime(context, sharedObjectRegistry, existing, async (dataStoreRuntime) => dataStoreRuntime.entryPoint);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
46
|
+
*/
|
|
47
|
+
get IFluidRouter() {
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
get connected() {
|
|
51
|
+
return this.dataStoreContext.connected;
|
|
52
|
+
}
|
|
53
|
+
get clientId() {
|
|
54
|
+
return this.dataStoreContext.clientId;
|
|
55
|
+
}
|
|
56
|
+
get clientDetails() {
|
|
57
|
+
return this.dataStoreContext.clientDetails;
|
|
58
|
+
}
|
|
59
|
+
get isAttached() {
|
|
60
|
+
return this.attachState !== AttachState.Detached;
|
|
61
|
+
}
|
|
62
|
+
get attachState() {
|
|
63
|
+
return this._attachState;
|
|
64
|
+
}
|
|
65
|
+
get absolutePath() {
|
|
66
|
+
return generateHandleContextPath(this.id, this.routeContext);
|
|
67
|
+
}
|
|
68
|
+
get routeContext() {
|
|
69
|
+
return this.dataStoreContext.IFluidHandleContext;
|
|
70
|
+
}
|
|
71
|
+
get idCompressor() {
|
|
72
|
+
return this.dataStoreContext.idCompressor;
|
|
73
|
+
}
|
|
74
|
+
get IFluidHandleContext() {
|
|
75
|
+
return this;
|
|
76
|
+
}
|
|
77
|
+
get rootRoutingContext() {
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
get channelsRoutingContext() {
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
get objectsRoutingContext() {
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
get disposed() {
|
|
87
|
+
return this._disposed;
|
|
88
|
+
}
|
|
89
|
+
get logger() {
|
|
90
|
+
return this.mc.logger;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Invokes the given callback and expects that no ops are submitted
|
|
94
|
+
* until execution finishes. If an op is submitted, an error will be raised.
|
|
95
|
+
*
|
|
96
|
+
* Can be disabled by feature gate `Fluid.ContainerRuntime.DisableOpReentryCheck`
|
|
97
|
+
*
|
|
98
|
+
* @param callback - the callback to be invoked
|
|
99
|
+
*/
|
|
100
|
+
ensureNoDataModelChanges(callback) {
|
|
101
|
+
// back-compat ADO:2309
|
|
102
|
+
return this.dataStoreContext.ensureNoDataModelChanges === undefined
|
|
103
|
+
? callback()
|
|
104
|
+
: this.dataStoreContext.ensureNoDataModelChanges(callback);
|
|
105
|
+
}
|
|
28
106
|
/**
|
|
29
107
|
* Create an instance of a DataStore runtime.
|
|
30
108
|
*
|
|
31
109
|
* @param dataStoreContext - Context object for the runtime.
|
|
32
110
|
* @param sharedObjectRegistry - The registry of shared objects that this data store will be able to instantiate.
|
|
33
111
|
* @param existing - Pass 'true' if loading this datastore from an existing file; pass 'false' otherwise.
|
|
34
|
-
* @param
|
|
112
|
+
* @param provideEntryPoint - Function to initialize the entryPoint object for the data store runtime. The
|
|
35
113
|
* handle to this data store runtime will point to the object returned by this function. If this function is not
|
|
36
114
|
* provided, the handle will be left undefined. This is here so we can start making handles a first-class citizen
|
|
37
115
|
* and the primary way of interacting with some Fluid objects, and should be used if possible.
|
|
38
116
|
*/
|
|
39
|
-
constructor(dataStoreContext, sharedObjectRegistry, existing,
|
|
117
|
+
constructor(dataStoreContext, sharedObjectRegistry, existing, provideEntryPoint) {
|
|
40
118
|
super();
|
|
41
119
|
this.dataStoreContext = dataStoreContext;
|
|
42
120
|
this.sharedObjectRegistry = sharedObjectRegistry;
|
|
@@ -95,10 +173,7 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
|
|
|
95
173
|
this.contexts.set(path, channelContext);
|
|
96
174
|
});
|
|
97
175
|
}
|
|
98
|
-
|
|
99
|
-
const promise = new LazyPromise(async () => initializeEntryPoint(this));
|
|
100
|
-
this.entryPoint = new FluidObjectHandle(promise, "", this.objectsRoutingContext);
|
|
101
|
-
}
|
|
176
|
+
this.entryPoint = new FluidObjectHandle(new LazyPromise(async () => provideEntryPoint(this)), "", this.objectsRoutingContext);
|
|
102
177
|
this.attachListener();
|
|
103
178
|
this._attachState = dataStoreContext.attachState;
|
|
104
179
|
/**
|
|
@@ -128,79 +203,6 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
|
|
|
128
203
|
this.localChangesTelemetryCount =
|
|
129
204
|
this.mc.config.getNumber("Fluid.Telemetry.LocalChangesTelemetryCount") ?? 10;
|
|
130
205
|
}
|
|
131
|
-
/**
|
|
132
|
-
* @deprecated - Instantiate the class using its constructor instead.
|
|
133
|
-
*
|
|
134
|
-
* Loads the data store runtime
|
|
135
|
-
* @param context - The data store context
|
|
136
|
-
* @param sharedObjectRegistry - The registry of shared objects used by this data store
|
|
137
|
-
* @param existing - If loading from an existing file.
|
|
138
|
-
*/
|
|
139
|
-
static load(context, sharedObjectRegistry, existing) {
|
|
140
|
-
return new FluidDataStoreRuntime(context, sharedObjectRegistry, existing, async (dataStoreRuntime) => requestFluidObject(dataStoreRuntime, "/"));
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
144
|
-
*/
|
|
145
|
-
get IFluidRouter() {
|
|
146
|
-
return this;
|
|
147
|
-
}
|
|
148
|
-
get connected() {
|
|
149
|
-
return this.dataStoreContext.connected;
|
|
150
|
-
}
|
|
151
|
-
get clientId() {
|
|
152
|
-
return this.dataStoreContext.clientId;
|
|
153
|
-
}
|
|
154
|
-
get clientDetails() {
|
|
155
|
-
return this.dataStoreContext.clientDetails;
|
|
156
|
-
}
|
|
157
|
-
get isAttached() {
|
|
158
|
-
return this.attachState !== AttachState.Detached;
|
|
159
|
-
}
|
|
160
|
-
get attachState() {
|
|
161
|
-
return this._attachState;
|
|
162
|
-
}
|
|
163
|
-
get absolutePath() {
|
|
164
|
-
return generateHandleContextPath(this.id, this.routeContext);
|
|
165
|
-
}
|
|
166
|
-
get routeContext() {
|
|
167
|
-
return this.dataStoreContext.IFluidHandleContext;
|
|
168
|
-
}
|
|
169
|
-
get idCompressor() {
|
|
170
|
-
return this.dataStoreContext.idCompressor;
|
|
171
|
-
}
|
|
172
|
-
get IFluidHandleContext() {
|
|
173
|
-
return this;
|
|
174
|
-
}
|
|
175
|
-
get rootRoutingContext() {
|
|
176
|
-
return this;
|
|
177
|
-
}
|
|
178
|
-
get channelsRoutingContext() {
|
|
179
|
-
return this;
|
|
180
|
-
}
|
|
181
|
-
get objectsRoutingContext() {
|
|
182
|
-
return this;
|
|
183
|
-
}
|
|
184
|
-
get disposed() {
|
|
185
|
-
return this._disposed;
|
|
186
|
-
}
|
|
187
|
-
get logger() {
|
|
188
|
-
return this.mc.logger;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Invokes the given callback and expects that no ops are submitted
|
|
192
|
-
* until execution finishes. If an op is submitted, an error will be raised.
|
|
193
|
-
*
|
|
194
|
-
* Can be disabled by feature gate `Fluid.ContainerRuntime.DisableOpReentryCheck`
|
|
195
|
-
*
|
|
196
|
-
* @param callback - the callback to be invoked
|
|
197
|
-
*/
|
|
198
|
-
ensureNoDataModelChanges(callback) {
|
|
199
|
-
// back-compat ADO:2309
|
|
200
|
-
return this.dataStoreContext.ensureNoDataModelChanges === undefined
|
|
201
|
-
? callback()
|
|
202
|
-
: this.dataStoreContext.ensureNoDataModelChanges(callback);
|
|
203
|
-
}
|
|
204
206
|
dispose() {
|
|
205
207
|
if (this._disposed) {
|
|
206
208
|
return;
|
|
@@ -313,16 +315,6 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
|
|
|
313
315
|
attachGraph() {
|
|
314
316
|
this.makeVisibleAndAttachGraph();
|
|
315
317
|
}
|
|
316
|
-
/**
|
|
317
|
-
* @deprecated - Not necessary if consumers add a new dataStore to the container by storing its handle.
|
|
318
|
-
* Binds this runtime to the container
|
|
319
|
-
* This includes the following:
|
|
320
|
-
* 1. Sending an Attach op that includes all existing state
|
|
321
|
-
* 2. Attaching the graph if the data store becomes attached.
|
|
322
|
-
*/
|
|
323
|
-
bindToContext() {
|
|
324
|
-
this.makeVisibleAndAttachGraph();
|
|
325
|
-
}
|
|
326
318
|
bind(handle) {
|
|
327
319
|
// If visible, attach the incoming handle's graph. Else, this will be done when we become visible.
|
|
328
320
|
if (this.visibilityState !== VisibilityState.NotVisible) {
|
|
@@ -754,6 +746,8 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
|
|
|
754
746
|
* Request handler is only called when data store can't resolve request, i.e. for custom requests.
|
|
755
747
|
* @param Base - base class, inherits from FluidDataStoreRuntime
|
|
756
748
|
* @param requestHandler - request handler to mix in
|
|
749
|
+
*
|
|
750
|
+
* @public
|
|
757
751
|
*/
|
|
758
752
|
export const mixinRequestHandler = (requestHandler, Base = FluidDataStoreRuntime) => class RuntimeWithRequestHandler extends Base {
|
|
759
753
|
async request(request) {
|
|
@@ -769,6 +763,8 @@ export const mixinRequestHandler = (requestHandler, Base = FluidDataStoreRuntime
|
|
|
769
763
|
* @param handler - handler that returns info about blob to be added to summary.
|
|
770
764
|
* Or undefined not to add anything to summary.
|
|
771
765
|
* @param Base - base class, inherits from FluidDataStoreRuntime
|
|
766
|
+
*
|
|
767
|
+
* @public
|
|
772
768
|
*/
|
|
773
769
|
export const mixinSummaryHandler = (handler, Base = FluidDataStoreRuntime) => class RuntimeWithSummarizerHandler extends Base {
|
|
774
770
|
addBlob(summary, path, content) {
|