@fluidframework/datastore 2.0.0-dev.1.4.6.106135 → 2.0.0-dev.2.2.0.111723
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/.eslintrc.js +1 -1
- package/dist/channelContext.d.ts +1 -2
- package/dist/channelContext.d.ts.map +1 -1
- package/dist/channelContext.js.map +1 -1
- package/dist/dataStoreRuntime.d.ts +20 -5
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/dataStoreRuntime.js +23 -8
- package/dist/dataStoreRuntime.js.map +1 -1
- package/dist/fluidHandle.d.ts +27 -4
- package/dist/fluidHandle.d.ts.map +1 -1
- package/dist/fluidHandle.js +27 -5
- package/dist/fluidHandle.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -12
- package/dist/index.js.map +1 -1
- package/dist/localChannelContext.d.ts +1 -1
- package/dist/localChannelContext.d.ts.map +1 -1
- package/dist/localChannelContext.js +1 -1
- package/dist/localChannelContext.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 +1 -1
- package/dist/remoteChannelContext.d.ts.map +1 -1
- package/dist/remoteChannelContext.js +1 -1
- package/dist/remoteChannelContext.js.map +1 -1
- package/lib/channelContext.d.ts +1 -2
- package/lib/channelContext.d.ts.map +1 -1
- package/lib/channelContext.js.map +1 -1
- package/lib/dataStoreRuntime.d.ts +20 -5
- package/lib/dataStoreRuntime.d.ts.map +1 -1
- package/lib/dataStoreRuntime.js +24 -9
- package/lib/dataStoreRuntime.js.map +1 -1
- package/lib/fluidHandle.d.ts +27 -4
- package/lib/fluidHandle.d.ts.map +1 -1
- package/lib/fluidHandle.js +27 -5
- package/lib/fluidHandle.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/localChannelContext.d.ts +1 -1
- package/lib/localChannelContext.d.ts.map +1 -1
- package/lib/localChannelContext.js +1 -1
- package/lib/localChannelContext.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 +1 -1
- package/lib/remoteChannelContext.d.ts.map +1 -1
- package/lib/remoteChannelContext.js +1 -1
- package/lib/remoteChannelContext.js.map +1 -1
- package/package.json +30 -25
- package/prettier.config.cjs +8 -0
- package/src/channelContext.ts +1 -2
- package/src/dataStoreRuntime.ts +35 -7
- package/src/fluidHandle.ts +31 -5
- package/src/index.ts +8 -2
- package/src/localChannelContext.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/remoteChannelContext.ts +1 -1
package/lib/fluidHandle.js
CHANGED
|
@@ -3,12 +3,17 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { generateHandleContextPath } from "@fluidframework/runtime-utils";
|
|
6
|
+
/**
|
|
7
|
+
* Handle for a shared {@link @fluidframework/core-interfaces#FluidObject}.
|
|
8
|
+
*/
|
|
6
9
|
export class FluidObjectHandle {
|
|
7
10
|
/**
|
|
8
|
-
* Creates a new FluidObjectHandle
|
|
9
|
-
*
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
11
|
+
* Creates a new `FluidObjectHandle`.
|
|
12
|
+
*
|
|
13
|
+
* @param value - The {@link @fluidframework/core-interfaces#FluidObject} object this handle is for.
|
|
14
|
+
* @param path - The path to this handle relative to the `routeContext`.
|
|
15
|
+
* @param routeContext - The parent {@link @fluidframework/core-interfaces#IFluidHandleContext} that has a route
|
|
16
|
+
* to this handle.
|
|
12
17
|
*/
|
|
13
18
|
constructor(value, path, routeContext) {
|
|
14
19
|
this.value = value;
|
|
@@ -21,7 +26,15 @@ export class FluidObjectHandle {
|
|
|
21
26
|
this.locallyVisible = false;
|
|
22
27
|
this.absolutePath = generateHandleContextPath(path, this.routeContext);
|
|
23
28
|
}
|
|
24
|
-
|
|
29
|
+
/**
|
|
30
|
+
* {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}
|
|
31
|
+
*/
|
|
32
|
+
get IFluidHandle() {
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.isAttached}
|
|
37
|
+
*/
|
|
25
38
|
get isAttached() {
|
|
26
39
|
return this.routeContext.isAttached;
|
|
27
40
|
}
|
|
@@ -43,10 +56,16 @@ export class FluidObjectHandle {
|
|
|
43
56
|
*/
|
|
44
57
|
return this.isAttached || this.locallyVisible;
|
|
45
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.get}
|
|
61
|
+
*/
|
|
46
62
|
async get() {
|
|
47
63
|
// Note that this return works whether we received a T or a Promise<T> for this.value in the constructor.
|
|
48
64
|
return this.value;
|
|
49
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.attachGraph }
|
|
68
|
+
*/
|
|
50
69
|
attachGraph() {
|
|
51
70
|
if (this.visible) {
|
|
52
71
|
return;
|
|
@@ -58,6 +77,9 @@ export class FluidObjectHandle {
|
|
|
58
77
|
this.pendingHandlesToMakeVisible.clear();
|
|
59
78
|
this.routeContext.attachGraph();
|
|
60
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.bind}
|
|
82
|
+
*/
|
|
61
83
|
bind(handle) {
|
|
62
84
|
// If this handle is visible, attach the graph of the incoming handle as well.
|
|
63
85
|
if (this.visible) {
|
package/lib/fluidHandle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidHandle.js","sourceRoot":"","sources":["../src/fluidHandle.ts"],"names":[],"mapp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AAE,CAAC;QACzB,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,2BAA2B,CAAC,KAAK,EAAE,CAAC;QACzC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IACpC,CAAC;IAED;;OAEG;IACI,IAAI,CAAC,MAAoB;QAC5B,8EAA8E;QAC9E,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,MAAM,CAAC,WAAW,EAAE,CAAC;YACrB,OAAO;SACV;QACD,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IFluidHandle,\n IFluidHandleContext,\n FluidObject,\n} from \"@fluidframework/core-interfaces\";\nimport { generateHandleContextPath } from \"@fluidframework/runtime-utils\";\n\n/**\n * Handle for a shared {@link @fluidframework/core-interfaces#FluidObject}.\n */\nexport class FluidObjectHandle<T extends FluidObject = FluidObject> implements IFluidHandle {\n private readonly pendingHandlesToMakeVisible: Set<IFluidHandle> = new Set();\n\n /**\n * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.absolutePath}\n */\n public readonly absolutePath: string;\n\n /**\n * {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}\n */\n public get IFluidHandle(): IFluidHandle {\n return this;\n }\n\n /**\n * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.isAttached}\n */\n public get isAttached(): boolean {\n return this.routeContext.isAttached;\n }\n\n /**\n * Tells whether the object of this handle is visible in the container locally or globally.\n */\n private get visible(): boolean {\n /**\n * If the object of this handle is attached, it is visible in the container. Ideally, checking local visibility\n * should be enough for a handle. However, there are scenarios where the object becomes locally visible but the\n * handle does not know this - This will happen is attachGraph is never called on the handle. Couple of examples\n * where this can happen:\n *\n * 1. Handles to DDS other than the default handle won't know if the DDS becomes visible after the handle was\n * created.\n *\n * 2. Handles to root data stores will never know that it was visible because the handle will not be stores in\n * another DDS and so, attachGraph will never be called on it.\n */\n return this.isAttached || this.locallyVisible;\n }\n\n /**\n * Tracks whether this handle is locally visible in the container.\n */\n private locallyVisible: boolean = false;\n\n /**\n * Creates a new `FluidObjectHandle`.\n *\n * @param value - The {@link @fluidframework/core-interfaces#FluidObject} object this handle is for.\n * @param path - The path to this handle relative to the `routeContext`.\n * @param routeContext - The parent {@link @fluidframework/core-interfaces#IFluidHandleContext} that has a route\n * to this handle.\n */\n constructor(\n protected readonly value: T | Promise<T>,\n public readonly path: string,\n public readonly routeContext: IFluidHandleContext,\n ) {\n this.absolutePath = generateHandleContextPath(path, this.routeContext);\n }\n\n /**\n * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.get}\n */\n public async get(): Promise<any> {\n // Note that this return works whether we received a T or a Promise<T> for this.value in the constructor.\n return this.value;\n }\n\n /**\n * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.attachGraph }\n */\n public attachGraph(): void {\n if (this.visible) {\n return;\n }\n\n this.locallyVisible = true;\n this.pendingHandlesToMakeVisible.forEach((handle) => {\n handle.attachGraph();\n });\n this.pendingHandlesToMakeVisible.clear();\n this.routeContext.attachGraph();\n }\n\n /**\n * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.bind}\n */\n public bind(handle: IFluidHandle) {\n // If this handle is visible, attach the graph of the incoming handle as well.\n if (this.visible) {\n handle.attachGraph();\n return;\n }\n this.pendingHandlesToMakeVisible.add(handle);\n }\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export { FluidObjectHandle } from "./fluidHandle";
|
|
6
|
+
export { DataStoreMessageType, FluidDataStoreRuntime, ISharedObjectRegistry, mixinRequestHandler, mixinSummaryHandler, } from "./dataStoreRuntime";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACN,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,GACnB,MAAM,oBAAoB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export { FluidObjectHandle } from "./fluidHandle";
|
|
6
|
+
export { DataStoreMessageType, FluidDataStoreRuntime, mixinRequestHandler, mixinSummaryHandler, } from "./dataStoreRuntime";
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACN,oBAAoB,EACpB,qBAAqB,EAErB,mBAAmB,EACnB,mBAAmB,GACnB,MAAM,oBAAoB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { FluidObjectHandle } from \"./fluidHandle\";\nexport {\n\tDataStoreMessageType,\n\tFluidDataStoreRuntime,\n\tISharedObjectRegistry,\n\tmixinRequestHandler,\n\tmixinSummaryHandler,\n} from \"./dataStoreRuntime\";\n"]}
|
|
@@ -52,7 +52,7 @@ export declare abstract class LocalChannelContextBase implements IChannelContext
|
|
|
52
52
|
* @param fullGC - true to bypass optimizations and force full generation of GC data.
|
|
53
53
|
*/
|
|
54
54
|
getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;
|
|
55
|
-
updateUsedRoutes(usedRoutes: string[]
|
|
55
|
+
updateUsedRoutes(usedRoutes: string[]): void;
|
|
56
56
|
}
|
|
57
57
|
export declare class RehydratedLocalChannelContext extends LocalChannelContextBase {
|
|
58
58
|
private readonly snapshotTree;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localChannelContext.d.ts","sourceRoot":"","sources":["../src/localChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAChG,OAAO,EACH,QAAQ,EACR,sBAAsB,EACtB,eAAe,EAElB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACH,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACpB,MAAM,qCAAqC,CAAC;AAG7C,OAAO,EAAU,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAEH,eAAe,EAGlB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AA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run GC" */);
|
|
95
95
|
return this.channel.getGCData(fullGC);
|
|
96
96
|
}
|
|
97
|
-
updateUsedRoutes(usedRoutes
|
|
97
|
+
updateUsedRoutes(usedRoutes) {
|
|
98
98
|
/**
|
|
99
99
|
* Currently, DDSes are always considered referenced and are not garbage collected.
|
|
100
100
|
* Once we have GC at DDS level, this channel context's used routes will be updated as per the passed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localChannelContext.js","sourceRoot":"","sources":["../src/localChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sDAAsD;AACtD,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAgBzC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EACH,sBAAsB,EAEtB,gBAAgB,EAChB,qBAAqB,GACxB,MAAM,kBAAkB,CAAC;AAK1B;;GAEG;AACH,MAAM,OAAgB,uBAAuB;IAKzC,YACuB,EAAU,EACV,QAA+B,EAC/B,OAA+B,EACjC,cAGX;QANa,OAAE,GAAF,EAAE,CAAQ;QACV,aAAQ,GAAR,QAAQ,CAAuB;QAC/B,YAAO,GAAP,OAAO,CAAwB;QACjC,mBAAc,GAAd,cAAc,CAGzB;QAVF,oBAAe,GAAG,KAAK,CAAC;QACb,YAAO,GAAgC,EAAE,CAAC;QAWzD,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,+CAA+C,CAAC,CAAC;IAC1F,CAAC;IAEM,KAAK,CAAC,UAAU;QACnB,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,KAAK,CAAC,iCAAiC,CAAC,CAAC;QAC5E,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,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AAG,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// eslint-disable-next-line import/no-internal-modules\nimport cloneDeep from \"lodash/cloneDeep\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n IChannel,\n IFluidDataStoreRuntime,\n IChannelFactory,\n IChannelAttributes,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n IFluidDataStoreContext,\n IGarbageCollectionData,\n ISummarizeResult,\n ITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { DataProcessingError } from \"@fluidframework/container-utils\";\nimport { assert, Lazy } from \"@fluidframework/common-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n createServiceEndpoints,\n IChannelContext,\n summarizeChannel,\n summarizeChannelAsync,\n} from \"./channelContext\";\nimport { ChannelDeltaConnection } from \"./channelDeltaConnection\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime\";\nimport { ChannelStorageService } from \"./channelStorageService\";\n\n/**\n * Channel context for a locally created channel\n */\nexport abstract class LocalChannelContextBase implements IChannelContext {\n public channel: IChannel | undefined;\n private globallyVisible = false;\n protected readonly pending: ISequencedDocumentMessage[] = [];\n protected factory: IChannelFactory | undefined;\n constructor(\n protected readonly id: string,\n protected readonly registry: ISharedObjectRegistry,\n protected readonly runtime: IFluidDataStoreRuntime,\n private readonly servicesGetter: () => Lazy<{\n readonly deltaConnection: ChannelDeltaConnection;\n readonly objectStorage: ChannelStorageService;\n }>,\n ) {\n assert(!this.id.includes(\"/\"), 0x30f /* Channel context ID cannot contain slashes */);\n }\n\n public async getChannel(): Promise<IChannel> {\n assert(this.channel !== undefined, 0x207 /* \"Channel should be defined\" */);\n return this.channel;\n }\n\n public get isLoaded(): boolean {\n return this.channel !== undefined;\n }\n\n public setConnectionState(connected: boolean, clientId?: string) {\n // Connection events are ignored if the data store is not yet globallyVisible or loaded\n if (this.globallyVisible && this.isLoaded) {\n this.servicesGetter().value.deltaConnection.setConnectionState(connected);\n }\n }\n\n public processOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n assert(this.globallyVisible, 0x2d3 /* \"Local channel must be globally visible when processing op\" */);\n\n // A local channel may not be loaded in case where we rehydrate the container from a snapshot because of\n // delay loading. So after the container is attached and some other client joins which start generating\n // ops for this channel. So not loaded local channel can still receive ops and we store them to process later.\n if (this.isLoaded) {\n this.servicesGetter().value.deltaConnection.process(message, local, localOpMetadata);\n } else {\n assert(local === false,\n 0x189 /* \"Should always be remote because a local dds shouldn't generate ops before loading\" */);\n this.pending.push(message);\n }\n }\n\n public reSubmit(content: any, localOpMetadata: unknown) {\n assert(this.isLoaded, 0x18a /* \"Channel should be loaded to resubmit ops\" */);\n assert(this.globallyVisible, 0x2d4 /* \"Local channel must be globally visible when resubmitting op\" */);\n this.servicesGetter().value.deltaConnection.reSubmit(content, localOpMetadata);\n }\n public rollback(content: any, localOpMetadata: unknown) {\n assert(this.isLoaded, 0x2ee /* \"Channel should be loaded to rollback ops\" */);\n assert(this.globallyVisible, 0x2ef /* \"Local channel must be globally visible when rolling back op\" */);\n this.servicesGetter().value.deltaConnection.rollback(content, localOpMetadata);\n }\n\n public applyStashedOp() {\n throw new Error(\"no stashed ops on local channel\");\n }\n\n /**\n * Returns a summary at the current sequence number.\n * @param fullTree - true to bypass optimizations and force a full summary tree\n * @param trackState - This tells whether we should track state from this summary.\n * @param telemetryContext - summary data passed through the layers for telemetry purposes\n */\n public async summarize(\n fullTree: boolean = false,\n trackState: boolean = false,\n telemetryContext?: ITelemetryContext,\n ): Promise<ISummarizeResult> {\n assert(this.isLoaded && this.channel !== undefined, 0x18c /* \"Channel should be loaded to summarize\" */);\n return summarizeChannelAsync(this.channel, fullTree, trackState, telemetryContext);\n }\n\n public getAttachSummary(telemetryContext?: ITelemetryContext): ISummarizeResult {\n assert(this.isLoaded && this.channel !== undefined, 0x18d /* \"Channel should be loaded to take snapshot\" */);\n return summarizeChannel(this.channel, true /* fullTree */, false /* trackState */, telemetryContext);\n }\n\n public makeVisible(): void {\n if (this.globallyVisible) {\n throw new Error(\"Channel is already globally visible\");\n }\n\n if (this.isLoaded) {\n assert(!!this.channel, 0x192 /* \"Channel should be there if loaded!!\" */);\n this.channel.connect(this.servicesGetter().value);\n }\n this.globallyVisible = true;\n }\n\n /**\n * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n * Each node has a set of outbound routes to other GC nodes in the document. This should be called only after\n * the context has loaded.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n public async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n assert(this.isLoaded && this.channel !== undefined, 0x193 /* \"Channel should be loaded to run GC\" */);\n return this.channel.getGCData(fullGC);\n }\n\n public updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number) {\n /**\n * Currently, DDSes are always considered referenced and are not garbage collected.\n * Once we have GC at DDS level, this channel context's used routes will be updated as per the passed\n * value. See - https://github.com/microsoft/FluidFramework/issues/4611\n */\n }\n}\n\nexport class RehydratedLocalChannelContext extends LocalChannelContextBase {\n private readonly services: Lazy<{\n readonly deltaConnection: ChannelDeltaConnection;\n readonly objectStorage: ChannelStorageService;\n }>;\n\n private readonly dirtyFn: () => void;\n\n constructor(\n id: string,\n registry: ISharedObjectRegistry,\n runtime: IFluidDataStoreRuntime,\n dataStoreContext: IFluidDataStoreContext,\n storageService: IDocumentStorageService,\n logger: ITelemetryLogger,\n submitFn: (content: any, localOpMetadata: unknown) => void,\n dirtyFn: (address: string) => void,\n addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n private readonly snapshotTree: ISnapshotTree,\n ) {\n super(id, registry, runtime, () => this.services);\n const blobMap: Map<string, ArrayBufferLike> = new Map<string, ArrayBufferLike>();\n const clonedSnapshotTree = cloneDeep(this.snapshotTree);\n // 0.47 back-compat Need to sanitize if snapshotTree.blobs still contains blob contents too.\n // This is for older snapshot which is generated by loader <=0.47 version which still contains\n // the contents within blobs. After a couple of revisions we can remove it.\n if (this.isSnapshotInOldFormatAndCollectBlobs(clonedSnapshotTree, blobMap)) {\n this.sanitizeSnapshot(clonedSnapshotTree);\n }\n\n this.services = new Lazy(() => {\n return createServiceEndpoints(\n this.id,\n dataStoreContext.connected,\n submitFn,\n this.dirtyFn,\n addedGCOutboundReferenceFn,\n storageService,\n logger,\n clonedSnapshotTree,\n blobMap,\n );\n });\n this.dirtyFn = () => { dirtyFn(id); };\n }\n\n public async getChannel(): Promise<IChannel> {\n if (this.channel === undefined) {\n this.channel = await this.loadChannel()\n .catch((err) => {\n throw DataProcessingError.wrapIfUnrecognized(\n err, \"rehydratedLocalChannelContextFailedToLoadChannel\", undefined);\n });\n }\n return this.channel;\n }\n\n private async loadChannel(): Promise<IChannel> {\n assert(!this.isLoaded, 0x18e /* \"Channel must not already be loaded when loading\" */);\n assert(await this.services.value.objectStorage.contains(\".attributes\"),\n 0x190 /* \".attributes blob should be present\" */);\n const attributes = await readAndParse<IChannelAttributes>(\n this.services.value.objectStorage,\n \".attributes\");\n\n assert(this.factory === undefined, 0x208 /* \"Factory should be undefined before loading\" */);\n this.factory = this.registry.get(attributes.type);\n if (this.factory === undefined) {\n throw new Error(`Channel Factory ${attributes.type} not registered`);\n }\n // Services will be assigned during this load.\n const channel = await this.factory.load(\n this.runtime,\n this.id,\n this.services.value,\n attributes);\n\n // Commit changes.\n this.channel = channel;\n\n // Send all pending messages to the channel\n for (const message of this.pending) {\n this.services.value.deltaConnection.process(message, false, undefined /* localOpMetadata */);\n }\n return this.channel;\n }\n\n private isSnapshotInOldFormatAndCollectBlobs(\n snapshotTree: ISnapshotTree,\n blobMap: Map<string, ArrayBufferLike>,\n ): boolean {\n let sanitize = false;\n const blobsContents: { [path: string]: ArrayBufferLike; } = (snapshotTree as any).blobsContents;\n Object.entries(blobsContents).forEach(([key, value]) => {\n blobMap.set(key, value);\n if (snapshotTree.blobs[key] !== undefined) {\n sanitize = true;\n }\n });\n for (const value of Object.values(snapshotTree.trees)) {\n sanitize = sanitize || this.isSnapshotInOldFormatAndCollectBlobs(value, blobMap);\n }\n return sanitize;\n }\n\n private sanitizeSnapshot(snapshotTree: ISnapshotTree) {\n const blobMapInitial = new Map(Object.entries(snapshotTree.blobs));\n for (const [blobName, blobId] of blobMapInitial.entries()) {\n const blobValue = blobMapInitial.get(blobId);\n if (blobValue === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete snapshotTree.blobs[blobName];\n }\n }\n for (const value of Object.values(snapshotTree.trees)) {\n this.sanitizeSnapshot(value);\n }\n }\n}\n\nexport class LocalChannelContext extends LocalChannelContextBase {\n private readonly services: Lazy<{\n readonly deltaConnection: ChannelDeltaConnection;\n readonly objectStorage: ChannelStorageService;\n }>;\n private readonly dirtyFn: () => void;\n constructor(\n id: string,\n registry: ISharedObjectRegistry,\n type: string,\n runtime: IFluidDataStoreRuntime,\n dataStoreContext: IFluidDataStoreContext,\n storageService: IDocumentStorageService,\n logger: ITelemetryLogger,\n submitFn: (content: any, localOpMetadata: unknown) => void,\n dirtyFn: (address: string) => void,\n addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n ) {\n super(id, registry, runtime, () => this.services);\n assert(type !== undefined, 0x209 /* \"Factory Type should be defined\" */);\n this.factory = registry.get(type);\n if (this.factory === undefined) {\n throw new Error(`Channel Factory ${type} not registered`);\n }\n this.channel = this.factory.create(runtime, id);\n this.services = new Lazy(() => {\n return createServiceEndpoints(\n this.id,\n dataStoreContext.connected,\n submitFn,\n this.dirtyFn,\n addedGCOutboundReferenceFn,\n storageService,\n logger,\n );\n });\n this.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IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;SAChC;IACL,CAAC;CACJ;AAED,MAAM,OAAO,mBAAoB,SAAQ,uBAAuB;IAM5D,YACI,EAAU,EACV,QAA+B,EAC/B,IAAY,EACZ,OAA+B,EAC/B,gBAAwC,EACxC,cAAuC,EACvC,MAAwB,EACxB,QAA0D,EAC1D,OAAkC,EAClC,0BAA2F;QAE3F,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,KAAK,CAAC,sCAAsC,CAAC,CAAC;QACzE,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,iBAAiB,CAAC,CAAC;SAC7D;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAChD,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE;YAC1B,OAAO,sBAAsB,CACzB,IAAI,CAAC,EAAE,EACP,gBAAgB,CAAC,SAAS,EAC1B,QAAQ,EACR,IAAI,CAAC,OAAO,EACZ,0BAA0B,EAC1B,cAAc,EACd,MAAM,CACT,CAAC;QACN,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// eslint-disable-next-line import/no-internal-modules\nimport cloneDeep from \"lodash/cloneDeep\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n IChannel,\n IFluidDataStoreRuntime,\n IChannelFactory,\n IChannelAttributes,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n IFluidDataStoreContext,\n IGarbageCollectionData,\n ISummarizeResult,\n ITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { DataProcessingError } from \"@fluidframework/container-utils\";\nimport { assert, Lazy } from \"@fluidframework/common-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n createServiceEndpoints,\n IChannelContext,\n summarizeChannel,\n summarizeChannelAsync,\n} from \"./channelContext\";\nimport { ChannelDeltaConnection } from \"./channelDeltaConnection\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime\";\nimport { ChannelStorageService } from \"./channelStorageService\";\n\n/**\n * Channel context for a locally created channel\n */\nexport abstract class LocalChannelContextBase implements IChannelContext {\n public channel: IChannel | undefined;\n private globallyVisible = false;\n protected readonly pending: ISequencedDocumentMessage[] = [];\n protected factory: IChannelFactory | undefined;\n constructor(\n protected readonly id: string,\n protected readonly registry: ISharedObjectRegistry,\n protected readonly runtime: IFluidDataStoreRuntime,\n private readonly servicesGetter: () => Lazy<{\n readonly deltaConnection: ChannelDeltaConnection;\n readonly objectStorage: ChannelStorageService;\n }>,\n ) {\n assert(!this.id.includes(\"/\"), 0x30f /* Channel context ID cannot contain slashes */);\n }\n\n public async getChannel(): Promise<IChannel> {\n assert(this.channel !== undefined, 0x207 /* \"Channel should be defined\" */);\n return this.channel;\n }\n\n public get isLoaded(): boolean {\n return this.channel !== undefined;\n }\n\n public setConnectionState(connected: boolean, clientId?: string) {\n // Connection events are ignored if the data store is not yet globallyVisible or loaded\n if (this.globallyVisible && this.isLoaded) {\n this.servicesGetter().value.deltaConnection.setConnectionState(connected);\n }\n }\n\n public processOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n assert(this.globallyVisible, 0x2d3 /* \"Local channel must be globally visible when processing op\" */);\n\n // A local channel may not be loaded in case where we rehydrate the container from a snapshot because of\n // delay loading. So after the container is attached and some other client joins which start generating\n // ops for this channel. So not loaded local channel can still receive ops and we store them to process later.\n if (this.isLoaded) {\n this.servicesGetter().value.deltaConnection.process(message, local, localOpMetadata);\n } else {\n assert(local === false,\n 0x189 /* \"Should always be remote because a local dds shouldn't generate ops before loading\" */);\n this.pending.push(message);\n }\n }\n\n public reSubmit(content: any, localOpMetadata: unknown) {\n assert(this.isLoaded, 0x18a /* \"Channel should be loaded to resubmit ops\" */);\n assert(this.globallyVisible, 0x2d4 /* \"Local channel must be globally visible when resubmitting op\" */);\n this.servicesGetter().value.deltaConnection.reSubmit(content, localOpMetadata);\n }\n public rollback(content: any, localOpMetadata: unknown) {\n assert(this.isLoaded, 0x2ee /* \"Channel should be loaded to rollback ops\" */);\n assert(this.globallyVisible, 0x2ef /* \"Local channel must be globally visible when rolling back op\" */);\n this.servicesGetter().value.deltaConnection.rollback(content, localOpMetadata);\n }\n\n public applyStashedOp() {\n throw new Error(\"no stashed ops on local channel\");\n }\n\n /**\n * Returns a summary at the current sequence number.\n * @param fullTree - true to bypass optimizations and force a full summary tree\n * @param trackState - This tells whether we should track state from this summary.\n * @param telemetryContext - summary data passed through the layers for telemetry purposes\n */\n public async summarize(\n fullTree: boolean = false,\n trackState: boolean = false,\n telemetryContext?: ITelemetryContext,\n ): Promise<ISummarizeResult> {\n assert(this.isLoaded && this.channel !== undefined, 0x18c /* \"Channel should be loaded to summarize\" */);\n return summarizeChannelAsync(this.channel, fullTree, trackState, telemetryContext);\n }\n\n public getAttachSummary(telemetryContext?: ITelemetryContext): ISummarizeResult {\n assert(this.isLoaded && this.channel !== undefined, 0x18d /* \"Channel should be loaded to take snapshot\" */);\n return summarizeChannel(this.channel, true /* fullTree */, false /* trackState */, telemetryContext);\n }\n\n public makeVisible(): void {\n if (this.globallyVisible) {\n throw new Error(\"Channel is already globally visible\");\n }\n\n if (this.isLoaded) {\n assert(!!this.channel, 0x192 /* \"Channel should be there if loaded!!\" */);\n this.channel.connect(this.servicesGetter().value);\n }\n this.globallyVisible = true;\n }\n\n /**\n * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n * Each node has a set of outbound routes to other GC nodes in the document. This should be called only after\n * the context has loaded.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n public async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n assert(this.isLoaded && this.channel !== undefined, 0x193 /* \"Channel should be loaded to run GC\" */);\n return this.channel.getGCData(fullGC);\n }\n\n public updateUsedRoutes(usedRoutes: string[]) {\n /**\n * Currently, DDSes are always considered referenced and are not garbage collected.\n * Once we have GC at DDS level, this channel context's used routes will be updated as per the passed\n * value. See - https://github.com/microsoft/FluidFramework/issues/4611\n */\n }\n}\n\nexport class RehydratedLocalChannelContext extends LocalChannelContextBase {\n private readonly services: Lazy<{\n readonly deltaConnection: ChannelDeltaConnection;\n readonly objectStorage: ChannelStorageService;\n }>;\n\n private readonly dirtyFn: () => void;\n\n constructor(\n id: string,\n registry: ISharedObjectRegistry,\n runtime: IFluidDataStoreRuntime,\n dataStoreContext: IFluidDataStoreContext,\n storageService: IDocumentStorageService,\n logger: ITelemetryLogger,\n submitFn: (content: any, localOpMetadata: unknown) => void,\n dirtyFn: (address: string) => void,\n addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n private readonly snapshotTree: ISnapshotTree,\n ) {\n super(id, registry, runtime, () => this.services);\n const blobMap: Map<string, ArrayBufferLike> = new Map<string, ArrayBufferLike>();\n const clonedSnapshotTree = cloneDeep(this.snapshotTree);\n // 0.47 back-compat Need to sanitize if snapshotTree.blobs still contains blob contents too.\n // This is for older snapshot which is generated by loader <=0.47 version which still contains\n // the contents within blobs. After a couple of revisions we can remove it.\n if (this.isSnapshotInOldFormatAndCollectBlobs(clonedSnapshotTree, blobMap)) {\n this.sanitizeSnapshot(clonedSnapshotTree);\n }\n\n this.services = new Lazy(() => {\n return createServiceEndpoints(\n this.id,\n dataStoreContext.connected,\n submitFn,\n this.dirtyFn,\n addedGCOutboundReferenceFn,\n storageService,\n logger,\n clonedSnapshotTree,\n blobMap,\n );\n });\n this.dirtyFn = () => { dirtyFn(id); };\n }\n\n public async getChannel(): Promise<IChannel> {\n if (this.channel === undefined) {\n this.channel = await this.loadChannel()\n .catch((err) => {\n throw DataProcessingError.wrapIfUnrecognized(\n err, \"rehydratedLocalChannelContextFailedToLoadChannel\", undefined);\n });\n }\n return this.channel;\n }\n\n private async loadChannel(): Promise<IChannel> {\n assert(!this.isLoaded, 0x18e /* \"Channel must not already be loaded when loading\" */);\n assert(await this.services.value.objectStorage.contains(\".attributes\"),\n 0x190 /* \".attributes blob should be present\" */);\n const attributes = await readAndParse<IChannelAttributes>(\n this.services.value.objectStorage,\n \".attributes\");\n\n assert(this.factory === undefined, 0x208 /* \"Factory should be undefined before loading\" */);\n this.factory = this.registry.get(attributes.type);\n if (this.factory === undefined) {\n throw new Error(`Channel Factory ${attributes.type} not registered`);\n }\n // Services will be assigned during this load.\n const channel = await this.factory.load(\n this.runtime,\n this.id,\n this.services.value,\n attributes);\n\n // Commit changes.\n this.channel = channel;\n\n // Send all pending messages to the channel\n for (const message of this.pending) {\n this.services.value.deltaConnection.process(message, false, undefined /* localOpMetadata */);\n }\n return this.channel;\n }\n\n private isSnapshotInOldFormatAndCollectBlobs(\n snapshotTree: ISnapshotTree,\n blobMap: Map<string, ArrayBufferLike>,\n ): boolean {\n let sanitize = false;\n const blobsContents: { [path: string]: ArrayBufferLike; } = (snapshotTree as any).blobsContents;\n Object.entries(blobsContents).forEach(([key, value]) => {\n blobMap.set(key, value);\n if (snapshotTree.blobs[key] !== undefined) {\n sanitize = true;\n }\n });\n for (const value of Object.values(snapshotTree.trees)) {\n sanitize = sanitize || this.isSnapshotInOldFormatAndCollectBlobs(value, blobMap);\n }\n return sanitize;\n }\n\n private sanitizeSnapshot(snapshotTree: ISnapshotTree) {\n const blobMapInitial = new Map(Object.entries(snapshotTree.blobs));\n for (const [blobName, blobId] of blobMapInitial.entries()) {\n const blobValue = blobMapInitial.get(blobId);\n if (blobValue === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete snapshotTree.blobs[blobName];\n }\n }\n for (const value of Object.values(snapshotTree.trees)) {\n this.sanitizeSnapshot(value);\n }\n }\n}\n\nexport class LocalChannelContext extends LocalChannelContextBase {\n private readonly services: Lazy<{\n readonly deltaConnection: ChannelDeltaConnection;\n readonly objectStorage: ChannelStorageService;\n }>;\n private readonly dirtyFn: () => void;\n constructor(\n id: string,\n registry: ISharedObjectRegistry,\n type: string,\n runtime: IFluidDataStoreRuntime,\n dataStoreContext: IFluidDataStoreContext,\n storageService: IDocumentStorageService,\n logger: ITelemetryLogger,\n submitFn: (content: any, localOpMetadata: unknown) => void,\n dirtyFn: (address: string) => void,\n addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n ) {\n super(id, registry, runtime, () => this.services);\n assert(type !== undefined, 0x209 /* \"Factory Type should be defined\" */);\n this.factory = registry.get(type);\n if (this.factory === undefined) {\n throw new Error(`Channel Factory ${type} not registered`);\n }\n this.channel = this.factory.create(runtime, id);\n this.services = new Lazy(() => {\n return createServiceEndpoints(\n this.id,\n dataStoreContext.connected,\n submitFn,\n this.dirtyFn,\n addedGCOutboundReferenceFn,\n storageService,\n logger,\n );\n });\n this.dirtyFn = () => { dirtyFn(id); };\n }\n}\n"]}
|
package/lib/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-dev.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-dev.2.2.0.111723";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export const pkgName = "@fluidframework/datastore";
|
|
8
|
-
export const pkgVersion = "2.0.0-dev.
|
|
8
|
+
export const pkgVersion = "2.0.0-dev.2.2.0.111723";
|
|
9
9
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,2BAA2B,CAAC;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,wBAAwB,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-dev.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,2BAA2B,CAAC;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,wBAAwB,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-dev.2.2.0.111723\";\n"]}
|
|
@@ -54,6 +54,6 @@ export declare class RemoteChannelContext implements IChannelContext {
|
|
|
54
54
|
* @param fullGC - true to bypass optimizations and force full generation of GC data.
|
|
55
55
|
*/
|
|
56
56
|
private getGCDataInternal;
|
|
57
|
-
updateUsedRoutes(usedRoutes: string[]
|
|
57
|
+
updateUsedRoutes(usedRoutes: string[]): void;
|
|
58
58
|
}
|
|
59
59
|
//# sourceMappingURL=remoteChannelContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteChannelContext.d.ts","sourceRoot":"","sources":["../src/remoteChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EACH,QAAQ,EAER,sBAAsB,EAEzB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E,OAAO,EACH,yBAAyB,EACzB,aAAa,EAChB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACH,2BAA2B,EAC3B,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAE7B,gBAAgB,EAEhB,iBAAiB,EACpB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAGH,eAAe,EAElB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,qBAAa,oBAAqB,YAAW,eAAe;IAepD,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAKjC,OAAO,CAAC,QAAQ,CAAC,EAAE;IAEnB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAIzB,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC;IA1BvC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAA+C;IAC9D,OAAO,CAAC,QAAQ,CAAgC;IAChD,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,QAAQ,CAA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AAE,OAAc,EAC1B,gBAAgB,CAAC,EAAE,iBAAiB,GACrC,OAAO,CAAC,gBAAgB,CAAC;YAId,iBAAiB;YAUjB,WAAW;IA8GzB;;;;;;OAMG;IACU,SAAS,CAAC,MAAM,GAAE,OAAe,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAIhF;;;;OAIG;YACW,iBAAiB;IAKxB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE;CAS/C"}
|
|
@@ -189,7 +189,7 @@ export class RemoteChannelContext {
|
|
|
189
189
|
const channel = await this.getChannel();
|
|
190
190
|
return channel.getGCData(fullGC);
|
|
191
191
|
}
|
|
192
|
-
updateUsedRoutes(usedRoutes
|
|
192
|
+
updateUsedRoutes(usedRoutes) {
|
|
193
193
|
/**
|
|
194
194
|
* Currently, DDSes are always considered referenced and are not garbage collected. Update the summarizer node's
|
|
195
195
|
* used routes to contain a route to this channel context.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteChannelContext.js","sourceRoot":"","sources":["../src/remoteChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAStE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAe5D,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAClG,OAAO,EACH,iBAAiB,EACjB,sBAAsB,EAEtB,qBAAqB,GACxB,MAAM,kBAAkB,CAAC;AAK1B,MAAM,OAAO,oBAAoB;IAc7B,YACqB,OAA+B,EAC/B,gBAAwC,EACzD,cAAuC,EACvC,QAA0D,EAC1D,OAAkC,EAClC,0BAA2F,EAC1E,EAAU,EAC3B,YAA2B,EACV,QAA+B,EAChD,UAAoD,EACpD,oBAAiD,EACjD,gBAA8D,EAC7C,iBAA0B;QAZ1B,YAAO,G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* Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert } from \"@fluidframework/common-utils\";\nimport { DataCorruptionError } from \"@fluidframework/container-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n IChannel,\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport {\n ISequencedDocumentMessage,\n ISnapshotTree,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n CreateChildSummarizerNodeFn,\n IFluidDataStoreContext,\n IGarbageCollectionData,\n IGarbageCollectionDetailsBase,\n ISummarizeInternalResult,\n ISummarizeResult,\n ISummarizerNodeWithGC,\n ITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { ChildLogger, TelemetryDataTag, ThresholdCounter } from \"@fluidframework/telemetry-utils\";\nimport {\n attributesBlobKey,\n createServiceEndpoints,\n IChannelContext,\n summarizeChannelAsync,\n} from \"./channelContext\";\nimport { ChannelDeltaConnection } from \"./channelDeltaConnection\";\nimport { ChannelStorageService } from \"./channelStorageService\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime\";\n\nexport class RemoteChannelContext implements IChannelContext {\n private isLoaded = false;\n private pending: ISequencedDocumentMessage[] | undefined = [];\n private channelP: Promise<IChannel> | undefined;\n private channel: IChannel | undefined;\n private readonly services: {\n readonly deltaConnection: ChannelDeltaConnection;\n readonly objectStorage: ChannelStorageService;\n };\n private readonly summarizerNode: ISummarizerNodeWithGC;\n private readonly subLogger: ITelemetryLogger;\n private readonly thresholdOpsCounter: ThresholdCounter;\n private static readonly pendingOpsCountThreshold = 1000;\n\n constructor(\n private readonly runtime: IFluidDataStoreRuntime,\n private readonly dataStoreContext: IFluidDataStoreContext,\n storageService: IDocumentStorageService,\n submitFn: (content: any, localOpMetadata: unknown) => void,\n dirtyFn: (address: string) => void,\n addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n private readonly id: string,\n baseSnapshot: ISnapshotTree,\n private readonly registry: ISharedObjectRegistry,\n extraBlobs: Map<string, ArrayBufferLike> | undefined,\n createSummarizerNode: CreateChildSummarizerNodeFn,\n getBaseGCDetails: () => Promise<IGarbageCollectionDetailsBase>,\n private readonly attachMessageType?: string,\n ) {\n assert(!this.id.includes(\"/\"), 0x310 /* Channel context ID cannot contain slashes */);\n\n this.subLogger = ChildLogger.create(this.runtime.logger, \"RemoteChannelContext\");\n\n this.services = createServiceEndpoints(\n this.id,\n this.dataStoreContext.connected,\n submitFn,\n () => dirtyFn(this.id),\n addedGCOutboundReferenceFn,\n storageService,\n this.subLogger,\n baseSnapshot,\n extraBlobs);\n\n const thisSummarizeInternal =\n async (fullTree: boolean, trackState: boolean, telemetryContext?: ITelemetryContext) =>\n this.summarizeInternal(fullTree, trackState, telemetryContext);\n\n this.summarizerNode = createSummarizerNode(\n thisSummarizeInternal,\n async (fullGC?: boolean) => this.getGCDataInternal(fullGC),\n async () => getBaseGCDetails(),\n );\n\n this.thresholdOpsCounter = new ThresholdCounter(\n RemoteChannelContext.pendingOpsCountThreshold,\n this.subLogger,\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n public getChannel(): Promise<IChannel> {\n if (this.channelP === undefined) {\n this.channelP = this.loadChannel();\n }\n\n return this.channelP;\n }\n\n public setConnectionState(connected: boolean, clientId?: string) {\n // Connection events are ignored if the data store is not yet loaded\n if (!this.isLoaded) {\n return;\n }\n\n this.services.deltaConnection.setConnectionState(connected);\n }\n\n public applyStashedOp(message: ISequencedDocumentMessage): unknown {\n assert(this.isLoaded, 0x194 /* \"Remote channel must be loaded when rebasing op\" */);\n return this.services.deltaConnection.applyStashedOp(message);\n }\n\n public processOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n this.summarizerNode.invalidate(message.sequenceNumber);\n\n if (this.isLoaded) {\n this.services.deltaConnection.process(message, local, localOpMetadata);\n } else {\n assert(!local, 0x195 /* \"Remote channel must not be local when processing op\" */);\n assert(this.pending !== undefined, 0x23e /* \"pending is undefined\" */);\n this.pending.push(message);\n this.thresholdOpsCounter.sendIfMultiple(\"StorePendingOps\", this.pending.length);\n }\n }\n\n public reSubmit(content: any, localOpMetadata: unknown) {\n assert(this.isLoaded, 0x196 /* \"Remote channel must be loaded when resubmitting op\" */);\n\n this.services.deltaConnection.reSubmit(content, localOpMetadata);\n }\n\n public rollback(content: any, localOpMetadata: unknown) {\n assert(this.isLoaded, 0x2f0 /* \"Remote channel must be loaded when rolling back op\" */);\n\n this.services.deltaConnection.rollback(content, localOpMetadata);\n }\n\n /**\n * Returns a summary at the current sequence number.\n * @param fullTree - true to bypass optimizations and force a full summary tree\n * @param trackState - This tells whether we should track state from this summary.\n * @param telemetryContext - summary data passed through the layers for telemetry purposes\n */\n public async summarize(\n fullTree: boolean = false,\n trackState: boolean = true,\n telemetryContext?: ITelemetryContext,\n ): Promise<ISummarizeResult> {\n return this.summarizerNode.summarize(fullTree, trackState, telemetryContext);\n }\n\n private async summarizeInternal(\n fullTree: boolean,\n trackState: boolean,\n telemetryContext?: ITelemetryContext,\n ): Promise<ISummarizeInternalResult> {\n const channel = await this.getChannel();\n const summarizeResult = await summarizeChannelAsync(channel, fullTree, trackState, telemetryContext);\n return { ...summarizeResult, id: this.id };\n }\n\n private async loadChannel(): Promise<IChannel> {\n assert(!this.isLoaded, 0x197 /* \"Remote channel must not already be loaded when loading\" */);\n\n let attributes: IChannelAttributes | undefined;\n if (await this.services.objectStorage.contains(attributesBlobKey)) {\n attributes = await readAndParse<IChannelAttributes | undefined>(\n this.services.objectStorage,\n attributesBlobKey);\n }\n\n let factory: IChannelFactory | undefined;\n // this is a backward compatibility case where\n // the attach message doesn't include\n // the attributes. Since old attach messages\n // will not have attributes we need to keep\n // this as long as we support old attach messages\n if (attributes === undefined) {\n if (this.attachMessageType === undefined) {\n // TODO: dataStoreId may require a different tag from PackageData #7488\n throw new DataCorruptionError(\"channelTypeNotAvailable\", {\n channelId: {\n value: this.id,\n tag: TelemetryDataTag.CodeArtifact,\n },\n dataStoreId: {\n value: this.dataStoreContext.id,\n tag: TelemetryDataTag.CodeArtifact,\n },\n dataStorePackagePath: this.dataStoreContext.packagePath.join(\"/\"),\n });\n }\n factory = this.registry.get(this.attachMessageType);\n if (factory === undefined) {\n // TODO: dataStoreId may require a different tag from PackageData #7488\n throw new DataCorruptionError(\"channelFactoryNotRegisteredForAttachMessageType\", {\n channelId: {\n value: this.id,\n tag: TelemetryDataTag.CodeArtifact,\n },\n dataStoreId: {\n value: this.dataStoreContext.id,\n tag: TelemetryDataTag.CodeArtifact,\n },\n dataStorePackagePath: this.dataStoreContext.packagePath.join(\"/\"),\n channelFactoryType: this.attachMessageType,\n });\n }\n attributes = factory.attributes;\n } else {\n factory = this.registry.get(attributes.type);\n if (factory === undefined) {\n // TODO: dataStoreId may require a different tag from PackageData #7488\n throw new DataCorruptionError(\"channelFactoryNotRegisteredForGivenType\", {\n channelId: {\n value: this.id,\n tag: TelemetryDataTag.CodeArtifact,\n },\n dataStoreId: {\n value: this.dataStoreContext.id,\n tag: TelemetryDataTag.CodeArtifact,\n },\n dataStorePackagePath: this.dataStoreContext.packagePath.join(\"/\"),\n channelFactoryType: attributes.type,\n });\n }\n }\n\n // Compare snapshot version to collaborative object version\n if (attributes.snapshotFormatVersion !== undefined\n && attributes.snapshotFormatVersion !== factory.attributes.snapshotFormatVersion) {\n this.subLogger.sendTelemetryEvent(\n {\n eventName: \"ChannelAttributesVersionMismatch\",\n channelType: { value: attributes.type, tag: TelemetryDataTag.CodeArtifact },\n channelSnapshotVersion: {\n value: `${attributes.snapshotFormatVersion}@${attributes.packageVersion}`,\n tag: TelemetryDataTag.CodeArtifact,\n },\n channelCodeVersion: {\n value: `${factory.attributes.snapshotFormatVersion}@${factory.attributes.packageVersion}`,\n tag: TelemetryDataTag.CodeArtifact,\n },\n },\n );\n }\n\n const channel = await factory.load(\n this.runtime,\n this.id,\n this.services,\n attributes);\n\n // Send all pending messages to the channel\n assert(this.pending !== undefined, 0x23f /* \"pending undefined\" */);\n for (const message of this.pending) {\n this.services.deltaConnection.process(message, false, undefined /* localOpMetadata */);\n }\n this.thresholdOpsCounter.send(\"ProcessPendingOps\", this.pending.length);\n\n // Commit changes.\n this.channel = channel;\n this.pending = undefined;\n this.isLoaded = true;\n\n // Because have some await between we created the service and here, the connection state might have changed\n // and we don't propagate the connection state when we are not loaded. So we have to set it again here.\n this.services.deltaConnection.setConnectionState(this.dataStoreContext.connected);\n return this.channel;\n }\n\n /**\n * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n * Each node has a set of outbound routes to other GC nodes in the document.\n * If there is no new data in this context since the last summary, previous GC data is used.\n * If there is new data, the GC data is generated again (by calling getGCDataInternal).\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n public async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n return this.summarizerNode.getGCData(fullGC);\n }\n\n /**\n * Generates the data used for garbage collection. This is called when there is new data since last summary. It\n * loads the context and calls into the channel to get its GC data.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n private async getGCDataInternal(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n const channel = await this.getChannel();\n return channel.getGCData(fullGC);\n }\n\n public updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number) {\n /**\n * Currently, DDSes are always considered referenced and are not garbage collected. Update the summarizer node's\n * used routes to contain a route to this channel context.\n * Once we have GC at DDS level, this will be updated to use the passed usedRoutes. See -\n * https://github.com/microsoft/FluidFramework/issues/4611\n */\n this.summarizerNode.updateUsedRoutes([\"\"]);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"remoteChannelContext.js","sourceRoot":"","sources":["../src/remoteChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;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AC,OAAO,CAAC;IACxB,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,SAAS,CAAC,SAAkB,KAAK;QAC1C,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;IAED;;;;OAIG;IACK,KAAK,CAAC,iBAAiB,CAAC,SAAkB,KAAK;QACnD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,OAAO,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAEM,gBAAgB,CAAC,UAAoB;QACxC;;;;;WAKG;QACH,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC;;AAnQuB,6CAAwB,GAAG,IAAI,CAAC","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 { assert } from \"@fluidframework/common-utils\";\nimport { DataCorruptionError } from \"@fluidframework/container-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n IChannel,\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport {\n ISequencedDocumentMessage,\n ISnapshotTree,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n CreateChildSummarizerNodeFn,\n IFluidDataStoreContext,\n IGarbageCollectionData,\n IGarbageCollectionDetailsBase,\n ISummarizeInternalResult,\n ISummarizeResult,\n ISummarizerNodeWithGC,\n ITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { ChildLogger, TelemetryDataTag, ThresholdCounter } from \"@fluidframework/telemetry-utils\";\nimport {\n attributesBlobKey,\n createServiceEndpoints,\n IChannelContext,\n summarizeChannelAsync,\n} from \"./channelContext\";\nimport { ChannelDeltaConnection } from \"./channelDeltaConnection\";\nimport { ChannelStorageService } from \"./channelStorageService\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime\";\n\nexport class RemoteChannelContext implements IChannelContext {\n private isLoaded = false;\n private pending: ISequencedDocumentMessage[] | undefined = [];\n private channelP: Promise<IChannel> | undefined;\n private channel: IChannel | undefined;\n private readonly services: {\n readonly deltaConnection: ChannelDeltaConnection;\n readonly objectStorage: ChannelStorageService;\n };\n private readonly summarizerNode: ISummarizerNodeWithGC;\n private readonly subLogger: ITelemetryLogger;\n private readonly thresholdOpsCounter: ThresholdCounter;\n private static readonly pendingOpsCountThreshold = 1000;\n\n constructor(\n private readonly runtime: IFluidDataStoreRuntime,\n private readonly dataStoreContext: IFluidDataStoreContext,\n storageService: IDocumentStorageService,\n submitFn: (content: any, localOpMetadata: unknown) => void,\n dirtyFn: (address: string) => void,\n addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n private readonly id: string,\n baseSnapshot: ISnapshotTree,\n private readonly registry: ISharedObjectRegistry,\n extraBlobs: Map<string, ArrayBufferLike> | undefined,\n createSummarizerNode: CreateChildSummarizerNodeFn,\n getBaseGCDetails: () => Promise<IGarbageCollectionDetailsBase>,\n private readonly attachMessageType?: string,\n ) {\n assert(!this.id.includes(\"/\"), 0x310 /* Channel context ID cannot contain slashes */);\n\n this.subLogger = ChildLogger.create(this.runtime.logger, \"RemoteChannelContext\");\n\n this.services = createServiceEndpoints(\n this.id,\n this.dataStoreContext.connected,\n submitFn,\n () => dirtyFn(this.id),\n addedGCOutboundReferenceFn,\n storageService,\n this.subLogger,\n baseSnapshot,\n extraBlobs);\n\n const thisSummarizeInternal =\n async (fullTree: boolean, trackState: boolean, telemetryContext?: ITelemetryContext) =>\n this.summarizeInternal(fullTree, trackState, telemetryContext);\n\n this.summarizerNode = createSummarizerNode(\n thisSummarizeInternal,\n async (fullGC?: boolean) => this.getGCDataInternal(fullGC),\n async () => getBaseGCDetails(),\n );\n\n this.thresholdOpsCounter = new ThresholdCounter(\n RemoteChannelContext.pendingOpsCountThreshold,\n this.subLogger,\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n public getChannel(): Promise<IChannel> {\n if (this.channelP === undefined) {\n this.channelP = this.loadChannel();\n }\n\n return this.channelP;\n }\n\n public setConnectionState(connected: boolean, clientId?: string) {\n // Connection events are ignored if the data store is not yet loaded\n if (!this.isLoaded) {\n return;\n }\n\n this.services.deltaConnection.setConnectionState(connected);\n }\n\n public applyStashedOp(message: ISequencedDocumentMessage): unknown {\n assert(this.isLoaded, 0x194 /* \"Remote channel must be loaded when rebasing op\" */);\n return this.services.deltaConnection.applyStashedOp(message);\n }\n\n public processOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n this.summarizerNode.invalidate(message.sequenceNumber);\n\n if (this.isLoaded) {\n this.services.deltaConnection.process(message, local, localOpMetadata);\n } else {\n assert(!local, 0x195 /* \"Remote channel must not be local when processing op\" */);\n assert(this.pending !== undefined, 0x23e /* \"pending is undefined\" */);\n this.pending.push(message);\n this.thresholdOpsCounter.sendIfMultiple(\"StorePendingOps\", this.pending.length);\n }\n }\n\n public reSubmit(content: any, localOpMetadata: unknown) {\n assert(this.isLoaded, 0x196 /* \"Remote channel must be loaded when resubmitting op\" */);\n\n this.services.deltaConnection.reSubmit(content, localOpMetadata);\n }\n\n public rollback(content: any, localOpMetadata: unknown) {\n assert(this.isLoaded, 0x2f0 /* \"Remote channel must be loaded when rolling back op\" */);\n\n this.services.deltaConnection.rollback(content, localOpMetadata);\n }\n\n /**\n * Returns a summary at the current sequence number.\n * @param fullTree - true to bypass optimizations and force a full summary tree\n * @param trackState - This tells whether we should track state from this summary.\n * @param telemetryContext - summary data passed through the layers for telemetry purposes\n */\n public async summarize(\n fullTree: boolean = false,\n trackState: boolean = true,\n telemetryContext?: ITelemetryContext,\n ): Promise<ISummarizeResult> {\n return this.summarizerNode.summarize(fullTree, trackState, telemetryContext);\n }\n\n private async summarizeInternal(\n fullTree: boolean,\n trackState: boolean,\n telemetryContext?: ITelemetryContext,\n ): Promise<ISummarizeInternalResult> {\n const channel = await this.getChannel();\n const summarizeResult = await summarizeChannelAsync(channel, fullTree, trackState, telemetryContext);\n return { ...summarizeResult, id: this.id };\n }\n\n private async loadChannel(): Promise<IChannel> {\n assert(!this.isLoaded, 0x197 /* \"Remote channel must not already be loaded when loading\" */);\n\n let attributes: IChannelAttributes | undefined;\n if (await this.services.objectStorage.contains(attributesBlobKey)) {\n attributes = await readAndParse<IChannelAttributes | undefined>(\n this.services.objectStorage,\n attributesBlobKey);\n }\n\n let factory: IChannelFactory | undefined;\n // this is a backward compatibility case where\n // the attach message doesn't include\n // the attributes. Since old attach messages\n // will not have attributes we need to keep\n // this as long as we support old attach messages\n if (attributes === undefined) {\n if (this.attachMessageType === undefined) {\n // TODO: dataStoreId may require a different tag from PackageData #7488\n throw new DataCorruptionError(\"channelTypeNotAvailable\", {\n channelId: {\n value: this.id,\n tag: TelemetryDataTag.CodeArtifact,\n },\n dataStoreId: {\n value: this.dataStoreContext.id,\n tag: TelemetryDataTag.CodeArtifact,\n },\n dataStorePackagePath: this.dataStoreContext.packagePath.join(\"/\"),\n });\n }\n factory = this.registry.get(this.attachMessageType);\n if (factory === undefined) {\n // TODO: dataStoreId may require a different tag from PackageData #7488\n throw new DataCorruptionError(\"channelFactoryNotRegisteredForAttachMessageType\", {\n channelId: {\n value: this.id,\n tag: TelemetryDataTag.CodeArtifact,\n },\n dataStoreId: {\n value: this.dataStoreContext.id,\n tag: TelemetryDataTag.CodeArtifact,\n },\n dataStorePackagePath: this.dataStoreContext.packagePath.join(\"/\"),\n channelFactoryType: this.attachMessageType,\n });\n }\n attributes = factory.attributes;\n } else {\n factory = this.registry.get(attributes.type);\n if (factory === undefined) {\n // TODO: dataStoreId may require a different tag from PackageData #7488\n throw new DataCorruptionError(\"channelFactoryNotRegisteredForGivenType\", {\n channelId: {\n value: this.id,\n tag: TelemetryDataTag.CodeArtifact,\n },\n dataStoreId: {\n value: this.dataStoreContext.id,\n tag: TelemetryDataTag.CodeArtifact,\n },\n dataStorePackagePath: this.dataStoreContext.packagePath.join(\"/\"),\n channelFactoryType: attributes.type,\n });\n }\n }\n\n // Compare snapshot version to collaborative object version\n if (attributes.snapshotFormatVersion !== undefined\n && attributes.snapshotFormatVersion !== factory.attributes.snapshotFormatVersion) {\n this.subLogger.sendTelemetryEvent(\n {\n eventName: \"ChannelAttributesVersionMismatch\",\n channelType: { value: attributes.type, tag: TelemetryDataTag.CodeArtifact },\n channelSnapshotVersion: {\n value: `${attributes.snapshotFormatVersion}@${attributes.packageVersion}`,\n tag: TelemetryDataTag.CodeArtifact,\n },\n channelCodeVersion: {\n value: `${factory.attributes.snapshotFormatVersion}@${factory.attributes.packageVersion}`,\n tag: TelemetryDataTag.CodeArtifact,\n },\n },\n );\n }\n\n const channel = await factory.load(\n this.runtime,\n this.id,\n this.services,\n attributes);\n\n // Send all pending messages to the channel\n assert(this.pending !== undefined, 0x23f /* \"pending undefined\" */);\n for (const message of this.pending) {\n this.services.deltaConnection.process(message, false, undefined /* localOpMetadata */);\n }\n this.thresholdOpsCounter.send(\"ProcessPendingOps\", this.pending.length);\n\n // Commit changes.\n this.channel = channel;\n this.pending = undefined;\n this.isLoaded = true;\n\n // Because have some await between we created the service and here, the connection state might have changed\n // and we don't propagate the connection state when we are not loaded. So we have to set it again here.\n this.services.deltaConnection.setConnectionState(this.dataStoreContext.connected);\n return this.channel;\n }\n\n /**\n * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n * Each node has a set of outbound routes to other GC nodes in the document.\n * If there is no new data in this context since the last summary, previous GC data is used.\n * If there is new data, the GC data is generated again (by calling getGCDataInternal).\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n public async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n return this.summarizerNode.getGCData(fullGC);\n }\n\n /**\n * Generates the data used for garbage collection. This is called when there is new data since last summary. It\n * loads the context and calls into the channel to get its GC data.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n private async getGCDataInternal(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n const channel = await this.getChannel();\n return channel.getGCData(fullGC);\n }\n\n public updateUsedRoutes(usedRoutes: string[]) {\n /**\n * Currently, DDSes are always considered referenced and are not garbage collected. Update the summarizer node's\n * used routes to contain a route to this channel context.\n * Once we have GC at DDS level, this will be updated to use the passed usedRoutes. See -\n * https://github.com/microsoft/FluidFramework/issues/4611\n */\n this.summarizerNode.updateUsedRoutes([\"\"]);\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/datastore",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.2.2.0.111723",
|
|
4
4
|
"description": "Fluid data store implementation",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -28,17 +28,19 @@
|
|
|
28
28
|
"clean": "rimraf dist lib *.tsbuildinfo *.build.log",
|
|
29
29
|
"eslint": "eslint --format stylish src",
|
|
30
30
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
31
|
+
"format": "npm run prettier:fix",
|
|
31
32
|
"lint": "npm run eslint",
|
|
32
33
|
"lint:fix": "npm run eslint:fix",
|
|
34
|
+
"prettier": "prettier --check . --ignore-path ../../../.prettierignore",
|
|
35
|
+
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
|
|
33
36
|
"test": "npm run test:mocha",
|
|
34
37
|
"test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
|
|
35
38
|
"test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test --exit -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
|
|
36
39
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
37
40
|
"tsc": "tsc",
|
|
38
41
|
"tsc:watch": "tsc --watch",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"typetests:gen": "fluid-type-validator -g -d ."
|
|
42
|
+
"typetests:gen": "flub generate typetests --generate --dir .",
|
|
43
|
+
"typetests:prepare": "flub generate typetests --prepare --dir . --pin"
|
|
42
44
|
},
|
|
43
45
|
"nyc": {
|
|
44
46
|
"all": true,
|
|
@@ -63,28 +65,29 @@
|
|
|
63
65
|
"dependencies": {
|
|
64
66
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
65
67
|
"@fluidframework/common-utils": "^1.0.0",
|
|
66
|
-
"@fluidframework/container-definitions": "2.0.0-dev.
|
|
67
|
-
"@fluidframework/container-utils": "2.0.0-dev.
|
|
68
|
-
"@fluidframework/core-interfaces": "2.0.0-dev.
|
|
69
|
-
"@fluidframework/datastore-definitions": "2.0.0-dev.
|
|
70
|
-
"@fluidframework/driver-definitions": "2.0.0-dev.
|
|
71
|
-
"@fluidframework/driver-utils": "2.0.0-dev.
|
|
72
|
-
"@fluidframework/garbage-collector": "2.0.0-dev.
|
|
73
|
-
"@fluidframework/protocol-base": "^0.
|
|
74
|
-
"@fluidframework/protocol-definitions": "^1.
|
|
75
|
-
"@fluidframework/runtime-definitions": "2.0.0-dev.
|
|
76
|
-
"@fluidframework/runtime-utils": "2.0.0-dev.
|
|
77
|
-
"@fluidframework/telemetry-utils": "2.0.0-dev.
|
|
68
|
+
"@fluidframework/container-definitions": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
69
|
+
"@fluidframework/container-utils": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
70
|
+
"@fluidframework/core-interfaces": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
71
|
+
"@fluidframework/datastore-definitions": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
72
|
+
"@fluidframework/driver-definitions": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
73
|
+
"@fluidframework/driver-utils": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
74
|
+
"@fluidframework/garbage-collector": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
75
|
+
"@fluidframework/protocol-base": "^0.1038.2000",
|
|
76
|
+
"@fluidframework/protocol-definitions": "^1.1.0",
|
|
77
|
+
"@fluidframework/runtime-definitions": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
78
|
+
"@fluidframework/runtime-utils": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
79
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
78
80
|
"lodash": "^4.17.21",
|
|
79
81
|
"uuid": "^8.3.1"
|
|
80
82
|
},
|
|
81
83
|
"devDependencies": {
|
|
82
|
-
"@
|
|
83
|
-
"@fluidframework/build-
|
|
84
|
-
"@fluidframework/
|
|
85
|
-
"@fluidframework/
|
|
86
|
-
"@fluidframework/
|
|
87
|
-
"@fluidframework/test-
|
|
84
|
+
"@fluid-tools/build-cli": "^0.6.0-109663",
|
|
85
|
+
"@fluidframework/build-common": "^1.1.0",
|
|
86
|
+
"@fluidframework/build-tools": "^0.6.0-109663",
|
|
87
|
+
"@fluidframework/datastore-previous": "npm:@fluidframework/datastore@2.0.0-internal.2.1.0",
|
|
88
|
+
"@fluidframework/eslint-config-fluid": "^1.2.0",
|
|
89
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
90
|
+
"@fluidframework/test-runtime-utils": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
88
91
|
"@microsoft/api-extractor": "^7.22.2",
|
|
89
92
|
"@rushstack/eslint-config": "^2.5.1",
|
|
90
93
|
"@types/mocha": "^9.1.1",
|
|
@@ -96,12 +99,14 @@
|
|
|
96
99
|
"eslint": "~8.6.0",
|
|
97
100
|
"mocha": "^10.0.0",
|
|
98
101
|
"nyc": "^15.0.0",
|
|
102
|
+
"prettier": "~2.6.2",
|
|
99
103
|
"rimraf": "^2.6.2",
|
|
100
|
-
"typescript": "~4.5.5"
|
|
101
|
-
"typescript-formatter": "7.1.0"
|
|
104
|
+
"typescript": "~4.5.5"
|
|
102
105
|
},
|
|
103
106
|
"typeValidation": {
|
|
104
|
-
"version": "2.0.0",
|
|
107
|
+
"version": "2.0.0-internal.2.2.0",
|
|
108
|
+
"baselineRange": ">=2.0.0-internal.2.1.0 <2.0.0-internal.2.2.0",
|
|
109
|
+
"baselineVersion": "2.0.0-internal.2.1.0",
|
|
105
110
|
"broken": {}
|
|
106
111
|
}
|
|
107
112
|
}
|
package/src/channelContext.ts
CHANGED
|
@@ -51,9 +51,8 @@ export interface IChannelContext {
|
|
|
51
51
|
* 1. To identify if this context is being referenced in the document or not.
|
|
52
52
|
* 2. To identify if this context or any of its children's used routes changed since last summary.
|
|
53
53
|
* 3. They are added to the summary generated by this context.
|
|
54
|
-
* 4. To update the timestamp when this context is marked as unreferenced.
|
|
55
54
|
*/
|
|
56
|
-
updateUsedRoutes(usedRoutes: string[]
|
|
55
|
+
updateUsedRoutes(usedRoutes: string[]): void;
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
export function createServiceEndpoints(
|