@fluidframework/shared-object-base 2.0.0-internal.6.1.0 → 2.0.0-internal.6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/README.md +4 -3
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/sharedObject.d.ts +1 -1
- package/dist/sharedObject.d.ts.map +1 -1
- package/dist/sharedObject.js +1 -2
- package/dist/sharedObject.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.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/sharedObject.d.ts +1 -1
- package/lib/sharedObject.d.ts.map +1 -1
- package/lib/sharedObject.js +1 -2
- package/lib/sharedObject.js.map +1 -1
- package/lib/types.d.ts +1 -1
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/package.json +17 -19
- package/src/packageVersion.ts +1 -1
- package/src/sharedObject.ts +2 -3
- package/src/types.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @fluidframework/shared-object-base
|
|
2
2
|
|
|
3
|
+
## 2.0.0-internal.6.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Remove use of @fluidframework/common-definitions ([#16638](https://github.com/microsoft/FluidFramework/issues/16638)) [a8c81509c9](https://github.com/microsoft/FluidFramework/commits/a8c81509c9bf09cfb2092ebcf7265205f9eb6dbf)
|
|
8
|
+
|
|
9
|
+
The **@fluidframework/common-definitions** package is being deprecated, so the following interfaces and types are now
|
|
10
|
+
imported from the **@fluidframework/core-interfaces** package:
|
|
11
|
+
|
|
12
|
+
- interface IDisposable
|
|
13
|
+
- interface IErrorEvent
|
|
14
|
+
- interface IErrorEvent
|
|
15
|
+
- interface IEvent
|
|
16
|
+
- interface IEventProvider
|
|
17
|
+
- interface ILoggingError
|
|
18
|
+
- interface ITaggedTelemetryPropertyType
|
|
19
|
+
- interface ITelemetryBaseEvent
|
|
20
|
+
- interface ITelemetryBaseLogger
|
|
21
|
+
- interface ITelemetryErrorEvent
|
|
22
|
+
- interface ITelemetryGenericEvent
|
|
23
|
+
- interface ITelemetryLogger
|
|
24
|
+
- interface ITelemetryPerformanceEvent
|
|
25
|
+
- interface ITelemetryProperties
|
|
26
|
+
- type ExtendEventProvider
|
|
27
|
+
- type IEventThisPlaceHolder
|
|
28
|
+
- type IEventTransformer
|
|
29
|
+
- type ReplaceIEventThisPlaceHolder
|
|
30
|
+
- type ReplaceIEventThisPlaceHolder
|
|
31
|
+
- type TelemetryEventCategory
|
|
32
|
+
- type TelemetryEventPropertyType
|
|
33
|
+
|
|
3
34
|
## 2.0.0-internal.6.1.0
|
|
4
35
|
|
|
5
36
|
Dependency updates only.
|
package/README.md
CHANGED
|
@@ -13,9 +13,10 @@ When taking a dependency on a Fluid Framework library, we recommend using a `^`
|
|
|
13
13
|
While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
|
|
14
14
|
library consumers should always prefer `^`.
|
|
15
15
|
|
|
16
|
-
Note that when depending on a library version of the form 2.0.0-internal.x.y.z
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
Note that when depending on a library version of the form `2.0.0-internal.x.y.z`, called the Fluid internal version scheme,
|
|
17
|
+
you must use a `>= <` dependency range (such as `>=2.0.0-internal.x.y.z <2.0.0-internal.w.0.0` where `w` is `x+1`).
|
|
18
|
+
Standard `^` and `~` ranges will not work as expected.
|
|
19
|
+
See the [@fluid-tools/version-tools](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/version-tools/README.md)
|
|
19
20
|
package for more information including tools to convert between version schemes.
|
|
20
21
|
|
|
21
22
|
<!-- prettier-ignore-end -->
|
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.2.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/shared-object-base";
|
|
11
|
-
exports.pkgVersion = "2.0.0-internal.6.
|
|
11
|
+
exports.pkgVersion = "2.0.0-internal.6.2.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,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.2.0\";\n"]}
|
package/dist/sharedObject.d.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
5
6
|
import { ITelemetryLoggerExt, EventEmitterWithErrorHandling } from "@fluidframework/telemetry-utils";
|
|
6
7
|
import { EventEmitterEventType } from "@fluidframework/common-utils";
|
|
7
|
-
import { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
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;
|
|
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;AACzC,OAAO,EAAU,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAE7E,OAAO,EACN,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;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ED;;;;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/dist/sharedObject.js
CHANGED
|
@@ -10,7 +10,6 @@ const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
|
10
10
|
const common_utils_1 = require("@fluidframework/common-utils");
|
|
11
11
|
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
12
12
|
const runtime_definitions_1 = require("@fluidframework/runtime-definitions");
|
|
13
|
-
const container_utils_1 = require("@fluidframework/container-utils");
|
|
14
13
|
const serializer_1 = require("./serializer");
|
|
15
14
|
const handle_1 = require("./handle");
|
|
16
15
|
const summarySerializer_1 = require("./summarySerializer");
|
|
@@ -117,7 +116,7 @@ class SharedObjectCore extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
117
116
|
* allow processing of ops or local changes, which very quickly results in container closure.
|
|
118
117
|
*/
|
|
119
118
|
eventListenerErrorHandler(event, e) {
|
|
120
|
-
const error =
|
|
119
|
+
const error = telemetry_utils_1.DataProcessingError.wrapIfUnrecognized(e, "SharedObjectEventListenerException");
|
|
121
120
|
error.addTelemetryProperties({ emittedEventName: String(event) });
|
|
122
121
|
this.closeWithError(error);
|
|
123
122
|
throw error;
|
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,qEAQyC;AACzC,+DAA6E;AAC7E,iFAAoE;AASpE,6EAO6C;AAC7C,qEAAsE;AACtE,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,qBAAM,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,EAA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C,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;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 { ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport {\n\tITelemetryLoggerExt,\n\tcreateChildLogger,\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 { IFluidHandle } from \"@fluidframework/core-interfaces\";\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 { DataProcessingError } from \"@fluidframework/container-utils\";\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,+DAA6E;AAC7E,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;Q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MAAM,UAAU,GAAG,IAAI,qCAAiB,CACvC,IAAI,CAAC,OAAO,CAAC,sBAAsB,EACnC,CAAC,MAAoB,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CACpD,CAAC;YACF,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;YACnC,yGAAyG;YACzG,qDAAqD;YACrD,MAAM,GAAG,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,mBAAmB,EAAE,EAAE,EAAE,CAAC;YAChE,IAAA,qBAAM,EACL,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;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"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -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 { IErrorEvent, IEventProvider, IEventThisPlaceHolder } from "@fluidframework/
|
|
5
|
+
import { IErrorEvent, IEventProvider, IEventThisPlaceHolder } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { IChannel } from "@fluidframework/datastore-definitions";
|
|
7
7
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
8
8
|
import { IGarbageCollectionData } from "@fluidframework/runtime-definitions";
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACvD;;;;;;;OAOG;IACH,CACC,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,CACT,EAAE,EAAE,yBAAyB,EAC7B,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,qBAAqB,KACzB,IAAI,OACR;IAEF;;;;;;;OAOG;IACH,CACC,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,CACT,EAAE,EAAE,yBAAyB,EAC7B,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,qBAAqB,KACzB,IAAI,OACR;CACF;AAED;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,MAAM,SAAS,mBAAmB,GAAG,mBAAmB,CACtF,SAAQ,QAAQ,EACf,cAAc,CAAC,MAAM,CAAC;IACvB;;;OAGG;IACH,aAAa,IAAI,IAAI,CAAC;IAEtB;;;;OAIG;IACH,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,sBAAsB,CAAC;CACpD"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIErrorEvent,\n\tIEventProvider,\n\tIEventThisPlaceHolder,\n} from \"@fluidframework/
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIErrorEvent,\n\tIEventProvider,\n\tIEventThisPlaceHolder,\n} from \"@fluidframework/core-interfaces\";\nimport { IChannel } from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { IGarbageCollectionData } from \"@fluidframework/runtime-definitions\";\n\n/**\n * Events emitted by {@link ISharedObject}.\n */\nexport interface ISharedObjectEvents extends IErrorEvent {\n\t/**\n\t * Fires before an incoming operation (op) is applied to the shared object.\n\t *\n\t * @remarks Note: this should be considered an internal implementation detail. It is not recommended for external\n\t * use.\n\t *\n\t * @eventProperty\n\t */\n\t(\n\t\tevent: \"pre-op\",\n\t\tlistener: (\n\t\t\top: ISequencedDocumentMessage,\n\t\t\tlocal: boolean,\n\t\t\ttarget: IEventThisPlaceHolder,\n\t\t) => void,\n\t);\n\n\t/**\n\t * Fires after an incoming op is applied to the shared object.\n\t *\n\t * @remarks Note: this should be considered an internal implementation detail. It is not recommended for external\n\t * use.\n\t *\n\t * @eventProperty\n\t */\n\t(\n\t\tevent: \"op\",\n\t\tlistener: (\n\t\t\top: ISequencedDocumentMessage,\n\t\t\tlocal: boolean,\n\t\t\ttarget: IEventThisPlaceHolder,\n\t\t) => void,\n\t);\n}\n\n/**\n * Base interface for shared objects from which other interfaces derive. Implemented by SharedObject\n */\nexport interface ISharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents>\n\textends IChannel,\n\t\tIEventProvider<TEvent> {\n\t/**\n\t * Binds the given shared object to its containing data store runtime, causing it to attach once\n\t * the runtime attaches.\n\t */\n\tbindToContext(): void;\n\n\t/**\n\t * Returns the GC data for this shared object. It contains a list of GC nodes that contains references to\n\t * other GC nodes.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tgetGCData(fullGC?: boolean): IGarbageCollectionData;\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.2.0";
|
|
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.2.0";
|
|
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.2.0\";\n"]}
|
package/lib/sharedObject.d.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
5
6
|
import { ITelemetryLoggerExt, EventEmitterWithErrorHandling } from "@fluidframework/telemetry-utils";
|
|
6
7
|
import { EventEmitterEventType } from "@fluidframework/common-utils";
|
|
7
|
-
import { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
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.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|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { v4 as uuid } from "uuid";
|
|
6
|
-
import { createChildLogger, EventEmitterWithErrorHandling, loggerToMonitoringContext, SampledTelemetryHelper, tagCodeArtifacts, } from "@fluidframework/telemetry-utils";
|
|
6
|
+
import { createChildLogger, DataProcessingError, EventEmitterWithErrorHandling, loggerToMonitoringContext, SampledTelemetryHelper, tagCodeArtifacts, } from "@fluidframework/telemetry-utils";
|
|
7
7
|
import { assert } from "@fluidframework/common-utils";
|
|
8
8
|
import { AttachState } from "@fluidframework/container-definitions";
|
|
9
9
|
import { blobCountPropertyName, totalBlobSizePropertyName, } from "@fluidframework/runtime-definitions";
|
|
10
|
-
import { DataProcessingError } from "@fluidframework/container-utils";
|
|
11
10
|
import { FluidSerializer } from "./serializer";
|
|
12
11
|
import { SharedObjectHandle } from "./handle";
|
|
13
12
|
import { SummarySerializer } from "./summarySerializer";
|
package/lib/sharedObject.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,6BAA6B,EAC7B,yBAAyB,EAEzB,sBAAsB,EACtB,gBAAgB,GAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,MAAM,EAAyB,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AASpE,OAAO,EAIN,qBAAqB,EACrB,yBAAyB,GAEzB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAoB,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,M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,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 { ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport {\n\tITelemetryLoggerExt,\n\tcreateChildLogger,\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 { IFluidHandle } from \"@fluidframework/core-interfaces\";\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 { DataProcessingError } from \"@fluidframework/container-utils\";\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,EAAyB,MAAM,8BAA8B,CAAC;AAC7E,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,CAAC;AAGxD;;GAEG;AACH,MAAM,OAAgB,gBACrB,SAAQ,6BAAqC;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,MAAM,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,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U,CAAC,CAAC;YACnC,yGAAyG;YACzG,qDAAqD;YACrD,MAAM,GAAG,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,mBAAmB,EAAE,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"]}
|
package/lib/types.d.ts
CHANGED
|
@@ -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 { IErrorEvent, IEventProvider, IEventThisPlaceHolder } from "@fluidframework/
|
|
5
|
+
import { IErrorEvent, IEventProvider, IEventThisPlaceHolder } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { IChannel } from "@fluidframework/datastore-definitions";
|
|
7
7
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
8
8
|
import { IGarbageCollectionData } from "@fluidframework/runtime-definitions";
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACvD;;;;;;;OAOG;IACH,CACC,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,CACT,EAAE,EAAE,yBAAyB,EAC7B,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,qBAAqB,KACzB,IAAI,OACR;IAEF;;;;;;;OAOG;IACH,CACC,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,CACT,EAAE,EAAE,yBAAyB,EAC7B,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,qBAAqB,KACzB,IAAI,OACR;CACF;AAED;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,MAAM,SAAS,mBAAmB,GAAG,mBAAmB,CACtF,SAAQ,QAAQ,EACf,cAAc,CAAC,MAAM,CAAC;IACvB;;;OAGG;IACH,aAAa,IAAI,IAAI,CAAC;IAEtB;;;;OAIG;IACH,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,sBAAsB,CAAC;CACpD"}
|
package/lib/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIErrorEvent,\n\tIEventProvider,\n\tIEventThisPlaceHolder,\n} from \"@fluidframework/
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIErrorEvent,\n\tIEventProvider,\n\tIEventThisPlaceHolder,\n} from \"@fluidframework/core-interfaces\";\nimport { IChannel } from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { IGarbageCollectionData } from \"@fluidframework/runtime-definitions\";\n\n/**\n * Events emitted by {@link ISharedObject}.\n */\nexport interface ISharedObjectEvents extends IErrorEvent {\n\t/**\n\t * Fires before an incoming operation (op) is applied to the shared object.\n\t *\n\t * @remarks Note: this should be considered an internal implementation detail. It is not recommended for external\n\t * use.\n\t *\n\t * @eventProperty\n\t */\n\t(\n\t\tevent: \"pre-op\",\n\t\tlistener: (\n\t\t\top: ISequencedDocumentMessage,\n\t\t\tlocal: boolean,\n\t\t\ttarget: IEventThisPlaceHolder,\n\t\t) => void,\n\t);\n\n\t/**\n\t * Fires after an incoming op is applied to the shared object.\n\t *\n\t * @remarks Note: this should be considered an internal implementation detail. It is not recommended for external\n\t * use.\n\t *\n\t * @eventProperty\n\t */\n\t(\n\t\tevent: \"op\",\n\t\tlistener: (\n\t\t\top: ISequencedDocumentMessage,\n\t\t\tlocal: boolean,\n\t\t\ttarget: IEventThisPlaceHolder,\n\t\t) => void,\n\t);\n}\n\n/**\n * Base interface for shared objects from which other interfaces derive. Implemented by SharedObject\n */\nexport interface ISharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents>\n\textends IChannel,\n\t\tIEventProvider<TEvent> {\n\t/**\n\t * Binds the given shared object to its containing data store runtime, causing it to attach once\n\t * the runtime attaches.\n\t */\n\tbindToContext(): void;\n\n\t/**\n\t * Returns the GC data for this shared object. It contains a list of GC nodes that contains references to\n\t * other GC nodes.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tgetGCData(fullGC?: boolean): IGarbageCollectionData;\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.2.0",
|
|
4
4
|
"description": "Fluid base class for shared distributed data structures",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -35,28 +35,26 @@
|
|
|
35
35
|
"temp-directory": "nyc/.nyc_output"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@fluidframework/common-definitions": "^0.20.1",
|
|
39
38
|
"@fluidframework/common-utils": "^1.1.1",
|
|
40
|
-
"@fluidframework/container-definitions": ">=2.0.0-internal.6.
|
|
41
|
-
"@fluidframework/container-runtime": ">=2.0.0-internal.6.
|
|
42
|
-
"@fluidframework/
|
|
43
|
-
"@fluidframework/
|
|
44
|
-
"@fluidframework/datastore": ">=2.0.0-internal.6.
|
|
45
|
-
"@fluidframework/datastore-definitions": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
|
|
39
|
+
"@fluidframework/container-definitions": ">=2.0.0-internal.6.2.0 <2.0.0-internal.6.3.0",
|
|
40
|
+
"@fluidframework/container-runtime": ">=2.0.0-internal.6.2.0 <2.0.0-internal.6.3.0",
|
|
41
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.6.2.0 <2.0.0-internal.6.3.0",
|
|
42
|
+
"@fluidframework/datastore": ">=2.0.0-internal.6.2.0 <2.0.0-internal.6.3.0",
|
|
43
|
+
"@fluidframework/datastore-definitions": ">=2.0.0-internal.6.2.0 <2.0.0-internal.6.3.0",
|
|
46
44
|
"@fluidframework/protocol-definitions": "^1.1.0",
|
|
47
|
-
"@fluidframework/runtime-definitions": ">=2.0.0-internal.6.
|
|
48
|
-
"@fluidframework/runtime-utils": ">=2.0.0-internal.6.
|
|
49
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-internal.6.
|
|
50
|
-
"uuid": "^
|
|
45
|
+
"@fluidframework/runtime-definitions": ">=2.0.0-internal.6.2.0 <2.0.0-internal.6.3.0",
|
|
46
|
+
"@fluidframework/runtime-utils": ">=2.0.0-internal.6.2.0 <2.0.0-internal.6.3.0",
|
|
47
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.6.2.0 <2.0.0-internal.6.3.0",
|
|
48
|
+
"uuid": "^9.0.0"
|
|
51
49
|
},
|
|
52
50
|
"devDependencies": {
|
|
53
|
-
"@fluid-tools/build-cli": "^0.
|
|
51
|
+
"@fluid-tools/build-cli": "^0.23.0",
|
|
54
52
|
"@fluidframework/build-common": "^2.0.0",
|
|
55
|
-
"@fluidframework/build-tools": "^0.
|
|
56
|
-
"@fluidframework/eslint-config-fluid": "^2.
|
|
57
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.6.
|
|
58
|
-
"@fluidframework/shared-object-base-previous": "npm:@fluidframework/shared-object-base@2.0.0-internal.6.
|
|
59
|
-
"@fluidframework/test-runtime-utils": ">=2.0.0-internal.6.
|
|
53
|
+
"@fluidframework/build-tools": "^0.23.0",
|
|
54
|
+
"@fluidframework/eslint-config-fluid": "^2.1.0",
|
|
55
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.6.2.0 <2.0.0-internal.6.3.0",
|
|
56
|
+
"@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.2.0 <2.0.0-internal.6.3.0",
|
|
60
58
|
"@microsoft/api-extractor": "^7.34.4",
|
|
61
59
|
"@types/benchmark": "^2.1.0",
|
|
62
60
|
"@types/mocha": "^9.1.1",
|
|
@@ -100,7 +98,7 @@
|
|
|
100
98
|
"test": "npm run test:mocha",
|
|
101
99
|
"test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
|
|
102
100
|
"test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
|
|
103
|
-
"test:mocha:multireport": "
|
|
101
|
+
"test:mocha:multireport": "npm run test:mocha",
|
|
104
102
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
105
103
|
"tsc": "tsc",
|
|
106
104
|
"typetests:gen": "fluid-type-test-generator",
|
package/src/packageVersion.ts
CHANGED
package/src/sharedObject.ts
CHANGED
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { v4 as uuid } from "uuid";
|
|
7
|
-
import { ITelemetryProperties } from "@fluidframework/
|
|
7
|
+
import { IFluidHandle, ITelemetryProperties } from "@fluidframework/core-interfaces";
|
|
8
8
|
import {
|
|
9
9
|
ITelemetryLoggerExt,
|
|
10
10
|
createChildLogger,
|
|
11
|
+
DataProcessingError,
|
|
11
12
|
EventEmitterWithErrorHandling,
|
|
12
13
|
loggerToMonitoringContext,
|
|
13
14
|
MonitoringContext,
|
|
@@ -16,7 +17,6 @@ import {
|
|
|
16
17
|
} from "@fluidframework/telemetry-utils";
|
|
17
18
|
import { assert, EventEmitterEventType } from "@fluidframework/common-utils";
|
|
18
19
|
import { AttachState } from "@fluidframework/container-definitions";
|
|
19
|
-
import { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
20
20
|
import {
|
|
21
21
|
IChannelAttributes,
|
|
22
22
|
IFluidDataStoreRuntime,
|
|
@@ -32,7 +32,6 @@ import {
|
|
|
32
32
|
totalBlobSizePropertyName,
|
|
33
33
|
IExperimentalIncrementalSummaryContext,
|
|
34
34
|
} from "@fluidframework/runtime-definitions";
|
|
35
|
-
import { DataProcessingError } from "@fluidframework/container-utils";
|
|
36
35
|
import { FluidSerializer, IFluidSerializer } from "./serializer";
|
|
37
36
|
import { SharedObjectHandle } from "./handle";
|
|
38
37
|
import { SummarySerializer } from "./summarySerializer";
|
package/src/types.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
IErrorEvent,
|
|
8
8
|
IEventProvider,
|
|
9
9
|
IEventThisPlaceHolder,
|
|
10
|
-
} from "@fluidframework/
|
|
10
|
+
} from "@fluidframework/core-interfaces";
|
|
11
11
|
import { IChannel } from "@fluidframework/datastore-definitions";
|
|
12
12
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
13
13
|
import { IGarbageCollectionData } from "@fluidframework/runtime-definitions";
|