@fluidframework/container-runtime 0.57.0 → 0.57.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/containerRuntime.d.ts +8 -4
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +52 -10
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts +1 -36
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +5 -27
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +1 -7
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +10 -6
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/containerRuntime.d.ts +8 -4
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +53 -11
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts +1 -36
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js +4 -26
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +1 -7
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +10 -6
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -1
- package/lib/index.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/package.json +11 -11
- package/src/containerRuntime.ts +69 -9
- package/src/dataStore.ts +6 -42
- package/src/dataStoreContext.ts +10 -13
- package/src/index.ts +0 -1
- package/src/packageVersion.ts +1 -1
package/dist/dataStore.d.ts
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
6
|
-
import {
|
|
7
|
-
import { IFluidDataStoreChannel } from "@fluidframework/runtime-definitions";
|
|
6
|
+
import { IDataStore, IFluidDataStoreChannel } from "@fluidframework/runtime-definitions";
|
|
8
7
|
import { ContainerRuntime } from "./containerRuntime";
|
|
9
8
|
import { DataStores } from "./dataStores";
|
|
10
9
|
/**
|
|
@@ -24,39 +23,5 @@ export interface IDataStoreAliasMessage {
|
|
|
24
23
|
* @returns True if the @see IDataStoreAliasMessage is fully implemented, false otherwise
|
|
25
24
|
*/
|
|
26
25
|
export declare const isDataStoreAliasMessage: (maybeDataStoreAliasMessage: any) => maybeDataStoreAliasMessage is IDataStoreAliasMessage;
|
|
27
|
-
/**
|
|
28
|
-
* Encapsulates the return codes of the aliasing API
|
|
29
|
-
*/
|
|
30
|
-
export declare enum AliasResult {
|
|
31
|
-
/**
|
|
32
|
-
* The datastore has been successfully aliased
|
|
33
|
-
*/
|
|
34
|
-
Success = "Success",
|
|
35
|
-
/**
|
|
36
|
-
* There is already a datastore bound to the provided alias
|
|
37
|
-
*/
|
|
38
|
-
Conflict = "Conflict",
|
|
39
|
-
/**
|
|
40
|
-
* The datastore is currently in the process of being aliased
|
|
41
|
-
*/
|
|
42
|
-
Aliasing = "Aliasing",
|
|
43
|
-
/**
|
|
44
|
-
* The datastore has been attempted to be aliased before
|
|
45
|
-
*/
|
|
46
|
-
AlreadyAliased = "AlreadyAliased"
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* A fluid router with the capability of being assigned an alias
|
|
50
|
-
*/
|
|
51
|
-
export interface IDataStore extends IFluidRouter {
|
|
52
|
-
/**
|
|
53
|
-
* Attempt to assign an alias to the datastore.
|
|
54
|
-
* If the operation succeeds, the datastore can be referenced
|
|
55
|
-
* by the supplied alias.
|
|
56
|
-
*
|
|
57
|
-
* @param alias - Given alias for this datastore.
|
|
58
|
-
*/
|
|
59
|
-
trySetAlias(alias: string): Promise<AliasResult>;
|
|
60
|
-
}
|
|
61
26
|
export declare const channelToDataStore: (fluidDataStoreChannel: IFluidDataStoreChannel, internalId: string, runtime: ContainerRuntime, datastores: DataStores, logger: ITelemetryLogger) => IDataStore;
|
|
62
27
|
//# sourceMappingURL=dataStore.d.ts.map
|
package/dist/dataStore.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStore.d.ts","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"dataStore.d.ts","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAItE,OAAO,EAAe,UAAU,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAEtG,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACnC,uCAAuC;IACvC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,qDAAqD;IACrD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACF,eAAO,MAAM,uBAAuB,+BACL,GAAG,yDAIlC,CAAC;AAEF,eAAO,MAAM,kBAAkB,0BACJ,sBAAsB,cACjC,MAAM,WACT,gBAAgB,cACb,UAAU,UACd,gBAAgB,KACzB,UAA2F,CAAC"}
|
package/dist/dataStore.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.channelToDataStore = exports.
|
|
7
|
+
exports.channelToDataStore = exports.isDataStoreAliasMessage = void 0;
|
|
8
8
|
const common_utils_1 = require("@fluidframework/common-utils");
|
|
9
9
|
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
10
10
|
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
@@ -19,28 +19,6 @@ const isDataStoreAliasMessage = (maybeDataStoreAliasMessage) => {
|
|
|
19
19
|
&& typeof (maybeDataStoreAliasMessage === null || maybeDataStoreAliasMessage === void 0 ? void 0 : maybeDataStoreAliasMessage.alias) === "string";
|
|
20
20
|
};
|
|
21
21
|
exports.isDataStoreAliasMessage = isDataStoreAliasMessage;
|
|
22
|
-
/**
|
|
23
|
-
* Encapsulates the return codes of the aliasing API
|
|
24
|
-
*/
|
|
25
|
-
var AliasResult;
|
|
26
|
-
(function (AliasResult) {
|
|
27
|
-
/**
|
|
28
|
-
* The datastore has been successfully aliased
|
|
29
|
-
*/
|
|
30
|
-
AliasResult["Success"] = "Success";
|
|
31
|
-
/**
|
|
32
|
-
* There is already a datastore bound to the provided alias
|
|
33
|
-
*/
|
|
34
|
-
AliasResult["Conflict"] = "Conflict";
|
|
35
|
-
/**
|
|
36
|
-
* The datastore is currently in the process of being aliased
|
|
37
|
-
*/
|
|
38
|
-
AliasResult["Aliasing"] = "Aliasing";
|
|
39
|
-
/**
|
|
40
|
-
* The datastore has been attempted to be aliased before
|
|
41
|
-
*/
|
|
42
|
-
AliasResult["AlreadyAliased"] = "AlreadyAliased";
|
|
43
|
-
})(AliasResult = exports.AliasResult || (exports.AliasResult = {}));
|
|
44
22
|
const channelToDataStore = (fluidDataStoreChannel, internalId, runtime, datastores, logger) => new DataStore(fluidDataStoreChannel, internalId, runtime, datastores, logger);
|
|
45
23
|
exports.channelToDataStore = channelToDataStore;
|
|
46
24
|
var AliasState;
|
|
@@ -62,11 +40,11 @@ class DataStore {
|
|
|
62
40
|
switch (this.aliasState) {
|
|
63
41
|
// If we're already aliasing, throw an exception
|
|
64
42
|
case AliasState.Aliasing:
|
|
65
|
-
return
|
|
43
|
+
return "Aliasing";
|
|
66
44
|
// If this datastore is already aliased, return true only if this
|
|
67
45
|
// is a repeated call for the same alias
|
|
68
46
|
case AliasState.Aliased:
|
|
69
|
-
return this.alias === alias ?
|
|
47
|
+
return this.alias === alias ? "Success" : "AlreadyAliased";
|
|
70
48
|
// There is no current or past alias operation for this datastore,
|
|
71
49
|
// it is safe to continue execution
|
|
72
50
|
case AliasState.None: break;
|
|
@@ -83,7 +61,7 @@ class DataStore {
|
|
|
83
61
|
// Explicitly Lock-out future attempts of aliasing,
|
|
84
62
|
// regardless of result
|
|
85
63
|
this.aliasState = AliasState.Aliased;
|
|
86
|
-
return localResult ?
|
|
64
|
+
return localResult ? "Success" : "Conflict";
|
|
87
65
|
}
|
|
88
66
|
const aliased = await this.ackBasedPromise((resolve) => {
|
|
89
67
|
this.runtime.submitDataStoreAliasOp(message, resolve);
|
|
@@ -110,7 +88,7 @@ class DataStore {
|
|
|
110
88
|
this.aliasState = AliasState.None;
|
|
111
89
|
return false;
|
|
112
90
|
});
|
|
113
|
-
return aliased ?
|
|
91
|
+
return aliased ? "Success" : "Conflict";
|
|
114
92
|
}
|
|
115
93
|
async request(request) {
|
|
116
94
|
return this.fluidDataStoreChannel.request(request);
|
package/dist/dataStore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStore.js","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAA+D;AAC/D,iFAAoE;AAGpE,qEAAmE;AAenE;;;;;GAKG;AACK,MAAM,uBAAuB,GAAG,CACpC,0BAA+B,EACqB,EAAE;IACtD,OAAO,QAAO,0BAA0B,aAA1B,0BAA0B,uBAA1B,0BAA0B,CAAE,UAAU,CAAA,KAAK,QAAQ;WAC1D,QAAO,0BAA0B,aAA1B,0BAA0B,uBAA1B,0BAA0B,C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,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { unreachableCase } from \"@fluidframework/common-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { IFluidRouter, IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { IFluidDataStoreChannel } from \"@fluidframework/runtime-definitions\";\nimport { TelemetryDataTag } from \"@fluidframework/telemetry-utils\";\nimport { ContainerRuntime } from \"./containerRuntime\";\nimport { DataStores } from \"./dataStores\";\n\n/**\n * Interface for an op to be used for assigning an\n * alias to a datastore\n */\nexport interface IDataStoreAliasMessage {\n /** The internal id of the datastore */\n readonly internalId: string;\n /** The alias name to be assigned to the datastore */\n readonly alias: string;\n}\n\n/**\n * Type guard that returns true if the given alias message is actually an instance of\n * a class which implements @see IDataStoreAliasMessage\n * @param maybeDataStoreAliasMessage - message object to be validated\n * @returns True if the @see IDataStoreAliasMessage is fully implemented, false otherwise\n */\n export const isDataStoreAliasMessage = (\n maybeDataStoreAliasMessage: any,\n): maybeDataStoreAliasMessage is IDataStoreAliasMessage => {\n return typeof maybeDataStoreAliasMessage?.internalId === \"string\"\n && typeof maybeDataStoreAliasMessage?.alias === \"string\";\n};\n\n/**\n * Encapsulates the return codes of the aliasing API\n */\nexport enum AliasResult {\n /**\n * The datastore has been successfully aliased\n */\n Success = \"Success\",\n /**\n * There is already a datastore bound to the provided alias\n */\n Conflict = \"Conflict\",\n /**\n * The datastore is currently in the process of being aliased\n */\n Aliasing = \"Aliasing\",\n /**\n * The datastore has been attempted to be aliased before\n */\n AlreadyAliased = \"AlreadyAliased\",\n}\n\n/**\n * A fluid router with the capability of being assigned an alias\n */\n export interface IDataStore extends IFluidRouter {\n /**\n * Attempt to assign an alias to the datastore.\n * If the operation succeeds, the datastore can be referenced\n * by the supplied alias.\n *\n * @param alias - Given alias for this datastore.\n */\n trySetAlias(alias: string): Promise<AliasResult>;\n}\n\nexport const channelToDataStore = (\n fluidDataStoreChannel: IFluidDataStoreChannel,\n internalId: string,\n runtime: ContainerRuntime,\n datastores: DataStores,\n logger: ITelemetryLogger,\n): IDataStore => new DataStore(fluidDataStoreChannel, internalId, runtime, datastores, logger);\n\nenum AliasState {\n Aliased = \"Aliased\",\n Aliasing = \"Aliasing\",\n None = \"None\",\n}\n\nclass DataStore implements IDataStore {\n private aliasState: AliasState = AliasState.None;\n private alias: string | undefined;\n\n async trySetAlias(alias: string): Promise<AliasResult> {\n switch (this.aliasState) {\n // If we're already aliasing, throw an exception\n case AliasState.Aliasing:\n return AliasResult.Aliasing;\n // If this datastore is already aliased, return true only if this\n // is a repeated call for the same alias\n case AliasState.Aliased:\n return this.alias === alias ? AliasResult.Success : AliasResult.AlreadyAliased;\n // There is no current or past alias operation for this datastore,\n // it is safe to continue execution\n case AliasState.None: break;\n default: unreachableCase(this.aliasState);\n }\n\n this.aliasState = AliasState.Aliasing;\n const message: IDataStoreAliasMessage = {\n internalId: this.internalId,\n alias,\n };\n\n this.fluidDataStoreChannel.bindToContext();\n\n if (this.runtime.attachState === AttachState.Detached) {\n const localResult = this.datastores.processAliasMessageCore(message);\n // Explicitly Lock-out future attempts of aliasing,\n // regardless of result\n this.aliasState = AliasState.Aliased;\n return localResult ? AliasResult.Success : AliasResult.Conflict;\n }\n\n const aliased = await this.ackBasedPromise<boolean>((resolve) => {\n this.runtime.submitDataStoreAliasOp(message, resolve);\n }).then((succeeded) => {\n // Explicitly Lock-out future attempts of aliasing,\n // regardless of result\n this.aliasState = AliasState.Aliased;\n if (succeeded) {\n this.alias = alias;\n }\n\n return succeeded;\n }).catch((error) => {\n this.logger.sendErrorEvent({\n eventName: \"AliasingException\",\n alias: {\n value: alias,\n tag: TelemetryDataTag.UserData,\n },\n internalId: {\n value: this.internalId,\n tag: TelemetryDataTag.PackageData,\n },\n }, error);\n this.aliasState = AliasState.None;\n return false;\n });\n\n return aliased ? AliasResult.Success : AliasResult.Conflict;\n }\n\n async request(request: IRequest): Promise<IResponse> {\n return this.fluidDataStoreChannel.request(request);\n }\n\n constructor(\n private readonly fluidDataStoreChannel: IFluidDataStoreChannel,\n private readonly internalId: string,\n private readonly runtime: ContainerRuntime,\n private datastores: DataStores,\n private readonly logger: ITelemetryLogger,\n ) { }\n public get IFluidRouter() { return this.fluidDataStoreChannel; }\n\n private async ackBasedPromise<T>(\n executor: (resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void) => void,\n ): Promise<T> {\n let rejectBecauseDispose: () => void;\n return new Promise<T>((resolve, reject) => {\n rejectBecauseDispose =\n () => reject(new Error(\"ContainerRuntime disposed while this ack-based Promise was pending\"));\n\n if (this.runtime.disposed) {\n rejectBecauseDispose();\n return;\n }\n\n this.runtime.on(\"dispose\", rejectBecauseDispose);\n executor(resolve, reject);\n }).finally(() => {\n this.runtime.off(\"dispose\", rejectBecauseDispose);\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dataStore.js","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAA+D;AAC/D,iFAAoE;AAGpE,qEAAmE;AAenE;;;;;GAKG;AACK,MAAM,uBAAuB,GAAG,CACpC,0BAA+B,EACqB,EAAE;IACtD,OAAO,QAAO,0BAA0B,aAA1B,0BAA0B,uBAA1B,0BAA0B,CAAE,UAAU,CAAA,KAAK,QAAQ;WAC1D,QAAO,0BAA0B,aAA1B,0BAA0B,uBAA1B,0BAA0B,CAAE,KAAK,CAAA,KAAK,QAAQ,CAAC;AACjE,CAAC,CAAC;AALY,QAAA,uBAAuB,2BAKnC;AAEK,MAAM,kBAAkB,GAAG,CAC9B,qBAA6C,EAC7C,UAAkB,EAClB,OAAyB,EACzB,UAAsB,EACtB,MAAwB,EACd,EAAE,CAAC,IAAI,SAAS,CAAC,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AAO,CAAC,OAAiB;QAC3B,OAAO,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC;IASD,IAAW,YAAY,KAAK,OAAO,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAExD,KAAK,CAAC,eAAe,CACzB,QACuC;QAEvC,IAAI,oBAAgC,CAAC;QACrC,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,oBAAoB;gBAChB,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC,CAAC;YAElG,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;gBACvB,oBAAoB,EAAE,CAAC;gBACvB,OAAO;aACV;YAED,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;YACjD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;YACZ,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { unreachableCase } from \"@fluidframework/common-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { AliasResult, IDataStore, IFluidDataStoreChannel } from \"@fluidframework/runtime-definitions\";\nimport { TelemetryDataTag } from \"@fluidframework/telemetry-utils\";\nimport { ContainerRuntime } from \"./containerRuntime\";\nimport { DataStores } from \"./dataStores\";\n\n/**\n * Interface for an op to be used for assigning an\n * alias to a datastore\n */\nexport interface IDataStoreAliasMessage {\n /** The internal id of the datastore */\n readonly internalId: string;\n /** The alias name to be assigned to the datastore */\n readonly alias: string;\n}\n\n/**\n * Type guard that returns true if the given alias message is actually an instance of\n * a class which implements @see IDataStoreAliasMessage\n * @param maybeDataStoreAliasMessage - message object to be validated\n * @returns True if the @see IDataStoreAliasMessage is fully implemented, false otherwise\n */\n export const isDataStoreAliasMessage = (\n maybeDataStoreAliasMessage: any,\n): maybeDataStoreAliasMessage is IDataStoreAliasMessage => {\n return typeof maybeDataStoreAliasMessage?.internalId === \"string\"\n && typeof maybeDataStoreAliasMessage?.alias === \"string\";\n};\n\nexport const channelToDataStore = (\n fluidDataStoreChannel: IFluidDataStoreChannel,\n internalId: string,\n runtime: ContainerRuntime,\n datastores: DataStores,\n logger: ITelemetryLogger,\n): IDataStore => new DataStore(fluidDataStoreChannel, internalId, runtime, datastores, logger);\n\nenum AliasState {\n Aliased = \"Aliased\",\n Aliasing = \"Aliasing\",\n None = \"None\",\n}\n\nclass DataStore implements IDataStore {\n private aliasState: AliasState = AliasState.None;\n private alias: string | undefined;\n\n async trySetAlias(alias: string): Promise<AliasResult> {\n switch (this.aliasState) {\n // If we're already aliasing, throw an exception\n case AliasState.Aliasing:\n return \"Aliasing\";\n // If this datastore is already aliased, return true only if this\n // is a repeated call for the same alias\n case AliasState.Aliased:\n return this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n // There is no current or past alias operation for this datastore,\n // it is safe to continue execution\n case AliasState.None: break;\n default: unreachableCase(this.aliasState);\n }\n\n this.aliasState = AliasState.Aliasing;\n const message: IDataStoreAliasMessage = {\n internalId: this.internalId,\n alias,\n };\n\n this.fluidDataStoreChannel.bindToContext();\n\n if (this.runtime.attachState === AttachState.Detached) {\n const localResult = this.datastores.processAliasMessageCore(message);\n // Explicitly Lock-out future attempts of aliasing,\n // regardless of result\n this.aliasState = AliasState.Aliased;\n return localResult ? \"Success\" : \"Conflict\";\n }\n\n const aliased = await this.ackBasedPromise<boolean>((resolve) => {\n this.runtime.submitDataStoreAliasOp(message, resolve);\n }).then((succeeded) => {\n // Explicitly Lock-out future attempts of aliasing,\n // regardless of result\n this.aliasState = AliasState.Aliased;\n if (succeeded) {\n this.alias = alias;\n }\n\n return succeeded;\n }).catch((error) => {\n this.logger.sendErrorEvent({\n eventName: \"AliasingException\",\n alias: {\n value: alias,\n tag: TelemetryDataTag.UserData,\n },\n internalId: {\n value: this.internalId,\n tag: TelemetryDataTag.PackageData,\n },\n }, error);\n this.aliasState = AliasState.None;\n return false;\n });\n\n return aliased ? \"Success\" : \"Conflict\";\n }\n\n async request(request: IRequest): Promise<IResponse> {\n return this.fluidDataStoreChannel.request(request);\n }\n\n constructor(\n private readonly fluidDataStoreChannel: IFluidDataStoreChannel,\n private readonly internalId: string,\n private readonly runtime: ContainerRuntime,\n private datastores: DataStores,\n private readonly logger: ITelemetryLogger,\n ) { }\n public get IFluidRouter() { return this.fluidDataStoreChannel; }\n\n private async ackBasedPromise<T>(\n executor: (resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void) => void,\n ): Promise<T> {\n let rejectBecauseDispose: () => void;\n return new Promise<T>((resolve, reject) => {\n rejectBecauseDispose =\n () => reject(new Error(\"ContainerRuntime disposed while this ack-based Promise was pending\"));\n\n if (this.runtime.disposed) {\n rejectBecauseDispose();\n return;\n }\n\n this.runtime.on(\"dispose\", rejectBecauseDispose);\n executor(resolve, reject);\n }).finally(() => {\n this.runtime.off(\"dispose\", rejectBecauseDispose);\n });\n }\n}\n"]}
|
|
@@ -14,11 +14,6 @@ import { ContainerRuntime } from "./containerRuntime";
|
|
|
14
14
|
export declare function createAttributesBlob(pkg: readonly string[], isRootDataStore: boolean, disableIsolatedChannels: boolean): ITreeEntry;
|
|
15
15
|
interface ISnapshotDetails {
|
|
16
16
|
pkg: readonly string[];
|
|
17
|
-
/**
|
|
18
|
-
* This tells whether a data store is root. Root data stores are never collected.
|
|
19
|
-
* Non-root data stores may be collected if they are not used.
|
|
20
|
-
*/
|
|
21
|
-
isRootDataStore: boolean;
|
|
22
17
|
snapshot?: ISnapshotTree;
|
|
23
18
|
}
|
|
24
19
|
/** Properties necessary for creating a FluidDataStoreContext */
|
|
@@ -80,6 +75,7 @@ export declare abstract class FluidDataStoreContext extends TypedEventEmitter<IF
|
|
|
80
75
|
protected channelDeferred: Deferred<IFluidDataStoreChannel> | undefined;
|
|
81
76
|
private _baseSnapshot;
|
|
82
77
|
protected _attachState: AttachState;
|
|
78
|
+
protected isRootDataStore: boolean;
|
|
83
79
|
protected readonly summarizerNode: ISummarizerNodeWithGC;
|
|
84
80
|
private readonly subLogger;
|
|
85
81
|
private readonly thresholdOpsCounter;
|
|
@@ -199,7 +195,6 @@ export declare abstract class FluidDataStoreContext extends TypedEventEmitter<IF
|
|
|
199
195
|
uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>>;
|
|
200
196
|
}
|
|
201
197
|
export declare class RemoteFluidDataStoreContext extends FluidDataStoreContext {
|
|
202
|
-
private isRootDataStore;
|
|
203
198
|
private readonly initSnapshotValue;
|
|
204
199
|
private readonly baseGCDetailsP;
|
|
205
200
|
constructor(props: IRemoteFluidDataStoreContextProps);
|
|
@@ -223,7 +218,6 @@ export declare class RemoteFluidDataStoreContext extends FluidDataStoreContext {
|
|
|
223
218
|
*/
|
|
224
219
|
export declare class LocalFluidDataStoreContextBase extends FluidDataStoreContext {
|
|
225
220
|
private readonly snapshotTree;
|
|
226
|
-
protected isRootDataStore: boolean | undefined;
|
|
227
221
|
/**
|
|
228
222
|
* @deprecated 0.16 Issue #1635, #3631
|
|
229
223
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreContext.d.ts","sourceRoot":"","sources":["../src/dataStoreContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EACH,WAAW,EACX,QAAQ,EACR,SAAS,EACT,YAAY,EACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,SAAS,EACT,aAAa,EACb,SAAS,EACT,WAAW,EACX,cAAc,EACjB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAEH,QAAQ,EAER,iBAAiB,EACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAG7E,OAAO,EACH,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,yBAAyB,EACzB,aAAa,EACb,UAAU,EACb,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACH,iBAAiB,EACpB,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAEH,2BAA2B,EAC3B,8BAA8B,EAG9B,cAAc,EACd,sBAAsB,EACtB,sBAAsB,EACtB,8BAA8B,EAC9B,4BAA4B,EAC5B,uBAAuB,EACvB,sBAAsB,EACtB,6BAA6B,EAC7B,gCAAgC,EAChC,qBAAqB,EACrB,6BAA6B,EAE7B,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACtB,MAAM,qCAAqC,CAAC;AAU7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AA2BtD,wBAAgB,oBAAoB,CAChC,GAAG,EAAE,SAAS,MAAM,EAAE,EACtB,eAAe,EAAE,OAAO,EACxB,uBAAuB,EAAE,OAAO,GACjC,UAAU,CAGZ;AAED,UAAU,gBAAgB;IACtB,GAAG,EAAE,SAAS,MAAM,EAAE,CAAC;IACvB
|
|
1
|
+
{"version":3,"file":"dataStoreContext.d.ts","sourceRoot":"","sources":["../src/dataStoreContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EACH,WAAW,EACX,QAAQ,EACR,SAAS,EACT,YAAY,EACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,SAAS,EACT,aAAa,EACb,SAAS,EACT,WAAW,EACX,cAAc,EACjB,MAA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,iCAAiC;IAiBpD,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CA6DrC;cAEa,yBAAyB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAItE;;OAEG;IACU,0BAA0B,IAAI,OAAO,CAAC,gCAAgC,CAAC;IAIvE,gBAAgB,IAAI,OAAO,CAAC,6BAA6B,CAAC;IAIhE,qBAAqB,IAAI,cAAc;IAI9C;;;;OAIG;IACI,OAAO,IAAI,IAAI;CAGzB;AAED;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,qBAAqB;IACrE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA4B;IACzD;;OAEG;IACH,SAAgB,WAAW,CAAC,EAAE,GAAG,CAAC;gBAEtB,KAAK,EAAE,gCAAgC;IAenD,OAAO,CAAC,eAAe;IAWhB,qBAAqB,IAAI,cAAc;cAiC9B,yBAAyB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IA8BtE;;OAEG;IACU,0BAA0B,IAAI,OAAO,CAAC,gCAAgC,CAAC;IAKvE,gBAAgB,IAAI,OAAO,CAAC,6BAA6B,CAAC;IAKvE;;;;OAIG;IACI,OAAO,IAAI,IAAI;CAGzB;AAED;;;;;GAKG;AACH,qBAAa,0BAA2B,SAAQ,8BAA8B;gBAC9D,KAAK,EAAE,gCAAgC;CAGtD;AAED;;;;;GAKG;AACH,qBAAa,kCACT,SAAQ,8BACR,YAAW,8BAA8B;gBAE7B,KAAK,EAAE,gCAAgC;IAKtC,aAAa,CACtB,QAAQ,EAAE,6BAA6B,EACvC,gBAAgB,EAAE,sBAAsB;cAuB5B,yBAAyB,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAMzE"}
|
package/dist/dataStoreContext.js
CHANGED
|
@@ -44,6 +44,7 @@ class FluidDataStoreContext extends common_utils_1.TypedEventEmitter {
|
|
|
44
44
|
this.detachedRuntimeCreation = false;
|
|
45
45
|
this.loaded = false;
|
|
46
46
|
this.pending = [];
|
|
47
|
+
this.isRootDataStore = false;
|
|
47
48
|
this._containerRuntime = props.runtime;
|
|
48
49
|
this.id = props.id;
|
|
49
50
|
this.storage = props.storage;
|
|
@@ -110,7 +111,10 @@ class FluidDataStoreContext extends common_utils_1.TypedEventEmitter {
|
|
|
110
111
|
return this.registry;
|
|
111
112
|
}
|
|
112
113
|
async isRoot() {
|
|
113
|
-
|
|
114
|
+
// This call updates this.isRootDataStore if it has not yet been updated
|
|
115
|
+
// The initial value is stored in the initial snapshot of the data store
|
|
116
|
+
await this.getInitialSnapshotDetails();
|
|
117
|
+
return this.isRootDataStore;
|
|
114
118
|
}
|
|
115
119
|
dispose() {
|
|
116
120
|
if (this._disposed) {
|
|
@@ -247,8 +251,8 @@ class FluidDataStoreContext extends common_utils_1.TypedEventEmitter {
|
|
|
247
251
|
pathPartsForChildren = [runtime_definitions_1.channelsTreeName];
|
|
248
252
|
}
|
|
249
253
|
// Add data store's attributes to the summary.
|
|
250
|
-
const { pkg
|
|
251
|
-
const attributes = createAttributes(pkg, isRootDataStore, this.disableIsolatedChannels);
|
|
254
|
+
const { pkg } = await this.getInitialSnapshotDetails();
|
|
255
|
+
const attributes = createAttributes(pkg, this.isRootDataStore, this.disableIsolatedChannels);
|
|
252
256
|
runtime_utils_1.addBlobToSummary(summarizeResult, summaryFormat_1.dataStoreAttributesBlobName, JSON.stringify(attributes));
|
|
253
257
|
// Add GC data to the summary if it's not written at the root.
|
|
254
258
|
if (!this.writeGCDataAtRoot) {
|
|
@@ -506,11 +510,11 @@ class RemoteFluidDataStoreContext extends FluidDataStoreContext {
|
|
|
506
510
|
common_utils_1.assert(tree !== undefined, 0x1fe /* "isolated channels subtree should exist in remote datastore snapshot" */);
|
|
507
511
|
}
|
|
508
512
|
}
|
|
513
|
+
this.isRootDataStore = isRootDataStore;
|
|
509
514
|
return {
|
|
510
515
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
511
516
|
pkg: this.pkg,
|
|
512
517
|
snapshot: tree,
|
|
513
|
-
isRootDataStore,
|
|
514
518
|
};
|
|
515
519
|
});
|
|
516
520
|
this.initSnapshotValue = props.snapshotTree;
|
|
@@ -549,9 +553,10 @@ exports.RemoteFluidDataStoreContext = RemoteFluidDataStoreContext;
|
|
|
549
553
|
*/
|
|
550
554
|
class LocalFluidDataStoreContextBase extends FluidDataStoreContext {
|
|
551
555
|
constructor(props) {
|
|
556
|
+
var _a;
|
|
552
557
|
super(props, props.snapshotTree !== undefined ? true : false /* existing */, props.snapshotTree ? container_definitions_1.BindState.Bound : container_definitions_1.BindState.NotBound, true /* isLocalDataStore */, props.bindChannelFn);
|
|
553
558
|
this.snapshotTree = props.snapshotTree;
|
|
554
|
-
this.isRootDataStore = props.isRootDataStore;
|
|
559
|
+
this.isRootDataStore = (_a = props.isRootDataStore) !== null && _a !== void 0 ? _a : false;
|
|
555
560
|
this.createProps = props.createProps;
|
|
556
561
|
this.attachListeners();
|
|
557
562
|
}
|
|
@@ -611,7 +616,6 @@ class LocalFluidDataStoreContextBase extends FluidDataStoreContext {
|
|
|
611
616
|
return {
|
|
612
617
|
pkg: this.pkg,
|
|
613
618
|
snapshot,
|
|
614
|
-
isRootDataStore: this.isRootDataStore,
|
|
615
619
|
};
|
|
616
620
|
}
|
|
617
621
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreContext.js","sourceRoot":"","sources":["../src/dataStoreContext.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,iFAM+C;AAC/C,+DAKsC;AAEtC,+DAA4D;AAC5D,iEAA8D;AAY9D,6EAqB6C;AAC7C,iEAA4F;AAC5F,qEAKyC;AACzC,qEAAwE;AAGxE,mDAQyB;AAEzB,SAAS,gBAAgB,CACrB,GAAsB,EACtB,eAAwB,EACxB,uBAAgC;IAEhC,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC3C,OAAO,uBAAuB,CAAC,CAAC,CAAC;QAC7B,GAAG,EAAE,cAAc;QACnB,qBAAqB,EAAE,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MAAM,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1D,qBAAM,CAAC,KAAK,CAAC,OAAO,KAAK,OAAO,EAAE,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAErF,qBAAM,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,KAAK,CAAC,2CAA2C,CAAC,CAAC;QACvF,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAE/B,IAAI,CAAC,uBAAuB,GAAG,KAAK,CAAC;QACrC,IAAI,CAAC,eAAe,GAAG,IAAI,uBAAQ,EAA0B,CAAC;QAE9D,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;QAEpC,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,gBAAgB,CAAC,aAAa,EAAE,CAAC;SACpC;IACL,CAAC;IAES,KAAK,CAAC,yBAAyB;QACrC,IAAI,IAAI,CAAC,uBAAuB,EAAE;YAC9B,MAAM,IAAI,KAAK,CAAC,mFAAmF,CAAC,CAAC;SACxG;QACD,OAAO,KAAK,CAAC,yBAAyB,EAAE,CAAC;IAC7C,CAAC;CACJ;AAxCD,gFAwCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable, ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport {\n FluidObject,\n IRequest,\n IResponse,\n IFluidHandle,\n} from \"@fluidframework/core-interfaces\";\nimport {\n IAudience,\n IDeltaManager,\n BindState,\n AttachState,\n ILoaderOptions,\n} from \"@fluidframework/container-definitions\";\nimport {\n assert,\n Deferred,\n LazyPromise,\n TypedEventEmitter,\n} from \"@fluidframework/common-utils\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { BlobTreeEntry } from \"@fluidframework/protocol-base\";\nimport {\n IClientDetails,\n IDocumentMessage,\n IQuorumClients,\n ISequencedDocumentMessage,\n ISnapshotTree,\n ITreeEntry,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n IContainerRuntime,\n} from \"@fluidframework/container-runtime-definitions\";\nimport {\n channelsTreeName,\n CreateChildSummarizerNodeFn,\n CreateChildSummarizerNodeParam,\n FluidDataStoreRegistryEntry,\n gcBlobKey,\n IAttachMessage,\n IFluidDataStoreChannel,\n IFluidDataStoreContext,\n IFluidDataStoreContextDetached,\n IFluidDataStoreContextEvents,\n IFluidDataStoreRegistry,\n IGarbageCollectionData,\n IGarbageCollectionDetailsBase,\n IGarbageCollectionSummaryDetails,\n IInboundSignalMessage,\n IProvideFluidDataStoreFactory,\n ISummarizeInternalResult,\n ISummarizeResult,\n ISummarizerNodeWithGC,\n SummarizeInternalFn,\n} from \"@fluidframework/runtime-definitions\";\nimport { addBlobToSummary, convertSummaryTreeToITree } from \"@fluidframework/runtime-utils\";\nimport {\n ChildLogger,\n LoggingError,\n TelemetryDataTag,\n ThresholdCounter,\n} from \"@fluidframework/telemetry-utils\";\nimport { CreateProcessingError } from \"@fluidframework/container-utils\";\n\nimport { ContainerRuntime } from \"./containerRuntime\";\nimport {\n dataStoreAttributesBlobName,\n hasIsolatedChannels,\n wrapSummaryInChannelsTree,\n ReadFluidDataStoreAttributes,\n WriteFluidDataStoreAttributes,\n getAttributesFormatVersion,\n getFluidDataStoreAttributes,\n} from \"./summaryFormat\";\n\nfunction createAttributes(\n pkg: readonly string[],\n isRootDataStore: boolean,\n disableIsolatedChannels: boolean,\n): WriteFluidDataStoreAttributes {\n const stringifiedPkg = JSON.stringify(pkg);\n return disableIsolatedChannels ? {\n pkg: stringifiedPkg,\n snapshotFormatVersion: \"0.1\",\n isRootDataStore,\n } : {\n pkg: stringifiedPkg,\n summaryFormatVersion: 2,\n isRootDataStore,\n };\n}\nexport function createAttributesBlob(\n pkg: readonly string[],\n isRootDataStore: boolean,\n disableIsolatedChannels: boolean,\n): ITreeEntry {\n const attributes = createAttributes(pkg, isRootDataStore, disableIsolatedChannels);\n return new BlobTreeEntry(dataStoreAttributesBlobName, JSON.stringify(attributes));\n}\n\ninterface ISnapshotDetails {\n pkg: readonly string[];\n /**\n * This tells whether a data store is root. Root data stores are never collected.\n * Non-root data stores may be collected if they are not used.\n */\n isRootDataStore: boolean;\n snapshot?: ISnapshotTree;\n}\n\ninterface FluidDataStoreMessage {\n content: any;\n type: string;\n}\n\n/** Properties necessary for creating a FluidDataStoreContext */\nexport interface IFluidDataStoreContextProps {\n readonly id: string;\n readonly runtime: ContainerRuntime;\n readonly storage: IDocumentStorageService;\n readonly scope: FluidObject;\n readonly createSummarizerNodeFn: CreateChildSummarizerNodeFn;\n readonly writeGCDataAtRoot: boolean;\n readonly disableIsolatedChannels: boolean;\n readonly pkg?: Readonly<string[]>;\n}\n\n/** Properties necessary for creating a local FluidDataStoreContext */\nexport interface ILocalFluidDataStoreContextProps extends IFluidDataStoreContextProps {\n readonly pkg: Readonly<string[]> | undefined;\n readonly snapshotTree: ISnapshotTree | undefined;\n readonly isRootDataStore: boolean | undefined;\n readonly bindChannelFn: (channel: IFluidDataStoreChannel) => void;\n /**\n * @deprecated 0.16 Issue #1635, #3631\n */\n readonly createProps?: any;\n}\n\n/** Properties necessary for creating a remote FluidDataStoreContext */\nexport interface IRemoteFluidDataStoreContextProps extends IFluidDataStoreContextProps {\n readonly snapshotTree: ISnapshotTree | string | undefined;\n readonly getBaseGCDetails: () => Promise<IGarbageCollectionDetailsBase | undefined>;\n}\n\n/**\n * Represents the context for the store. This context is passed to the store runtime.\n */\nexport abstract class FluidDataStoreContext extends TypedEventEmitter<IFluidDataStoreContextEvents> implements\n IFluidDataStoreContext,\n IDisposable {\n public get packagePath(): readonly string[] {\n assert(this.pkg !== undefined, 0x139 /* \"Undefined package path\" */);\n return this.pkg;\n }\n\n public get options(): ILoaderOptions {\n return this._containerRuntime.options;\n }\n\n public get clientId(): string | undefined {\n return this._containerRuntime.clientId;\n }\n\n public get clientDetails(): IClientDetails {\n return this._containerRuntime.clientDetails;\n }\n\n public get logger(): ITelemetryLogger {\n return this._containerRuntime.logger;\n }\n\n public get deltaManager(): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage> {\n return this._containerRuntime.deltaManager;\n }\n\n public get connected(): boolean {\n return this._containerRuntime.connected;\n }\n\n public get IFluidHandleContext() {\n return this._containerRuntime.IFluidHandleContext;\n }\n\n public get containerRuntime(): IContainerRuntime {\n return this._containerRuntime;\n }\n\n public get isLoaded(): boolean {\n return this.loaded;\n }\n\n public get baseSnapshot(): ISnapshotTree | undefined {\n return this._baseSnapshot;\n }\n\n private _disposed = false;\n public get disposed() { return this._disposed; }\n\n public get attachState(): AttachState {\n return this._attachState;\n }\n\n public get IFluidDataStoreRegistry(): IFluidDataStoreRegistry | undefined {\n return this.registry;\n }\n\n public async isRoot(): Promise<boolean> {\n return (await this.getInitialSnapshotDetails()).isRootDataStore;\n }\n\n protected registry: IFluidDataStoreRegistry | undefined;\n\n protected detachedRuntimeCreation = false;\n public readonly bindToContext: () => void;\n protected channel: IFluidDataStoreChannel | undefined;\n private loaded = false;\n protected pending: ISequencedDocumentMessage[] | undefined = [];\n protected channelDeferred: Deferred<IFluidDataStoreChannel> | undefined;\n private _baseSnapshot: ISnapshotTree | undefined;\n protected _attachState: AttachState;\n protected readonly summarizerNode: ISummarizerNodeWithGC;\n private readonly subLogger: ITelemetryLogger;\n private readonly thresholdOpsCounter: ThresholdCounter;\n private static readonly pendingOpsCountThreshold = 1000;\n\n // The used state of this node as per the last GC run. This is used to update the used state of the channel\n // if it realizes after GC is run.\n private lastUsedState: { usedRoutes: string[], gcTimestamp?: number } | undefined;\n\n public readonly id: string;\n private readonly _containerRuntime: ContainerRuntime;\n public readonly storage: IDocumentStorageService;\n public readonly scope: FluidObject;\n private readonly writeGCDataAtRoot: boolean;\n protected readonly disableIsolatedChannels: boolean;\n protected pkg?: readonly string[];\n\n constructor(\n props: IFluidDataStoreContextProps,\n private readonly existing: boolean,\n private bindState: BindState,\n public readonly isLocalDataStore: boolean,\n bindChannelFn: (channel: IFluidDataStoreChannel) => void,\n ) {\n super();\n\n this._containerRuntime = props.runtime;\n this.id = props.id;\n this.storage = props.storage;\n this.scope = props.scope;\n this.writeGCDataAtRoot = props.writeGCDataAtRoot;\n this.disableIsolatedChannels = props.disableIsolatedChannels;\n this.pkg = props.pkg;\n\n // URIs use slashes as delimiters. Handles use URIs.\n // Thus having slashes in types almost guarantees trouble down the road!\n assert(this.id.indexOf(\"/\") === -1, 0x13a /* `Data store ID contains slash: ${id}` */);\n\n this._attachState = this.containerRuntime.attachState !== AttachState.Detached && this.existing ?\n this.containerRuntime.attachState : AttachState.Detached;\n\n this.bindToContext = () => {\n assert(this.bindState === BindState.NotBound, 0x13b /* \"datastore context is already in bound state\" */);\n this.bindState = BindState.Binding;\n assert(this.channel !== undefined, 0x13c /* \"undefined channel on datastore context\" */);\n bindChannelFn(this.channel);\n this.bindState = BindState.Bound;\n };\n\n const thisSummarizeInternal =\n async (fullTree: boolean, trackState: boolean) => this.summarizeInternal(fullTree, trackState);\n\n this.summarizerNode = props.createSummarizerNodeFn(\n thisSummarizeInternal,\n async (fullGC?: boolean) => this.getGCDataInternal(fullGC),\n async () => this.getBaseGCDetails(),\n );\n\n this.subLogger = ChildLogger.create(this.logger, \"FluidDataStoreContext\");\n this.thresholdOpsCounter = new ThresholdCounter(FluidDataStoreContext.pendingOpsCountThreshold, this.subLogger);\n }\n\n public dispose(): void {\n if (this._disposed) {\n return;\n }\n this._disposed = true;\n\n // Dispose any pending runtime after it gets fulfilled\n // Errors are logged where this.channelDeferred is consumed/generated (realizeCore(), bindRuntime())\n if (this.channelDeferred) {\n this.channelDeferred.promise.then((runtime) => {\n runtime.dispose();\n }).catch((error) => {});\n }\n }\n\n private rejectDeferredRealize(reason: string, packageName?: string): never {\n throw new LoggingError(reason, { packageName: { value: packageName, tag: TelemetryDataTag.PackageData }});\n }\n\n public async realize(): Promise<IFluidDataStoreChannel> {\n assert(!this.detachedRuntimeCreation, 0x13d /* \"Detached runtime creation on realize()\" */);\n if (!this.channelDeferred) {\n this.channelDeferred = new Deferred<IFluidDataStoreChannel>();\n this.realizeCore(this.existing).catch((error) => {\n const errorWrapped = CreateProcessingError(error, \"realizeFluidDataStoreContext\");\n errorWrapped.addTelemetryProperties({ fluidDataStoreId: { value: this.id, tag: \"PackageData\"} });\n this.channelDeferred?.reject(errorWrapped);\n this.logger.sendErrorEvent({ eventName: \"RealizeError\"}, errorWrapped);\n });\n }\n return this.channelDeferred.promise;\n }\n\n protected async factoryFromPackagePath(packages?: readonly string[]) {\n assert(this.pkg === packages, 0x13e /* \"Unexpected package path\" */);\n if (packages === undefined) {\n this.rejectDeferredRealize(\"packages is undefined\");\n }\n\n let entry: FluidDataStoreRegistryEntry | undefined;\n let registry: IFluidDataStoreRegistry | undefined = this._containerRuntime.IFluidDataStoreRegistry;\n let lastPkg: string | undefined;\n for (const pkg of packages) {\n if (!registry) {\n this.rejectDeferredRealize(\"No registry for package\", lastPkg);\n }\n lastPkg = pkg;\n entry = await registry.get(pkg);\n if (!entry) {\n this.rejectDeferredRealize(\"Registry does not contain entry for the package\", pkg);\n }\n registry = entry.IFluidDataStoreRegistry;\n }\n const factory = entry?.IFluidDataStoreFactory;\n if (factory === undefined) {\n this.rejectDeferredRealize(\"Can't find factory for package\", lastPkg);\n }\n\n return { factory, registry };\n }\n\n private async realizeCore(existing: boolean): Promise<void> {\n const details = await this.getInitialSnapshotDetails();\n // Base snapshot is the baseline where pending ops are applied to.\n // It is important that this be in sync with the pending ops, and also\n // that it is set here, before bindRuntime is called.\n this._baseSnapshot = details.snapshot;\n const packages = details.pkg;\n\n const { factory, registry } = await this.factoryFromPackagePath(packages);\n\n assert(this.registry === undefined, 0x13f /* \"datastore context registry is already set\" */);\n this.registry = registry;\n\n const channel = await factory.instantiateDataStore(this, existing);\n assert(channel !== undefined, 0x140 /* \"undefined channel on datastore context\" */);\n this.bindRuntime(channel);\n }\n\n /**\n * Notifies this object about changes in the connection state.\n * @param value - New connection state.\n * @param clientId - ID of the client. It's old ID when in disconnected state and\n * it's new client ID when we are connecting or connected.\n */\n public setConnectionState(connected: boolean, clientId?: string) {\n this.verifyNotClosed();\n\n // Connection events are ignored if the store is not yet loaded\n if (!this.loaded) {\n return;\n }\n\n assert(this.connected === connected, 0x141 /* \"Unexpected connected state\" */);\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.channel!.setConnectionState(connected, clientId);\n }\n\n public process(messageArg: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n this.verifyNotClosed();\n\n const innerContents = messageArg.contents as FluidDataStoreMessage;\n const message = {\n ...messageArg,\n type: innerContents.type,\n contents: innerContents.content,\n };\n\n this.summarizerNode.recordChange(message);\n\n if (this.loaded) {\n return this.channel?.process(message, local, localOpMetadata);\n } else {\n assert(!local, 0x142 /* \"local store channel is not loaded\" */);\n assert(this.pending !== undefined, 0x23d /* \"pending is undefined\" */);\n this.pending.push(message);\n this.thresholdOpsCounter.sendIfMultiple(\"StorePendingOps\", this.pending.length);\n }\n }\n\n public processSignal(message: IInboundSignalMessage, local: boolean): void {\n this.verifyNotClosed();\n\n // Signals are ignored if the store is not yet loaded\n if (!this.loaded) {\n return;\n }\n\n this.channel?.processSignal(message, local);\n }\n\n public getQuorum(): IQuorumClients {\n return this._containerRuntime.getQuorum();\n }\n\n public getAudience(): IAudience {\n return this._containerRuntime.getAudience();\n }\n\n /**\n * Returns a summary at the current sequence number.\n * @param fullTree - true to bypass optimizations and force a full summary tree\n * @param trackState - This tells whether we should track state from this summary.\n */\n public async summarize(fullTree: boolean = false, trackState: boolean = true): Promise<ISummarizeResult> {\n return this.summarizerNode.summarize(fullTree, trackState);\n }\n\n private async summarizeInternal(fullTree: boolean, trackState: boolean): Promise<ISummarizeInternalResult> {\n await this.realize();\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const summarizeResult = await this.channel!.summarize(fullTree, trackState);\n let pathPartsForChildren: string[] | undefined;\n\n if (!this.disableIsolatedChannels) {\n // Wrap dds summaries in .channels subtree.\n wrapSummaryInChannelsTree(summarizeResult);\n pathPartsForChildren = [channelsTreeName];\n }\n\n // Add data store's attributes to the summary.\n const { pkg, isRootDataStore } = await this.getInitialSnapshotDetails();\n const attributes = createAttributes(pkg, isRootDataStore, this.disableIsolatedChannels);\n addBlobToSummary(summarizeResult, dataStoreAttributesBlobName, JSON.stringify(attributes));\n\n // Add GC data to the summary if it's not written at the root.\n if (!this.writeGCDataAtRoot) {\n addBlobToSummary(summarizeResult, gcBlobKey, JSON.stringify(this.summarizerNode.getGCSummaryDetails()));\n }\n\n // If we are not referenced, mark the summary tree as unreferenced. Also, update unreferenced blob\n // size in the summary stats with the blobs size of this data store.\n if (!this.summarizerNode.isReferenced()) {\n summarizeResult.summary.unreferenced = true;\n summarizeResult.stats.unreferencedBlobSize = summarizeResult.stats.totalBlobSize;\n }\n\n return {\n ...summarizeResult,\n id: this.id,\n pathPartsForChildren,\n };\n }\n\n /**\n * Returns the data used for garbage collection. This includes a list of GC nodes that represent this data store\n * including any of its child channel contexts. Each node has a set of outbound routes to other GC nodes in the\n * document.\n * If there is no new data in this data store since the last summary, previous GC data is used.\n * If there is new data, the GC data is generated again (by calling getGCDataInternal).\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n public async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n return this.summarizerNode.getGCData(fullGC);\n }\n\n /**\n * Generates data used for garbage collection. This is called when there is new data since last summary. It\n * realizes the data store and calls into each channel context to get its GC data.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n private async getGCDataInternal(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n await this.realize();\n assert(this.channel !== undefined, 0x143 /* \"Channel should not be undefined when running GC\" */);\n\n return this.channel.getGCData(fullGC);\n }\n\n /**\n * After GC has run, called to notify the data store of routes used in it. These are used for the following:\n * 1. To identify if this data store is being referenced in the document or not.\n * 2. To determine if it needs to re-summarize in case used routes changed since last summary.\n * 3. These are added to the summary generated by the data store.\n * 4. To notify child contexts of their used routes. This is done immediately if the data store is loaded. Else,\n * it is done when realizing the data store.\n * 5. To update the timestamp when this data store or any children are marked as unreferenced.\n * @param usedRoutes - The routes that are used in this data store.\n * @param gcTimestamp - The time when GC was run that generated these used routes. If any node becomes unreferenced\n * as part of this GC run, this should be used to update the time when it happens.\n */\n public updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number) {\n // Update the used routes in this data store's summarizer node.\n this.summarizerNode.updateUsedRoutes(usedRoutes, gcTimestamp);\n\n /**\n * If the data store has not been realized yet, we need this used state to update the used state of the channel\n * when it realizes. It's safe to keep only the last used state because if something changes because of this GC\n * run, the data store will be immediately realized as part of the summary that follows GC. For example, if a\n * child's reference state changes, the gcTimestamp has to be used to update its unreferencedTimestamp. Since\n * it will result in a change in this data store's used routes, it will be realized to regenerate its summary.\n */\n this.lastUsedState = { usedRoutes, gcTimestamp };\n\n // If we are loaded, call the channel so it can update the used routes of the child contexts.\n // If we are not loaded, we will update this when we are realized.\n if (this.loaded) {\n this.updateChannelUsedRoutes();\n }\n }\n\n /**\n * Called when a new outbound reference is added to another node. This is used by garbage collection to identify\n * all references added in the system.\n * @param srcHandle - The handle of the node that added the reference.\n * @param outboundHandle - The handle of the outbound node that is referenced.\n */\n public addedGCOutboundReference(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) {\n this._containerRuntime.addedGCOutboundReference(srcHandle, outboundHandle);\n }\n\n /**\n * Updates the used routes of the channel and its child contexts. The channel must be loaded before calling this.\n * It is called in these two scenarios:\n * 1. When the used routes of the data store is updated and the data store is loaded.\n * 2. When the data store is realized. This updates the channel's used routes as per last GC run.\n */\n private updateChannelUsedRoutes() {\n assert(this.loaded, 0x144 /* \"Channel should be loaded when updating used routes\" */);\n assert(this.channel !== undefined, 0x145 /* \"Channel should be present when data store is loaded\" */);\n\n // If there is no lastUsedState, GC has not run up until this point.\n if (this.lastUsedState === undefined) {\n return;\n }\n\n // Remove the route to this data store, if it exists.\n const usedChannelRoutes = this.lastUsedState.usedRoutes.filter(\n (id: string) => { return id !== \"/\" && id !== \"\"; },\n );\n this.channel.updateUsedRoutes(usedChannelRoutes, this.lastUsedState.gcTimestamp);\n }\n\n /**\n * @deprecated 0.18.Should call request on the runtime directly\n */\n public async request(request: IRequest): Promise<IResponse> {\n const runtime = await this.realize();\n return runtime.request(request);\n }\n\n public submitMessage(type: string, content: any, localOpMetadata: unknown): void {\n this.verifyNotClosed();\n assert(!!this.channel, 0x146 /* \"Channel must exist when submitting message\" */);\n const fluidDataStoreContent: FluidDataStoreMessage = {\n content,\n type,\n };\n this._containerRuntime.submitDataStoreOp(\n this.id,\n fluidDataStoreContent,\n localOpMetadata);\n }\n\n /**\n * This is called from a SharedSummaryBlock that does not generate ops but only wants to be part of the summary.\n * It indicates that there is data in the object that needs to be summarized.\n * We will update the latestSequenceNumber of the summary tracker of this\n * store and of the object's channel.\n *\n * @param address - The address of the channel that is dirty.\n *\n */\n public setChannelDirty(address: string): void {\n this.verifyNotClosed();\n\n // Get the latest sequence number.\n const latestSequenceNumber = this.deltaManager.lastSequenceNumber;\n\n this.summarizerNode.invalidate(latestSequenceNumber);\n\n const channelSummarizerNode = this.summarizerNode.getChild(address);\n\n if (channelSummarizerNode) {\n channelSummarizerNode.invalidate(latestSequenceNumber); // TODO: lazy load problem?\n }\n }\n\n public submitSignal(type: string, content: any) {\n this.verifyNotClosed();\n assert(!!this.channel, 0x147 /* \"Channel must exist on submitting signal\" */);\n return this._containerRuntime.submitDataStoreSignal(this.id, type, content);\n }\n\n protected bindRuntime(channel: IFluidDataStoreChannel) {\n if (this.channel) {\n throw new Error(\"Runtime already bound\");\n }\n\n try\n {\n assert(!this.detachedRuntimeCreation, 0x148 /* \"Detached runtime creation on runtime bind\" */);\n assert(this.channelDeferred !== undefined, 0x149 /* \"Undefined channel deferral\" */);\n assert(this.pkg !== undefined, 0x14a /* \"Undefined package path\" */);\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const pending = this.pending!;\n\n // Apply all pending ops\n for (const op of pending) {\n channel.process(op, false, undefined /* localOpMetadata */);\n }\n\n this.thresholdOpsCounter.send(\"ProcessPendingOps\", pending.length);\n this.pending = undefined;\n\n // And now mark the runtime active\n this.loaded = true;\n this.channel = channel;\n\n // Freeze the package path to ensure that someone doesn't modify it when it is\n // returned in packagePath().\n Object.freeze(this.pkg);\n\n /**\n * Update the used routes of the channel. If GC has run before this data store was realized, we will have\n * the used routes saved. So, this will ensure that all the child contexts have up-to-date used routes as\n * per the last time GC was run.\n * Also, this data store may have been realized during summarize. In that case, the child contexts need to\n * have their used routes updated to determine if its needs to summarize again and to add it to the summary.\n */\n this.updateChannelUsedRoutes();\n\n // And notify the pending promise it is now available\n this.channelDeferred.resolve(this.channel);\n } catch (error) {\n this.channelDeferred?.reject(error);\n this.logger.sendErrorEvent(\n { eventName: \"BindRuntimeError\", fluidDataStoreId: { value: this.id, tag: \"PackageData\"} },\n error);\n }\n }\n\n public async getAbsoluteUrl(relativeUrl: string): Promise<string | undefined> {\n if (this.attachState !== AttachState.Attached) {\n return undefined;\n }\n return this._containerRuntime.getAbsoluteUrl(relativeUrl);\n }\n\n public abstract generateAttachMessage(): IAttachMessage;\n\n protected abstract getInitialSnapshotDetails(): Promise<ISnapshotDetails>;\n\n /**\n * @deprecated - Sets the datastore as root, for aliasing purposes: #7948\n * This method should not be used outside of the aliasing context.\n * It will be removed, as the source of truth for this flag will be the aliasing blob.\n */\n public abstract setRoot(): void;\n\n /**\n * @deprecated - Renamed to getBaseGCDetails().\n */\n public abstract getInitialGCSummaryDetails(): Promise<IGarbageCollectionSummaryDetails>;\n\n public abstract getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase>;\n\n public reSubmit(contents: any, localOpMetadata: unknown) {\n assert(!!this.channel, 0x14b /* \"Channel must exist when resubmitting ops\" */);\n const innerContents = contents as FluidDataStoreMessage;\n this.channel.reSubmit(innerContents.type, innerContents.content, localOpMetadata);\n }\n\n public async applyStashedOp(contents: any): Promise<unknown> {\n if (!this.channel) {\n await this.realize();\n }\n assert(!!this.channel, 0x14c /* \"Channel must exist when rebasing ops\" */);\n const innerContents = contents as FluidDataStoreMessage;\n return this.channel.applyStashedOp(innerContents.content);\n }\n\n private verifyNotClosed() {\n if (this._disposed) {\n throw new Error(\"Context is closed\");\n }\n }\n\n public getCreateChildSummarizerNodeFn(id: string, createParam: CreateChildSummarizerNodeParam) {\n return (\n summarizeInternal: SummarizeInternalFn,\n getGCDataFn: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n getBaseGCDetailsFn: () => Promise<IGarbageCollectionDetailsBase>,\n ) => this.summarizerNode.createChild(\n summarizeInternal,\n id,\n createParam,\n // DDS will not create failure summaries\n { throwOnFailure: true },\n getGCDataFn,\n getBaseGCDetailsFn,\n );\n }\n\n public async uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>> {\n return this.containerRuntime.uploadBlob(blob);\n }\n}\n\nexport class RemoteFluidDataStoreContext extends FluidDataStoreContext {\n private isRootDataStore: boolean | undefined;\n private readonly initSnapshotValue: ISnapshotTree | string | undefined;\n private readonly baseGCDetailsP: Promise<IGarbageCollectionDetailsBase>;\n\n constructor(props: IRemoteFluidDataStoreContextProps) {\n super(\n props,\n true /* existing */,\n BindState.Bound,\n false /* isLocalDataStore */,\n () => {\n throw new Error(\"Already attached\");\n },\n );\n\n this.initSnapshotValue = props.snapshotTree;\n this.baseGCDetailsP = new LazyPromise<IGarbageCollectionDetailsBase>(async () => {\n return (await props.getBaseGCDetails()) ?? {};\n });\n }\n\n private readonly initialSnapshotDetailsP = new LazyPromise<ISnapshotDetails>(async () => {\n let tree: ISnapshotTree | undefined;\n let isRootDataStore = true;\n\n if (typeof this.initSnapshotValue === \"string\") {\n const commit = (await this.storage.getVersions(this.initSnapshotValue, 1))[0];\n tree = await this.storage.getSnapshotTree(commit) ?? undefined;\n } else {\n tree = this.initSnapshotValue;\n }\n\n const localReadAndParse = async <T>(id: string) => readAndParse<T>(this.storage, id);\n if (tree) {\n const loadedSummary = await this.summarizerNode.loadBaseSummary(tree, localReadAndParse);\n tree = loadedSummary.baseSummary;\n // Prepend outstanding ops to pending queue of ops to process.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.pending = loadedSummary.outstandingOps.concat(this.pending!);\n }\n\n if (!!tree && tree.blobs[dataStoreAttributesBlobName] !== undefined) {\n // Need to get through snapshot and use that to populate extraBlobs\n const attributes =\n await localReadAndParse<ReadFluidDataStoreAttributes>(tree.blobs[dataStoreAttributesBlobName]);\n\n let pkgFromSnapshot: string[];\n // Use the snapshotFormatVersion to determine how the pkg is encoded in the snapshot.\n // For snapshotFormatVersion = \"0.1\" (1) or above, pkg is jsonified, otherwise it is just a string.\n const formatVersion = getAttributesFormatVersion(attributes);\n if (formatVersion < 1) {\n if (attributes.pkg.startsWith(\"[\\\"\") && attributes.pkg.endsWith(\"\\\"]\")) {\n pkgFromSnapshot = JSON.parse(attributes.pkg) as string[];\n } else {\n pkgFromSnapshot = [attributes.pkg];\n }\n } else {\n pkgFromSnapshot = JSON.parse(attributes.pkg) as string[];\n }\n this.pkg = pkgFromSnapshot;\n\n /**\n * If there is no isRootDataStore in the attributes blob, set it to true. This will ensure that\n * data stores in older documents are not garbage collected incorrectly. This may lead to additional\n * roots in the document but they won't break.\n */\n isRootDataStore = this.isRootDataStore === true || (attributes.isRootDataStore ?? true);\n\n if (hasIsolatedChannels(attributes)) {\n tree = tree.trees[channelsTreeName];\n assert(tree !== undefined,\n 0x1fe /* \"isolated channels subtree should exist in remote datastore snapshot\" */);\n }\n }\n\n return {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n pkg: this.pkg!,\n snapshot: tree,\n isRootDataStore,\n };\n });\n\n protected async getInitialSnapshotDetails(): Promise<ISnapshotDetails> {\n return this.initialSnapshotDetailsP;\n }\n\n /**\n * @deprecated - Renamed to getBaseGCDetails.\n */\n public async getInitialGCSummaryDetails(): Promise<IGarbageCollectionSummaryDetails> {\n return this.getBaseGCDetails();\n }\n\n public async getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase> {\n return this.baseGCDetailsP;\n }\n\n public generateAttachMessage(): IAttachMessage {\n throw new Error(\"Cannot attach remote store\");\n }\n\n /**\n * @deprecated - Sets the datastore as root, for aliasing purposes: #7948\n * This method should not be used outside of the aliasing context.\n * It will be removed, as the source of truth for this flag will be the aliasing blob.\n */\n public setRoot(): void {\n this.isRootDataStore = true;\n }\n}\n\n/**\n * Base class for detached & attached context classes\n */\nexport class LocalFluidDataStoreContextBase extends FluidDataStoreContext {\n private readonly snapshotTree: ISnapshotTree | undefined;\n protected isRootDataStore: boolean | undefined;\n /**\n * @deprecated 0.16 Issue #1635, #3631\n */\n public readonly createProps?: any;\n\n constructor(props: ILocalFluidDataStoreContextProps) {\n super(\n props,\n props.snapshotTree !== undefined ? true : false /* existing */,\n props.snapshotTree ? BindState.Bound : BindState.NotBound,\n true /* isLocalDataStore */,\n props.bindChannelFn,\n );\n\n this.snapshotTree = props.snapshotTree;\n this.isRootDataStore = props.isRootDataStore;\n this.createProps = props.createProps;\n this.attachListeners();\n }\n\n private attachListeners(): void {\n this.once(\"attaching\", () => {\n assert(this.attachState === AttachState.Detached, 0x14d /* \"Should move from detached to attaching\" */);\n this._attachState = AttachState.Attaching;\n });\n this.once(\"attached\", () => {\n assert(this.attachState === AttachState.Attaching, 0x14e /* \"Should move from attaching to attached\" */);\n this._attachState = AttachState.Attached;\n });\n }\n\n public generateAttachMessage(): IAttachMessage {\n assert(this.channel !== undefined, 0x14f /* \"There should be a channel when generating attach message\" */);\n assert(this.pkg !== undefined, 0x150 /* \"pkg should be available in local data store context\" */);\n assert(this.isRootDataStore !== undefined,\n 0x151 /* \"isRootDataStore should be available in local data store context\" */);\n\n const summarizeResult = this.channel.getAttachSummary();\n\n if (!this.disableIsolatedChannels) {\n // Wrap dds summaries in .channels subtree.\n wrapSummaryInChannelsTree(summarizeResult);\n }\n\n // Add data store's attributes to the summary.\n const attributes = createAttributes(\n this.pkg,\n this.isRootDataStore,\n this.disableIsolatedChannels,\n );\n addBlobToSummary(summarizeResult, dataStoreAttributesBlobName, JSON.stringify(attributes));\n\n // Attach message needs the summary in ITree format. Convert the ISummaryTree into an ITree.\n const snapshot = convertSummaryTreeToITree(summarizeResult.summary);\n\n const message: IAttachMessage = {\n id: this.id,\n snapshot,\n type: this.pkg[this.pkg.length - 1],\n };\n\n return message;\n }\n\n protected async getInitialSnapshotDetails(): Promise<ISnapshotDetails> {\n let snapshot = this.snapshotTree;\n let attributes: ReadFluidDataStoreAttributes;\n if (snapshot !== undefined) {\n // Get the dataStore attributes.\n // Note: storage can be undefined in special case while detached.\n attributes = await getFluidDataStoreAttributes(this.storage, snapshot);\n if (hasIsolatedChannels(attributes)) {\n snapshot = snapshot.trees[channelsTreeName];\n assert(snapshot !== undefined,\n 0x1ff /* \"isolated channels subtree should exist in local datastore snapshot\" */);\n }\n if (this.pkg === undefined) {\n this.pkg = JSON.parse(attributes.pkg) as string[];\n // If there is no isRootDataStore in the attributes blob, set it to true. This ensures that data\n // stores in older documents are not garbage collected incorrectly. This may lead to additional\n // roots in the document but they won't break.\n this.isRootDataStore = this.isRootDataStore || (attributes.isRootDataStore ?? true);\n }\n }\n assert(this.pkg !== undefined, 0x152 /* \"pkg should be available in local data store\" */);\n assert(this.isRootDataStore !== undefined,\n 0x153 /* \"isRootDataStore should be available in local data store\" */);\n\n return {\n pkg: this.pkg,\n snapshot,\n isRootDataStore: this.isRootDataStore,\n };\n }\n\n /**\n * @deprecated - Renamed to getBaseGCDetails.\n */\n public async getInitialGCSummaryDetails(): Promise<IGarbageCollectionSummaryDetails> {\n // Local data store does not have initial summary.\n return {};\n }\n\n public async getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase> {\n // Local data store does not have initial summary.\n return {};\n }\n\n /**\n * @deprecated - Sets the datastore as root, for aliasing purposes: #7948\n * This method should not be used outside of the aliasing context.\n * It will be removed, as the source of truth for this flag will be the aliasing blob.\n */\n public setRoot(): void {\n this.isRootDataStore = true;\n }\n}\n\n/**\n * context implementation for \"attached\" data store runtime.\n * Various workflows (snapshot creation, requests) result in .realize() being called\n * on context, resulting in instantiation and attachment of runtime.\n * Runtime is created using data store factory that is associated with this context.\n */\nexport class LocalFluidDataStoreContext extends LocalFluidDataStoreContextBase {\n constructor(props: ILocalFluidDataStoreContextProps) {\n super(props);\n }\n}\n\n/**\n * Detached context. Data Store runtime will be attached to it by attachRuntime() call\n * Before attachment happens, this context is not associated with particular type of runtime\n * or factory, i.e. it's package path is undefined.\n * Attachment process provides all missing parts - package path, data store runtime, and data store factory\n */\nexport class LocalDetachedFluidDataStoreContext\n extends LocalFluidDataStoreContextBase\n implements IFluidDataStoreContextDetached\n{\n constructor(props: ILocalFluidDataStoreContextProps) {\n super(props);\n this.detachedRuntimeCreation = true;\n }\n\n public async attachRuntime(\n registry: IProvideFluidDataStoreFactory,\n dataStoreRuntime: IFluidDataStoreChannel)\n {\n assert(this.detachedRuntimeCreation, 0x154 /* \"runtime creation is already attached\" */);\n assert(this.channelDeferred === undefined, 0x155 /* \"channel deferral is already set\" */);\n\n const factory = registry.IFluidDataStoreFactory;\n\n const entry = await this.factoryFromPackagePath(this.pkg);\n assert(entry.factory === factory, 0x156 /* \"Unexpected factory for package path\" */);\n\n assert(this.registry === undefined, 0x157 /* \"datastore registry already attached\" */);\n this.registry = entry.registry;\n\n this.detachedRuntimeCreation = false;\n this.channelDeferred = new Deferred<IFluidDataStoreChannel>();\n\n super.bindRuntime(dataStoreRuntime);\n\n if (this.isRootDataStore) {\n dataStoreRuntime.bindToContext();\n }\n }\n\n protected async getInitialSnapshotDetails(): Promise<ISnapshotDetails> {\n if (this.detachedRuntimeCreation) {\n throw new Error(\"Detached Fluid Data Store context can't be realized! Please attach runtime first!\");\n }\n return super.getInitialSnapshotDetails();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dataStoreContext.js","sourceRoot":"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Content":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable, ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport {\n FluidObject,\n IRequest,\n IResponse,\n IFluidHandle,\n} from \"@fluidframework/core-interfaces\";\nimport {\n IAudience,\n IDeltaManager,\n BindState,\n AttachState,\n ILoaderOptions,\n} from \"@fluidframework/container-definitions\";\nimport {\n assert,\n Deferred,\n LazyPromise,\n TypedEventEmitter,\n} from \"@fluidframework/common-utils\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { BlobTreeEntry } from \"@fluidframework/protocol-base\";\nimport {\n IClientDetails,\n IDocumentMessage,\n IQuorumClients,\n ISequencedDocumentMessage,\n ISnapshotTree,\n ITreeEntry,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n IContainerRuntime,\n} from \"@fluidframework/container-runtime-definitions\";\nimport {\n channelsTreeName,\n CreateChildSummarizerNodeFn,\n CreateChildSummarizerNodeParam,\n FluidDataStoreRegistryEntry,\n gcBlobKey,\n IAttachMessage,\n IFluidDataStoreChannel,\n IFluidDataStoreContext,\n IFluidDataStoreContextDetached,\n IFluidDataStoreContextEvents,\n IFluidDataStoreRegistry,\n IGarbageCollectionData,\n IGarbageCollectionDetailsBase,\n IGarbageCollectionSummaryDetails,\n IInboundSignalMessage,\n IProvideFluidDataStoreFactory,\n ISummarizeInternalResult,\n ISummarizeResult,\n ISummarizerNodeWithGC,\n SummarizeInternalFn,\n} from \"@fluidframework/runtime-definitions\";\nimport { addBlobToSummary, convertSummaryTreeToITree } from \"@fluidframework/runtime-utils\";\nimport {\n ChildLogger,\n LoggingError,\n TelemetryDataTag,\n ThresholdCounter,\n} from \"@fluidframework/telemetry-utils\";\nimport { CreateProcessingError } from \"@fluidframework/container-utils\";\n\nimport { ContainerRuntime } from \"./containerRuntime\";\nimport {\n dataStoreAttributesBlobName,\n hasIsolatedChannels,\n wrapSummaryInChannelsTree,\n ReadFluidDataStoreAttributes,\n WriteFluidDataStoreAttributes,\n getAttributesFormatVersion,\n getFluidDataStoreAttributes,\n} from \"./summaryFormat\";\n\nfunction createAttributes(\n pkg: readonly string[],\n isRootDataStore: boolean,\n disableIsolatedChannels: boolean,\n): WriteFluidDataStoreAttributes {\n const stringifiedPkg = JSON.stringify(pkg);\n return disableIsolatedChannels ? {\n pkg: stringifiedPkg,\n snapshotFormatVersion: \"0.1\",\n isRootDataStore,\n } : {\n pkg: stringifiedPkg,\n summaryFormatVersion: 2,\n isRootDataStore,\n };\n}\nexport function createAttributesBlob(\n pkg: readonly string[],\n isRootDataStore: boolean,\n disableIsolatedChannels: boolean,\n): ITreeEntry {\n const attributes = createAttributes(pkg, isRootDataStore, disableIsolatedChannels);\n return new BlobTreeEntry(dataStoreAttributesBlobName, JSON.stringify(attributes));\n}\n\ninterface ISnapshotDetails {\n pkg: readonly string[];\n snapshot?: ISnapshotTree;\n}\n\ninterface FluidDataStoreMessage {\n content: any;\n type: string;\n}\n\n/** Properties necessary for creating a FluidDataStoreContext */\nexport interface IFluidDataStoreContextProps {\n readonly id: string;\n readonly runtime: ContainerRuntime;\n readonly storage: IDocumentStorageService;\n readonly scope: FluidObject;\n readonly createSummarizerNodeFn: CreateChildSummarizerNodeFn;\n readonly writeGCDataAtRoot: boolean;\n readonly disableIsolatedChannels: boolean;\n readonly pkg?: Readonly<string[]>;\n}\n\n/** Properties necessary for creating a local FluidDataStoreContext */\nexport interface ILocalFluidDataStoreContextProps extends IFluidDataStoreContextProps {\n readonly pkg: Readonly<string[]> | undefined;\n readonly snapshotTree: ISnapshotTree | undefined;\n readonly isRootDataStore: boolean | undefined;\n readonly bindChannelFn: (channel: IFluidDataStoreChannel) => void;\n /**\n * @deprecated 0.16 Issue #1635, #3631\n */\n readonly createProps?: any;\n}\n\n/** Properties necessary for creating a remote FluidDataStoreContext */\nexport interface IRemoteFluidDataStoreContextProps extends IFluidDataStoreContextProps {\n readonly snapshotTree: ISnapshotTree | string | undefined;\n readonly getBaseGCDetails: () => Promise<IGarbageCollectionDetailsBase | undefined>;\n}\n\n/**\n * Represents the context for the store. This context is passed to the store runtime.\n */\nexport abstract class FluidDataStoreContext extends TypedEventEmitter<IFluidDataStoreContextEvents> implements\n IFluidDataStoreContext,\n IDisposable {\n public get packagePath(): readonly string[] {\n assert(this.pkg !== undefined, 0x139 /* \"Undefined package path\" */);\n return this.pkg;\n }\n\n public get options(): ILoaderOptions {\n return this._containerRuntime.options;\n }\n\n public get clientId(): string | undefined {\n return this._containerRuntime.clientId;\n }\n\n public get clientDetails(): IClientDetails {\n return this._containerRuntime.clientDetails;\n }\n\n public get logger(): ITelemetryLogger {\n return this._containerRuntime.logger;\n }\n\n public get deltaManager(): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage> {\n return this._containerRuntime.deltaManager;\n }\n\n public get connected(): boolean {\n return this._containerRuntime.connected;\n }\n\n public get IFluidHandleContext() {\n return this._containerRuntime.IFluidHandleContext;\n }\n\n public get containerRuntime(): IContainerRuntime {\n return this._containerRuntime;\n }\n\n public get isLoaded(): boolean {\n return this.loaded;\n }\n\n public get baseSnapshot(): ISnapshotTree | undefined {\n return this._baseSnapshot;\n }\n\n private _disposed = false;\n public get disposed() { return this._disposed; }\n\n public get attachState(): AttachState {\n return this._attachState;\n }\n\n public get IFluidDataStoreRegistry(): IFluidDataStoreRegistry | undefined {\n return this.registry;\n }\n\n public async isRoot(): Promise<boolean> {\n // This call updates this.isRootDataStore if it has not yet been updated\n // The initial value is stored in the initial snapshot of the data store\n await this.getInitialSnapshotDetails();\n return this.isRootDataStore;\n }\n\n protected registry: IFluidDataStoreRegistry | undefined;\n\n protected detachedRuntimeCreation = false;\n public readonly bindToContext: () => void;\n protected channel: IFluidDataStoreChannel | undefined;\n private loaded = false;\n protected pending: ISequencedDocumentMessage[] | undefined = [];\n protected channelDeferred: Deferred<IFluidDataStoreChannel> | undefined;\n private _baseSnapshot: ISnapshotTree | undefined;\n protected _attachState: AttachState;\n protected isRootDataStore: boolean = false;\n protected readonly summarizerNode: ISummarizerNodeWithGC;\n private readonly subLogger: ITelemetryLogger;\n private readonly thresholdOpsCounter: ThresholdCounter;\n private static readonly pendingOpsCountThreshold = 1000;\n\n // The used state of this node as per the last GC run. This is used to update the used state of the channel\n // if it realizes after GC is run.\n private lastUsedState: { usedRoutes: string[], gcTimestamp?: number } | undefined;\n\n public readonly id: string;\n private readonly _containerRuntime: ContainerRuntime;\n public readonly storage: IDocumentStorageService;\n public readonly scope: FluidObject;\n private readonly writeGCDataAtRoot: boolean;\n protected readonly disableIsolatedChannels: boolean;\n protected pkg?: readonly string[];\n\n constructor(\n props: IFluidDataStoreContextProps,\n private readonly existing: boolean,\n private bindState: BindState,\n public readonly isLocalDataStore: boolean,\n bindChannelFn: (channel: IFluidDataStoreChannel) => void,\n ) {\n super();\n\n this._containerRuntime = props.runtime;\n this.id = props.id;\n this.storage = props.storage;\n this.scope = props.scope;\n this.writeGCDataAtRoot = props.writeGCDataAtRoot;\n this.disableIsolatedChannels = props.disableIsolatedChannels;\n this.pkg = props.pkg;\n\n // URIs use slashes as delimiters. Handles use URIs.\n // Thus having slashes in types almost guarantees trouble down the road!\n assert(this.id.indexOf(\"/\") === -1, 0x13a /* `Data store ID contains slash: ${id}` */);\n\n this._attachState = this.containerRuntime.attachState !== AttachState.Detached && this.existing ?\n this.containerRuntime.attachState : AttachState.Detached;\n\n this.bindToContext = () => {\n assert(this.bindState === BindState.NotBound, 0x13b /* \"datastore context is already in bound state\" */);\n this.bindState = BindState.Binding;\n assert(this.channel !== undefined, 0x13c /* \"undefined channel on datastore context\" */);\n bindChannelFn(this.channel);\n this.bindState = BindState.Bound;\n };\n\n const thisSummarizeInternal =\n async (fullTree: boolean, trackState: boolean) => this.summarizeInternal(fullTree, trackState);\n\n this.summarizerNode = props.createSummarizerNodeFn(\n thisSummarizeInternal,\n async (fullGC?: boolean) => this.getGCDataInternal(fullGC),\n async () => this.getBaseGCDetails(),\n );\n\n this.subLogger = ChildLogger.create(this.logger, \"FluidDataStoreContext\");\n this.thresholdOpsCounter = new ThresholdCounter(FluidDataStoreContext.pendingOpsCountThreshold, this.subLogger);\n }\n\n public dispose(): void {\n if (this._disposed) {\n return;\n }\n this._disposed = true;\n\n // Dispose any pending runtime after it gets fulfilled\n // Errors are logged where this.channelDeferred is consumed/generated (realizeCore(), bindRuntime())\n if (this.channelDeferred) {\n this.channelDeferred.promise.then((runtime) => {\n runtime.dispose();\n }).catch((error) => {});\n }\n }\n\n private rejectDeferredRealize(reason: string, packageName?: string): never {\n throw new LoggingError(reason, { packageName: { value: packageName, tag: TelemetryDataTag.PackageData }});\n }\n\n public async realize(): Promise<IFluidDataStoreChannel> {\n assert(!this.detachedRuntimeCreation, 0x13d /* \"Detached runtime creation on realize()\" */);\n if (!this.channelDeferred) {\n this.channelDeferred = new Deferred<IFluidDataStoreChannel>();\n this.realizeCore(this.existing).catch((error) => {\n const errorWrapped = CreateProcessingError(error, \"realizeFluidDataStoreContext\");\n errorWrapped.addTelemetryProperties({ fluidDataStoreId: { value: this.id, tag: \"PackageData\"} });\n this.channelDeferred?.reject(errorWrapped);\n this.logger.sendErrorEvent({ eventName: \"RealizeError\"}, errorWrapped);\n });\n }\n return this.channelDeferred.promise;\n }\n\n protected async factoryFromPackagePath(packages?: readonly string[]) {\n assert(this.pkg === packages, 0x13e /* \"Unexpected package path\" */);\n if (packages === undefined) {\n this.rejectDeferredRealize(\"packages is undefined\");\n }\n\n let entry: FluidDataStoreRegistryEntry | undefined;\n let registry: IFluidDataStoreRegistry | undefined = this._containerRuntime.IFluidDataStoreRegistry;\n let lastPkg: string | undefined;\n for (const pkg of packages) {\n if (!registry) {\n this.rejectDeferredRealize(\"No registry for package\", lastPkg);\n }\n lastPkg = pkg;\n entry = await registry.get(pkg);\n if (!entry) {\n this.rejectDeferredRealize(\"Registry does not contain entry for the package\", pkg);\n }\n registry = entry.IFluidDataStoreRegistry;\n }\n const factory = entry?.IFluidDataStoreFactory;\n if (factory === undefined) {\n this.rejectDeferredRealize(\"Can't find factory for package\", lastPkg);\n }\n\n return { factory, registry };\n }\n\n private async realizeCore(existing: boolean): Promise<void> {\n const details = await this.getInitialSnapshotDetails();\n // Base snapshot is the baseline where pending ops are applied to.\n // It is important that this be in sync with the pending ops, and also\n // that it is set here, before bindRuntime is called.\n this._baseSnapshot = details.snapshot;\n const packages = details.pkg;\n\n const { factory, registry } = await this.factoryFromPackagePath(packages);\n\n assert(this.registry === undefined, 0x13f /* \"datastore context registry is already set\" */);\n this.registry = registry;\n\n const channel = await factory.instantiateDataStore(this, existing);\n assert(channel !== undefined, 0x140 /* \"undefined channel on datastore context\" */);\n this.bindRuntime(channel);\n }\n\n /**\n * Notifies this object about changes in the connection state.\n * @param value - New connection state.\n * @param clientId - ID of the client. It's old ID when in disconnected state and\n * it's new client ID when we are connecting or connected.\n */\n public setConnectionState(connected: boolean, clientId?: string) {\n this.verifyNotClosed();\n\n // Connection events are ignored if the store is not yet loaded\n if (!this.loaded) {\n return;\n }\n\n assert(this.connected === connected, 0x141 /* \"Unexpected connected state\" */);\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.channel!.setConnectionState(connected, clientId);\n }\n\n public process(messageArg: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n this.verifyNotClosed();\n\n const innerContents = messageArg.contents as FluidDataStoreMessage;\n const message = {\n ...messageArg,\n type: innerContents.type,\n contents: innerContents.content,\n };\n\n this.summarizerNode.recordChange(message);\n\n if (this.loaded) {\n return this.channel?.process(message, local, localOpMetadata);\n } else {\n assert(!local, 0x142 /* \"local store channel is not loaded\" */);\n assert(this.pending !== undefined, 0x23d /* \"pending is undefined\" */);\n this.pending.push(message);\n this.thresholdOpsCounter.sendIfMultiple(\"StorePendingOps\", this.pending.length);\n }\n }\n\n public processSignal(message: IInboundSignalMessage, local: boolean): void {\n this.verifyNotClosed();\n\n // Signals are ignored if the store is not yet loaded\n if (!this.loaded) {\n return;\n }\n\n this.channel?.processSignal(message, local);\n }\n\n public getQuorum(): IQuorumClients {\n return this._containerRuntime.getQuorum();\n }\n\n public getAudience(): IAudience {\n return this._containerRuntime.getAudience();\n }\n\n /**\n * Returns a summary at the current sequence number.\n * @param fullTree - true to bypass optimizations and force a full summary tree\n * @param trackState - This tells whether we should track state from this summary.\n */\n public async summarize(fullTree: boolean = false, trackState: boolean = true): Promise<ISummarizeResult> {\n return this.summarizerNode.summarize(fullTree, trackState);\n }\n\n private async summarizeInternal(fullTree: boolean, trackState: boolean): Promise<ISummarizeInternalResult> {\n await this.realize();\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const summarizeResult = await this.channel!.summarize(fullTree, trackState);\n let pathPartsForChildren: string[] | undefined;\n\n if (!this.disableIsolatedChannels) {\n // Wrap dds summaries in .channels subtree.\n wrapSummaryInChannelsTree(summarizeResult);\n pathPartsForChildren = [channelsTreeName];\n }\n\n // Add data store's attributes to the summary.\n const { pkg } = await this.getInitialSnapshotDetails();\n const attributes = createAttributes(pkg, this.isRootDataStore, this.disableIsolatedChannels);\n addBlobToSummary(summarizeResult, dataStoreAttributesBlobName, JSON.stringify(attributes));\n\n // Add GC data to the summary if it's not written at the root.\n if (!this.writeGCDataAtRoot) {\n addBlobToSummary(summarizeResult, gcBlobKey, JSON.stringify(this.summarizerNode.getGCSummaryDetails()));\n }\n\n // If we are not referenced, mark the summary tree as unreferenced. Also, update unreferenced blob\n // size in the summary stats with the blobs size of this data store.\n if (!this.summarizerNode.isReferenced()) {\n summarizeResult.summary.unreferenced = true;\n summarizeResult.stats.unreferencedBlobSize = summarizeResult.stats.totalBlobSize;\n }\n\n return {\n ...summarizeResult,\n id: this.id,\n pathPartsForChildren,\n };\n }\n\n /**\n * Returns the data used for garbage collection. This includes a list of GC nodes that represent this data store\n * including any of its child channel contexts. Each node has a set of outbound routes to other GC nodes in the\n * document.\n * If there is no new data in this data store since the last summary, previous GC data is used.\n * If there is new data, the GC data is generated again (by calling getGCDataInternal).\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n public async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n return this.summarizerNode.getGCData(fullGC);\n }\n\n /**\n * Generates data used for garbage collection. This is called when there is new data since last summary. It\n * realizes the data store and calls into each channel context to get its GC data.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n private async getGCDataInternal(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n await this.realize();\n assert(this.channel !== undefined, 0x143 /* \"Channel should not be undefined when running GC\" */);\n\n return this.channel.getGCData(fullGC);\n }\n\n /**\n * After GC has run, called to notify the data store of routes used in it. These are used for the following:\n * 1. To identify if this data store is being referenced in the document or not.\n * 2. To determine if it needs to re-summarize in case used routes changed since last summary.\n * 3. These are added to the summary generated by the data store.\n * 4. To notify child contexts of their used routes. This is done immediately if the data store is loaded. Else,\n * it is done when realizing the data store.\n * 5. To update the timestamp when this data store or any children are marked as unreferenced.\n * @param usedRoutes - The routes that are used in this data store.\n * @param gcTimestamp - The time when GC was run that generated these used routes. If any node becomes unreferenced\n * as part of this GC run, this should be used to update the time when it happens.\n */\n public updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number) {\n // Update the used routes in this data store's summarizer node.\n this.summarizerNode.updateUsedRoutes(usedRoutes, gcTimestamp);\n\n /**\n * If the data store has not been realized yet, we need this used state to update the used state of the channel\n * when it realizes. It's safe to keep only the last used state because if something changes because of this GC\n * run, the data store will be immediately realized as part of the summary that follows GC. For example, if a\n * child's reference state changes, the gcTimestamp has to be used to update its unreferencedTimestamp. Since\n * it will result in a change in this data store's used routes, it will be realized to regenerate its summary.\n */\n this.lastUsedState = { usedRoutes, gcTimestamp };\n\n // If we are loaded, call the channel so it can update the used routes of the child contexts.\n // If we are not loaded, we will update this when we are realized.\n if (this.loaded) {\n this.updateChannelUsedRoutes();\n }\n }\n\n /**\n * Called when a new outbound reference is added to another node. This is used by garbage collection to identify\n * all references added in the system.\n * @param srcHandle - The handle of the node that added the reference.\n * @param outboundHandle - The handle of the outbound node that is referenced.\n */\n public addedGCOutboundReference(srcHandle: IFluidHandle, outboundHandle: IFluidHandle) {\n this._containerRuntime.addedGCOutboundReference(srcHandle, outboundHandle);\n }\n\n /**\n * Updates the used routes of the channel and its child contexts. The channel must be loaded before calling this.\n * It is called in these two scenarios:\n * 1. When the used routes of the data store is updated and the data store is loaded.\n * 2. When the data store is realized. This updates the channel's used routes as per last GC run.\n */\n private updateChannelUsedRoutes() {\n assert(this.loaded, 0x144 /* \"Channel should be loaded when updating used routes\" */);\n assert(this.channel !== undefined, 0x145 /* \"Channel should be present when data store is loaded\" */);\n\n // If there is no lastUsedState, GC has not run up until this point.\n if (this.lastUsedState === undefined) {\n return;\n }\n\n // Remove the route to this data store, if it exists.\n const usedChannelRoutes = this.lastUsedState.usedRoutes.filter(\n (id: string) => { return id !== \"/\" && id !== \"\"; },\n );\n this.channel.updateUsedRoutes(usedChannelRoutes, this.lastUsedState.gcTimestamp);\n }\n\n /**\n * @deprecated 0.18.Should call request on the runtime directly\n */\n public async request(request: IRequest): Promise<IResponse> {\n const runtime = await this.realize();\n return runtime.request(request);\n }\n\n public submitMessage(type: string, content: any, localOpMetadata: unknown): void {\n this.verifyNotClosed();\n assert(!!this.channel, 0x146 /* \"Channel must exist when submitting message\" */);\n const fluidDataStoreContent: FluidDataStoreMessage = {\n content,\n type,\n };\n this._containerRuntime.submitDataStoreOp(\n this.id,\n fluidDataStoreContent,\n localOpMetadata);\n }\n\n /**\n * This is called from a SharedSummaryBlock that does not generate ops but only wants to be part of the summary.\n * It indicates that there is data in the object that needs to be summarized.\n * We will update the latestSequenceNumber of the summary tracker of this\n * store and of the object's channel.\n *\n * @param address - The address of the channel that is dirty.\n *\n */\n public setChannelDirty(address: string): void {\n this.verifyNotClosed();\n\n // Get the latest sequence number.\n const latestSequenceNumber = this.deltaManager.lastSequenceNumber;\n\n this.summarizerNode.invalidate(latestSequenceNumber);\n\n const channelSummarizerNode = this.summarizerNode.getChild(address);\n\n if (channelSummarizerNode) {\n channelSummarizerNode.invalidate(latestSequenceNumber); // TODO: lazy load problem?\n }\n }\n\n public submitSignal(type: string, content: any) {\n this.verifyNotClosed();\n assert(!!this.channel, 0x147 /* \"Channel must exist on submitting signal\" */);\n return this._containerRuntime.submitDataStoreSignal(this.id, type, content);\n }\n\n protected bindRuntime(channel: IFluidDataStoreChannel) {\n if (this.channel) {\n throw new Error(\"Runtime already bound\");\n }\n\n try\n {\n assert(!this.detachedRuntimeCreation, 0x148 /* \"Detached runtime creation on runtime bind\" */);\n assert(this.channelDeferred !== undefined, 0x149 /* \"Undefined channel deferral\" */);\n assert(this.pkg !== undefined, 0x14a /* \"Undefined package path\" */);\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const pending = this.pending!;\n\n // Apply all pending ops\n for (const op of pending) {\n channel.process(op, false, undefined /* localOpMetadata */);\n }\n\n this.thresholdOpsCounter.send(\"ProcessPendingOps\", pending.length);\n this.pending = undefined;\n\n // And now mark the runtime active\n this.loaded = true;\n this.channel = channel;\n\n // Freeze the package path to ensure that someone doesn't modify it when it is\n // returned in packagePath().\n Object.freeze(this.pkg);\n\n /**\n * Update the used routes of the channel. If GC has run before this data store was realized, we will have\n * the used routes saved. So, this will ensure that all the child contexts have up-to-date used routes as\n * per the last time GC was run.\n * Also, this data store may have been realized during summarize. In that case, the child contexts need to\n * have their used routes updated to determine if its needs to summarize again and to add it to the summary.\n */\n this.updateChannelUsedRoutes();\n\n // And notify the pending promise it is now available\n this.channelDeferred.resolve(this.channel);\n } catch (error) {\n this.channelDeferred?.reject(error);\n this.logger.sendErrorEvent(\n { eventName: \"BindRuntimeError\", fluidDataStoreId: { value: this.id, tag: \"PackageData\"} },\n error);\n }\n }\n\n public async getAbsoluteUrl(relativeUrl: string): Promise<string | undefined> {\n if (this.attachState !== AttachState.Attached) {\n return undefined;\n }\n return this._containerRuntime.getAbsoluteUrl(relativeUrl);\n }\n\n public abstract generateAttachMessage(): IAttachMessage;\n\n protected abstract getInitialSnapshotDetails(): Promise<ISnapshotDetails>;\n\n /**\n * @deprecated - Sets the datastore as root, for aliasing purposes: #7948\n * This method should not be used outside of the aliasing context.\n * It will be removed, as the source of truth for this flag will be the aliasing blob.\n */\n public abstract setRoot(): void;\n\n /**\n * @deprecated - Renamed to getBaseGCDetails().\n */\n public abstract getInitialGCSummaryDetails(): Promise<IGarbageCollectionSummaryDetails>;\n\n public abstract getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase>;\n\n public reSubmit(contents: any, localOpMetadata: unknown) {\n assert(!!this.channel, 0x14b /* \"Channel must exist when resubmitting ops\" */);\n const innerContents = contents as FluidDataStoreMessage;\n this.channel.reSubmit(innerContents.type, innerContents.content, localOpMetadata);\n }\n\n public async applyStashedOp(contents: any): Promise<unknown> {\n if (!this.channel) {\n await this.realize();\n }\n assert(!!this.channel, 0x14c /* \"Channel must exist when rebasing ops\" */);\n const innerContents = contents as FluidDataStoreMessage;\n return this.channel.applyStashedOp(innerContents.content);\n }\n\n private verifyNotClosed() {\n if (this._disposed) {\n throw new Error(\"Context is closed\");\n }\n }\n\n public getCreateChildSummarizerNodeFn(id: string, createParam: CreateChildSummarizerNodeParam) {\n return (\n summarizeInternal: SummarizeInternalFn,\n getGCDataFn: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n getBaseGCDetailsFn: () => Promise<IGarbageCollectionDetailsBase>,\n ) => this.summarizerNode.createChild(\n summarizeInternal,\n id,\n createParam,\n // DDS will not create failure summaries\n { throwOnFailure: true },\n getGCDataFn,\n getBaseGCDetailsFn,\n );\n }\n\n public async uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>> {\n return this.containerRuntime.uploadBlob(blob);\n }\n}\n\nexport class RemoteFluidDataStoreContext extends FluidDataStoreContext {\n private readonly initSnapshotValue: ISnapshotTree | string | undefined;\n private readonly baseGCDetailsP: Promise<IGarbageCollectionDetailsBase>;\n\n constructor(props: IRemoteFluidDataStoreContextProps) {\n super(\n props,\n true /* existing */,\n BindState.Bound,\n false /* isLocalDataStore */,\n () => {\n throw new Error(\"Already attached\");\n },\n );\n\n this.initSnapshotValue = props.snapshotTree;\n this.baseGCDetailsP = new LazyPromise<IGarbageCollectionDetailsBase>(async () => {\n return (await props.getBaseGCDetails()) ?? {};\n });\n }\n\n private readonly initialSnapshotDetailsP = new LazyPromise<ISnapshotDetails>(async () => {\n let tree: ISnapshotTree | undefined;\n let isRootDataStore = true;\n\n if (typeof this.initSnapshotValue === \"string\") {\n const commit = (await this.storage.getVersions(this.initSnapshotValue, 1))[0];\n tree = await this.storage.getSnapshotTree(commit) ?? undefined;\n } else {\n tree = this.initSnapshotValue;\n }\n\n const localReadAndParse = async <T>(id: string) => readAndParse<T>(this.storage, id);\n if (tree) {\n const loadedSummary = await this.summarizerNode.loadBaseSummary(tree, localReadAndParse);\n tree = loadedSummary.baseSummary;\n // Prepend outstanding ops to pending queue of ops to process.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.pending = loadedSummary.outstandingOps.concat(this.pending!);\n }\n\n if (!!tree && tree.blobs[dataStoreAttributesBlobName] !== undefined) {\n // Need to get through snapshot and use that to populate extraBlobs\n const attributes =\n await localReadAndParse<ReadFluidDataStoreAttributes>(tree.blobs[dataStoreAttributesBlobName]);\n\n let pkgFromSnapshot: string[];\n // Use the snapshotFormatVersion to determine how the pkg is encoded in the snapshot.\n // For snapshotFormatVersion = \"0.1\" (1) or above, pkg is jsonified, otherwise it is just a string.\n const formatVersion = getAttributesFormatVersion(attributes);\n if (formatVersion < 1) {\n if (attributes.pkg.startsWith(\"[\\\"\") && attributes.pkg.endsWith(\"\\\"]\")) {\n pkgFromSnapshot = JSON.parse(attributes.pkg) as string[];\n } else {\n pkgFromSnapshot = [attributes.pkg];\n }\n } else {\n pkgFromSnapshot = JSON.parse(attributes.pkg) as string[];\n }\n this.pkg = pkgFromSnapshot;\n\n /**\n * If there is no isRootDataStore in the attributes blob, set it to true. This will ensure that\n * data stores in older documents are not garbage collected incorrectly. This may lead to additional\n * roots in the document but they won't break.\n */\n isRootDataStore = this.isRootDataStore === true || (attributes.isRootDataStore ?? true);\n\n if (hasIsolatedChannels(attributes)) {\n tree = tree.trees[channelsTreeName];\n assert(tree !== undefined,\n 0x1fe /* \"isolated channels subtree should exist in remote datastore snapshot\" */);\n }\n }\n\n this.isRootDataStore = isRootDataStore;\n\n return {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n pkg: this.pkg!,\n snapshot: tree,\n };\n });\n\n protected async getInitialSnapshotDetails(): Promise<ISnapshotDetails> {\n return this.initialSnapshotDetailsP;\n }\n\n /**\n * @deprecated - Renamed to getBaseGCDetails.\n */\n public async getInitialGCSummaryDetails(): Promise<IGarbageCollectionSummaryDetails> {\n return this.getBaseGCDetails();\n }\n\n public async getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase> {\n return this.baseGCDetailsP;\n }\n\n public generateAttachMessage(): IAttachMessage {\n throw new Error(\"Cannot attach remote store\");\n }\n\n /**\n * @deprecated - Sets the datastore as root, for aliasing purposes: #7948\n * This method should not be used outside of the aliasing context.\n * It will be removed, as the source of truth for this flag will be the aliasing blob.\n */\n public setRoot(): void {\n this.isRootDataStore = true;\n }\n}\n\n/**\n * Base class for detached & attached context classes\n */\nexport class LocalFluidDataStoreContextBase extends FluidDataStoreContext {\n private readonly snapshotTree: ISnapshotTree | undefined;\n /**\n * @deprecated 0.16 Issue #1635, #3631\n */\n public readonly createProps?: any;\n\n constructor(props: ILocalFluidDataStoreContextProps) {\n super(\n props,\n props.snapshotTree !== undefined ? true : false /* existing */,\n props.snapshotTree ? BindState.Bound : BindState.NotBound,\n true /* isLocalDataStore */,\n props.bindChannelFn,\n );\n\n this.snapshotTree = props.snapshotTree;\n this.isRootDataStore = props.isRootDataStore ?? false;\n this.createProps = props.createProps;\n this.attachListeners();\n }\n\n private attachListeners(): void {\n this.once(\"attaching\", () => {\n assert(this.attachState === AttachState.Detached, 0x14d /* \"Should move from detached to attaching\" */);\n this._attachState = AttachState.Attaching;\n });\n this.once(\"attached\", () => {\n assert(this.attachState === AttachState.Attaching, 0x14e /* \"Should move from attaching to attached\" */);\n this._attachState = AttachState.Attached;\n });\n }\n\n public generateAttachMessage(): IAttachMessage {\n assert(this.channel !== undefined, 0x14f /* \"There should be a channel when generating attach message\" */);\n assert(this.pkg !== undefined, 0x150 /* \"pkg should be available in local data store context\" */);\n assert(this.isRootDataStore !== undefined,\n 0x151 /* \"isRootDataStore should be available in local data store context\" */);\n\n const summarizeResult = this.channel.getAttachSummary();\n\n if (!this.disableIsolatedChannels) {\n // Wrap dds summaries in .channels subtree.\n wrapSummaryInChannelsTree(summarizeResult);\n }\n\n // Add data store's attributes to the summary.\n const attributes = createAttributes(\n this.pkg,\n this.isRootDataStore,\n this.disableIsolatedChannels,\n );\n addBlobToSummary(summarizeResult, dataStoreAttributesBlobName, JSON.stringify(attributes));\n\n // Attach message needs the summary in ITree format. Convert the ISummaryTree into an ITree.\n const snapshot = convertSummaryTreeToITree(summarizeResult.summary);\n\n const message: IAttachMessage = {\n id: this.id,\n snapshot,\n type: this.pkg[this.pkg.length - 1],\n };\n\n return message;\n }\n\n protected async getInitialSnapshotDetails(): Promise<ISnapshotDetails> {\n let snapshot = this.snapshotTree;\n let attributes: ReadFluidDataStoreAttributes;\n if (snapshot !== undefined) {\n // Get the dataStore attributes.\n // Note: storage can be undefined in special case while detached.\n attributes = await getFluidDataStoreAttributes(this.storage, snapshot);\n if (hasIsolatedChannels(attributes)) {\n snapshot = snapshot.trees[channelsTreeName];\n assert(snapshot !== undefined,\n 0x1ff /* \"isolated channels subtree should exist in local datastore snapshot\" */);\n }\n if (this.pkg === undefined) {\n this.pkg = JSON.parse(attributes.pkg) as string[];\n // If there is no isRootDataStore in the attributes blob, set it to true. This ensures that data\n // stores in older documents are not garbage collected incorrectly. This may lead to additional\n // roots in the document but they won't break.\n this.isRootDataStore = this.isRootDataStore || (attributes.isRootDataStore ?? true);\n }\n }\n assert(this.pkg !== undefined, 0x152 /* \"pkg should be available in local data store\" */);\n assert(this.isRootDataStore !== undefined,\n 0x153 /* \"isRootDataStore should be available in local data store\" */);\n\n return {\n pkg: this.pkg,\n snapshot,\n };\n }\n\n /**\n * @deprecated - Renamed to getBaseGCDetails.\n */\n public async getInitialGCSummaryDetails(): Promise<IGarbageCollectionSummaryDetails> {\n // Local data store does not have initial summary.\n return {};\n }\n\n public async getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase> {\n // Local data store does not have initial summary.\n return {};\n }\n\n /**\n * @deprecated - Sets the datastore as root, for aliasing purposes: #7948\n * This method should not be used outside of the aliasing context.\n * It will be removed, as the source of truth for this flag will be the aliasing blob.\n */\n public setRoot(): void {\n this.isRootDataStore = true;\n }\n}\n\n/**\n * context implementation for \"attached\" data store runtime.\n * Various workflows (snapshot creation, requests) result in .realize() being called\n * on context, resulting in instantiation and attachment of runtime.\n * Runtime is created using data store factory that is associated with this context.\n */\nexport class LocalFluidDataStoreContext extends LocalFluidDataStoreContextBase {\n constructor(props: ILocalFluidDataStoreContextProps) {\n super(props);\n }\n}\n\n/**\n * Detached context. Data Store runtime will be attached to it by attachRuntime() call\n * Before attachment happens, this context is not associated with particular type of runtime\n * or factory, i.e. it's package path is undefined.\n * Attachment process provides all missing parts - package path, data store runtime, and data store factory\n */\nexport class LocalDetachedFluidDataStoreContext\n extends LocalFluidDataStoreContextBase\n implements IFluidDataStoreContextDetached\n{\n constructor(props: ILocalFluidDataStoreContextProps) {\n super(props);\n this.detachedRuntimeCreation = true;\n }\n\n public async attachRuntime(\n registry: IProvideFluidDataStoreFactory,\n dataStoreRuntime: IFluidDataStoreChannel)\n {\n assert(this.detachedRuntimeCreation, 0x154 /* \"runtime creation is already attached\" */);\n assert(this.channelDeferred === undefined, 0x155 /* \"channel deferral is already set\" */);\n\n const factory = registry.IFluidDataStoreFactory;\n\n const entry = await this.factoryFromPackagePath(this.pkg);\n assert(entry.factory === factory, 0x156 /* \"Unexpected factory for package path\" */);\n\n assert(this.registry === undefined, 0x157 /* \"datastore registry already attached\" */);\n this.registry = entry.registry;\n\n this.detachedRuntimeCreation = false;\n this.channelDeferred = new Deferred<IFluidDataStoreChannel>();\n\n super.bindRuntime(dataStoreRuntime);\n\n if (this.isRootDataStore) {\n dataStoreRuntime.bindToContext();\n }\n }\n\n protected async getInitialSnapshotDetails(): Promise<ISnapshotDetails> {\n if (this.detachedRuntimeCreation) {\n throw new Error(\"Detached Fluid Data Store context can't be realized! Please attach runtime first!\");\n }\n return super.getInitialSnapshotDetails();\n }\n}\n"]}
|