@fluidframework/container-runtime 2.70.0-361788 → 2.70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/container-runtime.test-files.tar +0 -0
- package/dist/containerRuntime.d.ts +15 -6
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +55 -18
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts +1 -1
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +7 -8
- package/dist/dataStore.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/containerRuntime.d.ts +15 -6
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +55 -18
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts +1 -1
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js +2 -3
- package/lib/dataStore.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +17 -17
- package/src/containerRuntime.ts +97 -29
- package/src/dataStore.ts +6 -9
- package/src/packageVersion.ts +1 -1
package/lib/dataStore.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import type
|
|
5
|
+
import { type IDataStore, type IFluidDataStoreChannel } from "@fluidframework/runtime-definitions/internal";
|
|
6
6
|
import { type ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
7
7
|
import type { ChannelCollection } from "./channelCollection.js";
|
|
8
8
|
/**
|
package/lib/dataStore.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStore.d.ts","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"dataStore.d.ts","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAEN,KAAK,UAAU,EACf,KAAK,sBAAsB,EAE3B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACN,KAAK,mBAAmB,EAGxB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGhE;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,+BACP,OAAO,yDAOnC,CAAC;AAEF,eAAO,MAAM,kBAAkB,0BACP,sBAAsB,cACjC,MAAM,qBACC,iBAAiB,UAC5B,mBAAmB,KACzB,UAAyF,CAAC"}
|
package/lib/dataStore.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { AttachState } from "@fluidframework/container-definitions";
|
|
6
6
|
import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
7
|
+
import { asLegacyAlpha, } from "@fluidframework/runtime-definitions/internal";
|
|
7
8
|
import { TelemetryDataTag, UsageError, } from "@fluidframework/telemetry-utils/internal";
|
|
8
9
|
import { ContainerMessageType } from "./messageTypes.js";
|
|
9
10
|
/**
|
|
@@ -32,9 +33,7 @@ class DataStore {
|
|
|
32
33
|
if (alias.includes("/")) {
|
|
33
34
|
throw new UsageError(`The alias cannot contain slashes: '${alias}'`);
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
-
const runtime = this.parentContext.containerRuntime;
|
|
37
|
-
if (runtime.inStagingMode === true) {
|
|
36
|
+
if (asLegacyAlpha(this.parentContext.containerRuntime).inStagingMode === true) {
|
|
38
37
|
throw new UsageError("Cannot set aliases while in staging mode");
|
|
39
38
|
}
|
|
40
39
|
switch (this.aliasState) {
|
package/lib/dataStore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStore.js","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAGpE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAQ9E,OAAO,EAEN,gBAAgB,EAChB,UAAU,GACV,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAiBzD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACtC,0BAAmC,EACoB,EAAE;IACzD,OAAO,CACN,OAAQ,0BAA8D,EAAE,UAAU;QACjF,QAAQ;QACT,OAAQ,0BAA8D,EAAE,KAAK,KAAK,QAAQ,CAC1F,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CACjC,qBAA6C,EAC7C,UAAkB,EAClB,iBAAoC,EACpC,MAA2B,EACd,EAAE,CAAC,IAAI,SAAS,CAAC,qBAAqB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAC;AAE7F,IAAK,UAIJ;AAJD,WAAK,UAAU;IACd,iCAAmB,CAAA;IACnB,mCAAqB,CAAA;IACrB,2BAAa,CAAA;AACd,CAAC,EAJI,UAAU,KAAV,UAAU,QAId;AAED,MAAM,SAAS;IAMd;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,KAAa;QAC9B,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,M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,aAAa,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;gBAClD,oBAAoB,EAAE,CAAC;gBACvB,OAAO;YACR,CAAC;YAED,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;YACxE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;YACf,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport type { FluidObject } from \"@fluidframework/core-interfaces\";\nimport type { IFluidHandleInternal } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tAliasResult,\n\tIDataStore,\n\tIFluidDataStoreChannel,\n\t// eslint-disable-next-line import/no-deprecated\n\tIContainerRuntimeBaseExperimental,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tTelemetryDataTag,\n\tUsageError,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { ChannelCollection } from \"./channelCollection.js\";\nimport { ContainerMessageType } from \"./messageTypes.js\";\n\n/**\n * Interface for an op to be used for assigning an\n * alias to a datastore\n */\nexport interface IDataStoreAliasMessage {\n\t/**\n\t * The internal id of the datastore\n\t */\n\treadonly internalId: string;\n\t/**\n\t * The alias name to be assigned to the datastore\n\t */\n\treadonly 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 {@link IDataStoreAliasMessage}\n * @param maybeDataStoreAliasMessage - message object to be validated\n * @returns True if the {@link IDataStoreAliasMessage} is fully implemented, false otherwise\n */\nexport const isDataStoreAliasMessage = (\n\tmaybeDataStoreAliasMessage: unknown,\n): maybeDataStoreAliasMessage is IDataStoreAliasMessage => {\n\treturn (\n\t\ttypeof (maybeDataStoreAliasMessage as Partial<IDataStoreAliasMessage>)?.internalId ===\n\t\t\t\"string\" &&\n\t\ttypeof (maybeDataStoreAliasMessage as Partial<IDataStoreAliasMessage>)?.alias === \"string\"\n\t);\n};\n\nexport const channelToDataStore = (\n\tfluidDataStoreChannel: IFluidDataStoreChannel,\n\tinternalId: string,\n\tchannelCollection: ChannelCollection,\n\tlogger: ITelemetryLoggerExt,\n): IDataStore => new DataStore(fluidDataStoreChannel, internalId, channelCollection, logger);\n\nenum AliasState {\n\tAliased = \"Aliased\",\n\tAliasing = \"Aliasing\",\n\tNone = \"None\",\n}\n\nclass DataStore implements IDataStore {\n\tprivate aliasState: AliasState = AliasState.None;\n\tprivate alias: string | undefined;\n\tprivate readonly pendingAliases: Map<string, Promise<AliasResult>>;\n\tprivate aliasResult: Promise<AliasResult> | undefined;\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.trySetAlias}\n\t */\n\tasync trySetAlias(alias: string): Promise<AliasResult> {\n\t\tif (alias.includes(\"/\")) {\n\t\t\tthrow new UsageError(`The alias cannot contain slashes: '${alias}'`);\n\t\t}\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tconst runtime = this.parentContext.containerRuntime as IContainerRuntimeBaseExperimental;\n\t\tif (runtime.inStagingMode === true) {\n\t\t\tthrow new UsageError(\"Cannot set aliases while in staging mode\");\n\t\t}\n\n\t\tswitch (this.aliasState) {\n\t\t\t// If we're already aliasing, check if it's for the same value and return\n\t\t\t// the stored promise, otherwise return 'AlreadyAliased'\n\t\t\tcase AliasState.Aliasing: {\n\t\t\t\tassert(\n\t\t\t\t\tthis.aliasResult !== undefined,\n\t\t\t\t\t0x316 /* There should be a cached promise of in-progress aliasing */,\n\t\t\t\t);\n\t\t\t\tawait this.aliasResult;\n\t\t\t\treturn this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\t\t\t}\n\n\t\t\t// If this datastore is already aliased, return true only if this\n\t\t\t// is a repeated call for the same alias\n\t\t\tcase AliasState.Aliased: {\n\t\t\t\treturn this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\t\t\t}\n\n\t\t\tcase AliasState.None: {\n\t\t\t\tconst existingAlias = this.pendingAliases.get(alias);\n\t\t\t\tif (existingAlias !== undefined) {\n\t\t\t\t\t// There is already another datastore which will be aliased\n\t\t\t\t\t// to the same name\n\t\t\t\t\treturn \"Conflict\";\n\t\t\t\t}\n\n\t\t\t\t// There is no current or past alias operation for this datastore,\n\t\t\t\t// or for this alias, so it is safe to continue execution\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(this.aliasState);\n\t\t\t}\n\t\t}\n\n\t\tthis.aliasState = AliasState.Aliasing;\n\t\tthis.aliasResult = this.trySetAliasInternal(alias);\n\t\tthis.pendingAliases.set(alias, this.aliasResult);\n\t\treturn this.aliasResult;\n\t}\n\n\tasync trySetAliasInternal(alias: string): Promise<AliasResult> {\n\t\tconst message: IDataStoreAliasMessage = {\n\t\t\tinternalId: this.internalId,\n\t\t\talias,\n\t\t};\n\t\tthis.fluidDataStoreChannel.makeVisibleAndAttachGraph();\n\n\t\tif (this.parentContext.attachState === AttachState.Detached) {\n\t\t\tconst localResult = this.channelCollection.processAliasMessageCore(\n\t\t\t\tthis.internalId,\n\t\t\t\talias,\n\t\t\t);\n\t\t\t// Explicitly lock-out future attempts of aliasing,\n\t\t\t// regardless of result\n\t\t\tthis.aliasState = AliasState.Aliased;\n\t\t\treturn localResult ? \"Success\" : \"Conflict\";\n\t\t}\n\n\t\tconst aliased = await this.ackBasedPromise<boolean>((resolve) => {\n\t\t\tthis.parentContext.submitMessage(ContainerMessageType.Alias, message, resolve);\n\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"AliasingException\",\n\t\t\t\t\t\talias: {\n\t\t\t\t\t\t\tvalue: alias,\n\t\t\t\t\t\t\ttag: TelemetryDataTag.UserData,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinternalId: {\n\t\t\t\t\t\t\tvalue: this.internalId,\n\t\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\n\t\t\t\treturn false;\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tthis.pendingAliases.delete(alias);\n\t\t\t});\n\n\t\tif (!aliased) {\n\t\t\tthis.aliasState = AliasState.None;\n\t\t\tthis.aliasResult = undefined;\n\t\t\treturn \"Conflict\";\n\t\t}\n\n\t\tthis.alias = alias;\n\t\tthis.aliasState = AliasState.Aliased;\n\t\treturn \"Success\";\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.entryPoint}\n\t */\n\tget entryPoint(): IFluidHandleInternal<FluidObject> {\n\t\treturn this.fluidDataStoreChannel.entryPoint;\n\t}\n\n\tconstructor(\n\t\tprivate readonly fluidDataStoreChannel: IFluidDataStoreChannel,\n\t\tprivate readonly internalId: string,\n\t\tprivate readonly channelCollection: ChannelCollection,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly parentContext = channelCollection.parentContext,\n\t) {\n\t\tthis.pendingAliases = channelCollection.pendingAliases;\n\t}\n\n\tprivate async ackBasedPromise<T>(\n\t\texecutor: (\n\t\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\t\treject: (reason?: unknown) => void,\n\t\t) => void,\n\t): Promise<T> {\n\t\tlet rejectBecauseDispose: () => void;\n\t\treturn new Promise<T>((resolve, reject) => {\n\t\t\trejectBecauseDispose = () =>\n\t\t\t\treject(\n\t\t\t\t\tnew Error(\"ContainerRuntime disposed while this ack-based Promise was pending\"),\n\t\t\t\t);\n\n\t\t\tif (this.parentContext.containerRuntime.disposed) {\n\t\t\t\trejectBecauseDispose();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.parentContext.containerRuntime.on(\"dispose\", rejectBecauseDispose);\n\t\t\texecutor(resolve, reject);\n\t\t}).finally(() => {\n\t\t\tthis.parentContext.containerRuntime.off(\"dispose\", rejectBecauseDispose);\n\t\t});\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dataStore.js","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAGpE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAIN,aAAa,GACb,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAEN,gBAAgB,EAChB,UAAU,GACV,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAiBzD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACtC,0BAAmC,EACoB,EAAE;IACzD,OAAO,CACN,OAAQ,0BAA8D,EAAE,UAAU;QACjF,QAAQ;QACT,OAAQ,0BAA8D,EAAE,KAAK,KAAK,QAAQ,CAC1F,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CACjC,qBAA6C,EAC7C,UAAkB,EAClB,iBAAoC,EACpC,MAA2B,EACd,EAAE,CAAC,IAAI,SAAS,CAAC,qBAAqB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAC;AAE7F,IAAK,UAIJ;AAJD,WAAK,UAAU;IACd,iCAAmB,CAAA;IACnB,mCAAqB,CAAA;IACrB,2BAAa,CAAA;AACd,CAAC,EAJI,UAAU,KAAV,UAAU,QAId;AAED,MAAM,SAAS;IAMd;;OAEG;IACH,KAAK,CAAC,WAAW,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oEAAoE,CAAC,CAC/E,CAAC;YAEH,IAAI,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;gBAClD,oBAAoB,EAAE,CAAC;gBACvB,OAAO;YACR,CAAC;YAED,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;YACxE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;YACf,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport type { FluidObject } from \"@fluidframework/core-interfaces\";\nimport type { IFluidHandleInternal } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype AliasResult,\n\ttype IDataStore,\n\ttype IFluidDataStoreChannel,\n\tasLegacyAlpha,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tTelemetryDataTag,\n\tUsageError,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { ChannelCollection } from \"./channelCollection.js\";\nimport { ContainerMessageType } from \"./messageTypes.js\";\n\n/**\n * Interface for an op to be used for assigning an\n * alias to a datastore\n */\nexport interface IDataStoreAliasMessage {\n\t/**\n\t * The internal id of the datastore\n\t */\n\treadonly internalId: string;\n\t/**\n\t * The alias name to be assigned to the datastore\n\t */\n\treadonly 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 {@link IDataStoreAliasMessage}\n * @param maybeDataStoreAliasMessage - message object to be validated\n * @returns True if the {@link IDataStoreAliasMessage} is fully implemented, false otherwise\n */\nexport const isDataStoreAliasMessage = (\n\tmaybeDataStoreAliasMessage: unknown,\n): maybeDataStoreAliasMessage is IDataStoreAliasMessage => {\n\treturn (\n\t\ttypeof (maybeDataStoreAliasMessage as Partial<IDataStoreAliasMessage>)?.internalId ===\n\t\t\t\"string\" &&\n\t\ttypeof (maybeDataStoreAliasMessage as Partial<IDataStoreAliasMessage>)?.alias === \"string\"\n\t);\n};\n\nexport const channelToDataStore = (\n\tfluidDataStoreChannel: IFluidDataStoreChannel,\n\tinternalId: string,\n\tchannelCollection: ChannelCollection,\n\tlogger: ITelemetryLoggerExt,\n): IDataStore => new DataStore(fluidDataStoreChannel, internalId, channelCollection, logger);\n\nenum AliasState {\n\tAliased = \"Aliased\",\n\tAliasing = \"Aliasing\",\n\tNone = \"None\",\n}\n\nclass DataStore implements IDataStore {\n\tprivate aliasState: AliasState = AliasState.None;\n\tprivate alias: string | undefined;\n\tprivate readonly pendingAliases: Map<string, Promise<AliasResult>>;\n\tprivate aliasResult: Promise<AliasResult> | undefined;\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.trySetAlias}\n\t */\n\tasync trySetAlias(alias: string): Promise<AliasResult> {\n\t\tif (alias.includes(\"/\")) {\n\t\t\tthrow new UsageError(`The alias cannot contain slashes: '${alias}'`);\n\t\t}\n\t\tif (asLegacyAlpha(this.parentContext.containerRuntime).inStagingMode === true) {\n\t\t\tthrow new UsageError(\"Cannot set aliases while in staging mode\");\n\t\t}\n\n\t\tswitch (this.aliasState) {\n\t\t\t// If we're already aliasing, check if it's for the same value and return\n\t\t\t// the stored promise, otherwise return 'AlreadyAliased'\n\t\t\tcase AliasState.Aliasing: {\n\t\t\t\tassert(\n\t\t\t\t\tthis.aliasResult !== undefined,\n\t\t\t\t\t0x316 /* There should be a cached promise of in-progress aliasing */,\n\t\t\t\t);\n\t\t\t\tawait this.aliasResult;\n\t\t\t\treturn this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\t\t\t}\n\n\t\t\t// If this datastore is already aliased, return true only if this\n\t\t\t// is a repeated call for the same alias\n\t\t\tcase AliasState.Aliased: {\n\t\t\t\treturn this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\t\t\t}\n\n\t\t\tcase AliasState.None: {\n\t\t\t\tconst existingAlias = this.pendingAliases.get(alias);\n\t\t\t\tif (existingAlias !== undefined) {\n\t\t\t\t\t// There is already another datastore which will be aliased\n\t\t\t\t\t// to the same name\n\t\t\t\t\treturn \"Conflict\";\n\t\t\t\t}\n\n\t\t\t\t// There is no current or past alias operation for this datastore,\n\t\t\t\t// or for this alias, so it is safe to continue execution\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(this.aliasState);\n\t\t\t}\n\t\t}\n\n\t\tthis.aliasState = AliasState.Aliasing;\n\t\tthis.aliasResult = this.trySetAliasInternal(alias);\n\t\tthis.pendingAliases.set(alias, this.aliasResult);\n\t\treturn this.aliasResult;\n\t}\n\n\tasync trySetAliasInternal(alias: string): Promise<AliasResult> {\n\t\tconst message: IDataStoreAliasMessage = {\n\t\t\tinternalId: this.internalId,\n\t\t\talias,\n\t\t};\n\t\tthis.fluidDataStoreChannel.makeVisibleAndAttachGraph();\n\n\t\tif (this.parentContext.attachState === AttachState.Detached) {\n\t\t\tconst localResult = this.channelCollection.processAliasMessageCore(\n\t\t\t\tthis.internalId,\n\t\t\t\talias,\n\t\t\t);\n\t\t\t// Explicitly lock-out future attempts of aliasing,\n\t\t\t// regardless of result\n\t\t\tthis.aliasState = AliasState.Aliased;\n\t\t\treturn localResult ? \"Success\" : \"Conflict\";\n\t\t}\n\n\t\tconst aliased = await this.ackBasedPromise<boolean>((resolve) => {\n\t\t\tthis.parentContext.submitMessage(ContainerMessageType.Alias, message, resolve);\n\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"AliasingException\",\n\t\t\t\t\t\talias: {\n\t\t\t\t\t\t\tvalue: alias,\n\t\t\t\t\t\t\ttag: TelemetryDataTag.UserData,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinternalId: {\n\t\t\t\t\t\t\tvalue: this.internalId,\n\t\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\n\t\t\t\treturn false;\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tthis.pendingAliases.delete(alias);\n\t\t\t});\n\n\t\tif (!aliased) {\n\t\t\tthis.aliasState = AliasState.None;\n\t\t\tthis.aliasResult = undefined;\n\t\t\treturn \"Conflict\";\n\t\t}\n\n\t\tthis.alias = alias;\n\t\tthis.aliasState = AliasState.Aliased;\n\t\treturn \"Success\";\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.entryPoint}\n\t */\n\tget entryPoint(): IFluidHandleInternal<FluidObject> {\n\t\treturn this.fluidDataStoreChannel.entryPoint;\n\t}\n\n\tconstructor(\n\t\tprivate readonly fluidDataStoreChannel: IFluidDataStoreChannel,\n\t\tprivate readonly internalId: string,\n\t\tprivate readonly channelCollection: ChannelCollection,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly parentContext = channelCollection.parentContext,\n\t) {\n\t\tthis.pendingAliases = channelCollection.pendingAliases;\n\t}\n\n\tprivate async ackBasedPromise<T>(\n\t\texecutor: (\n\t\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\t\treject: (reason?: unknown) => void,\n\t\t) => void,\n\t): Promise<T> {\n\t\tlet rejectBecauseDispose: () => void;\n\t\treturn new Promise<T>((resolve, reject) => {\n\t\t\trejectBecauseDispose = () =>\n\t\t\t\treject(\n\t\t\t\t\tnew Error(\"ContainerRuntime disposed while this ack-based Promise was pending\"),\n\t\t\t\t);\n\n\t\t\tif (this.parentContext.containerRuntime.disposed) {\n\t\t\t\trejectBecauseDispose();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.parentContext.containerRuntime.on(\"dispose\", rejectBecauseDispose);\n\t\t\texecutor(resolve, reject);\n\t\t}).finally(() => {\n\t\t\tthis.parentContext.containerRuntime.off(\"dispose\", rejectBecauseDispose);\n\t\t});\n\t}\n}\n"]}
|
package/lib/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/container-runtime";
|
|
8
|
-
export declare const pkgVersion = "2.70.0
|
|
8
|
+
export declare const pkgVersion = "2.70.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,sCAAsC,CAAC;AAC3D,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,sCAAsC,CAAC;AAC3D,eAAO,MAAM,UAAU,WAAW,CAAC"}
|
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,mCAAmC,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,mCAAmC,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-runtime\";\nexport const pkgVersion = \"2.70.0\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/container-runtime",
|
|
3
|
-
"version": "2.70.0
|
|
3
|
+
"version": "2.70.0",
|
|
4
4
|
"description": "Fluid container runtime",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -119,18 +119,18 @@
|
|
|
119
119
|
"temp-directory": "nyc/.nyc_output"
|
|
120
120
|
},
|
|
121
121
|
"dependencies": {
|
|
122
|
-
"@fluid-internal/client-utils": "2.70.0
|
|
123
|
-
"@fluidframework/container-definitions": "2.70.0
|
|
124
|
-
"@fluidframework/container-runtime-definitions": "2.70.0
|
|
125
|
-
"@fluidframework/core-interfaces": "2.70.0
|
|
126
|
-
"@fluidframework/core-utils": "2.70.0
|
|
127
|
-
"@fluidframework/datastore": "2.70.0
|
|
128
|
-
"@fluidframework/driver-definitions": "2.70.0
|
|
129
|
-
"@fluidframework/driver-utils": "2.70.0
|
|
130
|
-
"@fluidframework/id-compressor": "2.70.0
|
|
131
|
-
"@fluidframework/runtime-definitions": "2.70.0
|
|
132
|
-
"@fluidframework/runtime-utils": "2.70.0
|
|
133
|
-
"@fluidframework/telemetry-utils": "2.70.0
|
|
122
|
+
"@fluid-internal/client-utils": "~2.70.0",
|
|
123
|
+
"@fluidframework/container-definitions": "~2.70.0",
|
|
124
|
+
"@fluidframework/container-runtime-definitions": "~2.70.0",
|
|
125
|
+
"@fluidframework/core-interfaces": "~2.70.0",
|
|
126
|
+
"@fluidframework/core-utils": "~2.70.0",
|
|
127
|
+
"@fluidframework/datastore": "~2.70.0",
|
|
128
|
+
"@fluidframework/driver-definitions": "~2.70.0",
|
|
129
|
+
"@fluidframework/driver-utils": "~2.70.0",
|
|
130
|
+
"@fluidframework/id-compressor": "~2.70.0",
|
|
131
|
+
"@fluidframework/runtime-definitions": "~2.70.0",
|
|
132
|
+
"@fluidframework/runtime-utils": "~2.70.0",
|
|
133
|
+
"@fluidframework/telemetry-utils": "~2.70.0",
|
|
134
134
|
"@tylerbu/sorted-btree-es6": "^1.8.0",
|
|
135
135
|
"double-ended-queue": "^2.1.0-0",
|
|
136
136
|
"lz4js": "^0.2.0",
|
|
@@ -140,16 +140,16 @@
|
|
|
140
140
|
"devDependencies": {
|
|
141
141
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
142
142
|
"@biomejs/biome": "~1.9.3",
|
|
143
|
-
"@fluid-internal/mocha-test-setup": "2.70.0
|
|
144
|
-
"@fluid-private/stochastic-test-utils": "2.70.0
|
|
145
|
-
"@fluid-private/test-pairwise-generator": "2.70.0
|
|
143
|
+
"@fluid-internal/mocha-test-setup": "~2.70.0",
|
|
144
|
+
"@fluid-private/stochastic-test-utils": "~2.70.0",
|
|
145
|
+
"@fluid-private/test-pairwise-generator": "~2.70.0",
|
|
146
146
|
"@fluid-tools/benchmark": "^0.51.0",
|
|
147
147
|
"@fluid-tools/build-cli": "^0.58.3",
|
|
148
148
|
"@fluidframework/build-common": "^2.0.3",
|
|
149
149
|
"@fluidframework/build-tools": "^0.58.3",
|
|
150
150
|
"@fluidframework/container-runtime-previous": "npm:@fluidframework/container-runtime@2.63.0",
|
|
151
151
|
"@fluidframework/eslint-config-fluid": "^6.1.0",
|
|
152
|
-
"@fluidframework/test-runtime-utils": "2.70.0
|
|
152
|
+
"@fluidframework/test-runtime-utils": "~2.70.0",
|
|
153
153
|
"@microsoft/api-extractor": "7.52.11",
|
|
154
154
|
"@types/double-ended-queue": "^2.1.0",
|
|
155
155
|
"@types/lz4js": "^0.2.0",
|
package/src/containerRuntime.ts
CHANGED
|
@@ -23,6 +23,7 @@ import type {
|
|
|
23
23
|
IDeltaManagerFull,
|
|
24
24
|
ILoader,
|
|
25
25
|
IContainerStorageService,
|
|
26
|
+
ConnectionStatus,
|
|
26
27
|
} from "@fluidframework/container-definitions/internal";
|
|
27
28
|
import {
|
|
28
29
|
ConnectionState,
|
|
@@ -120,10 +121,8 @@ import type {
|
|
|
120
121
|
IInboundSignalMessage,
|
|
121
122
|
IRuntimeMessagesContent,
|
|
122
123
|
ISummarizerNodeWithGC,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
// eslint-disable-next-line import/no-deprecated
|
|
126
|
-
IContainerRuntimeBaseExperimental,
|
|
124
|
+
StageControlsInternal,
|
|
125
|
+
IContainerRuntimeBaseInternal,
|
|
127
126
|
IFluidParentContext,
|
|
128
127
|
MinimumVersionForCollab,
|
|
129
128
|
} from "@fluidframework/runtime-definitions/internal";
|
|
@@ -817,8 +816,7 @@ export class ContainerRuntime
|
|
|
817
816
|
extends TypedEventEmitter<IContainerRuntimeEvents>
|
|
818
817
|
implements
|
|
819
818
|
IContainerRuntimeInternal,
|
|
820
|
-
|
|
821
|
-
IContainerRuntimeBaseExperimental,
|
|
819
|
+
IContainerRuntimeBaseInternal,
|
|
822
820
|
// eslint-disable-next-line import/no-deprecated
|
|
823
821
|
IContainerRuntimeWithResolveHandle_Deprecated,
|
|
824
822
|
IRuntime,
|
|
@@ -1570,6 +1568,7 @@ export class ContainerRuntime
|
|
|
1570
1568
|
deltaManager,
|
|
1571
1569
|
quorum,
|
|
1572
1570
|
audience,
|
|
1571
|
+
signalAudience,
|
|
1573
1572
|
pendingLocalState,
|
|
1574
1573
|
supportedFeatures,
|
|
1575
1574
|
snapshotWithContents,
|
|
@@ -1721,10 +1720,11 @@ export class ContainerRuntime
|
|
|
1721
1720
|
this.messageAtLastSummary = lastMessageFromMetadata(metadata);
|
|
1722
1721
|
|
|
1723
1722
|
// Note that we only need to pull the *initial* connected state from the context.
|
|
1724
|
-
// Later updates come through calls to setConnectionState.
|
|
1723
|
+
// Later updates come through calls to setConnectionState/Status.
|
|
1725
1724
|
this.canSendOps = connected;
|
|
1726
1725
|
this.canSendSignals = this.getConnectionState
|
|
1727
|
-
? this.getConnectionState() === ConnectionState.Connected
|
|
1726
|
+
? this.getConnectionState() === ConnectionState.Connected ||
|
|
1727
|
+
this.getConnectionState() === ConnectionState.CatchingUp
|
|
1728
1728
|
: undefined;
|
|
1729
1729
|
|
|
1730
1730
|
this.mc.logger.sendTelemetryEvent({
|
|
@@ -2040,6 +2040,8 @@ export class ContainerRuntime
|
|
|
2040
2040
|
});
|
|
2041
2041
|
}
|
|
2042
2042
|
|
|
2043
|
+
this.signalAudience = signalAudience;
|
|
2044
|
+
|
|
2043
2045
|
const closeSummarizerDelayOverride = this.mc.config.getNumber(
|
|
2044
2046
|
"Fluid.ContainerRuntime.Test.CloseSummarizerDelayOverrideMs",
|
|
2045
2047
|
);
|
|
@@ -2812,6 +2814,59 @@ export class ContainerRuntime
|
|
|
2812
2814
|
this.channelCollection.notifyReadOnlyState(readonly);
|
|
2813
2815
|
|
|
2814
2816
|
public setConnectionState(canSendOps: boolean, clientId?: string): void {
|
|
2817
|
+
this.setConnectionStateToConnectedOrDisconnected(canSendOps, clientId);
|
|
2818
|
+
}
|
|
2819
|
+
|
|
2820
|
+
public setConnectionStatus(status: ConnectionStatus): void {
|
|
2821
|
+
switch (status.connectionState) {
|
|
2822
|
+
case ConnectionState.Connected: {
|
|
2823
|
+
this.setConnectionStateToConnectedOrDisconnected(
|
|
2824
|
+
status.canSendOps,
|
|
2825
|
+
status.clientConnectionId,
|
|
2826
|
+
);
|
|
2827
|
+
|
|
2828
|
+
break;
|
|
2829
|
+
}
|
|
2830
|
+
case ConnectionState.Disconnected: {
|
|
2831
|
+
this.setConnectionStateToConnectedOrDisconnected(
|
|
2832
|
+
status.canSendOps,
|
|
2833
|
+
status.priorConnectedClientConnectionId,
|
|
2834
|
+
);
|
|
2835
|
+
|
|
2836
|
+
break;
|
|
2837
|
+
}
|
|
2838
|
+
case ConnectionState.CatchingUp: {
|
|
2839
|
+
assert(
|
|
2840
|
+
this.getConnectionState !== undefined &&
|
|
2841
|
+
this.getConnectionState() === ConnectionState.CatchingUp,
|
|
2842
|
+
0xc8d /* connection state mismatch between getConnectionState and setConnectionStatus notification */,
|
|
2843
|
+
);
|
|
2844
|
+
|
|
2845
|
+
// Note: Historically when only `setConnectionState` of `IRuntime`
|
|
2846
|
+
// was supported, it was possible to be in `CatchingUp` state and
|
|
2847
|
+
// call through to `setConnectionStateCore` when there is a readonly
|
|
2848
|
+
// change - see `Container`'s `"deltaManager.on("readonly"`. There
|
|
2849
|
+
// would not be a transition of `canSendOps` in that case, but
|
|
2850
|
+
// `channelCollection` and `garbageCollector` would receive early
|
|
2851
|
+
// `setConnectionState` call AND `this` would `emit` "disconnected"
|
|
2852
|
+
// event.
|
|
2853
|
+
|
|
2854
|
+
this.emitServiceConnectionEvents(
|
|
2855
|
+
/* canSendOpsChanged */ this.canSendOps,
|
|
2856
|
+
/* canSendOps */ false,
|
|
2857
|
+
status.pendingClientConnectionId,
|
|
2858
|
+
);
|
|
2859
|
+
|
|
2860
|
+
break;
|
|
2861
|
+
}
|
|
2862
|
+
// No default
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2865
|
+
|
|
2866
|
+
private setConnectionStateToConnectedOrDisconnected(
|
|
2867
|
+
canSendOps: boolean,
|
|
2868
|
+
clientId: string | undefined,
|
|
2869
|
+
): void {
|
|
2815
2870
|
// Validate we have consistent state
|
|
2816
2871
|
const currentClientId = this._audience.getSelf()?.clientId;
|
|
2817
2872
|
assert(clientId === currentClientId, 0x977 /* input clientId does not match Audience */);
|
|
@@ -2896,7 +2951,7 @@ export class ContainerRuntime
|
|
|
2896
2951
|
* Emits service connection events based on connection state changes.
|
|
2897
2952
|
*
|
|
2898
2953
|
* @remarks
|
|
2899
|
-
* "connectedToService" is emitted when container connection state transitions to 'Connected' regardless of connection mode.
|
|
2954
|
+
* "connectedToService" is emitted when container connection state transitions to 'CatchingUp' or 'Connected' regardless of connection mode.
|
|
2900
2955
|
* "disconnectedFromService" excludes false "disconnected" events that happen when readonly client transitions to 'Connected'.
|
|
2901
2956
|
*/
|
|
2902
2957
|
private emitServiceConnectionEvents(
|
|
@@ -2908,21 +2963,25 @@ export class ContainerRuntime
|
|
|
2908
2963
|
return;
|
|
2909
2964
|
}
|
|
2910
2965
|
|
|
2911
|
-
const
|
|
2966
|
+
const connectionState = this.getConnectionState();
|
|
2967
|
+
const canSendSignals =
|
|
2968
|
+
connectionState === ConnectionState.Connected ||
|
|
2969
|
+
connectionState === ConnectionState.CatchingUp;
|
|
2912
2970
|
const canSendSignalsChanged = this.canSendSignals !== canSendSignals;
|
|
2913
2971
|
this.canSendSignals = canSendSignals;
|
|
2914
2972
|
if (canSendSignalsChanged) {
|
|
2915
|
-
// If canSendSignals changed, we either transitioned from
|
|
2973
|
+
// If canSendSignals changed, we either transitioned from CatchingUp or
|
|
2974
|
+
// Connected to Disconnected or EstablishingConnection to CatchingUp.
|
|
2916
2975
|
if (canSendSignals) {
|
|
2917
|
-
// Emit for
|
|
2976
|
+
// Emit for EstablishingConnection to CatchingUp or Connected transition
|
|
2918
2977
|
this.emit("connectedToService", clientId, canSendOps);
|
|
2919
2978
|
} else {
|
|
2920
|
-
// Emit for Connected to Disconnected transition
|
|
2979
|
+
// Emit for CatchingUp or Connected to Disconnected transition
|
|
2921
2980
|
this.emit("disconnectedFromService");
|
|
2922
2981
|
}
|
|
2923
2982
|
} else if (canSendOpsChanged) {
|
|
2924
|
-
// If canSendSignals did not change but canSendOps did, then
|
|
2925
|
-
this.emit("
|
|
2983
|
+
// If canSendSignals did not change but canSendOps did, then operations possible has changed.
|
|
2984
|
+
this.emit("operabilityChanged", canSendOps);
|
|
2926
2985
|
}
|
|
2927
2986
|
}
|
|
2928
2987
|
|
|
@@ -3455,8 +3514,7 @@ export class ContainerRuntime
|
|
|
3455
3514
|
*/
|
|
3456
3515
|
public orderSequentially<T>(callback: () => T): T {
|
|
3457
3516
|
let checkpoint: IBatchCheckpoint | undefined;
|
|
3458
|
-
|
|
3459
|
-
let stageControls: StageControlsExperimental | undefined;
|
|
3517
|
+
let stageControls: StageControlsInternal | undefined;
|
|
3460
3518
|
if (this.mc.config.getBoolean("Fluid.ContainerRuntime.EnableRollback") === true) {
|
|
3461
3519
|
if (!this.batchRunner.running && !this.inStagingMode) {
|
|
3462
3520
|
stageControls = this.enterStagingMode();
|
|
@@ -3520,8 +3578,7 @@ export class ContainerRuntime
|
|
|
3520
3578
|
return result;
|
|
3521
3579
|
}
|
|
3522
3580
|
|
|
3523
|
-
|
|
3524
|
-
private stageControls: StageControlsExperimental | undefined;
|
|
3581
|
+
private stageControls: StageControlsInternal | undefined;
|
|
3525
3582
|
|
|
3526
3583
|
/**
|
|
3527
3584
|
* If true, the ContainerRuntime is not submitting any new ops to the ordering service.
|
|
@@ -3536,10 +3593,9 @@ export class ContainerRuntime
|
|
|
3536
3593
|
* Enter Staging Mode, such that ops submitted to the ContainerRuntime will not be sent to the ordering service.
|
|
3537
3594
|
* To exit Staging Mode, call either discardChanges or commitChanges on the Stage Controls returned from this method.
|
|
3538
3595
|
*
|
|
3539
|
-
* @returns
|
|
3596
|
+
* @returns Controls for exiting Staging Mode.
|
|
3540
3597
|
*/
|
|
3541
|
-
|
|
3542
|
-
public enterStagingMode = (): StageControlsExperimental => {
|
|
3598
|
+
public enterStagingMode = (): StageControlsInternal => {
|
|
3543
3599
|
if (this.stageControls !== undefined) {
|
|
3544
3600
|
throw new UsageError("Already in staging mode");
|
|
3545
3601
|
}
|
|
@@ -3572,8 +3628,7 @@ export class ContainerRuntime
|
|
|
3572
3628
|
}
|
|
3573
3629
|
};
|
|
3574
3630
|
|
|
3575
|
-
|
|
3576
|
-
const stageControls: StageControlsExperimental = {
|
|
3631
|
+
const stageControls: StageControlsInternal = {
|
|
3577
3632
|
discardChanges: () =>
|
|
3578
3633
|
exitStagingMode(() => {
|
|
3579
3634
|
// Pop all staged batches from the PSM and roll them back in LIFO order
|
|
@@ -3680,6 +3735,14 @@ export class ContainerRuntime
|
|
|
3680
3735
|
return this._audience;
|
|
3681
3736
|
}
|
|
3682
3737
|
|
|
3738
|
+
/**
|
|
3739
|
+
* When defined, this {@link @fluidframework/container-definitions#IAudience}
|
|
3740
|
+
* maintains member list using signals only.
|
|
3741
|
+
* Thus "write" members may be known earlier than quorum and avoid noise from
|
|
3742
|
+
* un-summarized quorum history.
|
|
3743
|
+
*/
|
|
3744
|
+
private readonly signalAudience?: IAudience;
|
|
3745
|
+
|
|
3683
3746
|
/**
|
|
3684
3747
|
* Returns true of container is dirty, i.e. there are some pending local changes that
|
|
3685
3748
|
* either were not sent out to delta stream or were not yet acknowledged.
|
|
@@ -5208,8 +5271,8 @@ export class ContainerRuntime
|
|
|
5208
5271
|
eventEmitter.emit("joined", { clientId, canWrite });
|
|
5209
5272
|
});
|
|
5210
5273
|
this.on("disconnectedFromService", () => eventEmitter.emit("disconnected"));
|
|
5211
|
-
this.on("
|
|
5212
|
-
eventEmitter.emit("
|
|
5274
|
+
this.on("operabilityChanged", (canWrite: boolean) =>
|
|
5275
|
+
eventEmitter.emit("operabilityChanged", canWrite),
|
|
5213
5276
|
);
|
|
5214
5277
|
} else {
|
|
5215
5278
|
this.on("connected", (clientId: string) => {
|
|
@@ -5224,7 +5287,11 @@ export class ContainerRuntime
|
|
|
5224
5287
|
const getConnectionState = this.getConnectionState;
|
|
5225
5288
|
if (getConnectionState) {
|
|
5226
5289
|
const connectionState = getConnectionState();
|
|
5227
|
-
if (
|
|
5290
|
+
if (
|
|
5291
|
+
connectionState === ConnectionState.Connected ||
|
|
5292
|
+
connectionState === ConnectionState.CatchingUp
|
|
5293
|
+
) {
|
|
5294
|
+
// Note: when CatchingUp, canSendOps will always be false.
|
|
5228
5295
|
return this.canSendOps ? "joinedForWriting" : "joinedForReading";
|
|
5229
5296
|
}
|
|
5230
5297
|
} else if (this.canSendOps) {
|
|
@@ -5250,9 +5317,10 @@ export class ContainerRuntime
|
|
|
5250
5317
|
): T {
|
|
5251
5318
|
let entry = this.extensions.get(id);
|
|
5252
5319
|
if (entry === undefined) {
|
|
5320
|
+
const audience = this.signalAudience;
|
|
5253
5321
|
const runtime = {
|
|
5254
5322
|
getJoinedStatus: this.getJoinedStatus.bind(this),
|
|
5255
|
-
getClientId: () => this.clientId,
|
|
5323
|
+
getClientId: audience ? () => audience.getSelf()?.clientId : () => this.clientId,
|
|
5256
5324
|
events: this.lazyEventsForExtensions.value,
|
|
5257
5325
|
logger: this.baseLogger,
|
|
5258
5326
|
submitAddressedSignal: (
|
|
@@ -5262,7 +5330,7 @@ export class ContainerRuntime
|
|
|
5262
5330
|
this.submitExtensionSignal(id, addressChain, message);
|
|
5263
5331
|
},
|
|
5264
5332
|
getQuorum: this.getQuorum.bind(this),
|
|
5265
|
-
getAudience: this.getAudience.bind(this),
|
|
5333
|
+
getAudience: audience ? () => audience : this.getAudience.bind(this),
|
|
5266
5334
|
supportedFeatures: this.ILayerCompatDetails.supportedFeatures,
|
|
5267
5335
|
} satisfies ExtensionHost<TRuntimeProperties>;
|
|
5268
5336
|
entry = new factory(runtime, ...useContext);
|
package/src/dataStore.ts
CHANGED
|
@@ -7,12 +7,11 @@ import { AttachState } from "@fluidframework/container-definitions";
|
|
|
7
7
|
import type { FluidObject } from "@fluidframework/core-interfaces";
|
|
8
8
|
import type { IFluidHandleInternal } from "@fluidframework/core-interfaces/internal";
|
|
9
9
|
import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
10
|
-
import
|
|
11
|
-
AliasResult,
|
|
12
|
-
IDataStore,
|
|
13
|
-
IFluidDataStoreChannel,
|
|
14
|
-
|
|
15
|
-
IContainerRuntimeBaseExperimental,
|
|
10
|
+
import {
|
|
11
|
+
type AliasResult,
|
|
12
|
+
type IDataStore,
|
|
13
|
+
type IFluidDataStoreChannel,
|
|
14
|
+
asLegacyAlpha,
|
|
16
15
|
} from "@fluidframework/runtime-definitions/internal";
|
|
17
16
|
import {
|
|
18
17
|
type ITelemetryLoggerExt,
|
|
@@ -80,9 +79,7 @@ class DataStore implements IDataStore {
|
|
|
80
79
|
if (alias.includes("/")) {
|
|
81
80
|
throw new UsageError(`The alias cannot contain slashes: '${alias}'`);
|
|
82
81
|
}
|
|
83
|
-
|
|
84
|
-
const runtime = this.parentContext.containerRuntime as IContainerRuntimeBaseExperimental;
|
|
85
|
-
if (runtime.inStagingMode === true) {
|
|
82
|
+
if (asLegacyAlpha(this.parentContext.containerRuntime).inStagingMode === true) {
|
|
86
83
|
throw new UsageError("Cannot set aliases while in staging mode");
|
|
87
84
|
}
|
|
88
85
|
|
package/src/packageVersion.ts
CHANGED