@fluidframework/shared-object-base 2.0.0-internal.6.2.0 → 2.0.0-internal.6.3.1
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 +4 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/remoteObjectHandle.js +2 -2
- package/dist/remoteObjectHandle.js.map +1 -1
- package/dist/sharedObject.d.ts +1 -1
- package/dist/sharedObject.d.ts.map +1 -1
- package/dist/sharedObject.js +7 -7
- package/dist/sharedObject.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/remoteObjectHandle.js +1 -1
- package/lib/remoteObjectHandle.js.map +1 -1
- package/lib/sharedObject.d.ts +1 -1
- package/lib/sharedObject.d.ts.map +1 -1
- package/lib/sharedObject.js +1 -1
- package/lib/sharedObject.js.map +1 -1
- package/package.json +21 -22
- package/src/packageVersion.ts +1 -1
- package/src/remoteObjectHandle.ts +1 -1
- package/src/sharedObject.ts +2 -1
package/CHANGELOG.md
CHANGED
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/shared-object-base";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-internal.6.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.6.3.1";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/shared-object-base";
|
|
11
|
-
exports.pkgVersion = "2.0.0-internal.6.
|
|
11
|
+
exports.pkgVersion = "2.0.0-internal.6.3.1";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,oCAAoC,CAAC;AAC/C,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/shared-object-base\";\nexport const pkgVersion = \"2.0.0-internal.6.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,oCAAoC,CAAC;AAC/C,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/shared-object-base\";\nexport const pkgVersion = \"2.0.0-internal.6.3.1\";\n"]}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.RemoteFluidObjectHandle = void 0;
|
|
8
|
-
const
|
|
8
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
9
9
|
const container_runtime_1 = require("@fluidframework/container-runtime");
|
|
10
10
|
const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
11
11
|
/**
|
|
@@ -25,7 +25,7 @@ class RemoteFluidObjectHandle {
|
|
|
25
25
|
this.absolutePath = absolutePath;
|
|
26
26
|
this.routeContext = routeContext;
|
|
27
27
|
this.isAttached = true;
|
|
28
|
-
(0,
|
|
28
|
+
(0, core_utils_1.assert)(absolutePath.startsWith("/"), 0x19d /* "Handles should always have absolute paths" */);
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteObjectHandle.js","sourceRoot":"","sources":["../src/remoteObjectHandle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH
|
|
1
|
+
{"version":3,"file":"remoteObjectHandle.js","sourceRoot":"","sources":["../src/remoteObjectHandle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AACpD,yEAAmE;AASnE,iEAIuC;AAEvC;;;;;;GAMG;AACH,MAAa,uBAAuB;IAiBnC;;;;OAIG;IACH,YACiB,YAAoB,EACpB,YAAiC;QADjC,iBAAY,GAAZ,YAAY,CAAQ;QACpB,iBAAY,GAAZ,YAAY,CAAqB;QAVlC,eAAU,GAAG,IAAI,CAAC;QAYjC,IAAA,mBAAM,EACL,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAC5B,KAAK,CAAC,iDAAiD,CACvD,CAAC;IACH,CAAC;IA7BD;;OAEG;IACH,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IACD,IAAW,mBAAmB;QAC7B,OAAO,IAAI,CAAC;IACb,CAAC;IACD,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IAoBM,KAAK,CAAC,GAAG;QACf,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE;YAC/B,6EAA6E;YAC7E,MAAM,OAAO,GAAa;gBACzB,GAAG,EAAE,IAAI,CAAC,YAAY;gBACtB,OAAO,EAAE,EAAE,CAAC,kCAAc,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE;aAC7C,CAAC;YACF,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,YAAY;iBAC9B,aAAa,CAAC,OAAO,CAAC;iBACtB,IAAI,CAAc,CAAC,QAAQ,EAAE,EAAE;gBAC/B,IAAI,QAAQ,CAAC,QAAQ,KAAK,cAAc,EAAE;oBACzC,MAAM,WAAW,GAAgB,QAAQ,CAAC,KAAK,CAAC;oBAChD,OAAO,WAAW,CAAC;iBACnB;gBACD,MAAM,IAAA,mCAAmB,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;SACJ;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAEM,WAAW;QACjB,OAAO;IACR,CAAC;IAEM,IAAI,CAAC,MAAoB;QAC/B,MAAM,CAAC,WAAW,EAAE,CAAC;IACtB,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,OAAO,CAAC,OAAiB;QACrC,IAAI;YACH,MAAM,MAAM,GAA8B,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;YAC3D,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC;YAEnC,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAA,iCAAiB,EAAC,OAAO,CAAC,CAAC;SACnF;QAAC,OAAO,KAAK,EAAE;YACf,OAAO,IAAA,mCAAmB,EAAC,KAAK,CAAC,CAAC;SAClC;IACF,CAAC;CACD;AAzED,0DAyEC","sourcesContent":["/*!\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 { RuntimeHeaders } from \"@fluidframework/container-runtime\";\nimport {\n\tIFluidHandle,\n\tIFluidHandleContext,\n\tIRequest,\n\tIResponse,\n\tFluidObject,\n\tIFluidRouter,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tcreate404Response,\n\texceptionToResponse,\n\tresponseToException,\n} from \"@fluidframework/runtime-utils\";\n\n/**\n * This handle is used to dynamically load a Fluid object on a remote client and is created on parsing a serialized\n * FluidObjectHandle.\n * This class is used to generate an IFluidHandle when de-serializing any all handles (including handles to DDSes,\n * custom objects) that are stored in SharedObjects. The Data Store or SharedObject corresponding to the\n * IFluidHandle can be retrieved by calling `get` on it.\n */\nexport class RemoteFluidObjectHandle implements IFluidHandle {\n\t/**\n\t * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t */\n\tpublic get IFluidRouter() {\n\t\treturn this;\n\t}\n\tpublic get IFluidHandleContext() {\n\t\treturn this;\n\t}\n\tpublic get IFluidHandle() {\n\t\treturn this;\n\t}\n\n\tpublic readonly isAttached = true;\n\tprivate objectP: Promise<FluidObject> | undefined;\n\n\t/**\n\t * Creates a new RemoteFluidObjectHandle when parsing an IFluidHandle.\n\t * @param absolutePath - The absolute path to the handle from the container runtime.\n\t * @param routeContext - The root IFluidHandleContext that has a route to this handle.\n\t */\n\tconstructor(\n\t\tpublic readonly absolutePath: string,\n\t\tpublic readonly routeContext: IFluidHandleContext,\n\t) {\n\t\tassert(\n\t\t\tabsolutePath.startsWith(\"/\"),\n\t\t\t0x19d /* \"Handles should always have absolute paths\" */,\n\t\t);\n\t}\n\n\tpublic async get(): Promise<any> {\n\t\tif (this.objectP === undefined) {\n\t\t\t// Add `viaHandle` header to distinguish from requests from non-handle paths.\n\t\t\tconst request: IRequest = {\n\t\t\t\turl: this.absolutePath,\n\t\t\t\theaders: { [RuntimeHeaders.viaHandle]: true },\n\t\t\t};\n\t\t\tthis.objectP = this.routeContext\n\t\t\t\t.resolveHandle(request)\n\t\t\t\t.then<FluidObject>((response) => {\n\t\t\t\t\tif (response.mimeType === \"fluid/object\") {\n\t\t\t\t\t\tconst fluidObject: FluidObject = response.value;\n\t\t\t\t\t\treturn fluidObject;\n\t\t\t\t\t}\n\t\t\t\t\tthrow responseToException(response, request);\n\t\t\t\t});\n\t\t}\n\t\treturn this.objectP;\n\t}\n\n\tpublic attachGraph(): void {\n\t\treturn;\n\t}\n\n\tpublic bind(handle: IFluidHandle): void {\n\t\thandle.attachGraph();\n\t}\n\n\t/**\n\t * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t */\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\ttry {\n\t\t\tconst object: FluidObject<IFluidRouter> = await this.get();\n\t\t\tconst router = object.IFluidRouter;\n\n\t\t\treturn router !== undefined ? router.request(request) : create404Response(request);\n\t\t} catch (error) {\n\t\t\treturn exceptionToResponse(error);\n\t\t}\n\t}\n}\n"]}
|
package/dist/sharedObject.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { ITelemetryLoggerExt, EventEmitterWithErrorHandling } from "@fluidframework/telemetry-utils";
|
|
7
|
-
import { EventEmitterEventType } from "@
|
|
7
|
+
import { EventEmitterEventType } from "@fluid-internal/client-utils";
|
|
8
8
|
import { IChannelAttributes, IFluidDataStoreRuntime, IChannelStorageService, IChannelServices } from "@fluidframework/datastore-definitions";
|
|
9
9
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
10
10
|
import { IGarbageCollectionData, ISummaryTreeWithStats, ITelemetryContext, IExperimentalIncrementalSummaryContext } from "@fluidframework/runtime-definitions";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedObject.d.ts","sourceRoot":"","sources":["../src/sharedObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAwB,MAAM,iCAAiC,CAAC;AACrF,OAAO,EACN,mBAAmB,EAGnB,6BAA6B,EAK7B,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"sharedOb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|
exports.SharedObject = exports.SharedObjectCore = void 0;
|
|
8
8
|
const uuid_1 = require("uuid");
|
|
9
9
|
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
10
|
-
const
|
|
10
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
11
11
|
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
12
12
|
const runtime_definitions_1 = require("@fluidframework/runtime-definitions");
|
|
13
13
|
const serializer_1 = require("./serializer");
|
|
@@ -35,7 +35,7 @@ class SharedObjectCore extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
35
35
|
* True if the dds is bound to its parent.
|
|
36
36
|
*/
|
|
37
37
|
this._isBoundToContext = false;
|
|
38
|
-
(0,
|
|
38
|
+
(0, core_utils_1.assert)(!id.includes("/"), 0x304 /* Id cannot contain slashes */);
|
|
39
39
|
this.handle = new handle_1.SharedObjectHandle(this, id, runtime.IFluidHandleContext);
|
|
40
40
|
this.logger = (0, telemetry_utils_1.createChildLogger)({
|
|
41
41
|
logger: runtime.logger,
|
|
@@ -69,7 +69,7 @@ class SharedObjectCore extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
69
69
|
* to variables to avoid complaints from TypeScript.
|
|
70
70
|
*/
|
|
71
71
|
setUpSampledTelemetryHelpers() {
|
|
72
|
-
(0,
|
|
72
|
+
(0, core_utils_1.assert)(this.mc !== undefined && this.logger !== undefined, 0x349 /* this.mc and/or this.logger has not been set */);
|
|
73
73
|
const opProcessingHelper = new telemetry_utils_1.SampledTelemetryHelper({
|
|
74
74
|
eventName: "ddsOpProcessing",
|
|
75
75
|
category: "performance",
|
|
@@ -263,7 +263,7 @@ class SharedObjectCore extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
263
263
|
}
|
|
264
264
|
attachDeltaHandler() {
|
|
265
265
|
// Services should already be there in case we are attaching delta handler.
|
|
266
|
-
(0,
|
|
266
|
+
(0, core_utils_1.assert)(this.services !== undefined, 0x07a /* "Services should be there to attach delta handler" */);
|
|
267
267
|
this._isBoundToContext = true;
|
|
268
268
|
// Allows objects to do any custom processing if it is attached.
|
|
269
269
|
this.didAttach();
|
|
@@ -413,7 +413,7 @@ class SharedObject extends SharedObjectCore {
|
|
|
413
413
|
* This is fine for now. However, if we implement delay loading in DDss, they may load and de-serialize content
|
|
414
414
|
* in summarize. When that happens, they may incorrectly hit this assert and we will have to change this.
|
|
415
415
|
*/
|
|
416
|
-
(0,
|
|
416
|
+
(0, core_utils_1.assert)(!this._isGCing, 0x075 /* "SummarySerializer should be used for serializing data during summary." */);
|
|
417
417
|
return this._serializer;
|
|
418
418
|
}
|
|
419
419
|
/**
|
|
@@ -440,7 +440,7 @@ class SharedObject extends SharedObjectCore {
|
|
|
440
440
|
getGCData(fullGC = false) {
|
|
441
441
|
// Set _isGCing to true. This flag is used to ensure that we only use SummarySerializer to serialize handles
|
|
442
442
|
// in this object's data.
|
|
443
|
-
(0,
|
|
443
|
+
(0, core_utils_1.assert)(!this._isGCing, 0x078 /* "Possible re-entrancy! Summary should not already be in progress." */);
|
|
444
444
|
this._isGCing = true;
|
|
445
445
|
let gcData;
|
|
446
446
|
try {
|
|
@@ -449,7 +449,7 @@ class SharedObject extends SharedObjectCore {
|
|
|
449
449
|
// The GC data for this shared object contains a single GC node. The outbound routes of this node are the
|
|
450
450
|
// routes of handles serialized during summarization.
|
|
451
451
|
gcData = { gcNodes: { "/": serializer.getSerializedRoutes() } };
|
|
452
|
-
(0,
|
|
452
|
+
(0, core_utils_1.assert)(this._isGCing, 0x079 /* "Possible re-entrancy! Summary should have been in progress." */);
|
|
453
453
|
}
|
|
454
454
|
finally {
|
|
455
455
|
this._isGCing = false;
|
package/dist/sharedObject.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedObject.js","sourceRoot":"","sources":["../src/sharedObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAAkC;AAElC,qEASyC;AACzC,+DAA6E;AAC7E,iFAAo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AAY,CAAC;YAClF,CAAC,CAAW,CAAC;QACd,gBAAgB,EAAE,GAAG,CAAC,IAAI,CAAC,sBAAsB,EAAE,YAAY,EAAE,SAAS,GAAG,WAAW,CAAC,CAAC;IAC3F,CAAC;CACD;AA/JD,oCA+JC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport { IFluidHandle, ITelemetryProperties } from \"@fluidframework/core-interfaces\";\nimport {\n\tITelemetryLoggerExt,\n\tcreateChildLogger,\n\tDataProcessingError,\n\tEventEmitterWithErrorHandling,\n\tloggerToMonitoringContext,\n\tMonitoringContext,\n\tSampledTelemetryHelper,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils\";\nimport { assert, EventEmitterEventType } from \"@fluidframework/common-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n\tIChannelServices,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIGarbageCollectionData,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\tblobCountPropertyName,\n\ttotalBlobSizePropertyName,\n\tIExperimentalIncrementalSummaryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { FluidSerializer, IFluidSerializer } from \"./serializer\";\nimport { SharedObjectHandle } from \"./handle\";\nimport { SummarySerializer } from \"./summarySerializer\";\nimport { ISharedObject, ISharedObjectEvents } from \"./types\";\n\n/**\n * Base class from which all shared objects derive.\n */\nexport abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISharedObjectEvents>\n\textends EventEmitterWithErrorHandling<TEvent>\n\timplements ISharedObject<TEvent>\n{\n\tpublic get IFluidLoadable() {\n\t\treturn this;\n\t}\n\n\tprivate readonly opProcessingHelper: SampledTelemetryHelper;\n\tprivate readonly callbacksHelper: SampledTelemetryHelper;\n\n\t/**\n\t * The handle referring to this SharedObject\n\t */\n\tpublic readonly handle: IFluidHandle;\n\n\t/**\n\t * Telemetry logger for the shared object\n\t */\n\tprotected readonly logger: ITelemetryLoggerExt;\n\tprivate readonly mc: MonitoringContext;\n\n\t/**\n\t * Connection state\n\t */\n\tprivate _connected = false;\n\n\t/**\n\t * Services used by the shared object\n\t */\n\tprivate services: IChannelServices | undefined;\n\n\t/**\n\t * True if the dds is bound to its parent.\n\t */\n\tprivate _isBoundToContext: boolean = false;\n\n\t/**\n\t * Tracks error that closed this object.\n\t */\n\tprivate closeError?: ReturnType<typeof DataProcessingError.wrapIfUnrecognized>;\n\n\t/**\n\t * Gets the connection state\n\t * @returns The state of the connection\n\t */\n\tpublic get connected(): boolean {\n\t\treturn this._connected;\n\t}\n\n\t/**\n\t * @param id - The id of the shared object\n\t * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n\t * @param attributes - Attributes of the shared object\n\t */\n\tconstructor(\n\t\tpublic id: string,\n\t\tprotected runtime: IFluidDataStoreRuntime,\n\t\tpublic readonly attributes: IChannelAttributes,\n\t) {\n\t\tsuper((event: EventEmitterEventType, e: any) => this.eventListenerErrorHandler(event, e));\n\n\t\tassert(!id.includes(\"/\"), 0x304 /* Id cannot contain slashes */);\n\n\t\tthis.handle = new SharedObjectHandle(this, id, runtime.IFluidHandleContext);\n\n\t\tthis.logger = createChildLogger({\n\t\t\tlogger: runtime.logger,\n\t\t\tproperties: {\n\t\t\t\tall: {\n\t\t\t\t\tsharedObjectId: uuid(),\n\t\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\t\tddsType: this.attributes.type,\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\t\tthis.mc = loggerToMonitoringContext(this.logger);\n\n\t\t[this.opProcessingHelper, this.callbacksHelper] = this.setUpSampledTelemetryHelpers();\n\n\t\tthis.attachListeners();\n\t}\n\n\t/**\n\t * This function is only supposed to be called from SharedObjectCore's constructor and\n\t * depends on a few things being set already. assert() calls make sure of it.\n\t * @returns The telemetry sampling helpers, so the constructor can be the one to assign them\n\t * to variables to avoid complaints from TypeScript.\n\t */\n\tprivate setUpSampledTelemetryHelpers(): SampledTelemetryHelper[] {\n\t\tassert(\n\t\t\tthis.mc !== undefined && this.logger !== undefined,\n\t\t\t0x349 /* this.mc and/or this.logger has not been set */,\n\t\t);\n\t\tconst opProcessingHelper = new SampledTelemetryHelper(\n\t\t\t{\n\t\t\t\teventName: \"ddsOpProcessing\",\n\t\t\t\tcategory: \"performance\",\n\t\t\t},\n\t\t\tthis.logger,\n\t\t\tthis.mc.config.getNumber(\"Fluid.SharedObject.OpProcessingTelemetrySampling\") ?? 1000,\n\t\t\ttrue,\n\t\t\tnew Map<string, ITelemetryProperties>([\n\t\t\t\t[\"local\", { localOp: true }],\n\t\t\t\t[\"remote\", { localOp: false }],\n\t\t\t]),\n\t\t);\n\t\tconst callbacksHelper = new SampledTelemetryHelper(\n\t\t\t{\n\t\t\t\teventName: \"ddsEventCallbacks\",\n\t\t\t\tcategory: \"performance\",\n\t\t\t},\n\t\t\tthis.logger,\n\t\t\tthis.mc.config.getNumber(\"Fluid.SharedObject.DdsCallbacksTelemetrySampling\") ?? 1000,\n\t\t\ttrue,\n\t\t);\n\n\t\tthis.runtime.once(\"dispose\", () => {\n\t\t\tthis.callbacksHelper.dispose();\n\t\t\tthis.opProcessingHelper.dispose();\n\t\t});\n\n\t\treturn [opProcessingHelper, callbacksHelper];\n\t}\n\n\t/**\n\t * Marks this objects as closed. Any attempt to change it (local changes or processing remote ops)\n\t * would result in same error thrown. If called multiple times, only first error is remembered.\n\t * @param error - error object that is thrown whenever an attempt is made to modify this object\n\t */\n\tprivate closeWithError(error: any) {\n\t\tif (this.closeError === undefined) {\n\t\t\tthis.closeError = error;\n\t\t}\n\t}\n\n\t/**\n\t * Verifies that this object is not closed via closeWithError(). If it is, throws an error used to close it.\n\t */\n\tprivate verifyNotClosed() {\n\t\tif (this.closeError !== undefined) {\n\t\t\tthrow this.closeError;\n\t\t}\n\t}\n\n\t/**\n\t * Event listener handler helper that can be used to react to exceptions thrown from event listeners\n\t * It wraps error with DataProcessingError, closes this object and throws resulting error.\n\t * See closeWithError() for more details\n\t * Ideally such situation never happens, as consumers of DDS should never throw exceptions\n\t * in event listeners (i.e. catch any of the issues and make determination on how to handle it).\n\t * When such exceptions propagate through, most likely data model is no longer consistent, i.e.\n\t * DDS state does not match what user sees. Because of it DDS moves to \"corrupted state\" and does not\n\t * allow processing of ops or local changes, which very quickly results in container closure.\n\t */\n\tprivate eventListenerErrorHandler(event: EventEmitterEventType, e: any) {\n\t\tconst error = DataProcessingError.wrapIfUnrecognized(\n\t\t\te,\n\t\t\t\"SharedObjectEventListenerException\",\n\t\t);\n\t\terror.addTelemetryProperties({ emittedEventName: String(event) });\n\n\t\tthis.closeWithError(error);\n\t\tthrow error;\n\t}\n\n\tprivate attachListeners() {\n\t\t// Only listen to these events if not attached.\n\t\tif (!this.isAttached()) {\n\t\t\tthis.runtime.once(\"attaching\", () => {\n\t\t\t\t// Calling this will let the dds to do any custom processing based on attached\n\t\t\t\t// like starting generating ops.\n\t\t\t\tthis.didAttach();\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * A shared object, after construction, can either be loaded in the case that it is already part of\n\t * a shared document. Or later attached if it is being newly added.\n\t * @param services - Services used by the shared object\n\t */\n\tpublic async load(services: IChannelServices): Promise<void> {\n\t\tif (this.runtime.attachState !== AttachState.Detached) {\n\t\t\tthis.services = services;\n\t\t}\n\t\tawait this.loadCore(services.objectStorage);\n\t\tif (this.runtime.attachState !== AttachState.Detached) {\n\t\t\tthis.attachDeltaHandler();\n\t\t}\n\t}\n\n\t/**\n\t * Initializes the object as a local, non-shared object. This object can become shared after\n\t * it is attached to the document.\n\t */\n\tpublic initializeLocal(): void {\n\t\tthis.initializeLocalCore();\n\t}\n\n\t/**\n\t * {@inheritDoc (ISharedObject:interface).bindToContext}\n\t */\n\tpublic bindToContext(): void {\n\t\tif (this._isBoundToContext) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._isBoundToContext = true;\n\n\t\tthis.runtime.bindChannel(this);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).connect}\n\t */\n\tpublic connect(services: IChannelServices) {\n\t\tthis.services = services;\n\t\tthis.attachDeltaHandler();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).isAttached}\n\t */\n\tpublic isAttached(): boolean {\n\t\treturn this.services !== undefined && this.runtime.attachState !== AttachState.Detached;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}\n\t */\n\tpublic abstract getAttachSummary(\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats;\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}\n\t */\n\tpublic abstract summarize(\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats>;\n\n\t/**\n\t * {@inheritDoc (ISharedObject:interface).getGCData}\n\t */\n\tpublic abstract getGCData(fullGC?: boolean): IGarbageCollectionData;\n\n\t/**\n\t * Called when a handle is decoded by this object. A handle in the object's data represents an outbound reference\n\t * to another object in the container.\n\t * @param decodedHandle - The handle of the Fluid object that is decoded.\n\t */\n\tprotected handleDecoded(decodedHandle: IFluidHandle) {\n\t\tif (this.isAttached()) {\n\t\t\t// This represents an outbound reference from this object to the node represented by decodedHandle.\n\t\t\tthis.services?.deltaConnection.addedGCOutboundReference?.(this.handle, decodedHandle);\n\t\t}\n\t}\n\n\t/**\n\t * Allows the distributed data type to perform custom loading\n\t * @param services - Storage used by the shared object\n\t */\n\tprotected abstract loadCore(services: IChannelStorageService): Promise<void>;\n\n\t/**\n\t * Allows the distributed data type to perform custom local loading.\n\t */\n\tprotected initializeLocalCore() {\n\t\treturn;\n\t}\n\n\t/**\n\t * Allows the distributive data type the ability to perform custom processing once an attach has happened.\n\t * Also called after non-local data type get loaded.\n\t */\n\tprotected didAttach() {\n\t\treturn;\n\t}\n\n\t/**\n\t * Derived classes must override this to do custom processing on a remote message.\n\t * @param message - The message to process\n\t * @param local - True if the shared object is local\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprotected abstract processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t);\n\n\t/**\n\t * Called when the object has disconnected from the delta stream.\n\t */\n\tprotected abstract onDisconnect();\n\n\t/**\n\t * Submits a message by the local client to the runtime.\n\t * @param content - Content of the message\n\t * @param localOpMetadata - The local metadata associated with the message. This is kept locally by the runtime\n\t * and not sent to the server. This will be sent back when this message is received back from the server. This is\n\t * also sent if we are asked to resubmit the message.\n\t */\n\tprotected submitLocalMessage(content: any, localOpMetadata: unknown = undefined): void {\n\t\tthis.verifyNotClosed();\n\t\tif (this.isAttached()) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tthis.services!.deltaConnection.submit(content, localOpMetadata);\n\t\t}\n\t}\n\n\t/**\n\t * Marks this object as dirty so that it is part of the next summary. It is called by a SharedSummaryBlock\n\t * that want to be part of summary but does not generate ops.\n\t */\n\tprotected dirty(): void {\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tthis.services!.deltaConnection.dirty();\n\t}\n\n\t/**\n\t * Called when the object has fully connected to the delta stream\n\t * Default implementation for DDS, override if different behavior is required.\n\t */\n\tprotected onConnect() {}\n\n\t/**\n\t * Called when a message has to be resubmitted. This typically happens after a reconnection for unacked messages.\n\t * The default implementation here is to resubmit the same message. The client can override if different behavior\n\t * is required. It can choose to resubmit the same message, submit different / multiple messages or not submit\n\t * anything at all.\n\t * @param content - The content of the original message.\n\t * @param localOpMetadata - The local metadata associated with the original message.\n\t */\n\tprotected reSubmitCore(content: any, localOpMetadata: unknown) {\n\t\tthis.submitLocalMessage(content, localOpMetadata);\n\t}\n\n\t/**\n\t * Promises that are waiting for an ack from the server before resolving should use this instead of new Promise.\n\t * It ensures that if something changes that will interrupt that ack (e.g. the FluidDataStoreRuntime disposes),\n\t * the Promise will reject.\n\t * If runtime is disposed when this call is made, executor is not run and promise is rejected right away.\n\t */\n\tprotected async newAckBasedPromise<T>(\n\t\texecutor: (\n\t\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\t\treject: (reason?: any) => void,\n\t\t) => void,\n\t): Promise<T> {\n\t\tlet rejectBecauseDispose: () => void;\n\t\treturn new Promise<T>((resolve, reject) => {\n\t\t\trejectBecauseDispose = () =>\n\t\t\t\treject(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\"FluidDataStoreRuntime disposed while this ack-based Promise was pending\",\n\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\tif (this.runtime.disposed) {\n\t\t\t\trejectBecauseDispose();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.runtime.on(\"dispose\", rejectBecauseDispose);\n\t\t\texecutor(resolve, reject);\n\t\t}).finally(() => {\n\t\t\t// Note: rejectBecauseDispose will never be undefined here\n\t\t\tthis.runtime.off(\"dispose\", rejectBecauseDispose);\n\t\t});\n\t}\n\n\tprivate attachDeltaHandler() {\n\t\t// Services should already be there in case we are attaching delta handler.\n\t\tassert(\n\t\t\tthis.services !== undefined,\n\t\t\t0x07a /* \"Services should be there to attach delta handler\" */,\n\t\t);\n\t\tthis._isBoundToContext = true;\n\t\t// Allows objects to do any custom processing if it is attached.\n\t\tthis.didAttach();\n\n\t\t// attachDeltaHandler is only called after services is assigned\n\t\tthis.services.deltaConnection.attach({\n\t\t\tprocess: (\n\t\t\t\tmessage: ISequencedDocumentMessage,\n\t\t\t\tlocal: boolean,\n\t\t\t\tlocalOpMetadata: unknown,\n\t\t\t) => {\n\t\t\t\tthis.process(message, local, localOpMetadata);\n\t\t\t},\n\t\t\tsetConnectionState: (connected: boolean) => {\n\t\t\t\tthis.setConnectionState(connected);\n\t\t\t},\n\t\t\treSubmit: (content: any, localOpMetadata: unknown) => {\n\t\t\t\tthis.reSubmit(content, localOpMetadata);\n\t\t\t},\n\t\t\tapplyStashedOp: (content: any): unknown => {\n\t\t\t\treturn this.applyStashedOp(content);\n\t\t\t},\n\t\t\trollback: (content: any, localOpMetadata: unknown) => {\n\t\t\t\tthis.rollback(content, localOpMetadata);\n\t\t\t},\n\t\t});\n\n\t\t// Trigger initial state\n\t\t// attachDeltaHandler is only called after services is assigned\n\t\tthis.setConnectionState(this.services.deltaConnection.connected);\n\t}\n\n\t/**\n\t * Set the state of connection to services.\n\t * @param connected - true if connected, false otherwise.\n\t */\n\tprivate setConnectionState(connected: boolean) {\n\t\tif (this._connected === connected) {\n\t\t\t// Not changing state, nothing the same.\n\t\t\treturn;\n\t\t}\n\n\t\t// Should I change the state at the end? So that we *can't* send new stuff before we send old?\n\t\tthis._connected = connected;\n\n\t\tif (!connected) {\n\t\t\t// Things that are true now...\n\t\t\t// - if we had a connection we can no longer send messages over it\n\t\t\t// - if we had outbound messages some may or may not be ACK'd. Won't know until next message\n\t\t\t//\n\t\t\t// - nack could get a new msn - but might as well do it in the join?\n\t\t\tthis.onDisconnect();\n\t\t} else {\n\t\t\t// Call this for now so that DDSes like ConsensusOrderedCollection that maintain their own pending\n\t\t\t// messages will work.\n\t\t\tthis.onConnect();\n\t\t}\n\t}\n\n\t/**\n\t * Handles a message being received from the remote delta server.\n\t * @param message - The message to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprivate process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n\t\tthis.verifyNotClosed(); // This will result in container closure.\n\t\tthis.emitInternal(\"pre-op\", message, local, this);\n\n\t\tthis.opProcessingHelper.measure(\n\t\t\t() => {\n\t\t\t\tthis.processCore(message, local, localOpMetadata);\n\t\t\t},\n\t\t\tlocal ? \"local\" : \"remote\",\n\t\t);\n\n\t\tthis.emitInternal(\"op\", message, local, this);\n\t}\n\n\t/**\n\t * Called when a message has to be resubmitted. This typically happens for unacked messages after a\n\t * reconnection.\n\t * @param content - The content of the original message.\n\t * @param localOpMetadata - The local metadata associated with the original message.\n\t */\n\tprivate reSubmit(content: any, localOpMetadata: unknown) {\n\t\tthis.reSubmitCore(content, localOpMetadata);\n\t}\n\n\t/**\n\t * Revert an op\n\t */\n\tprotected rollback(content: any, localOpMetadata: unknown) {\n\t\tthrow new Error(\"rollback not supported\");\n\t}\n\n\t/**\n\t * Apply changes from an op. Used when rehydrating an attached container\n\t * with pending changes. This prepares the SharedObject for seeing an ACK\n\t * for the op or resubmitting the op upon reconnection.\n\t * @param content - Contents of a stashed op.\n\t * @returns localMetadata of the op, to be passed to process() or resubmit()\n\t * when the op is ACKed or resubmitted, respectively\n\t */\n\tprotected abstract applyStashedOp(content: any): unknown;\n\n\t/**\n\t * Emit an event. This function is only intended for use by DDS classes that extend SharedObject/SharedObjectCore,\n\t * specifically to emit events that are part of the public interface of the DDS (i.e. those that can have listeners\n\t * attached to them by the consumers of the DDS). It should not be called from outside the class or to emit events\n\t * which are only internal to the DDS. Support for calling it from outside the DDS instance might be removed in the\n\t * future.\n\t *\n\t * @internal\n\t *\n\t * @param event - The event to emit.\n\t * @param args - Arguments to pass to the event listeners.\n\t * @returns `true` if the event had listeners, `false` otherwise.\n\t */\n\tpublic emit(event: EventEmitterEventType, ...args: any[]): boolean {\n\t\treturn this.callbacksHelper.measure(() => {\n\t\t\t// Creating ops while handling a DDS event can lead\n\t\t\t// to undefined behavior and events observed in the wrong order.\n\t\t\t// For example, we have two callbacks registered for a DDS, A and B.\n\t\t\t// Then if on change #1 callback A creates change #2, the invocation flow will be:\n\t\t\t//\n\t\t\t// A because of #1\n\t\t\t// A because of #2\n\t\t\t// B because of #2\n\t\t\t// B because of #1\n\t\t\t//\n\t\t\t// The runtime must enforce op coherence by not allowing any ops to be created during\n\t\t\t// the event handler\n\t\t\treturn this.runtime.ensureNoDataModelChanges(() => super.emit(event, ...args));\n\t\t});\n\t}\n\n\t/**\n\t * Use to emit events inside {@link SharedObjectCore}, with no telemetry measurement\n\t * done on the duration of the callbacks. Simply calls `super.emit()`.\n\t * @param event - Event to emit\n\t * @param args - Arguments for the event\n\t * @returns Whatever `super.emit()` returns.\n\t */\n\tprivate emitInternal(event: EventEmitterEventType, ...args: any[]): boolean {\n\t\treturn super.emit(event, ...args);\n\t}\n}\n\n/**\n * SharedObject with simplified, synchronous summarization and GC.\n * DDS implementations with async and incremental summarization should extend SharedObjectCore directly instead.\n */\nexport abstract class SharedObject<\n\tTEvent extends ISharedObjectEvents = ISharedObjectEvents,\n> extends SharedObjectCore<TEvent> {\n\t/**\n\t * True while we are garbage collecting this object's data.\n\t */\n\tprivate _isGCing: boolean = false;\n\n\t/**\n\t * The serializer to use to serialize / parse handles, if any.\n\t */\n\tprivate readonly _serializer: IFluidSerializer;\n\n\tprotected get serializer(): IFluidSerializer {\n\t\t/**\n\t\t * During garbage collection, the SummarySerializer keeps track of IFluidHandles that are serialized. These\n\t\t * handles represent references to other Fluid objects.\n\t\t *\n\t\t * This is fine for now. However, if we implement delay loading in DDss, they may load and de-serialize content\n\t\t * in summarize. When that happens, they may incorrectly hit this assert and we will have to change this.\n\t\t */\n\t\tassert(\n\t\t\t!this._isGCing,\n\t\t\t0x075 /* \"SummarySerializer should be used for serializing data during summary.\" */,\n\t\t);\n\t\treturn this._serializer;\n\t}\n\n\t/**\n\t * @param id - The id of the shared object\n\t * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n\t * @param attributes - Attributes of the shared object\n\t */\n\tconstructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t\tprivate readonly telemetryContextPrefix: string,\n\t) {\n\t\tsuper(id, runtime, attributes);\n\n\t\tthis._serializer = new FluidSerializer(\n\t\t\tthis.runtime.channelsRoutingContext,\n\t\t\t(handle: IFluidHandle) => this.handleDecoded(handle),\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}\n\t */\n\tpublic getAttachSummary(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = false,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\tconst result = this.summarizeCore(this.serializer, telemetryContext);\n\t\tthis.incrementTelemetryMetric(\n\t\t\tblobCountPropertyName,\n\t\t\tresult.stats.blobNodeCount,\n\t\t\ttelemetryContext,\n\t\t);\n\t\tthis.incrementTelemetryMetric(\n\t\t\ttotalBlobSizePropertyName,\n\t\t\tresult.stats.totalBlobSize,\n\t\t\ttelemetryContext,\n\t\t);\n\t\treturn result;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}\n\t */\n\tpublic async summarize(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = false,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): Promise<ISummaryTreeWithStats> {\n\t\tconst result = this.summarizeCore(\n\t\t\tthis.serializer,\n\t\t\ttelemetryContext,\n\t\t\tincrementalSummaryContext,\n\t\t);\n\t\tthis.incrementTelemetryMetric(\n\t\t\tblobCountPropertyName,\n\t\t\tresult.stats.blobNodeCount,\n\t\t\ttelemetryContext,\n\t\t);\n\t\tthis.incrementTelemetryMetric(\n\t\t\ttotalBlobSizePropertyName,\n\t\t\tresult.stats.totalBlobSize,\n\t\t\ttelemetryContext,\n\t\t);\n\t\treturn result;\n\t}\n\n\t/**\n\t * {@inheritDoc (ISharedObject:interface).getGCData}\n\t */\n\tpublic getGCData(fullGC: boolean = false): IGarbageCollectionData {\n\t\t// Set _isGCing to true. This flag is used to ensure that we only use SummarySerializer to serialize handles\n\t\t// in this object's data.\n\t\tassert(\n\t\t\t!this._isGCing,\n\t\t\t0x078 /* \"Possible re-entrancy! Summary should not already be in progress.\" */,\n\t\t);\n\t\tthis._isGCing = true;\n\n\t\tlet gcData: IGarbageCollectionData;\n\t\ttry {\n\t\t\tconst serializer = new SummarySerializer(\n\t\t\t\tthis.runtime.channelsRoutingContext,\n\t\t\t\t(handle: IFluidHandle) => this.handleDecoded(handle),\n\t\t\t);\n\t\t\tthis.processGCDataCore(serializer);\n\t\t\t// The GC data for this shared object contains a single GC node. The outbound routes of this node are the\n\t\t\t// routes of handles serialized during summarization.\n\t\t\tgcData = { gcNodes: { \"/\": serializer.getSerializedRoutes() } };\n\t\t\tassert(\n\t\t\t\tthis._isGCing,\n\t\t\t\t0x079 /* \"Possible re-entrancy! Summary should have been in progress.\" */,\n\t\t\t);\n\t\t} finally {\n\t\t\tthis._isGCing = false;\n\t\t}\n\n\t\treturn gcData;\n\t}\n\n\t/**\n\t * Calls the serializer over all data in this object that reference other GC nodes.\n\t * Derived classes must override this to provide custom list of references to other GC nodes.\n\t */\n\tprotected processGCDataCore(serializer: SummarySerializer) {\n\t\t// We run the full summarize logic to get the list of outbound routes from this object. This is a little\n\t\t// expensive but its okay for now. It will be updated to not use full summarize and make it more efficient.\n\t\t// See: https://github.com/microsoft/FluidFramework/issues/4547\n\t\tthis.summarizeCore(serializer);\n\t}\n\n\t/**\n\t * Gets a form of the object that can be serialized.\n\t * @returns A tree representing the snapshot of the shared object.\n\t */\n\tprotected abstract summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): ISummaryTreeWithStats;\n\n\tprivate incrementTelemetryMetric(\n\t\tpropertyName: string,\n\t\tincrementBy: number,\n\t\ttelemetryContext?: ITelemetryContext,\n\t) {\n\t\tconst prevTotal = (telemetryContext?.get(this.telemetryContextPrefix, propertyName) ??\n\t\t\t0) as number;\n\t\ttelemetryContext?.set(this.telemetryContextPrefix, propertyName, prevTotal + incrementBy);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sharedObject.js","sourceRoot":"","sources":["../src/sharedObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAAkC;AAElC,qEASyC;AACzC,2DAAoD;AAEpD,iFAAoE;AAQpE,6EAO6C;AAC7C,6CAAiE;AACjE,qCAA8C;AAC9C,2DAAwD;AAGxD;;GAEG;AACH,MAAsB,gBACrB,SAAQ,+CAAqC;IAiD7C;;;;OAIG;IACH,YACQ,EAAU,EACP,OAA+B,EACzB,UAA8B;QAE9C,KAAK,CAAC,CAAC,KAA4B,EAAE,CAAM,EAAE,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;QAJnF,OAAE,GAAF,EAAE,CAAQ;QACP,YAAO,GAAP,OAAO,CAAwB;QACzB,eAAU,GAAV,UAAU,CAAoB;QApC/C;;WAEG;QACK,eAAU,GAAG,KAAK,CAAC;QAO3B;;WAEG;QACK,sBAAiB,GAAY,KAAK,CAAC;QA2B1C,IAAA,mBAAM,EAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAEjE,IAAI,CAAC,MAAM,GAAG,IAAI,2BAAkB,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;QAE5E,IAAI,CAAC,MAAM,GAAG,IAAA,mCAAiB,EAAC;YAC/B,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,UAAU,EAAE;gBACX,GAAG,EAAE;oBACJ,cAAc,EAAE,IAAA,SAAI,GAAE;oBACtB,GAAG,IAAA,kCAAgB,EAAC;wBACnB,OAAO,EAA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AED,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;;OAGG;IACO,iBAAiB,CAAC,UAA6B;QACxD,wGAAwG;QACxG,2GAA2G;QAC3G,+DAA+D;QAC/D,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAChC,CAAC;IAYO,wBAAwB,CAC/B,YAAoB,EACpB,WAAmB,EACnB,gBAAoC;QAEpC,MAAM,SAAS,GAAG,CAAC,gBAAgB,EAAE,GAAG,CAAC,IAAI,CAAC,sBAAsB,EAAE,YAAY,CAAC;YAClF,CAAC,CAAW,CAAC;QACd,gBAAgB,EAAE,GAAG,CAAC,IAAI,CAAC,sBAAsB,EAAE,YAAY,EAAE,SAAS,GAAG,WAAW,CAAC,CAAC;IAC3F,CAAC;CACD;AA/JD,oCA+JC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport { IFluidHandle, ITelemetryProperties } from \"@fluidframework/core-interfaces\";\nimport {\n\tITelemetryLoggerExt,\n\tcreateChildLogger,\n\tDataProcessingError,\n\tEventEmitterWithErrorHandling,\n\tloggerToMonitoringContext,\n\tMonitoringContext,\n\tSampledTelemetryHelper,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { EventEmitterEventType } from \"@fluid-internal/client-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n\tIChannelServices,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIGarbageCollectionData,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\tblobCountPropertyName,\n\ttotalBlobSizePropertyName,\n\tIExperimentalIncrementalSummaryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { FluidSerializer, IFluidSerializer } from \"./serializer\";\nimport { SharedObjectHandle } from \"./handle\";\nimport { SummarySerializer } from \"./summarySerializer\";\nimport { ISharedObject, ISharedObjectEvents } from \"./types\";\n\n/**\n * Base class from which all shared objects derive.\n */\nexport abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISharedObjectEvents>\n\textends EventEmitterWithErrorHandling<TEvent>\n\timplements ISharedObject<TEvent>\n{\n\tpublic get IFluidLoadable() {\n\t\treturn this;\n\t}\n\n\tprivate readonly opProcessingHelper: SampledTelemetryHelper;\n\tprivate readonly callbacksHelper: SampledTelemetryHelper;\n\n\t/**\n\t * The handle referring to this SharedObject\n\t */\n\tpublic readonly handle: IFluidHandle;\n\n\t/**\n\t * Telemetry logger for the shared object\n\t */\n\tprotected readonly logger: ITelemetryLoggerExt;\n\tprivate readonly mc: MonitoringContext;\n\n\t/**\n\t * Connection state\n\t */\n\tprivate _connected = false;\n\n\t/**\n\t * Services used by the shared object\n\t */\n\tprivate services: IChannelServices | undefined;\n\n\t/**\n\t * True if the dds is bound to its parent.\n\t */\n\tprivate _isBoundToContext: boolean = false;\n\n\t/**\n\t * Tracks error that closed this object.\n\t */\n\tprivate closeError?: ReturnType<typeof DataProcessingError.wrapIfUnrecognized>;\n\n\t/**\n\t * Gets the connection state\n\t * @returns The state of the connection\n\t */\n\tpublic get connected(): boolean {\n\t\treturn this._connected;\n\t}\n\n\t/**\n\t * @param id - The id of the shared object\n\t * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n\t * @param attributes - Attributes of the shared object\n\t */\n\tconstructor(\n\t\tpublic id: string,\n\t\tprotected runtime: IFluidDataStoreRuntime,\n\t\tpublic readonly attributes: IChannelAttributes,\n\t) {\n\t\tsuper((event: EventEmitterEventType, e: any) => this.eventListenerErrorHandler(event, e));\n\n\t\tassert(!id.includes(\"/\"), 0x304 /* Id cannot contain slashes */);\n\n\t\tthis.handle = new SharedObjectHandle(this, id, runtime.IFluidHandleContext);\n\n\t\tthis.logger = createChildLogger({\n\t\t\tlogger: runtime.logger,\n\t\t\tproperties: {\n\t\t\t\tall: {\n\t\t\t\t\tsharedObjectId: uuid(),\n\t\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\t\tddsType: this.attributes.type,\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\t\tthis.mc = loggerToMonitoringContext(this.logger);\n\n\t\t[this.opProcessingHelper, this.callbacksHelper] = this.setUpSampledTelemetryHelpers();\n\n\t\tthis.attachListeners();\n\t}\n\n\t/**\n\t * This function is only supposed to be called from SharedObjectCore's constructor and\n\t * depends on a few things being set already. assert() calls make sure of it.\n\t * @returns The telemetry sampling helpers, so the constructor can be the one to assign them\n\t * to variables to avoid complaints from TypeScript.\n\t */\n\tprivate setUpSampledTelemetryHelpers(): SampledTelemetryHelper[] {\n\t\tassert(\n\t\t\tthis.mc !== undefined && this.logger !== undefined,\n\t\t\t0x349 /* this.mc and/or this.logger has not been set */,\n\t\t);\n\t\tconst opProcessingHelper = new SampledTelemetryHelper(\n\t\t\t{\n\t\t\t\teventName: \"ddsOpProcessing\",\n\t\t\t\tcategory: \"performance\",\n\t\t\t},\n\t\t\tthis.logger,\n\t\t\tthis.mc.config.getNumber(\"Fluid.SharedObject.OpProcessingTelemetrySampling\") ?? 1000,\n\t\t\ttrue,\n\t\t\tnew Map<string, ITelemetryProperties>([\n\t\t\t\t[\"local\", { localOp: true }],\n\t\t\t\t[\"remote\", { localOp: false }],\n\t\t\t]),\n\t\t);\n\t\tconst callbacksHelper = new SampledTelemetryHelper(\n\t\t\t{\n\t\t\t\teventName: \"ddsEventCallbacks\",\n\t\t\t\tcategory: \"performance\",\n\t\t\t},\n\t\t\tthis.logger,\n\t\t\tthis.mc.config.getNumber(\"Fluid.SharedObject.DdsCallbacksTelemetrySampling\") ?? 1000,\n\t\t\ttrue,\n\t\t);\n\n\t\tthis.runtime.once(\"dispose\", () => {\n\t\t\tthis.callbacksHelper.dispose();\n\t\t\tthis.opProcessingHelper.dispose();\n\t\t});\n\n\t\treturn [opProcessingHelper, callbacksHelper];\n\t}\n\n\t/**\n\t * Marks this objects as closed. Any attempt to change it (local changes or processing remote ops)\n\t * would result in same error thrown. If called multiple times, only first error is remembered.\n\t * @param error - error object that is thrown whenever an attempt is made to modify this object\n\t */\n\tprivate closeWithError(error: any) {\n\t\tif (this.closeError === undefined) {\n\t\t\tthis.closeError = error;\n\t\t}\n\t}\n\n\t/**\n\t * Verifies that this object is not closed via closeWithError(). If it is, throws an error used to close it.\n\t */\n\tprivate verifyNotClosed() {\n\t\tif (this.closeError !== undefined) {\n\t\t\tthrow this.closeError;\n\t\t}\n\t}\n\n\t/**\n\t * Event listener handler helper that can be used to react to exceptions thrown from event listeners\n\t * It wraps error with DataProcessingError, closes this object and throws resulting error.\n\t * See closeWithError() for more details\n\t * Ideally such situation never happens, as consumers of DDS should never throw exceptions\n\t * in event listeners (i.e. catch any of the issues and make determination on how to handle it).\n\t * When such exceptions propagate through, most likely data model is no longer consistent, i.e.\n\t * DDS state does not match what user sees. Because of it DDS moves to \"corrupted state\" and does not\n\t * allow processing of ops or local changes, which very quickly results in container closure.\n\t */\n\tprivate eventListenerErrorHandler(event: EventEmitterEventType, e: any) {\n\t\tconst error = DataProcessingError.wrapIfUnrecognized(\n\t\t\te,\n\t\t\t\"SharedObjectEventListenerException\",\n\t\t);\n\t\terror.addTelemetryProperties({ emittedEventName: String(event) });\n\n\t\tthis.closeWithError(error);\n\t\tthrow error;\n\t}\n\n\tprivate attachListeners() {\n\t\t// Only listen to these events if not attached.\n\t\tif (!this.isAttached()) {\n\t\t\tthis.runtime.once(\"attaching\", () => {\n\t\t\t\t// Calling this will let the dds to do any custom processing based on attached\n\t\t\t\t// like starting generating ops.\n\t\t\t\tthis.didAttach();\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * A shared object, after construction, can either be loaded in the case that it is already part of\n\t * a shared document. Or later attached if it is being newly added.\n\t * @param services - Services used by the shared object\n\t */\n\tpublic async load(services: IChannelServices): Promise<void> {\n\t\tif (this.runtime.attachState !== AttachState.Detached) {\n\t\t\tthis.services = services;\n\t\t}\n\t\tawait this.loadCore(services.objectStorage);\n\t\tif (this.runtime.attachState !== AttachState.Detached) {\n\t\t\tthis.attachDeltaHandler();\n\t\t}\n\t}\n\n\t/**\n\t * Initializes the object as a local, non-shared object. This object can become shared after\n\t * it is attached to the document.\n\t */\n\tpublic initializeLocal(): void {\n\t\tthis.initializeLocalCore();\n\t}\n\n\t/**\n\t * {@inheritDoc (ISharedObject:interface).bindToContext}\n\t */\n\tpublic bindToContext(): void {\n\t\tif (this._isBoundToContext) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._isBoundToContext = true;\n\n\t\tthis.runtime.bindChannel(this);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).connect}\n\t */\n\tpublic connect(services: IChannelServices) {\n\t\tthis.services = services;\n\t\tthis.attachDeltaHandler();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).isAttached}\n\t */\n\tpublic isAttached(): boolean {\n\t\treturn this.services !== undefined && this.runtime.attachState !== AttachState.Detached;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}\n\t */\n\tpublic abstract getAttachSummary(\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats;\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}\n\t */\n\tpublic abstract summarize(\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats>;\n\n\t/**\n\t * {@inheritDoc (ISharedObject:interface).getGCData}\n\t */\n\tpublic abstract getGCData(fullGC?: boolean): IGarbageCollectionData;\n\n\t/**\n\t * Called when a handle is decoded by this object. A handle in the object's data represents an outbound reference\n\t * to another object in the container.\n\t * @param decodedHandle - The handle of the Fluid object that is decoded.\n\t */\n\tprotected handleDecoded(decodedHandle: IFluidHandle) {\n\t\tif (this.isAttached()) {\n\t\t\t// This represents an outbound reference from this object to the node represented by decodedHandle.\n\t\t\tthis.services?.deltaConnection.addedGCOutboundReference?.(this.handle, decodedHandle);\n\t\t}\n\t}\n\n\t/**\n\t * Allows the distributed data type to perform custom loading\n\t * @param services - Storage used by the shared object\n\t */\n\tprotected abstract loadCore(services: IChannelStorageService): Promise<void>;\n\n\t/**\n\t * Allows the distributed data type to perform custom local loading.\n\t */\n\tprotected initializeLocalCore() {\n\t\treturn;\n\t}\n\n\t/**\n\t * Allows the distributive data type the ability to perform custom processing once an attach has happened.\n\t * Also called after non-local data type get loaded.\n\t */\n\tprotected didAttach() {\n\t\treturn;\n\t}\n\n\t/**\n\t * Derived classes must override this to do custom processing on a remote message.\n\t * @param message - The message to process\n\t * @param local - True if the shared object is local\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprotected abstract processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t);\n\n\t/**\n\t * Called when the object has disconnected from the delta stream.\n\t */\n\tprotected abstract onDisconnect();\n\n\t/**\n\t * Submits a message by the local client to the runtime.\n\t * @param content - Content of the message\n\t * @param localOpMetadata - The local metadata associated with the message. This is kept locally by the runtime\n\t * and not sent to the server. This will be sent back when this message is received back from the server. This is\n\t * also sent if we are asked to resubmit the message.\n\t */\n\tprotected submitLocalMessage(content: any, localOpMetadata: unknown = undefined): void {\n\t\tthis.verifyNotClosed();\n\t\tif (this.isAttached()) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tthis.services!.deltaConnection.submit(content, localOpMetadata);\n\t\t}\n\t}\n\n\t/**\n\t * Marks this object as dirty so that it is part of the next summary. It is called by a SharedSummaryBlock\n\t * that want to be part of summary but does not generate ops.\n\t */\n\tprotected dirty(): void {\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tthis.services!.deltaConnection.dirty();\n\t}\n\n\t/**\n\t * Called when the object has fully connected to the delta stream\n\t * Default implementation for DDS, override if different behavior is required.\n\t */\n\tprotected onConnect() {}\n\n\t/**\n\t * Called when a message has to be resubmitted. This typically happens after a reconnection for unacked messages.\n\t * The default implementation here is to resubmit the same message. The client can override if different behavior\n\t * is required. It can choose to resubmit the same message, submit different / multiple messages or not submit\n\t * anything at all.\n\t * @param content - The content of the original message.\n\t * @param localOpMetadata - The local metadata associated with the original message.\n\t */\n\tprotected reSubmitCore(content: any, localOpMetadata: unknown) {\n\t\tthis.submitLocalMessage(content, localOpMetadata);\n\t}\n\n\t/**\n\t * Promises that are waiting for an ack from the server before resolving should use this instead of new Promise.\n\t * It ensures that if something changes that will interrupt that ack (e.g. the FluidDataStoreRuntime disposes),\n\t * the Promise will reject.\n\t * If runtime is disposed when this call is made, executor is not run and promise is rejected right away.\n\t */\n\tprotected async newAckBasedPromise<T>(\n\t\texecutor: (\n\t\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\t\treject: (reason?: any) => void,\n\t\t) => void,\n\t): Promise<T> {\n\t\tlet rejectBecauseDispose: () => void;\n\t\treturn new Promise<T>((resolve, reject) => {\n\t\t\trejectBecauseDispose = () =>\n\t\t\t\treject(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\"FluidDataStoreRuntime disposed while this ack-based Promise was pending\",\n\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\tif (this.runtime.disposed) {\n\t\t\t\trejectBecauseDispose();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.runtime.on(\"dispose\", rejectBecauseDispose);\n\t\t\texecutor(resolve, reject);\n\t\t}).finally(() => {\n\t\t\t// Note: rejectBecauseDispose will never be undefined here\n\t\t\tthis.runtime.off(\"dispose\", rejectBecauseDispose);\n\t\t});\n\t}\n\n\tprivate attachDeltaHandler() {\n\t\t// Services should already be there in case we are attaching delta handler.\n\t\tassert(\n\t\t\tthis.services !== undefined,\n\t\t\t0x07a /* \"Services should be there to attach delta handler\" */,\n\t\t);\n\t\tthis._isBoundToContext = true;\n\t\t// Allows objects to do any custom processing if it is attached.\n\t\tthis.didAttach();\n\n\t\t// attachDeltaHandler is only called after services is assigned\n\t\tthis.services.deltaConnection.attach({\n\t\t\tprocess: (\n\t\t\t\tmessage: ISequencedDocumentMessage,\n\t\t\t\tlocal: boolean,\n\t\t\t\tlocalOpMetadata: unknown,\n\t\t\t) => {\n\t\t\t\tthis.process(message, local, localOpMetadata);\n\t\t\t},\n\t\t\tsetConnectionState: (connected: boolean) => {\n\t\t\t\tthis.setConnectionState(connected);\n\t\t\t},\n\t\t\treSubmit: (content: any, localOpMetadata: unknown) => {\n\t\t\t\tthis.reSubmit(content, localOpMetadata);\n\t\t\t},\n\t\t\tapplyStashedOp: (content: any): unknown => {\n\t\t\t\treturn this.applyStashedOp(content);\n\t\t\t},\n\t\t\trollback: (content: any, localOpMetadata: unknown) => {\n\t\t\t\tthis.rollback(content, localOpMetadata);\n\t\t\t},\n\t\t});\n\n\t\t// Trigger initial state\n\t\t// attachDeltaHandler is only called after services is assigned\n\t\tthis.setConnectionState(this.services.deltaConnection.connected);\n\t}\n\n\t/**\n\t * Set the state of connection to services.\n\t * @param connected - true if connected, false otherwise.\n\t */\n\tprivate setConnectionState(connected: boolean) {\n\t\tif (this._connected === connected) {\n\t\t\t// Not changing state, nothing the same.\n\t\t\treturn;\n\t\t}\n\n\t\t// Should I change the state at the end? So that we *can't* send new stuff before we send old?\n\t\tthis._connected = connected;\n\n\t\tif (!connected) {\n\t\t\t// Things that are true now...\n\t\t\t// - if we had a connection we can no longer send messages over it\n\t\t\t// - if we had outbound messages some may or may not be ACK'd. Won't know until next message\n\t\t\t//\n\t\t\t// - nack could get a new msn - but might as well do it in the join?\n\t\t\tthis.onDisconnect();\n\t\t} else {\n\t\t\t// Call this for now so that DDSes like ConsensusOrderedCollection that maintain their own pending\n\t\t\t// messages will work.\n\t\t\tthis.onConnect();\n\t\t}\n\t}\n\n\t/**\n\t * Handles a message being received from the remote delta server.\n\t * @param message - The message to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprivate process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n\t\tthis.verifyNotClosed(); // This will result in container closure.\n\t\tthis.emitInternal(\"pre-op\", message, local, this);\n\n\t\tthis.opProcessingHelper.measure(\n\t\t\t() => {\n\t\t\t\tthis.processCore(message, local, localOpMetadata);\n\t\t\t},\n\t\t\tlocal ? \"local\" : \"remote\",\n\t\t);\n\n\t\tthis.emitInternal(\"op\", message, local, this);\n\t}\n\n\t/**\n\t * Called when a message has to be resubmitted. This typically happens for unacked messages after a\n\t * reconnection.\n\t * @param content - The content of the original message.\n\t * @param localOpMetadata - The local metadata associated with the original message.\n\t */\n\tprivate reSubmit(content: any, localOpMetadata: unknown) {\n\t\tthis.reSubmitCore(content, localOpMetadata);\n\t}\n\n\t/**\n\t * Revert an op\n\t */\n\tprotected rollback(content: any, localOpMetadata: unknown) {\n\t\tthrow new Error(\"rollback not supported\");\n\t}\n\n\t/**\n\t * Apply changes from an op. Used when rehydrating an attached container\n\t * with pending changes. This prepares the SharedObject for seeing an ACK\n\t * for the op or resubmitting the op upon reconnection.\n\t * @param content - Contents of a stashed op.\n\t * @returns localMetadata of the op, to be passed to process() or resubmit()\n\t * when the op is ACKed or resubmitted, respectively\n\t */\n\tprotected abstract applyStashedOp(content: any): unknown;\n\n\t/**\n\t * Emit an event. This function is only intended for use by DDS classes that extend SharedObject/SharedObjectCore,\n\t * specifically to emit events that are part of the public interface of the DDS (i.e. those that can have listeners\n\t * attached to them by the consumers of the DDS). It should not be called from outside the class or to emit events\n\t * which are only internal to the DDS. Support for calling it from outside the DDS instance might be removed in the\n\t * future.\n\t *\n\t * @internal\n\t *\n\t * @param event - The event to emit.\n\t * @param args - Arguments to pass to the event listeners.\n\t * @returns `true` if the event had listeners, `false` otherwise.\n\t */\n\tpublic emit(event: EventEmitterEventType, ...args: any[]): boolean {\n\t\treturn this.callbacksHelper.measure(() => {\n\t\t\t// Creating ops while handling a DDS event can lead\n\t\t\t// to undefined behavior and events observed in the wrong order.\n\t\t\t// For example, we have two callbacks registered for a DDS, A and B.\n\t\t\t// Then if on change #1 callback A creates change #2, the invocation flow will be:\n\t\t\t//\n\t\t\t// A because of #1\n\t\t\t// A because of #2\n\t\t\t// B because of #2\n\t\t\t// B because of #1\n\t\t\t//\n\t\t\t// The runtime must enforce op coherence by not allowing any ops to be created during\n\t\t\t// the event handler\n\t\t\treturn this.runtime.ensureNoDataModelChanges(() => super.emit(event, ...args));\n\t\t});\n\t}\n\n\t/**\n\t * Use to emit events inside {@link SharedObjectCore}, with no telemetry measurement\n\t * done on the duration of the callbacks. Simply calls `super.emit()`.\n\t * @param event - Event to emit\n\t * @param args - Arguments for the event\n\t * @returns Whatever `super.emit()` returns.\n\t */\n\tprivate emitInternal(event: EventEmitterEventType, ...args: any[]): boolean {\n\t\treturn super.emit(event, ...args);\n\t}\n}\n\n/**\n * SharedObject with simplified, synchronous summarization and GC.\n * DDS implementations with async and incremental summarization should extend SharedObjectCore directly instead.\n */\nexport abstract class SharedObject<\n\tTEvent extends ISharedObjectEvents = ISharedObjectEvents,\n> extends SharedObjectCore<TEvent> {\n\t/**\n\t * True while we are garbage collecting this object's data.\n\t */\n\tprivate _isGCing: boolean = false;\n\n\t/**\n\t * The serializer to use to serialize / parse handles, if any.\n\t */\n\tprivate readonly _serializer: IFluidSerializer;\n\n\tprotected get serializer(): IFluidSerializer {\n\t\t/**\n\t\t * During garbage collection, the SummarySerializer keeps track of IFluidHandles that are serialized. These\n\t\t * handles represent references to other Fluid objects.\n\t\t *\n\t\t * This is fine for now. However, if we implement delay loading in DDss, they may load and de-serialize content\n\t\t * in summarize. When that happens, they may incorrectly hit this assert and we will have to change this.\n\t\t */\n\t\tassert(\n\t\t\t!this._isGCing,\n\t\t\t0x075 /* \"SummarySerializer should be used for serializing data during summary.\" */,\n\t\t);\n\t\treturn this._serializer;\n\t}\n\n\t/**\n\t * @param id - The id of the shared object\n\t * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n\t * @param attributes - Attributes of the shared object\n\t */\n\tconstructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t\tprivate readonly telemetryContextPrefix: string,\n\t) {\n\t\tsuper(id, runtime, attributes);\n\n\t\tthis._serializer = new FluidSerializer(\n\t\t\tthis.runtime.channelsRoutingContext,\n\t\t\t(handle: IFluidHandle) => this.handleDecoded(handle),\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}\n\t */\n\tpublic getAttachSummary(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = false,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\tconst result = this.summarizeCore(this.serializer, telemetryContext);\n\t\tthis.incrementTelemetryMetric(\n\t\t\tblobCountPropertyName,\n\t\t\tresult.stats.blobNodeCount,\n\t\t\ttelemetryContext,\n\t\t);\n\t\tthis.incrementTelemetryMetric(\n\t\t\ttotalBlobSizePropertyName,\n\t\t\tresult.stats.totalBlobSize,\n\t\t\ttelemetryContext,\n\t\t);\n\t\treturn result;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}\n\t */\n\tpublic async summarize(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = false,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): Promise<ISummaryTreeWithStats> {\n\t\tconst result = this.summarizeCore(\n\t\t\tthis.serializer,\n\t\t\ttelemetryContext,\n\t\t\tincrementalSummaryContext,\n\t\t);\n\t\tthis.incrementTelemetryMetric(\n\t\t\tblobCountPropertyName,\n\t\t\tresult.stats.blobNodeCount,\n\t\t\ttelemetryContext,\n\t\t);\n\t\tthis.incrementTelemetryMetric(\n\t\t\ttotalBlobSizePropertyName,\n\t\t\tresult.stats.totalBlobSize,\n\t\t\ttelemetryContext,\n\t\t);\n\t\treturn result;\n\t}\n\n\t/**\n\t * {@inheritDoc (ISharedObject:interface).getGCData}\n\t */\n\tpublic getGCData(fullGC: boolean = false): IGarbageCollectionData {\n\t\t// Set _isGCing to true. This flag is used to ensure that we only use SummarySerializer to serialize handles\n\t\t// in this object's data.\n\t\tassert(\n\t\t\t!this._isGCing,\n\t\t\t0x078 /* \"Possible re-entrancy! Summary should not already be in progress.\" */,\n\t\t);\n\t\tthis._isGCing = true;\n\n\t\tlet gcData: IGarbageCollectionData;\n\t\ttry {\n\t\t\tconst serializer = new SummarySerializer(\n\t\t\t\tthis.runtime.channelsRoutingContext,\n\t\t\t\t(handle: IFluidHandle) => this.handleDecoded(handle),\n\t\t\t);\n\t\t\tthis.processGCDataCore(serializer);\n\t\t\t// The GC data for this shared object contains a single GC node. The outbound routes of this node are the\n\t\t\t// routes of handles serialized during summarization.\n\t\t\tgcData = { gcNodes: { \"/\": serializer.getSerializedRoutes() } };\n\t\t\tassert(\n\t\t\t\tthis._isGCing,\n\t\t\t\t0x079 /* \"Possible re-entrancy! Summary should have been in progress.\" */,\n\t\t\t);\n\t\t} finally {\n\t\t\tthis._isGCing = false;\n\t\t}\n\n\t\treturn gcData;\n\t}\n\n\t/**\n\t * Calls the serializer over all data in this object that reference other GC nodes.\n\t * Derived classes must override this to provide custom list of references to other GC nodes.\n\t */\n\tprotected processGCDataCore(serializer: SummarySerializer) {\n\t\t// We run the full summarize logic to get the list of outbound routes from this object. This is a little\n\t\t// expensive but its okay for now. It will be updated to not use full summarize and make it more efficient.\n\t\t// See: https://github.com/microsoft/FluidFramework/issues/4547\n\t\tthis.summarizeCore(serializer);\n\t}\n\n\t/**\n\t * Gets a form of the object that can be serialized.\n\t * @returns A tree representing the snapshot of the shared object.\n\t */\n\tprotected abstract summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): ISummaryTreeWithStats;\n\n\tprivate incrementTelemetryMetric(\n\t\tpropertyName: string,\n\t\tincrementBy: number,\n\t\ttelemetryContext?: ITelemetryContext,\n\t) {\n\t\tconst prevTotal = (telemetryContext?.get(this.telemetryContextPrefix, propertyName) ??\n\t\t\t0) as number;\n\t\ttelemetryContext?.set(this.telemetryContextPrefix, propertyName, prevTotal + incrementBy);\n\t}\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/shared-object-base";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-internal.6.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.6.3.1";
|
|
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/shared-object-base";
|
|
8
|
-
export const pkgVersion = "2.0.0-internal.6.
|
|
8
|
+
export const pkgVersion = "2.0.0-internal.6.3.1";
|
|
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,oCAAoC,CAAC;AAC5D,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/shared-object-base\";\nexport const pkgVersion = \"2.0.0-internal.6.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,oCAAoC,CAAC;AAC5D,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/shared-object-base\";\nexport const pkgVersion = \"2.0.0-internal.6.3.1\";\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { assert } from "@fluidframework/
|
|
5
|
+
import { assert } from "@fluidframework/core-utils";
|
|
6
6
|
import { RuntimeHeaders } from "@fluidframework/container-runtime";
|
|
7
7
|
import { create404Response, exceptionToResponse, responseToException, } from "@fluidframework/runtime-utils";
|
|
8
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteObjectHandle.js","sourceRoot":"","sources":["../src/remoteObjectHandle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"remoteObjectHandle.js","sourceRoot":"","sources":["../src/remoteObjectHandle.ts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CAAC;YAC9C,CAAC,CAAC,CAAC;SACJ;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAEM,WAAW;QACjB,OAAO;IACR,CAAC;IAEM,IAAI,CAAC,MAAoB;QAC/B,MAAM,CAAC,WAAW,EAAE,CAAC;IACtB,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,OAAO,CAAC,OAAiB;QACrC,IAAI;YACH,MAAM,MAAM,GAA8B,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;YAC3D,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC;YAEnC,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;SACnF;QAAC,OAAO,KAAK,EAAE;YACf,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;SAClC;IACF,CAAC;CACD","sourcesContent":["/*!\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 { RuntimeHeaders } from \"@fluidframework/container-runtime\";\nimport {\n\tIFluidHandle,\n\tIFluidHandleContext,\n\tIRequest,\n\tIResponse,\n\tFluidObject,\n\tIFluidRouter,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tcreate404Response,\n\texceptionToResponse,\n\tresponseToException,\n} from \"@fluidframework/runtime-utils\";\n\n/**\n * This handle is used to dynamically load a Fluid object on a remote client and is created on parsing a serialized\n * FluidObjectHandle.\n * This class is used to generate an IFluidHandle when de-serializing any all handles (including handles to DDSes,\n * custom objects) that are stored in SharedObjects. The Data Store or SharedObject corresponding to the\n * IFluidHandle can be retrieved by calling `get` on it.\n */\nexport class RemoteFluidObjectHandle implements IFluidHandle {\n\t/**\n\t * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t */\n\tpublic get IFluidRouter() {\n\t\treturn this;\n\t}\n\tpublic get IFluidHandleContext() {\n\t\treturn this;\n\t}\n\tpublic get IFluidHandle() {\n\t\treturn this;\n\t}\n\n\tpublic readonly isAttached = true;\n\tprivate objectP: Promise<FluidObject> | undefined;\n\n\t/**\n\t * Creates a new RemoteFluidObjectHandle when parsing an IFluidHandle.\n\t * @param absolutePath - The absolute path to the handle from the container runtime.\n\t * @param routeContext - The root IFluidHandleContext that has a route to this handle.\n\t */\n\tconstructor(\n\t\tpublic readonly absolutePath: string,\n\t\tpublic readonly routeContext: IFluidHandleContext,\n\t) {\n\t\tassert(\n\t\t\tabsolutePath.startsWith(\"/\"),\n\t\t\t0x19d /* \"Handles should always have absolute paths\" */,\n\t\t);\n\t}\n\n\tpublic async get(): Promise<any> {\n\t\tif (this.objectP === undefined) {\n\t\t\t// Add `viaHandle` header to distinguish from requests from non-handle paths.\n\t\t\tconst request: IRequest = {\n\t\t\t\turl: this.absolutePath,\n\t\t\t\theaders: { [RuntimeHeaders.viaHandle]: true },\n\t\t\t};\n\t\t\tthis.objectP = this.routeContext\n\t\t\t\t.resolveHandle(request)\n\t\t\t\t.then<FluidObject>((response) => {\n\t\t\t\t\tif (response.mimeType === \"fluid/object\") {\n\t\t\t\t\t\tconst fluidObject: FluidObject = response.value;\n\t\t\t\t\t\treturn fluidObject;\n\t\t\t\t\t}\n\t\t\t\t\tthrow responseToException(response, request);\n\t\t\t\t});\n\t\t}\n\t\treturn this.objectP;\n\t}\n\n\tpublic attachGraph(): void {\n\t\treturn;\n\t}\n\n\tpublic bind(handle: IFluidHandle): void {\n\t\thandle.attachGraph();\n\t}\n\n\t/**\n\t * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t */\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\ttry {\n\t\t\tconst object: FluidObject<IFluidRouter> = await this.get();\n\t\t\tconst router = object.IFluidRouter;\n\n\t\t\treturn router !== undefined ? router.request(request) : create404Response(request);\n\t\t} catch (error) {\n\t\t\treturn exceptionToResponse(error);\n\t\t}\n\t}\n}\n"]}
|
package/lib/sharedObject.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { ITelemetryLoggerExt, EventEmitterWithErrorHandling } from "@fluidframework/telemetry-utils";
|
|
7
|
-
import { EventEmitterEventType } from "@
|
|
7
|
+
import { EventEmitterEventType } from "@fluid-internal/client-utils";
|
|
8
8
|
import { IChannelAttributes, IFluidDataStoreRuntime, IChannelStorageService, IChannelServices } from "@fluidframework/datastore-definitions";
|
|
9
9
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
10
10
|
import { IGarbageCollectionData, ISummaryTreeWithStats, ITelemetryContext, IExperimentalIncrementalSummaryContext } from "@fluidframework/runtime-definitions";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedObject.d.ts","sourceRoot":"","sources":["../src/sharedObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAwB,MAAM,iCAAiC,CAAC;AACrF,OAAO,EACN,mBAAmB,EAGnB,6BAA6B,EAK7B,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"sharedObject.d.ts","sourceRoot":"","sources":["../src/sharedObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAwB,MAAM,iCAAiC,CAAC;AACrF,OAAO,EACN,mBAAmB,EAGnB,6BAA6B,EAK7B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,EACN,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,yBAAyB,E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,IAAI,gBAAgB,CAa3C;IAED;;;;OAIG;gBAEF,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,sBAAsB,EAC/B,UAAU,EAAE,kBAAkB,EACb,sBAAsB,EAAE,MAAM;IAUhD;;OAEG;IACI,gBAAgB,CACtB,QAAQ,GAAE,OAAe,EACzB,UAAU,GAAE,OAAe,EAC3B,gBAAgB,CAAC,EAAE,iBAAiB,GAClC,qBAAqB;IAexB;;OAEG;IACU,SAAS,CACrB,QAAQ,GAAE,OAAe,EACzB,UAAU,GAAE,OAAe,EAC3B,gBAAgB,CAAC,EAAE,iBAAiB,EACpC,yBAAyB,CAAC,EAAE,sCAAsC,GAChE,OAAO,CAAC,qBAAqB,CAAC;IAmBjC;;OAEG;IACI,SAAS,CAAC,MAAM,GAAE,OAAe,GAAG,sBAAsB;IA8BjE;;;OAGG;IACH,SAAS,CAAC,iBAAiB,CAAC,UAAU,EAAE,iBAAiB;IAOzD;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,aAAa,CAC/B,UAAU,EAAE,gBAAgB,EAC5B,gBAAgB,CAAC,EAAE,iBAAiB,EACpC,yBAAyB,CAAC,EAAE,sCAAsC,GAChE,qBAAqB;IAExB,OAAO,CAAC,wBAAwB;CAShC"}
|
package/lib/sharedObject.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { v4 as uuid } from "uuid";
|
|
6
6
|
import { createChildLogger, DataProcessingError, EventEmitterWithErrorHandling, loggerToMonitoringContext, SampledTelemetryHelper, tagCodeArtifacts, } from "@fluidframework/telemetry-utils";
|
|
7
|
-
import { assert } from "@fluidframework/
|
|
7
|
+
import { assert } from "@fluidframework/core-utils";
|
|
8
8
|
import { AttachState } from "@fluidframework/container-definitions";
|
|
9
9
|
import { blobCountPropertyName, totalBlobSizePropertyName, } from "@fluidframework/runtime-definitions";
|
|
10
10
|
import { FluidSerializer } from "./serializer";
|
package/lib/sharedObject.js.map
CHANGED
|
@@ -1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AAE,EAAE,EAAE,CAAC;YAChE,MAAM,CACL,IAAI,CAAC,QAAQ,EACb,KAAK,CAAC,mEAAmE,CACzE,CAAC;SACF;gBAAS;YACT,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;SACtB;QAED,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;;OAGG;IACO,iBAAiB,CAAC,UAA6B;QACxD,wGAAwG;QACxG,2GAA2G;QAC3G,+DAA+D;QAC/D,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAChC,CAAC;IAYO,wBAAwB,CAC/B,YAAoB,EACpB,WAAmB,EACnB,gBAAoC;QAEpC,MAAM,SAAS,GAAG,CAAC,gBAAgB,EAAE,GAAG,CAAC,IAAI,CAAC,sBAAsB,EAAE,YAAY,CAAC;YAClF,CAAC,CAAW,CAAC;QACd,gBAAgB,EAAE,GAAG,CAAC,IAAI,CAAC,sBAAsB,EAAE,YAAY,EAAE,SAAS,GAAG,WAAW,CAAC,CAAC;IAC3F,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport { IFluidHandle, ITelemetryProperties } from \"@fluidframework/core-interfaces\";\nimport {\n\tITelemetryLoggerExt,\n\tcreateChildLogger,\n\tDataProcessingError,\n\tEventEmitterWithErrorHandling,\n\tloggerToMonitoringContext,\n\tMonitoringContext,\n\tSampledTelemetryHelper,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils\";\nimport { assert, EventEmitterEventType } from \"@fluidframework/common-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n\tIChannelServices,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIGarbageCollectionData,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\tblobCountPropertyName,\n\ttotalBlobSizePropertyName,\n\tIExperimentalIncrementalSummaryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { FluidSerializer, IFluidSerializer } from \"./serializer\";\nimport { SharedObjectHandle } from \"./handle\";\nimport { SummarySerializer } from \"./summarySerializer\";\nimport { ISharedObject, ISharedObjectEvents } from \"./types\";\n\n/**\n * Base class from which all shared objects derive.\n */\nexport abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISharedObjectEvents>\n\textends EventEmitterWithErrorHandling<TEvent>\n\timplements ISharedObject<TEvent>\n{\n\tpublic get IFluidLoadable() {\n\t\treturn this;\n\t}\n\n\tprivate readonly opProcessingHelper: SampledTelemetryHelper;\n\tprivate readonly callbacksHelper: SampledTelemetryHelper;\n\n\t/**\n\t * The handle referring to this SharedObject\n\t */\n\tpublic readonly handle: IFluidHandle;\n\n\t/**\n\t * Telemetry logger for the shared object\n\t */\n\tprotected readonly logger: ITelemetryLoggerExt;\n\tprivate readonly mc: MonitoringContext;\n\n\t/**\n\t * Connection state\n\t */\n\tprivate _connected = false;\n\n\t/**\n\t * Services used by the shared object\n\t */\n\tprivate services: IChannelServices | undefined;\n\n\t/**\n\t * True if the dds is bound to its parent.\n\t */\n\tprivate _isBoundToContext: boolean = false;\n\n\t/**\n\t * Tracks error that closed this object.\n\t */\n\tprivate closeError?: ReturnType<typeof DataProcessingError.wrapIfUnrecognized>;\n\n\t/**\n\t * Gets the connection state\n\t * @returns The state of the connection\n\t */\n\tpublic get connected(): boolean {\n\t\treturn this._connected;\n\t}\n\n\t/**\n\t * @param id - The id of the shared object\n\t * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n\t * @param attributes - Attributes of the shared object\n\t */\n\tconstructor(\n\t\tpublic id: string,\n\t\tprotected runtime: IFluidDataStoreRuntime,\n\t\tpublic readonly attributes: IChannelAttributes,\n\t) {\n\t\tsuper((event: EventEmitterEventType, e: any) => this.eventListenerErrorHandler(event, e));\n\n\t\tassert(!id.includes(\"/\"), 0x304 /* Id cannot contain slashes */);\n\n\t\tthis.handle = new SharedObjectHandle(this, id, runtime.IFluidHandleContext);\n\n\t\tthis.logger = createChildLogger({\n\t\t\tlogger: runtime.logger,\n\t\t\tproperties: {\n\t\t\t\tall: {\n\t\t\t\t\tsharedObjectId: uuid(),\n\t\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\t\tddsType: this.attributes.type,\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\t\tthis.mc = loggerToMonitoringContext(this.logger);\n\n\t\t[this.opProcessingHelper, this.callbacksHelper] = this.setUpSampledTelemetryHelpers();\n\n\t\tthis.attachListeners();\n\t}\n\n\t/**\n\t * This function is only supposed to be called from SharedObjectCore's constructor and\n\t * depends on a few things being set already. assert() calls make sure of it.\n\t * @returns The telemetry sampling helpers, so the constructor can be the one to assign them\n\t * to variables to avoid complaints from TypeScript.\n\t */\n\tprivate setUpSampledTelemetryHelpers(): SampledTelemetryHelper[] {\n\t\tassert(\n\t\t\tthis.mc !== undefined && this.logger !== undefined,\n\t\t\t0x349 /* this.mc and/or this.logger has not been set */,\n\t\t);\n\t\tconst opProcessingHelper = new SampledTelemetryHelper(\n\t\t\t{\n\t\t\t\teventName: \"ddsOpProcessing\",\n\t\t\t\tcategory: \"performance\",\n\t\t\t},\n\t\t\tthis.logger,\n\t\t\tthis.mc.config.getNumber(\"Fluid.SharedObject.OpProcessingTelemetrySampling\") ?? 1000,\n\t\t\ttrue,\n\t\t\tnew Map<string, ITelemetryProperties>([\n\t\t\t\t[\"local\", { localOp: true }],\n\t\t\t\t[\"remote\", { localOp: false }],\n\t\t\t]),\n\t\t);\n\t\tconst callbacksHelper = new SampledTelemetryHelper(\n\t\t\t{\n\t\t\t\teventName: \"ddsEventCallbacks\",\n\t\t\t\tcategory: \"performance\",\n\t\t\t},\n\t\t\tthis.logger,\n\t\t\tthis.mc.config.getNumber(\"Fluid.SharedObject.DdsCallbacksTelemetrySampling\") ?? 1000,\n\t\t\ttrue,\n\t\t);\n\n\t\tthis.runtime.once(\"dispose\", () => {\n\t\t\tthis.callbacksHelper.dispose();\n\t\t\tthis.opProcessingHelper.dispose();\n\t\t});\n\n\t\treturn [opProcessingHelper, callbacksHelper];\n\t}\n\n\t/**\n\t * Marks this objects as closed. Any attempt to change it (local changes or processing remote ops)\n\t * would result in same error thrown. If called multiple times, only first error is remembered.\n\t * @param error - error object that is thrown whenever an attempt is made to modify this object\n\t */\n\tprivate closeWithError(error: any) {\n\t\tif (this.closeError === undefined) {\n\t\t\tthis.closeError = error;\n\t\t}\n\t}\n\n\t/**\n\t * Verifies that this object is not closed via closeWithError(). If it is, throws an error used to close it.\n\t */\n\tprivate verifyNotClosed() {\n\t\tif (this.closeError !== undefined) {\n\t\t\tthrow this.closeError;\n\t\t}\n\t}\n\n\t/**\n\t * Event listener handler helper that can be used to react to exceptions thrown from event listeners\n\t * It wraps error with DataProcessingError, closes this object and throws resulting error.\n\t * See closeWithError() for more details\n\t * Ideally such situation never happens, as consumers of DDS should never throw exceptions\n\t * in event listeners (i.e. catch any of the issues and make determination on how to handle it).\n\t * When such exceptions propagate through, most likely data model is no longer consistent, i.e.\n\t * DDS state does not match what user sees. Because of it DDS moves to \"corrupted state\" and does not\n\t * allow processing of ops or local changes, which very quickly results in container closure.\n\t */\n\tprivate eventListenerErrorHandler(event: EventEmitterEventType, e: any) {\n\t\tconst error = DataProcessingError.wrapIfUnrecognized(\n\t\t\te,\n\t\t\t\"SharedObjectEventListenerException\",\n\t\t);\n\t\terror.addTelemetryProperties({ emittedEventName: String(event) });\n\n\t\tthis.closeWithError(error);\n\t\tthrow error;\n\t}\n\n\tprivate attachListeners() {\n\t\t// Only listen to these events if not attached.\n\t\tif (!this.isAttached()) {\n\t\t\tthis.runtime.once(\"attaching\", () => {\n\t\t\t\t// Calling this will let the dds to do any custom processing based on attached\n\t\t\t\t// like starting generating ops.\n\t\t\t\tthis.didAttach();\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * A shared object, after construction, can either be loaded in the case that it is already part of\n\t * a shared document. Or later attached if it is being newly added.\n\t * @param services - Services used by the shared object\n\t */\n\tpublic async load(services: IChannelServices): Promise<void> {\n\t\tif (this.runtime.attachState !== AttachState.Detached) {\n\t\t\tthis.services = services;\n\t\t}\n\t\tawait this.loadCore(services.objectStorage);\n\t\tif (this.runtime.attachState !== AttachState.Detached) {\n\t\t\tthis.attachDeltaHandler();\n\t\t}\n\t}\n\n\t/**\n\t * Initializes the object as a local, non-shared object. This object can become shared after\n\t * it is attached to the document.\n\t */\n\tpublic initializeLocal(): void {\n\t\tthis.initializeLocalCore();\n\t}\n\n\t/**\n\t * {@inheritDoc (ISharedObject:interface).bindToContext}\n\t */\n\tpublic bindToContext(): void {\n\t\tif (this._isBoundToContext) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._isBoundToContext = true;\n\n\t\tthis.runtime.bindChannel(this);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).connect}\n\t */\n\tpublic connect(services: IChannelServices) {\n\t\tthis.services = services;\n\t\tthis.attachDeltaHandler();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).isAttached}\n\t */\n\tpublic isAttached(): boolean {\n\t\treturn this.services !== undefined && this.runtime.attachState !== AttachState.Detached;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}\n\t */\n\tpublic abstract getAttachSummary(\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats;\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}\n\t */\n\tpublic abstract summarize(\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats>;\n\n\t/**\n\t * {@inheritDoc (ISharedObject:interface).getGCData}\n\t */\n\tpublic abstract getGCData(fullGC?: boolean): IGarbageCollectionData;\n\n\t/**\n\t * Called when a handle is decoded by this object. A handle in the object's data represents an outbound reference\n\t * to another object in the container.\n\t * @param decodedHandle - The handle of the Fluid object that is decoded.\n\t */\n\tprotected handleDecoded(decodedHandle: IFluidHandle) {\n\t\tif (this.isAttached()) {\n\t\t\t// This represents an outbound reference from this object to the node represented by decodedHandle.\n\t\t\tthis.services?.deltaConnection.addedGCOutboundReference?.(this.handle, decodedHandle);\n\t\t}\n\t}\n\n\t/**\n\t * Allows the distributed data type to perform custom loading\n\t * @param services - Storage used by the shared object\n\t */\n\tprotected abstract loadCore(services: IChannelStorageService): Promise<void>;\n\n\t/**\n\t * Allows the distributed data type to perform custom local loading.\n\t */\n\tprotected initializeLocalCore() {\n\t\treturn;\n\t}\n\n\t/**\n\t * Allows the distributive data type the ability to perform custom processing once an attach has happened.\n\t * Also called after non-local data type get loaded.\n\t */\n\tprotected didAttach() {\n\t\treturn;\n\t}\n\n\t/**\n\t * Derived classes must override this to do custom processing on a remote message.\n\t * @param message - The message to process\n\t * @param local - True if the shared object is local\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprotected abstract processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t);\n\n\t/**\n\t * Called when the object has disconnected from the delta stream.\n\t */\n\tprotected abstract onDisconnect();\n\n\t/**\n\t * Submits a message by the local client to the runtime.\n\t * @param content - Content of the message\n\t * @param localOpMetadata - The local metadata associated with the message. This is kept locally by the runtime\n\t * and not sent to the server. This will be sent back when this message is received back from the server. This is\n\t * also sent if we are asked to resubmit the message.\n\t */\n\tprotected submitLocalMessage(content: any, localOpMetadata: unknown = undefined): void {\n\t\tthis.verifyNotClosed();\n\t\tif (this.isAttached()) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tthis.services!.deltaConnection.submit(content, localOpMetadata);\n\t\t}\n\t}\n\n\t/**\n\t * Marks this object as dirty so that it is part of the next summary. It is called by a SharedSummaryBlock\n\t * that want to be part of summary but does not generate ops.\n\t */\n\tprotected dirty(): void {\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tthis.services!.deltaConnection.dirty();\n\t}\n\n\t/**\n\t * Called when the object has fully connected to the delta stream\n\t * Default implementation for DDS, override if different behavior is required.\n\t */\n\tprotected onConnect() {}\n\n\t/**\n\t * Called when a message has to be resubmitted. This typically happens after a reconnection for unacked messages.\n\t * The default implementation here is to resubmit the same message. The client can override if different behavior\n\t * is required. It can choose to resubmit the same message, submit different / multiple messages or not submit\n\t * anything at all.\n\t * @param content - The content of the original message.\n\t * @param localOpMetadata - The local metadata associated with the original message.\n\t */\n\tprotected reSubmitCore(content: any, localOpMetadata: unknown) {\n\t\tthis.submitLocalMessage(content, localOpMetadata);\n\t}\n\n\t/**\n\t * Promises that are waiting for an ack from the server before resolving should use this instead of new Promise.\n\t * It ensures that if something changes that will interrupt that ack (e.g. the FluidDataStoreRuntime disposes),\n\t * the Promise will reject.\n\t * If runtime is disposed when this call is made, executor is not run and promise is rejected right away.\n\t */\n\tprotected async newAckBasedPromise<T>(\n\t\texecutor: (\n\t\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\t\treject: (reason?: any) => void,\n\t\t) => void,\n\t): Promise<T> {\n\t\tlet rejectBecauseDispose: () => void;\n\t\treturn new Promise<T>((resolve, reject) => {\n\t\t\trejectBecauseDispose = () =>\n\t\t\t\treject(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\"FluidDataStoreRuntime disposed while this ack-based Promise was pending\",\n\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\tif (this.runtime.disposed) {\n\t\t\t\trejectBecauseDispose();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.runtime.on(\"dispose\", rejectBecauseDispose);\n\t\t\texecutor(resolve, reject);\n\t\t}).finally(() => {\n\t\t\t// Note: rejectBecauseDispose will never be undefined here\n\t\t\tthis.runtime.off(\"dispose\", rejectBecauseDispose);\n\t\t});\n\t}\n\n\tprivate attachDeltaHandler() {\n\t\t// Services should already be there in case we are attaching delta handler.\n\t\tassert(\n\t\t\tthis.services !== undefined,\n\t\t\t0x07a /* \"Services should be there to attach delta handler\" */,\n\t\t);\n\t\tthis._isBoundToContext = true;\n\t\t// Allows objects to do any custom processing if it is attached.\n\t\tthis.didAttach();\n\n\t\t// attachDeltaHandler is only called after services is assigned\n\t\tthis.services.deltaConnection.attach({\n\t\t\tprocess: (\n\t\t\t\tmessage: ISequencedDocumentMessage,\n\t\t\t\tlocal: boolean,\n\t\t\t\tlocalOpMetadata: unknown,\n\t\t\t) => {\n\t\t\t\tthis.process(message, local, localOpMetadata);\n\t\t\t},\n\t\t\tsetConnectionState: (connected: boolean) => {\n\t\t\t\tthis.setConnectionState(connected);\n\t\t\t},\n\t\t\treSubmit: (content: any, localOpMetadata: unknown) => {\n\t\t\t\tthis.reSubmit(content, localOpMetadata);\n\t\t\t},\n\t\t\tapplyStashedOp: (content: any): unknown => {\n\t\t\t\treturn this.applyStashedOp(content);\n\t\t\t},\n\t\t\trollback: (content: any, localOpMetadata: unknown) => {\n\t\t\t\tthis.rollback(content, localOpMetadata);\n\t\t\t},\n\t\t});\n\n\t\t// Trigger initial state\n\t\t// attachDeltaHandler is only called after services is assigned\n\t\tthis.setConnectionState(this.services.deltaConnection.connected);\n\t}\n\n\t/**\n\t * Set the state of connection to services.\n\t * @param connected - true if connected, false otherwise.\n\t */\n\tprivate setConnectionState(connected: boolean) {\n\t\tif (this._connected === connected) {\n\t\t\t// Not changing state, nothing the same.\n\t\t\treturn;\n\t\t}\n\n\t\t// Should I change the state at the end? So that we *can't* send new stuff before we send old?\n\t\tthis._connected = connected;\n\n\t\tif (!connected) {\n\t\t\t// Things that are true now...\n\t\t\t// - if we had a connection we can no longer send messages over it\n\t\t\t// - if we had outbound messages some may or may not be ACK'd. Won't know until next message\n\t\t\t//\n\t\t\t// - nack could get a new msn - but might as well do it in the join?\n\t\t\tthis.onDisconnect();\n\t\t} else {\n\t\t\t// Call this for now so that DDSes like ConsensusOrderedCollection that maintain their own pending\n\t\t\t// messages will work.\n\t\t\tthis.onConnect();\n\t\t}\n\t}\n\n\t/**\n\t * Handles a message being received from the remote delta server.\n\t * @param message - The message to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprivate process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n\t\tthis.verifyNotClosed(); // This will result in container closure.\n\t\tthis.emitInternal(\"pre-op\", message, local, this);\n\n\t\tthis.opProcessingHelper.measure(\n\t\t\t() => {\n\t\t\t\tthis.processCore(message, local, localOpMetadata);\n\t\t\t},\n\t\t\tlocal ? \"local\" : \"remote\",\n\t\t);\n\n\t\tthis.emitInternal(\"op\", message, local, this);\n\t}\n\n\t/**\n\t * Called when a message has to be resubmitted. This typically happens for unacked messages after a\n\t * reconnection.\n\t * @param content - The content of the original message.\n\t * @param localOpMetadata - The local metadata associated with the original message.\n\t */\n\tprivate reSubmit(content: any, localOpMetadata: unknown) {\n\t\tthis.reSubmitCore(content, localOpMetadata);\n\t}\n\n\t/**\n\t * Revert an op\n\t */\n\tprotected rollback(content: any, localOpMetadata: unknown) {\n\t\tthrow new Error(\"rollback not supported\");\n\t}\n\n\t/**\n\t * Apply changes from an op. Used when rehydrating an attached container\n\t * with pending changes. This prepares the SharedObject for seeing an ACK\n\t * for the op or resubmitting the op upon reconnection.\n\t * @param content - Contents of a stashed op.\n\t * @returns localMetadata of the op, to be passed to process() or resubmit()\n\t * when the op is ACKed or resubmitted, respectively\n\t */\n\tprotected abstract applyStashedOp(content: any): unknown;\n\n\t/**\n\t * Emit an event. This function is only intended for use by DDS classes that extend SharedObject/SharedObjectCore,\n\t * specifically to emit events that are part of the public interface of the DDS (i.e. those that can have listeners\n\t * attached to them by the consumers of the DDS). It should not be called from outside the class or to emit events\n\t * which are only internal to the DDS. Support for calling it from outside the DDS instance might be removed in the\n\t * future.\n\t *\n\t * @internal\n\t *\n\t * @param event - The event to emit.\n\t * @param args - Arguments to pass to the event listeners.\n\t * @returns `true` if the event had listeners, `false` otherwise.\n\t */\n\tpublic emit(event: EventEmitterEventType, ...args: any[]): boolean {\n\t\treturn this.callbacksHelper.measure(() => {\n\t\t\t// Creating ops while handling a DDS event can lead\n\t\t\t// to undefined behavior and events observed in the wrong order.\n\t\t\t// For example, we have two callbacks registered for a DDS, A and B.\n\t\t\t// Then if on change #1 callback A creates change #2, the invocation flow will be:\n\t\t\t//\n\t\t\t// A because of #1\n\t\t\t// A because of #2\n\t\t\t// B because of #2\n\t\t\t// B because of #1\n\t\t\t//\n\t\t\t// The runtime must enforce op coherence by not allowing any ops to be created during\n\t\t\t// the event handler\n\t\t\treturn this.runtime.ensureNoDataModelChanges(() => super.emit(event, ...args));\n\t\t});\n\t}\n\n\t/**\n\t * Use to emit events inside {@link SharedObjectCore}, with no telemetry measurement\n\t * done on the duration of the callbacks. Simply calls `super.emit()`.\n\t * @param event - Event to emit\n\t * @param args - Arguments for the event\n\t * @returns Whatever `super.emit()` returns.\n\t */\n\tprivate emitInternal(event: EventEmitterEventType, ...args: any[]): boolean {\n\t\treturn super.emit(event, ...args);\n\t}\n}\n\n/**\n * SharedObject with simplified, synchronous summarization and GC.\n * DDS implementations with async and incremental summarization should extend SharedObjectCore directly instead.\n */\nexport abstract class SharedObject<\n\tTEvent extends ISharedObjectEvents = ISharedObjectEvents,\n> extends SharedObjectCore<TEvent> {\n\t/**\n\t * True while we are garbage collecting this object's data.\n\t */\n\tprivate _isGCing: boolean = false;\n\n\t/**\n\t * The serializer to use to serialize / parse handles, if any.\n\t */\n\tprivate readonly _serializer: IFluidSerializer;\n\n\tprotected get serializer(): IFluidSerializer {\n\t\t/**\n\t\t * During garbage collection, the SummarySerializer keeps track of IFluidHandles that are serialized. These\n\t\t * handles represent references to other Fluid objects.\n\t\t *\n\t\t * This is fine for now. However, if we implement delay loading in DDss, they may load and de-serialize content\n\t\t * in summarize. When that happens, they may incorrectly hit this assert and we will have to change this.\n\t\t */\n\t\tassert(\n\t\t\t!this._isGCing,\n\t\t\t0x075 /* \"SummarySerializer should be used for serializing data during summary.\" */,\n\t\t);\n\t\treturn this._serializer;\n\t}\n\n\t/**\n\t * @param id - The id of the shared object\n\t * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n\t * @param attributes - Attributes of the shared object\n\t */\n\tconstructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t\tprivate readonly telemetryContextPrefix: string,\n\t) {\n\t\tsuper(id, runtime, attributes);\n\n\t\tthis._serializer = new FluidSerializer(\n\t\t\tthis.runtime.channelsRoutingContext,\n\t\t\t(handle: IFluidHandle) => this.handleDecoded(handle),\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}\n\t */\n\tpublic getAttachSummary(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = false,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\tconst result = this.summarizeCore(this.serializer, telemetryContext);\n\t\tthis.incrementTelemetryMetric(\n\t\t\tblobCountPropertyName,\n\t\t\tresult.stats.blobNodeCount,\n\t\t\ttelemetryContext,\n\t\t);\n\t\tthis.incrementTelemetryMetric(\n\t\t\ttotalBlobSizePropertyName,\n\t\t\tresult.stats.totalBlobSize,\n\t\t\ttelemetryContext,\n\t\t);\n\t\treturn result;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}\n\t */\n\tpublic async summarize(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = false,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): Promise<ISummaryTreeWithStats> {\n\t\tconst result = this.summarizeCore(\n\t\t\tthis.serializer,\n\t\t\ttelemetryContext,\n\t\t\tincrementalSummaryContext,\n\t\t);\n\t\tthis.incrementTelemetryMetric(\n\t\t\tblobCountPropertyName,\n\t\t\tresult.stats.blobNodeCount,\n\t\t\ttelemetryContext,\n\t\t);\n\t\tthis.incrementTelemetryMetric(\n\t\t\ttotalBlobSizePropertyName,\n\t\t\tresult.stats.totalBlobSize,\n\t\t\ttelemetryContext,\n\t\t);\n\t\treturn result;\n\t}\n\n\t/**\n\t * {@inheritDoc (ISharedObject:interface).getGCData}\n\t */\n\tpublic getGCData(fullGC: boolean = false): IGarbageCollectionData {\n\t\t// Set _isGCing to true. This flag is used to ensure that we only use SummarySerializer to serialize handles\n\t\t// in this object's data.\n\t\tassert(\n\t\t\t!this._isGCing,\n\t\t\t0x078 /* \"Possible re-entrancy! Summary should not already be in progress.\" */,\n\t\t);\n\t\tthis._isGCing = true;\n\n\t\tlet gcData: IGarbageCollectionData;\n\t\ttry {\n\t\t\tconst serializer = new SummarySerializer(\n\t\t\t\tthis.runtime.channelsRoutingContext,\n\t\t\t\t(handle: IFluidHandle) => this.handleDecoded(handle),\n\t\t\t);\n\t\t\tthis.processGCDataCore(serializer);\n\t\t\t// The GC data for this shared object contains a single GC node. The outbound routes of this node are the\n\t\t\t// routes of handles serialized during summarization.\n\t\t\tgcData = { gcNodes: { \"/\": serializer.getSerializedRoutes() } };\n\t\t\tassert(\n\t\t\t\tthis._isGCing,\n\t\t\t\t0x079 /* \"Possible re-entrancy! Summary should have been in progress.\" */,\n\t\t\t);\n\t\t} finally {\n\t\t\tthis._isGCing = false;\n\t\t}\n\n\t\treturn gcData;\n\t}\n\n\t/**\n\t * Calls the serializer over all data in this object that reference other GC nodes.\n\t * Derived classes must override this to provide custom list of references to other GC nodes.\n\t */\n\tprotected processGCDataCore(serializer: SummarySerializer) {\n\t\t// We run the full summarize logic to get the list of outbound routes from this object. This is a little\n\t\t// expensive but its okay for now. It will be updated to not use full summarize and make it more efficient.\n\t\t// See: https://github.com/microsoft/FluidFramework/issues/4547\n\t\tthis.summarizeCore(serializer);\n\t}\n\n\t/**\n\t * Gets a form of the object that can be serialized.\n\t * @returns A tree representing the snapshot of the shared object.\n\t */\n\tprotected abstract summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): ISummaryTreeWithStats;\n\n\tprivate incrementTelemetryMetric(\n\t\tpropertyName: string,\n\t\tincrementBy: number,\n\t\ttelemetryContext?: ITelemetryContext,\n\t) {\n\t\tconst prevTotal = (telemetryContext?.get(this.telemetryContextPrefix, propertyName) ??\n\t\t\t0) as number;\n\t\ttelemetryContext?.set(this.telemetryContextPrefix, propertyName, prevTotal + incrementBy);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sharedObject.js","sourceRoot":"","sources":["../src/sharedObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAEN,iBAAiB,EACjB,mBAAmB,EACnB,6BAA6B,EAC7B,yBAAyB,EAEzB,sBAAsB,EACtB,gBAAgB,GAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAQpE,OAAO,EAIN,qBAAqB,EACrB,yBAAyB,GAEzB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAoB,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB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IAC3F,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport { IFluidHandle, ITelemetryProperties } from \"@fluidframework/core-interfaces\";\nimport {\n\tITelemetryLoggerExt,\n\tcreateChildLogger,\n\tDataProcessingError,\n\tEventEmitterWithErrorHandling,\n\tloggerToMonitoringContext,\n\tMonitoringContext,\n\tSampledTelemetryHelper,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { EventEmitterEventType } from \"@fluid-internal/client-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n\tIChannelServices,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIGarbageCollectionData,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\tblobCountPropertyName,\n\ttotalBlobSizePropertyName,\n\tIExperimentalIncrementalSummaryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { FluidSerializer, IFluidSerializer } from \"./serializer\";\nimport { SharedObjectHandle } from \"./handle\";\nimport { SummarySerializer } from \"./summarySerializer\";\nimport { ISharedObject, ISharedObjectEvents } from \"./types\";\n\n/**\n * Base class from which all shared objects derive.\n */\nexport abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISharedObjectEvents>\n\textends EventEmitterWithErrorHandling<TEvent>\n\timplements ISharedObject<TEvent>\n{\n\tpublic get IFluidLoadable() {\n\t\treturn this;\n\t}\n\n\tprivate readonly opProcessingHelper: SampledTelemetryHelper;\n\tprivate readonly callbacksHelper: SampledTelemetryHelper;\n\n\t/**\n\t * The handle referring to this SharedObject\n\t */\n\tpublic readonly handle: IFluidHandle;\n\n\t/**\n\t * Telemetry logger for the shared object\n\t */\n\tprotected readonly logger: ITelemetryLoggerExt;\n\tprivate readonly mc: MonitoringContext;\n\n\t/**\n\t * Connection state\n\t */\n\tprivate _connected = false;\n\n\t/**\n\t * Services used by the shared object\n\t */\n\tprivate services: IChannelServices | undefined;\n\n\t/**\n\t * True if the dds is bound to its parent.\n\t */\n\tprivate _isBoundToContext: boolean = false;\n\n\t/**\n\t * Tracks error that closed this object.\n\t */\n\tprivate closeError?: ReturnType<typeof DataProcessingError.wrapIfUnrecognized>;\n\n\t/**\n\t * Gets the connection state\n\t * @returns The state of the connection\n\t */\n\tpublic get connected(): boolean {\n\t\treturn this._connected;\n\t}\n\n\t/**\n\t * @param id - The id of the shared object\n\t * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n\t * @param attributes - Attributes of the shared object\n\t */\n\tconstructor(\n\t\tpublic id: string,\n\t\tprotected runtime: IFluidDataStoreRuntime,\n\t\tpublic readonly attributes: IChannelAttributes,\n\t) {\n\t\tsuper((event: EventEmitterEventType, e: any) => this.eventListenerErrorHandler(event, e));\n\n\t\tassert(!id.includes(\"/\"), 0x304 /* Id cannot contain slashes */);\n\n\t\tthis.handle = new SharedObjectHandle(this, id, runtime.IFluidHandleContext);\n\n\t\tthis.logger = createChildLogger({\n\t\t\tlogger: runtime.logger,\n\t\t\tproperties: {\n\t\t\t\tall: {\n\t\t\t\t\tsharedObjectId: uuid(),\n\t\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\t\tddsType: this.attributes.type,\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\t\tthis.mc = loggerToMonitoringContext(this.logger);\n\n\t\t[this.opProcessingHelper, this.callbacksHelper] = this.setUpSampledTelemetryHelpers();\n\n\t\tthis.attachListeners();\n\t}\n\n\t/**\n\t * This function is only supposed to be called from SharedObjectCore's constructor and\n\t * depends on a few things being set already. assert() calls make sure of it.\n\t * @returns The telemetry sampling helpers, so the constructor can be the one to assign them\n\t * to variables to avoid complaints from TypeScript.\n\t */\n\tprivate setUpSampledTelemetryHelpers(): SampledTelemetryHelper[] {\n\t\tassert(\n\t\t\tthis.mc !== undefined && this.logger !== undefined,\n\t\t\t0x349 /* this.mc and/or this.logger has not been set */,\n\t\t);\n\t\tconst opProcessingHelper = new SampledTelemetryHelper(\n\t\t\t{\n\t\t\t\teventName: \"ddsOpProcessing\",\n\t\t\t\tcategory: \"performance\",\n\t\t\t},\n\t\t\tthis.logger,\n\t\t\tthis.mc.config.getNumber(\"Fluid.SharedObject.OpProcessingTelemetrySampling\") ?? 1000,\n\t\t\ttrue,\n\t\t\tnew Map<string, ITelemetryProperties>([\n\t\t\t\t[\"local\", { localOp: true }],\n\t\t\t\t[\"remote\", { localOp: false }],\n\t\t\t]),\n\t\t);\n\t\tconst callbacksHelper = new SampledTelemetryHelper(\n\t\t\t{\n\t\t\t\teventName: \"ddsEventCallbacks\",\n\t\t\t\tcategory: \"performance\",\n\t\t\t},\n\t\t\tthis.logger,\n\t\t\tthis.mc.config.getNumber(\"Fluid.SharedObject.DdsCallbacksTelemetrySampling\") ?? 1000,\n\t\t\ttrue,\n\t\t);\n\n\t\tthis.runtime.once(\"dispose\", () => {\n\t\t\tthis.callbacksHelper.dispose();\n\t\t\tthis.opProcessingHelper.dispose();\n\t\t});\n\n\t\treturn [opProcessingHelper, callbacksHelper];\n\t}\n\n\t/**\n\t * Marks this objects as closed. Any attempt to change it (local changes or processing remote ops)\n\t * would result in same error thrown. If called multiple times, only first error is remembered.\n\t * @param error - error object that is thrown whenever an attempt is made to modify this object\n\t */\n\tprivate closeWithError(error: any) {\n\t\tif (this.closeError === undefined) {\n\t\t\tthis.closeError = error;\n\t\t}\n\t}\n\n\t/**\n\t * Verifies that this object is not closed via closeWithError(). If it is, throws an error used to close it.\n\t */\n\tprivate verifyNotClosed() {\n\t\tif (this.closeError !== undefined) {\n\t\t\tthrow this.closeError;\n\t\t}\n\t}\n\n\t/**\n\t * Event listener handler helper that can be used to react to exceptions thrown from event listeners\n\t * It wraps error with DataProcessingError, closes this object and throws resulting error.\n\t * See closeWithError() for more details\n\t * Ideally such situation never happens, as consumers of DDS should never throw exceptions\n\t * in event listeners (i.e. catch any of the issues and make determination on how to handle it).\n\t * When such exceptions propagate through, most likely data model is no longer consistent, i.e.\n\t * DDS state does not match what user sees. Because of it DDS moves to \"corrupted state\" and does not\n\t * allow processing of ops or local changes, which very quickly results in container closure.\n\t */\n\tprivate eventListenerErrorHandler(event: EventEmitterEventType, e: any) {\n\t\tconst error = DataProcessingError.wrapIfUnrecognized(\n\t\t\te,\n\t\t\t\"SharedObjectEventListenerException\",\n\t\t);\n\t\terror.addTelemetryProperties({ emittedEventName: String(event) });\n\n\t\tthis.closeWithError(error);\n\t\tthrow error;\n\t}\n\n\tprivate attachListeners() {\n\t\t// Only listen to these events if not attached.\n\t\tif (!this.isAttached()) {\n\t\t\tthis.runtime.once(\"attaching\", () => {\n\t\t\t\t// Calling this will let the dds to do any custom processing based on attached\n\t\t\t\t// like starting generating ops.\n\t\t\t\tthis.didAttach();\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * A shared object, after construction, can either be loaded in the case that it is already part of\n\t * a shared document. Or later attached if it is being newly added.\n\t * @param services - Services used by the shared object\n\t */\n\tpublic async load(services: IChannelServices): Promise<void> {\n\t\tif (this.runtime.attachState !== AttachState.Detached) {\n\t\t\tthis.services = services;\n\t\t}\n\t\tawait this.loadCore(services.objectStorage);\n\t\tif (this.runtime.attachState !== AttachState.Detached) {\n\t\t\tthis.attachDeltaHandler();\n\t\t}\n\t}\n\n\t/**\n\t * Initializes the object as a local, non-shared object. This object can become shared after\n\t * it is attached to the document.\n\t */\n\tpublic initializeLocal(): void {\n\t\tthis.initializeLocalCore();\n\t}\n\n\t/**\n\t * {@inheritDoc (ISharedObject:interface).bindToContext}\n\t */\n\tpublic bindToContext(): void {\n\t\tif (this._isBoundToContext) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._isBoundToContext = true;\n\n\t\tthis.runtime.bindChannel(this);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).connect}\n\t */\n\tpublic connect(services: IChannelServices) {\n\t\tthis.services = services;\n\t\tthis.attachDeltaHandler();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).isAttached}\n\t */\n\tpublic isAttached(): boolean {\n\t\treturn this.services !== undefined && this.runtime.attachState !== AttachState.Detached;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}\n\t */\n\tpublic abstract getAttachSummary(\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats;\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}\n\t */\n\tpublic abstract summarize(\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats>;\n\n\t/**\n\t * {@inheritDoc (ISharedObject:interface).getGCData}\n\t */\n\tpublic abstract getGCData(fullGC?: boolean): IGarbageCollectionData;\n\n\t/**\n\t * Called when a handle is decoded by this object. A handle in the object's data represents an outbound reference\n\t * to another object in the container.\n\t * @param decodedHandle - The handle of the Fluid object that is decoded.\n\t */\n\tprotected handleDecoded(decodedHandle: IFluidHandle) {\n\t\tif (this.isAttached()) {\n\t\t\t// This represents an outbound reference from this object to the node represented by decodedHandle.\n\t\t\tthis.services?.deltaConnection.addedGCOutboundReference?.(this.handle, decodedHandle);\n\t\t}\n\t}\n\n\t/**\n\t * Allows the distributed data type to perform custom loading\n\t * @param services - Storage used by the shared object\n\t */\n\tprotected abstract loadCore(services: IChannelStorageService): Promise<void>;\n\n\t/**\n\t * Allows the distributed data type to perform custom local loading.\n\t */\n\tprotected initializeLocalCore() {\n\t\treturn;\n\t}\n\n\t/**\n\t * Allows the distributive data type the ability to perform custom processing once an attach has happened.\n\t * Also called after non-local data type get loaded.\n\t */\n\tprotected didAttach() {\n\t\treturn;\n\t}\n\n\t/**\n\t * Derived classes must override this to do custom processing on a remote message.\n\t * @param message - The message to process\n\t * @param local - True if the shared object is local\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprotected abstract processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t);\n\n\t/**\n\t * Called when the object has disconnected from the delta stream.\n\t */\n\tprotected abstract onDisconnect();\n\n\t/**\n\t * Submits a message by the local client to the runtime.\n\t * @param content - Content of the message\n\t * @param localOpMetadata - The local metadata associated with the message. This is kept locally by the runtime\n\t * and not sent to the server. This will be sent back when this message is received back from the server. This is\n\t * also sent if we are asked to resubmit the message.\n\t */\n\tprotected submitLocalMessage(content: any, localOpMetadata: unknown = undefined): void {\n\t\tthis.verifyNotClosed();\n\t\tif (this.isAttached()) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tthis.services!.deltaConnection.submit(content, localOpMetadata);\n\t\t}\n\t}\n\n\t/**\n\t * Marks this object as dirty so that it is part of the next summary. It is called by a SharedSummaryBlock\n\t * that want to be part of summary but does not generate ops.\n\t */\n\tprotected dirty(): void {\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tthis.services!.deltaConnection.dirty();\n\t}\n\n\t/**\n\t * Called when the object has fully connected to the delta stream\n\t * Default implementation for DDS, override if different behavior is required.\n\t */\n\tprotected onConnect() {}\n\n\t/**\n\t * Called when a message has to be resubmitted. This typically happens after a reconnection for unacked messages.\n\t * The default implementation here is to resubmit the same message. The client can override if different behavior\n\t * is required. It can choose to resubmit the same message, submit different / multiple messages or not submit\n\t * anything at all.\n\t * @param content - The content of the original message.\n\t * @param localOpMetadata - The local metadata associated with the original message.\n\t */\n\tprotected reSubmitCore(content: any, localOpMetadata: unknown) {\n\t\tthis.submitLocalMessage(content, localOpMetadata);\n\t}\n\n\t/**\n\t * Promises that are waiting for an ack from the server before resolving should use this instead of new Promise.\n\t * It ensures that if something changes that will interrupt that ack (e.g. the FluidDataStoreRuntime disposes),\n\t * the Promise will reject.\n\t * If runtime is disposed when this call is made, executor is not run and promise is rejected right away.\n\t */\n\tprotected async newAckBasedPromise<T>(\n\t\texecutor: (\n\t\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\t\treject: (reason?: any) => void,\n\t\t) => void,\n\t): Promise<T> {\n\t\tlet rejectBecauseDispose: () => void;\n\t\treturn new Promise<T>((resolve, reject) => {\n\t\t\trejectBecauseDispose = () =>\n\t\t\t\treject(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\"FluidDataStoreRuntime disposed while this ack-based Promise was pending\",\n\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\tif (this.runtime.disposed) {\n\t\t\t\trejectBecauseDispose();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.runtime.on(\"dispose\", rejectBecauseDispose);\n\t\t\texecutor(resolve, reject);\n\t\t}).finally(() => {\n\t\t\t// Note: rejectBecauseDispose will never be undefined here\n\t\t\tthis.runtime.off(\"dispose\", rejectBecauseDispose);\n\t\t});\n\t}\n\n\tprivate attachDeltaHandler() {\n\t\t// Services should already be there in case we are attaching delta handler.\n\t\tassert(\n\t\t\tthis.services !== undefined,\n\t\t\t0x07a /* \"Services should be there to attach delta handler\" */,\n\t\t);\n\t\tthis._isBoundToContext = true;\n\t\t// Allows objects to do any custom processing if it is attached.\n\t\tthis.didAttach();\n\n\t\t// attachDeltaHandler is only called after services is assigned\n\t\tthis.services.deltaConnection.attach({\n\t\t\tprocess: (\n\t\t\t\tmessage: ISequencedDocumentMessage,\n\t\t\t\tlocal: boolean,\n\t\t\t\tlocalOpMetadata: unknown,\n\t\t\t) => {\n\t\t\t\tthis.process(message, local, localOpMetadata);\n\t\t\t},\n\t\t\tsetConnectionState: (connected: boolean) => {\n\t\t\t\tthis.setConnectionState(connected);\n\t\t\t},\n\t\t\treSubmit: (content: any, localOpMetadata: unknown) => {\n\t\t\t\tthis.reSubmit(content, localOpMetadata);\n\t\t\t},\n\t\t\tapplyStashedOp: (content: any): unknown => {\n\t\t\t\treturn this.applyStashedOp(content);\n\t\t\t},\n\t\t\trollback: (content: any, localOpMetadata: unknown) => {\n\t\t\t\tthis.rollback(content, localOpMetadata);\n\t\t\t},\n\t\t});\n\n\t\t// Trigger initial state\n\t\t// attachDeltaHandler is only called after services is assigned\n\t\tthis.setConnectionState(this.services.deltaConnection.connected);\n\t}\n\n\t/**\n\t * Set the state of connection to services.\n\t * @param connected - true if connected, false otherwise.\n\t */\n\tprivate setConnectionState(connected: boolean) {\n\t\tif (this._connected === connected) {\n\t\t\t// Not changing state, nothing the same.\n\t\t\treturn;\n\t\t}\n\n\t\t// Should I change the state at the end? So that we *can't* send new stuff before we send old?\n\t\tthis._connected = connected;\n\n\t\tif (!connected) {\n\t\t\t// Things that are true now...\n\t\t\t// - if we had a connection we can no longer send messages over it\n\t\t\t// - if we had outbound messages some may or may not be ACK'd. Won't know until next message\n\t\t\t//\n\t\t\t// - nack could get a new msn - but might as well do it in the join?\n\t\t\tthis.onDisconnect();\n\t\t} else {\n\t\t\t// Call this for now so that DDSes like ConsensusOrderedCollection that maintain their own pending\n\t\t\t// messages will work.\n\t\t\tthis.onConnect();\n\t\t}\n\t}\n\n\t/**\n\t * Handles a message being received from the remote delta server.\n\t * @param message - The message to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprivate process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n\t\tthis.verifyNotClosed(); // This will result in container closure.\n\t\tthis.emitInternal(\"pre-op\", message, local, this);\n\n\t\tthis.opProcessingHelper.measure(\n\t\t\t() => {\n\t\t\t\tthis.processCore(message, local, localOpMetadata);\n\t\t\t},\n\t\t\tlocal ? \"local\" : \"remote\",\n\t\t);\n\n\t\tthis.emitInternal(\"op\", message, local, this);\n\t}\n\n\t/**\n\t * Called when a message has to be resubmitted. This typically happens for unacked messages after a\n\t * reconnection.\n\t * @param content - The content of the original message.\n\t * @param localOpMetadata - The local metadata associated with the original message.\n\t */\n\tprivate reSubmit(content: any, localOpMetadata: unknown) {\n\t\tthis.reSubmitCore(content, localOpMetadata);\n\t}\n\n\t/**\n\t * Revert an op\n\t */\n\tprotected rollback(content: any, localOpMetadata: unknown) {\n\t\tthrow new Error(\"rollback not supported\");\n\t}\n\n\t/**\n\t * Apply changes from an op. Used when rehydrating an attached container\n\t * with pending changes. This prepares the SharedObject for seeing an ACK\n\t * for the op or resubmitting the op upon reconnection.\n\t * @param content - Contents of a stashed op.\n\t * @returns localMetadata of the op, to be passed to process() or resubmit()\n\t * when the op is ACKed or resubmitted, respectively\n\t */\n\tprotected abstract applyStashedOp(content: any): unknown;\n\n\t/**\n\t * Emit an event. This function is only intended for use by DDS classes that extend SharedObject/SharedObjectCore,\n\t * specifically to emit events that are part of the public interface of the DDS (i.e. those that can have listeners\n\t * attached to them by the consumers of the DDS). It should not be called from outside the class or to emit events\n\t * which are only internal to the DDS. Support for calling it from outside the DDS instance might be removed in the\n\t * future.\n\t *\n\t * @internal\n\t *\n\t * @param event - The event to emit.\n\t * @param args - Arguments to pass to the event listeners.\n\t * @returns `true` if the event had listeners, `false` otherwise.\n\t */\n\tpublic emit(event: EventEmitterEventType, ...args: any[]): boolean {\n\t\treturn this.callbacksHelper.measure(() => {\n\t\t\t// Creating ops while handling a DDS event can lead\n\t\t\t// to undefined behavior and events observed in the wrong order.\n\t\t\t// For example, we have two callbacks registered for a DDS, A and B.\n\t\t\t// Then if on change #1 callback A creates change #2, the invocation flow will be:\n\t\t\t//\n\t\t\t// A because of #1\n\t\t\t// A because of #2\n\t\t\t// B because of #2\n\t\t\t// B because of #1\n\t\t\t//\n\t\t\t// The runtime must enforce op coherence by not allowing any ops to be created during\n\t\t\t// the event handler\n\t\t\treturn this.runtime.ensureNoDataModelChanges(() => super.emit(event, ...args));\n\t\t});\n\t}\n\n\t/**\n\t * Use to emit events inside {@link SharedObjectCore}, with no telemetry measurement\n\t * done on the duration of the callbacks. Simply calls `super.emit()`.\n\t * @param event - Event to emit\n\t * @param args - Arguments for the event\n\t * @returns Whatever `super.emit()` returns.\n\t */\n\tprivate emitInternal(event: EventEmitterEventType, ...args: any[]): boolean {\n\t\treturn super.emit(event, ...args);\n\t}\n}\n\n/**\n * SharedObject with simplified, synchronous summarization and GC.\n * DDS implementations with async and incremental summarization should extend SharedObjectCore directly instead.\n */\nexport abstract class SharedObject<\n\tTEvent extends ISharedObjectEvents = ISharedObjectEvents,\n> extends SharedObjectCore<TEvent> {\n\t/**\n\t * True while we are garbage collecting this object's data.\n\t */\n\tprivate _isGCing: boolean = false;\n\n\t/**\n\t * The serializer to use to serialize / parse handles, if any.\n\t */\n\tprivate readonly _serializer: IFluidSerializer;\n\n\tprotected get serializer(): IFluidSerializer {\n\t\t/**\n\t\t * During garbage collection, the SummarySerializer keeps track of IFluidHandles that are serialized. These\n\t\t * handles represent references to other Fluid objects.\n\t\t *\n\t\t * This is fine for now. However, if we implement delay loading in DDss, they may load and de-serialize content\n\t\t * in summarize. When that happens, they may incorrectly hit this assert and we will have to change this.\n\t\t */\n\t\tassert(\n\t\t\t!this._isGCing,\n\t\t\t0x075 /* \"SummarySerializer should be used for serializing data during summary.\" */,\n\t\t);\n\t\treturn this._serializer;\n\t}\n\n\t/**\n\t * @param id - The id of the shared object\n\t * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n\t * @param attributes - Attributes of the shared object\n\t */\n\tconstructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t\tprivate readonly telemetryContextPrefix: string,\n\t) {\n\t\tsuper(id, runtime, attributes);\n\n\t\tthis._serializer = new FluidSerializer(\n\t\t\tthis.runtime.channelsRoutingContext,\n\t\t\t(handle: IFluidHandle) => this.handleDecoded(handle),\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}\n\t */\n\tpublic getAttachSummary(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = false,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\tconst result = this.summarizeCore(this.serializer, telemetryContext);\n\t\tthis.incrementTelemetryMetric(\n\t\t\tblobCountPropertyName,\n\t\t\tresult.stats.blobNodeCount,\n\t\t\ttelemetryContext,\n\t\t);\n\t\tthis.incrementTelemetryMetric(\n\t\t\ttotalBlobSizePropertyName,\n\t\t\tresult.stats.totalBlobSize,\n\t\t\ttelemetryContext,\n\t\t);\n\t\treturn result;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}\n\t */\n\tpublic async summarize(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = false,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): Promise<ISummaryTreeWithStats> {\n\t\tconst result = this.summarizeCore(\n\t\t\tthis.serializer,\n\t\t\ttelemetryContext,\n\t\t\tincrementalSummaryContext,\n\t\t);\n\t\tthis.incrementTelemetryMetric(\n\t\t\tblobCountPropertyName,\n\t\t\tresult.stats.blobNodeCount,\n\t\t\ttelemetryContext,\n\t\t);\n\t\tthis.incrementTelemetryMetric(\n\t\t\ttotalBlobSizePropertyName,\n\t\t\tresult.stats.totalBlobSize,\n\t\t\ttelemetryContext,\n\t\t);\n\t\treturn result;\n\t}\n\n\t/**\n\t * {@inheritDoc (ISharedObject:interface).getGCData}\n\t */\n\tpublic getGCData(fullGC: boolean = false): IGarbageCollectionData {\n\t\t// Set _isGCing to true. This flag is used to ensure that we only use SummarySerializer to serialize handles\n\t\t// in this object's data.\n\t\tassert(\n\t\t\t!this._isGCing,\n\t\t\t0x078 /* \"Possible re-entrancy! Summary should not already be in progress.\" */,\n\t\t);\n\t\tthis._isGCing = true;\n\n\t\tlet gcData: IGarbageCollectionData;\n\t\ttry {\n\t\t\tconst serializer = new SummarySerializer(\n\t\t\t\tthis.runtime.channelsRoutingContext,\n\t\t\t\t(handle: IFluidHandle) => this.handleDecoded(handle),\n\t\t\t);\n\t\t\tthis.processGCDataCore(serializer);\n\t\t\t// The GC data for this shared object contains a single GC node. The outbound routes of this node are the\n\t\t\t// routes of handles serialized during summarization.\n\t\t\tgcData = { gcNodes: { \"/\": serializer.getSerializedRoutes() } };\n\t\t\tassert(\n\t\t\t\tthis._isGCing,\n\t\t\t\t0x079 /* \"Possible re-entrancy! Summary should have been in progress.\" */,\n\t\t\t);\n\t\t} finally {\n\t\t\tthis._isGCing = false;\n\t\t}\n\n\t\treturn gcData;\n\t}\n\n\t/**\n\t * Calls the serializer over all data in this object that reference other GC nodes.\n\t * Derived classes must override this to provide custom list of references to other GC nodes.\n\t */\n\tprotected processGCDataCore(serializer: SummarySerializer) {\n\t\t// We run the full summarize logic to get the list of outbound routes from this object. This is a little\n\t\t// expensive but its okay for now. It will be updated to not use full summarize and make it more efficient.\n\t\t// See: https://github.com/microsoft/FluidFramework/issues/4547\n\t\tthis.summarizeCore(serializer);\n\t}\n\n\t/**\n\t * Gets a form of the object that can be serialized.\n\t * @returns A tree representing the snapshot of the shared object.\n\t */\n\tprotected abstract summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): ISummaryTreeWithStats;\n\n\tprivate incrementTelemetryMetric(\n\t\tpropertyName: string,\n\t\tincrementBy: number,\n\t\ttelemetryContext?: ITelemetryContext,\n\t) {\n\t\tconst prevTotal = (telemetryContext?.get(this.telemetryContextPrefix, propertyName) ??\n\t\t\t0) as number;\n\t\ttelemetryContext?.set(this.telemetryContextPrefix, propertyName, prevTotal + incrementBy);\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/shared-object-base",
|
|
3
|
-
"version": "2.0.0-internal.6.
|
|
3
|
+
"version": "2.0.0-internal.6.3.1",
|
|
4
4
|
"description": "Fluid base class for shared distributed data structures",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"main": "dist/index.js",
|
|
15
15
|
"module": "lib/index.js",
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
|
-
"
|
|
17
|
+
"c8": {
|
|
18
18
|
"all": true,
|
|
19
19
|
"cache-dir": "nyc/.cache",
|
|
20
20
|
"exclude": [
|
|
@@ -35,32 +35,33 @@
|
|
|
35
35
|
"temp-directory": "nyc/.nyc_output"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@
|
|
39
|
-
"@fluidframework/container-definitions": ">=2.0.0-internal.6.
|
|
40
|
-
"@fluidframework/container-runtime": ">=2.0.0-internal.6.
|
|
41
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.6.
|
|
42
|
-
"@fluidframework/
|
|
43
|
-
"@fluidframework/datastore
|
|
38
|
+
"@fluid-internal/client-utils": ">=2.0.0-internal.6.3.1 <2.0.0-internal.6.4.0",
|
|
39
|
+
"@fluidframework/container-definitions": ">=2.0.0-internal.6.3.1 <2.0.0-internal.6.4.0",
|
|
40
|
+
"@fluidframework/container-runtime": ">=2.0.0-internal.6.3.1 <2.0.0-internal.6.4.0",
|
|
41
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.6.3.1 <2.0.0-internal.6.4.0",
|
|
42
|
+
"@fluidframework/core-utils": ">=2.0.0-internal.6.3.1 <2.0.0-internal.6.4.0",
|
|
43
|
+
"@fluidframework/datastore": ">=2.0.0-internal.6.3.1 <2.0.0-internal.6.4.0",
|
|
44
|
+
"@fluidframework/datastore-definitions": ">=2.0.0-internal.6.3.1 <2.0.0-internal.6.4.0",
|
|
44
45
|
"@fluidframework/protocol-definitions": "^1.1.0",
|
|
45
|
-
"@fluidframework/runtime-definitions": ">=2.0.0-internal.6.
|
|
46
|
-
"@fluidframework/runtime-utils": ">=2.0.0-internal.6.
|
|
47
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-internal.6.
|
|
46
|
+
"@fluidframework/runtime-definitions": ">=2.0.0-internal.6.3.1 <2.0.0-internal.6.4.0",
|
|
47
|
+
"@fluidframework/runtime-utils": ">=2.0.0-internal.6.3.1 <2.0.0-internal.6.4.0",
|
|
48
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.6.3.1 <2.0.0-internal.6.4.0",
|
|
48
49
|
"uuid": "^9.0.0"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
|
-
"@fluid-tools/build-cli": "^0.
|
|
52
|
+
"@fluid-tools/build-cli": "^0.22.0",
|
|
52
53
|
"@fluidframework/build-common": "^2.0.0",
|
|
53
|
-
"@fluidframework/build-tools": "^0.
|
|
54
|
+
"@fluidframework/build-tools": "^0.22.0",
|
|
54
55
|
"@fluidframework/eslint-config-fluid": "^2.1.0",
|
|
55
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.6.
|
|
56
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.6.3.1 <2.0.0-internal.6.4.0",
|
|
56
57
|
"@fluidframework/shared-object-base-previous": "npm:@fluidframework/shared-object-base@2.0.0-internal.6.1.1",
|
|
57
|
-
"@fluidframework/test-runtime-utils": ">=2.0.0-internal.6.
|
|
58
|
+
"@fluidframework/test-runtime-utils": ">=2.0.0-internal.6.3.1 <2.0.0-internal.6.4.0",
|
|
58
59
|
"@microsoft/api-extractor": "^7.34.4",
|
|
59
60
|
"@types/benchmark": "^2.1.0",
|
|
60
61
|
"@types/mocha": "^9.1.1",
|
|
61
62
|
"@types/node": "^16.18.38",
|
|
62
63
|
"benchmark": "^2.1.4",
|
|
63
|
-
"
|
|
64
|
+
"c8": "^7.7.1",
|
|
64
65
|
"copyfiles": "^2.4.1",
|
|
65
66
|
"cross-env": "^7.0.3",
|
|
66
67
|
"eslint": "~8.6.0",
|
|
@@ -68,10 +69,9 @@
|
|
|
68
69
|
"mocha-json-output-reporter": "^2.0.1",
|
|
69
70
|
"mocha-multi-reporters": "^1.5.1",
|
|
70
71
|
"moment": "^2.21.0",
|
|
71
|
-
"nyc": "^15.1.0",
|
|
72
72
|
"prettier": "~2.6.2",
|
|
73
73
|
"rimraf": "^4.4.0",
|
|
74
|
-
"ts-node": "^
|
|
74
|
+
"ts-node": "^10.9.1",
|
|
75
75
|
"typescript": "~4.5.5"
|
|
76
76
|
},
|
|
77
77
|
"typeValidation": {
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"build:genver": "gen-version",
|
|
88
88
|
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
89
89
|
"ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
|
|
90
|
-
"clean": "rimraf --glob
|
|
90
|
+
"clean": "rimraf --glob 'dist' 'lib' '*.tsbuildinfo' '*.build.log' '_api-extractor-temp' 'nyc'",
|
|
91
91
|
"eslint": "eslint --format stylish src",
|
|
92
92
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
93
93
|
"format": "npm run prettier:fix",
|
|
@@ -96,9 +96,8 @@
|
|
|
96
96
|
"prettier": "prettier --check . --ignore-path ../../../.prettierignore",
|
|
97
97
|
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
|
|
98
98
|
"test": "npm run test:mocha",
|
|
99
|
-
"test:coverage": "
|
|
100
|
-
"test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup
|
|
101
|
-
"test:mocha:multireport": "npm run test:mocha",
|
|
99
|
+
"test:coverage": "c8 npm test",
|
|
100
|
+
"test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
|
|
102
101
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
103
102
|
"tsc": "tsc",
|
|
104
103
|
"typetests:gen": "fluid-type-test-generator",
|
package/src/packageVersion.ts
CHANGED
package/src/sharedObject.ts
CHANGED
|
@@ -15,7 +15,8 @@ import {
|
|
|
15
15
|
SampledTelemetryHelper,
|
|
16
16
|
tagCodeArtifacts,
|
|
17
17
|
} from "@fluidframework/telemetry-utils";
|
|
18
|
-
import { assert
|
|
18
|
+
import { assert } from "@fluidframework/core-utils";
|
|
19
|
+
import { EventEmitterEventType } from "@fluid-internal/client-utils";
|
|
19
20
|
import { AttachState } from "@fluidframework/container-definitions";
|
|
20
21
|
import {
|
|
21
22
|
IChannelAttributes,
|