@fluidframework/container-runtime 2.0.0-internal.7.3.0 → 2.0.0-internal.8.0.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 +50 -0
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +9 -1
- package/api-report/container-runtime.api.md +123 -123
- package/dist/blobManager.d.ts +4 -4
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js.map +1 -1
- package/dist/container-runtime-alpha.d.ts +1444 -0
- package/dist/container-runtime-beta.d.ts +292 -0
- package/dist/container-runtime-public.d.ts +292 -0
- package/dist/container-runtime-untrimmed.d.ts +1792 -0
- package/dist/containerRuntime.d.ts +36 -66
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +68 -104
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.js +0 -12
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreRegistry.d.ts +1 -1
- package/dist/dataStoreRegistry.js +1 -1
- package/dist/dataStoreRegistry.js.map +1 -1
- package/dist/dataStores.d.ts +10 -15
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +77 -40
- package/dist/dataStores.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +41 -13
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +215 -78
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.d.ts.map +1 -1
- package/dist/gc/gcConfigs.js +34 -37
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +121 -46
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js +26 -18
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcHelpers.d.ts +18 -25
- package/dist/gc/gcHelpers.d.ts.map +1 -1
- package/dist/gc/gcHelpers.js +29 -45
- package/dist/gc/gcHelpers.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts +0 -5
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +14 -42
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/gc/gcUnreferencedStateTracker.d.ts +11 -5
- package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
- package/dist/gc/gcUnreferencedStateTracker.js +43 -19
- package/dist/gc/gcUnreferencedStateTracker.js.map +1 -1
- package/dist/gc/index.d.ts +1 -1
- package/dist/gc/index.d.ts.map +1 -1
- package/dist/gc/index.js +4 -5
- package/dist/gc/index.js.map +1 -1
- package/dist/index.d.ts +15 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -6
- package/dist/index.js.map +1 -1
- package/dist/messageTypes.d.ts +15 -7
- package/dist/messageTypes.d.ts.map +1 -1
- package/dist/messageTypes.js +6 -1
- package/dist/messageTypes.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts +1 -1
- package/dist/opLifecycle/definitions.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/pendingStateManager.d.ts +1 -0
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +1 -0
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts +1 -1
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.d.ts +2 -2
- package/dist/summary/runWhileConnectedCoordinator.js +1 -1
- package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/summary/summarizer.d.ts +1 -13
- package/dist/summary/summarizer.d.ts.map +1 -1
- package/dist/summary/summarizer.js +1 -47
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +30 -30
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts +10 -10
- package/dist/summary/summaryCollection.js +1 -1
- package/dist/summary/summaryCollection.js.map +1 -1
- package/dist/summary/summaryFormat.d.ts +3 -3
- package/dist/summary/summaryFormat.js.map +1 -1
- package/lib/blobManager.d.ts +4 -4
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js.map +1 -1
- package/lib/container-runtime-alpha.d.ts +1444 -0
- package/lib/container-runtime-beta.d.ts +292 -0
- package/lib/container-runtime-public.d.ts +292 -0
- package/lib/container-runtime-untrimmed.d.ts +1792 -0
- package/lib/containerRuntime.d.ts +36 -66
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +69 -104
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.js +0 -12
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreRegistry.d.ts +1 -1
- package/lib/dataStoreRegistry.js +1 -1
- package/lib/dataStoreRegistry.js.map +1 -1
- package/lib/dataStores.d.ts +10 -15
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +80 -43
- package/lib/dataStores.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts +41 -13
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +217 -80
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcConfigs.d.ts.map +1 -1
- package/lib/gc/gcConfigs.js +37 -40
- package/lib/gc/gcConfigs.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +121 -46
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js +25 -17
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcHelpers.d.ts +18 -25
- package/lib/gc/gcHelpers.d.ts.map +1 -1
- package/lib/gc/gcHelpers.js +27 -43
- package/lib/gc/gcHelpers.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts +0 -5
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +15 -43
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/gc/gcUnreferencedStateTracker.d.ts +11 -5
- package/lib/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
- package/lib/gc/gcUnreferencedStateTracker.js +43 -19
- package/lib/gc/gcUnreferencedStateTracker.js.map +1 -1
- package/lib/gc/index.d.ts +1 -1
- package/lib/gc/index.d.ts.map +1 -1
- package/lib/gc/index.js +1 -1
- package/lib/gc/index.js.map +1 -1
- package/lib/index.d.ts +15 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +16 -2
- package/lib/index.js.map +1 -1
- package/lib/messageTypes.d.ts +15 -7
- package/lib/messageTypes.d.ts.map +1 -1
- package/lib/messageTypes.js +6 -1
- package/lib/messageTypes.js.map +1 -1
- package/lib/opLifecycle/definitions.d.ts +1 -1
- package/lib/opLifecycle/definitions.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/pendingStateManager.d.ts +1 -0
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +1 -0
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts +1 -1
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/runWhileConnectedCoordinator.d.ts +2 -2
- package/lib/summary/runWhileConnectedCoordinator.js +1 -1
- package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/lib/summary/summarizer.d.ts +1 -13
- package/lib/summary/summarizer.d.ts.map +1 -1
- package/lib/summary/summarizer.js +1 -47
- package/lib/summary/summarizer.js.map +1 -1
- package/lib/summary/summarizerTypes.d.ts +30 -30
- package/lib/summary/summarizerTypes.js.map +1 -1
- package/lib/summary/summaryCollection.d.ts +10 -10
- package/lib/summary/summaryCollection.js +1 -1
- package/lib/summary/summaryCollection.js.map +1 -1
- package/lib/summary/summaryFormat.d.ts +3 -3
- package/lib/summary/summaryFormat.js.map +1 -1
- package/package.json +46 -19
- package/src/blobManager.ts +5 -5
- package/src/containerRuntime.ts +93 -141
- package/src/dataStore.ts +1 -15
- package/src/dataStoreRegistry.ts +1 -1
- package/src/dataStores.ts +140 -69
- package/src/gc/garbageCollection.md +14 -15
- package/src/gc/garbageCollection.ts +256 -96
- package/src/gc/gcConfigs.ts +50 -52
- package/src/gc/gcDefinitions.ts +137 -52
- package/src/gc/gcHelpers.ts +31 -52
- package/src/gc/gcTelemetry.ts +16 -57
- package/src/gc/gcUnreferencedStateTracker.ts +61 -22
- package/src/gc/index.ts +6 -4
- package/src/index.ts +19 -2
- package/src/messageTypes.ts +19 -4
- package/src/opLifecycle/definitions.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +1 -0
- package/src/summary/orderedClientElection.ts +1 -1
- package/src/summary/runWhileConnectedCoordinator.ts +2 -2
- package/src/summary/summarizer.ts +2 -51
- package/src/summary/summarizerTypes.ts +30 -30
- package/src/summary/summaryCollection.ts +10 -10
- package/src/summary/summaryFormat.ts +3 -3
- package/dist/id-compressor/appendOnlySortedMap.d.ts +0 -124
- package/dist/id-compressor/appendOnlySortedMap.d.ts.map +0 -1
- package/dist/id-compressor/appendOnlySortedMap.js +0 -318
- package/dist/id-compressor/appendOnlySortedMap.js.map +0 -1
- package/dist/id-compressor/finalSpace.d.ts +0 -29
- package/dist/id-compressor/finalSpace.d.ts.map +0 -1
- package/dist/id-compressor/finalSpace.js +0 -62
- package/dist/id-compressor/finalSpace.js.map +0 -1
- package/dist/id-compressor/idCompressor.d.ts +0 -54
- package/dist/id-compressor/idCompressor.d.ts.map +0 -1
- package/dist/id-compressor/idCompressor.js +0 -495
- package/dist/id-compressor/idCompressor.js.map +0 -1
- package/dist/id-compressor/identifiers.d.ts +0 -32
- package/dist/id-compressor/identifiers.d.ts.map +0 -1
- package/dist/id-compressor/identifiers.js +0 -15
- package/dist/id-compressor/identifiers.js.map +0 -1
- package/dist/id-compressor/index.d.ts +0 -13
- package/dist/id-compressor/index.d.ts.map +0 -1
- package/dist/id-compressor/index.js +0 -32
- package/dist/id-compressor/index.js.map +0 -1
- package/dist/id-compressor/persistanceUtilities.d.ts +0 -22
- package/dist/id-compressor/persistanceUtilities.d.ts.map +0 -1
- package/dist/id-compressor/persistanceUtilities.js +0 -43
- package/dist/id-compressor/persistanceUtilities.js.map +0 -1
- package/dist/id-compressor/sessionSpaceNormalizer.d.ts +0 -46
- package/dist/id-compressor/sessionSpaceNormalizer.d.ts.map +0 -1
- package/dist/id-compressor/sessionSpaceNormalizer.js +0 -80
- package/dist/id-compressor/sessionSpaceNormalizer.js.map +0 -1
- package/dist/id-compressor/sessions.d.ts +0 -115
- package/dist/id-compressor/sessions.d.ts.map +0 -1
- package/dist/id-compressor/sessions.js +0 -305
- package/dist/id-compressor/sessions.js.map +0 -1
- package/dist/id-compressor/utilities.d.ts +0 -52
- package/dist/id-compressor/utilities.d.ts.map +0 -1
- package/dist/id-compressor/utilities.js +0 -169
- package/dist/id-compressor/utilities.js.map +0 -1
- package/lib/id-compressor/appendOnlySortedMap.d.ts +0 -124
- package/lib/id-compressor/appendOnlySortedMap.d.ts.map +0 -1
- package/lib/id-compressor/appendOnlySortedMap.js +0 -314
- package/lib/id-compressor/appendOnlySortedMap.js.map +0 -1
- package/lib/id-compressor/finalSpace.d.ts +0 -29
- package/lib/id-compressor/finalSpace.d.ts.map +0 -1
- package/lib/id-compressor/finalSpace.js +0 -58
- package/lib/id-compressor/finalSpace.js.map +0 -1
- package/lib/id-compressor/idCompressor.d.ts +0 -54
- package/lib/id-compressor/idCompressor.d.ts.map +0 -1
- package/lib/id-compressor/idCompressor.js +0 -491
- package/lib/id-compressor/idCompressor.js.map +0 -1
- package/lib/id-compressor/identifiers.d.ts +0 -32
- package/lib/id-compressor/identifiers.d.ts.map +0 -1
- package/lib/id-compressor/identifiers.js +0 -11
- package/lib/id-compressor/identifiers.js.map +0 -1
- package/lib/id-compressor/index.d.ts +0 -13
- package/lib/id-compressor/index.d.ts.map +0 -1
- package/lib/id-compressor/index.js +0 -13
- package/lib/id-compressor/index.js.map +0 -1
- package/lib/id-compressor/persistanceUtilities.d.ts +0 -22
- package/lib/id-compressor/persistanceUtilities.d.ts.map +0 -1
- package/lib/id-compressor/persistanceUtilities.js +0 -34
- package/lib/id-compressor/persistanceUtilities.js.map +0 -1
- package/lib/id-compressor/sessionSpaceNormalizer.d.ts +0 -46
- package/lib/id-compressor/sessionSpaceNormalizer.d.ts.map +0 -1
- package/lib/id-compressor/sessionSpaceNormalizer.js +0 -76
- package/lib/id-compressor/sessionSpaceNormalizer.js.map +0 -1
- package/lib/id-compressor/sessions.d.ts +0 -115
- package/lib/id-compressor/sessions.d.ts.map +0 -1
- package/lib/id-compressor/sessions.js +0 -290
- package/lib/id-compressor/sessions.js.map +0 -1
- package/lib/id-compressor/utilities.d.ts +0 -52
- package/lib/id-compressor/utilities.d.ts.map +0 -1
- package/lib/id-compressor/utilities.js +0 -151
- package/lib/id-compressor/utilities.js.map +0 -1
- package/src/id-compressor/README.md +0 -3
- package/src/id-compressor/appendOnlySortedMap.ts +0 -366
- package/src/id-compressor/finalSpace.ts +0 -67
- package/src/id-compressor/idCompressor.ts +0 -630
- package/src/id-compressor/identifiers.ts +0 -42
- package/src/id-compressor/index.ts +0 -26
- package/src/id-compressor/persistanceUtilities.ts +0 -58
- package/src/id-compressor/sessionSpaceNormalizer.ts +0 -83
- package/src/id-compressor/sessions.ts +0 -405
- package/src/id-compressor/utilities.ts +0 -190
package/lib/dataStore.js
CHANGED
|
@@ -102,12 +102,6 @@ class DataStore {
|
|
|
102
102
|
this.aliasState = AliasState.Aliased;
|
|
103
103
|
return "Success";
|
|
104
104
|
}
|
|
105
|
-
/**
|
|
106
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
107
|
-
*/
|
|
108
|
-
async request(request) {
|
|
109
|
-
return this.fluidDataStoreChannel.request(request);
|
|
110
|
-
}
|
|
111
105
|
/**
|
|
112
106
|
* {@inheritDoc @fluidframework/runtime-definitions#IDataStore.entryPoint}
|
|
113
107
|
*/
|
|
@@ -123,12 +117,6 @@ class DataStore {
|
|
|
123
117
|
this.aliasState = AliasState.None;
|
|
124
118
|
this.pendingAliases = datastores.pendingAliases;
|
|
125
119
|
}
|
|
126
|
-
/**
|
|
127
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
128
|
-
*/
|
|
129
|
-
get IFluidRouter() {
|
|
130
|
-
return this.fluidDataStoreChannel;
|
|
131
|
-
}
|
|
132
120
|
async ackBasedPromise(executor) {
|
|
133
121
|
let rejectBecauseDispose;
|
|
134
122
|
return new Promise((resolve, reject) => {
|
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,EAAuB,gBAAgB,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACpG,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAqBpE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACtC,0BAA+B,EACwB,EAAE;IACzD,OAAO,CACN,OAAO,0BAA0B,EAAE,UAAU,KAAK,QAAQ;QAC1D,OAAO,0BAA0B,EAAE,KAAK,KAAK,QAAQ,CACrD,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CACjC,qBAA6C,EAC7C,UAAkB,EAClB,OAAyB,EACzB,UAAsB,EACtB,MAA2B,EACd,EAAE,CAAC,IAAI,SAAS,CAAC,qBAAqB,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;AAE/F,IAAK,UAIJ;AAJD,WAAK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I,CAAC,OAAO,CAAC,QAAQ,EAAE;gBAC1B,oBAAoB,EAAE,CAAC;gBACvB,OAAO;aACP;YAED,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;YACjD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;YACf,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;QACnD,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 { ITelemetryLoggerExt, TelemetryDataTag, UsageError } from \"@fluidframework/telemetry-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { FluidObject, IFluidHandle, IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport {\n\tAliasResult,\n\tIDataStore,\n\tIFluidDataStoreChannel,\n} from \"@fluidframework/runtime-definitions\";\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\t/** The internal id of the datastore */\n\treadonly internalId: string;\n\t/** The alias name to be assigned to the datastore */\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: any,\n): maybeDataStoreAliasMessage is IDataStoreAliasMessage => {\n\treturn (\n\t\ttypeof maybeDataStoreAliasMessage?.internalId === \"string\" &&\n\t\ttypeof maybeDataStoreAliasMessage?.alias === \"string\"\n\t);\n};\n\nexport const channelToDataStore = (\n\tfluidDataStoreChannel: IFluidDataStoreChannel,\n\tinternalId: string,\n\truntime: ContainerRuntime,\n\tdatastores: DataStores,\n\tlogger: ITelemetryLoggerExt,\n): IDataStore => new DataStore(fluidDataStoreChannel, internalId, runtime, datastores, 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\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\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\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}\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\n\t\tthis.fluidDataStoreChannel.makeVisibleAndAttachGraph();\n\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\tconst localResult = this.datastores.processAliasMessageCore(message);\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.runtime.submitDataStoreAliasOp(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 * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t */\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\treturn this.fluidDataStoreChannel.request(request);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.entryPoint}\n\t */\n\tget entryPoint(): IFluidHandle<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 runtime: ContainerRuntime,\n\t\tprivate readonly datastores: DataStores,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\tthis.pendingAliases = datastores.pendingAliases;\n\t}\n\n\t/**\n\t * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t */\n\tpublic get IFluidRouter() {\n\t\treturn this.fluidDataStoreChannel;\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?: any) => void,\n\t\t) => void,\n\t): Promise<T> {\n\t\tlet rejectBecauseDispose: () => void;\n\t\treturn new Promise<T>((resolve, reject) => {\n\t\t\trejectBecauseDispose = () =>\n\t\t\t\treject(\n\t\t\t\t\tnew Error(\"ContainerRuntime disposed while this ack-based Promise was pending\"),\n\t\t\t\t);\n\n\t\t\tif (this.runtime.disposed) {\n\t\t\t\trejectBecauseDispose();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.runtime.on(\"dispose\", rejectBecauseDispose);\n\t\t\texecutor(resolve, reject);\n\t\t}).finally(() => {\n\t\t\tthis.runtime.off(\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UAAkB,EAClB,OAAyB,EACzB,UAAsB,EACtB,MAA2B;QAJ3B,0BAAqB,GAArB,qBAAqB,CAAwB;QAC7C,eAAU,GAAV,UAAU,CAAQ;QAClB,YAAO,GAAP,OAAO,CAAkB;QACzB,eAAU,GAAV,UAAU,CAAY;QACtB,WAAM,GAAN,MAAM,CAAqB;QApHrC,eAAU,GAAe,UAAU,CAAC,IAAI,CAAC;QAsHhD,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;IACjD,CAAC;IAEO,KAAK,CAAC,eAAe,CAC5B,QAGS;QAET,IAAI,oBAAgC,CAAC;QACrC,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACzC,oBAAoB,GAAG,GAAG,EAAE,CAC3B,MAAM,CACL,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAC/E,CAAC;YAEH,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;gBAC1B,oBAAoB,EAAE,CAAC;gBACvB,OAAO;aACP;YAED,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;YACjD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;YACf,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;QACnD,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 { ITelemetryLoggerExt, TelemetryDataTag, UsageError } from \"@fluidframework/telemetry-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { FluidObject, IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n\tAliasResult,\n\tIDataStore,\n\tIFluidDataStoreChannel,\n} from \"@fluidframework/runtime-definitions\";\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\t/** The internal id of the datastore */\n\treadonly internalId: string;\n\t/** The alias name to be assigned to the datastore */\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: any,\n): maybeDataStoreAliasMessage is IDataStoreAliasMessage => {\n\treturn (\n\t\ttypeof maybeDataStoreAliasMessage?.internalId === \"string\" &&\n\t\ttypeof maybeDataStoreAliasMessage?.alias === \"string\"\n\t);\n};\n\nexport const channelToDataStore = (\n\tfluidDataStoreChannel: IFluidDataStoreChannel,\n\tinternalId: string,\n\truntime: ContainerRuntime,\n\tdatastores: DataStores,\n\tlogger: ITelemetryLoggerExt,\n): IDataStore => new DataStore(fluidDataStoreChannel, internalId, runtime, datastores, 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\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\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\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}\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\n\t\tthis.fluidDataStoreChannel.makeVisibleAndAttachGraph();\n\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\tconst localResult = this.datastores.processAliasMessageCore(message);\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.runtime.submitDataStoreAliasOp(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(): IFluidHandle<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 runtime: ContainerRuntime,\n\t\tprivate readonly datastores: DataStores,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\tthis.pendingAliases = datastores.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?: any) => void,\n\t\t) => void,\n\t): Promise<T> {\n\t\tlet rejectBecauseDispose: () => void;\n\t\treturn new Promise<T>((resolve, reject) => {\n\t\t\trejectBecauseDispose = () =>\n\t\t\t\treject(\n\t\t\t\t\tnew Error(\"ContainerRuntime disposed while this ack-based Promise was pending\"),\n\t\t\t\t);\n\n\t\t\tif (this.runtime.disposed) {\n\t\t\t\trejectBecauseDispose();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.runtime.on(\"dispose\", rejectBecauseDispose);\n\t\t\texecutor(resolve, reject);\n\t\t}).finally(() => {\n\t\t\tthis.runtime.off(\"dispose\", rejectBecauseDispose);\n\t\t});\n\t}\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FluidDataStoreRegistryEntry, IFluidDataStoreRegistry, NamedFluidDataStoreRegistryEntries } from "@fluidframework/runtime-definitions";
|
|
2
2
|
/**
|
|
3
|
-
* @
|
|
3
|
+
* @internal
|
|
4
4
|
*/
|
|
5
5
|
export declare class FluidDataStoreRegistry implements IFluidDataStoreRegistry {
|
|
6
6
|
private readonly map;
|
package/lib/dataStoreRegistry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreRegistry.js","sourceRoot":"","sources":["../src/dataStoreRegistry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAO7D;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAMlC,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,YAAY,YAAgD;QAC3D,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;QACrB,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE;YACjC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;gBAC3B,MAAM,IAAI,UAAU,CAAC,6BAA6B,CAAC,CAAC;aACpD;YACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SACjC;IACF,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,IAAY;QAC5B,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACvB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SAC1B;QAED,OAAO,SAAS,CAAC;IAClB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { UsageError } from \"@fluidframework/telemetry-utils\";\nimport {\n\tFluidDataStoreRegistryEntry,\n\tIFluidDataStoreRegistry,\n\tNamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions\";\n\n/**\n * @
|
|
1
|
+
{"version":3,"file":"dataStoreRegistry.js","sourceRoot":"","sources":["../src/dataStoreRegistry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAO7D;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAMlC,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,YAAY,YAAgD;QAC3D,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;QACrB,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE;YACjC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;gBAC3B,MAAM,IAAI,UAAU,CAAC,6BAA6B,CAAC,CAAC;aACpD;YACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SACjC;IACF,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,IAAY;QAC5B,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACvB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SAC1B;QAED,OAAO,SAAS,CAAC;IAClB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { UsageError } from \"@fluidframework/telemetry-utils\";\nimport {\n\tFluidDataStoreRegistryEntry,\n\tIFluidDataStoreRegistry,\n\tNamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions\";\n\n/**\n * @internal\n */\nexport class FluidDataStoreRegistry implements IFluidDataStoreRegistry {\n\tprivate readonly map: Map<\n\t\tstring,\n\t\tFluidDataStoreRegistryEntry | Promise<FluidDataStoreRegistryEntry>\n\t>;\n\n\tpublic get IFluidDataStoreRegistry() {\n\t\treturn this;\n\t}\n\n\tconstructor(namedEntries: NamedFluidDataStoreRegistryEntries) {\n\t\tthis.map = new Map();\n\t\tfor (const entry of namedEntries) {\n\t\t\tif (this.map.has(entry[0])) {\n\t\t\t\tthrow new UsageError(\"Duplicate entry names exist\");\n\t\t\t}\n\t\t\tthis.map.set(entry[0], entry[1]);\n\t\t}\n\t}\n\n\tpublic async get(name: string): Promise<FluidDataStoreRegistryEntry | undefined> {\n\t\tif (this.map.has(name)) {\n\t\t\treturn this.map.get(name);\n\t\t}\n\n\t\treturn undefined;\n\t}\n}\n"]}
|
package/lib/dataStores.d.ts
CHANGED
|
@@ -66,19 +66,14 @@ export declare class DataStores implements IDisposable {
|
|
|
66
66
|
*/
|
|
67
67
|
getDataStoreIfAvailable(id: string, requestHeaderData: RuntimeHeaderData): Promise<FluidDataStoreContext | undefined>;
|
|
68
68
|
/**
|
|
69
|
-
* Checks if the data store has been deleted by GC.
|
|
70
|
-
* @param id - data store id
|
|
71
|
-
* @param
|
|
72
|
-
* @param
|
|
69
|
+
* Checks if the data store has been deleted by GC. If so, log an error.
|
|
70
|
+
* @param id - The data store's id.
|
|
71
|
+
* @param context - The data store context.
|
|
72
|
+
* @param callSite - The function name this is called from.
|
|
73
|
+
* @param requestHeaderData - The request header information to log if the data store is deleted.
|
|
73
74
|
* @returns true if the data store is deleted. Otherwise, returns false.
|
|
74
75
|
*/
|
|
75
|
-
private
|
|
76
|
-
/**
|
|
77
|
-
* Validate that the data store had not been deleted by GC.
|
|
78
|
-
* @param id - data store id
|
|
79
|
-
* @param requestHeaderData - the request header information to log if the validation detects the data store has been deleted
|
|
80
|
-
*/
|
|
81
|
-
private validateNotDeleted;
|
|
76
|
+
private checkAndLogIfDeleted;
|
|
82
77
|
processSignal(fluidDataStoreId: string, message: IInboundSignalMessage, local: boolean): void;
|
|
83
78
|
setConnectionState(connected: boolean, clientId?: string): void;
|
|
84
79
|
setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void;
|
|
@@ -109,25 +104,25 @@ export declare class DataStores implements IDisposable {
|
|
|
109
104
|
* After GC has run, called to notify this Container's data stores of routes that are used in it.
|
|
110
105
|
* @param usedRoutes - The routes that are used in all data stores in this Container.
|
|
111
106
|
*/
|
|
112
|
-
updateUsedRoutes(usedRoutes: string[]): void;
|
|
107
|
+
updateUsedRoutes(usedRoutes: readonly string[]): void;
|
|
113
108
|
/**
|
|
114
109
|
* This is called to update objects whose routes are unused. The unused objects are deleted.
|
|
115
110
|
* @param unusedRoutes - The routes that are unused in all data stores in this Container.
|
|
116
111
|
*/
|
|
117
|
-
updateUnusedRoutes(unusedRoutes: string[]): void;
|
|
112
|
+
updateUnusedRoutes(unusedRoutes: readonly string[]): void;
|
|
118
113
|
/**
|
|
119
114
|
* Delete data stores and its objects that are sweep ready.
|
|
120
115
|
* @param sweepReadyDataStoreRoutes - The routes of data stores and its objects that are sweep ready and should
|
|
121
116
|
* be deleted.
|
|
122
117
|
* @returns The routes of data stores and its objects that were deleted.
|
|
123
118
|
*/
|
|
124
|
-
deleteSweepReadyNodes(sweepReadyDataStoreRoutes: string[]): string[];
|
|
119
|
+
deleteSweepReadyNodes(sweepReadyDataStoreRoutes: readonly string[]): readonly string[];
|
|
125
120
|
/**
|
|
126
121
|
* This is called to update objects whose routes are tombstones. Tombstoned datastore contexts enable testing
|
|
127
122
|
* scenarios with accessing deleted content without actually deleting content from summaries.
|
|
128
123
|
* @param tombstonedRoutes - The routes that are tombstones in all data stores in this Container.
|
|
129
124
|
*/
|
|
130
|
-
updateTombstonedRoutes(tombstonedRoutes: string[]): void;
|
|
125
|
+
updateTombstonedRoutes(tombstonedRoutes: readonly string[]): void;
|
|
131
126
|
/**
|
|
132
127
|
* Returns the outbound routes of this channel. Only root data stores are considered referenced and their paths are
|
|
133
128
|
* part of outbound routes.
|
package/lib/dataStores.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStores.d.ts","sourceRoot":"","sources":["../src/dataStores.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,oBAAoB,EACpB,WAAW,EAGX,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAChG,OAAO,EACN,WAAW,EAEX,2BAA2B,EAC3B,8BAA8B,EAE9B,cAAc,EACd,SAAS,EACT,8BAA8B,EAC9B,sBAAsB,EACtB,qBAAqB,EAGrB,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"dataStores.d.ts","sourceRoot":"","sources":["../src/dataStores.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,oBAAoB,EACpB,WAAW,EAGX,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAChG,OAAO,EACN,WAAW,EAEX,2BAA2B,EAC3B,8BAA8B,EAE9B,cAAc,EACd,SAAS,EACT,8BAA8B,EAC9B,sBAAsB,EACtB,qBAAqB,EAGrB,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,qCAAqC,CAAC;AAoB7C,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAIpE,O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AAM,GAAE,OAAe,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAiChF;;;OAGG;IACI,gBAAgB,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE;IAkBrD;;;OAGG;IACI,kBAAkB,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE;IAiBzD;;;;;OAKG;IACI,qBAAqB,CAAC,yBAAyB,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE;IAqC7F;;;;OAIG;IACI,sBAAsB,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE;IAmBjE;;;OAGG;YACW,iBAAiB;IAW/B;;OAEG;IACU,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAO9F;;;OAGG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;CAa9D;AAED,wBAAgB,uBAAuB,CACtC,QAAQ,EAAE,aAAa,GAAG,SAAS,EACnC,QAAQ,CAAC,EAAE,yBAAyB,GAClC,aAAa,GAAG,SAAS,CAsB3B"}
|
package/lib/dataStores.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { FluidObjectHandle } from "@fluidframework/datastore";
|
|
6
6
|
import { channelsTreeName, CreateSummarizerNodeSource, } from "@fluidframework/runtime-definitions";
|
|
7
7
|
import { convertSnapshotTreeToSummaryTree, convertToSummaryTree, create404Response, createResponseError, GCDataBuilder, responseToException, SummaryTreeBuilder, unpackChildNodesUsedRoutes, } from "@fluidframework/runtime-utils";
|
|
8
|
-
import { createChildMonitoringContext, DataCorruptionError, extractSafePropertiesFromMessage, LoggingError, tagCodeArtifacts, } from "@fluidframework/telemetry-utils";
|
|
8
|
+
import { createChildMonitoringContext, DataCorruptionError, DataProcessingError, extractSafePropertiesFromMessage, LoggingError, tagCodeArtifacts, } from "@fluidframework/telemetry-utils";
|
|
9
9
|
import { AttachState } from "@fluidframework/container-definitions";
|
|
10
10
|
import { buildSnapshotTree } from "@fluidframework/driver-utils";
|
|
11
11
|
import { assert, Lazy } from "@fluidframework/core-utils";
|
|
@@ -15,8 +15,8 @@ import { defaultRuntimeHeaderData } from "./containerRuntime";
|
|
|
15
15
|
import { RemoteFluidDataStoreContext, LocalFluidDataStoreContext, createAttributesBlob, LocalDetachedFluidDataStoreContext, } from "./dataStoreContext";
|
|
16
16
|
import { StorageServiceWithAttachBlobs } from "./storageServiceWithAttachBlobs";
|
|
17
17
|
import { isDataStoreAliasMessage } from "./dataStore";
|
|
18
|
-
import { GCNodeType, disableDatastoreSweepKey
|
|
19
|
-
import {
|
|
18
|
+
import { GCNodeType, disableDatastoreSweepKey } from "./gc";
|
|
19
|
+
import { nonDataStorePaths, rootHasIsolatedChannels } from "./summary";
|
|
20
20
|
/**
|
|
21
21
|
* This class encapsulates data store handling. Currently it is only used by the container runtime,
|
|
22
22
|
* but eventually could be hosted on any channel once we formalize the channel api boundary.
|
|
@@ -172,6 +172,11 @@ export class DataStores {
|
|
|
172
172
|
return false;
|
|
173
173
|
}
|
|
174
174
|
const context = this.contexts.get(aliasMessage.internalId);
|
|
175
|
+
// If the data store has been deleted, log an error and ignore this message. This helps prevent document
|
|
176
|
+
// corruption in case a deleted data store accidentally submitted a signal.
|
|
177
|
+
if (this.checkAndLogIfDeleted(aliasMessage.internalId, context, "Changed", "processAliasMessageCore")) {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
175
180
|
if (context === undefined) {
|
|
176
181
|
this.mc.logger.sendErrorEvent({
|
|
177
182
|
eventName: "AliasFluidDataStoreNotFound",
|
|
@@ -252,16 +257,37 @@ export class DataStores {
|
|
|
252
257
|
}
|
|
253
258
|
resubmitDataStoreOp(envelope, localOpMetadata) {
|
|
254
259
|
const context = this.contexts.get(envelope.address);
|
|
260
|
+
// If the data store has been deleted, log an error and throw an error. If there are local changes for a
|
|
261
|
+
// deleted data store, it can otherwise lead to inconsistent state when compared to other clients.
|
|
262
|
+
if (this.checkAndLogIfDeleted(envelope.address, context, "Changed", "resubmitDataStoreOp")) {
|
|
263
|
+
throw new DataCorruptionError("Context is deleted!", {
|
|
264
|
+
callSite: "resubmitDataStoreOp",
|
|
265
|
+
...tagCodeArtifacts({ id: envelope.address }),
|
|
266
|
+
});
|
|
267
|
+
}
|
|
255
268
|
assert(!!context, 0x160 /* "There should be a store context for the op" */);
|
|
256
269
|
context.reSubmit(envelope.contents, localOpMetadata);
|
|
257
270
|
}
|
|
258
271
|
rollbackDataStoreOp(envelope, localOpMetadata) {
|
|
259
272
|
const context = this.contexts.get(envelope.address);
|
|
273
|
+
// If the data store has been deleted, log an error and throw an error. If there are local changes for a
|
|
274
|
+
// deleted data store, it can otherwise lead to inconsistent state when compared to other clients.
|
|
275
|
+
if (this.checkAndLogIfDeleted(envelope.address, context, "Changed", "rollbackDataStoreOp")) {
|
|
276
|
+
throw new DataCorruptionError("Context is deleted!", {
|
|
277
|
+
callSite: "rollbackDataStoreOp",
|
|
278
|
+
...tagCodeArtifacts({ id: envelope.address }),
|
|
279
|
+
});
|
|
280
|
+
}
|
|
260
281
|
assert(!!context, 0x2e8 /* "There should be a store context for the op" */);
|
|
261
282
|
context.rollback(envelope.contents, localOpMetadata);
|
|
262
283
|
}
|
|
263
284
|
async applyStashedOp(envelope) {
|
|
264
285
|
const context = this.contexts.get(envelope.address);
|
|
286
|
+
// If the data store has been deleted, log an error and ignore this message. This helps prevent document
|
|
287
|
+
// corruption in case the data store that stashed the op is deleted.
|
|
288
|
+
if (this.checkAndLogIfDeleted(envelope.address, context, "Changed", "applyStashedOp")) {
|
|
289
|
+
return undefined;
|
|
290
|
+
}
|
|
265
291
|
assert(!!context, 0x161 /* "There should be a store context for the op" */);
|
|
266
292
|
return context.applyStashedOp(envelope.contents);
|
|
267
293
|
}
|
|
@@ -273,8 +299,12 @@ export class DataStores {
|
|
|
273
299
|
processFluidDataStoreOp(message, local, localMessageMetadata) {
|
|
274
300
|
const envelope = message.contents;
|
|
275
301
|
const transformed = { ...message, contents: envelope.contents };
|
|
276
|
-
this.validateNotDeleted(envelope.address);
|
|
277
302
|
const context = this.contexts.get(envelope.address);
|
|
303
|
+
// If the data store has been deleted, log an error and ignore this message. This helps prevent document
|
|
304
|
+
// corruption in case a deleted data store accidentally submitted an op.
|
|
305
|
+
if (this.checkAndLogIfDeleted(envelope.address, context, "Changed", "processFluidDataStoreOp")) {
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
278
308
|
assert(!!context, 0x162 /* "There should be a store context for the op" */);
|
|
279
309
|
context.process(transformed, local, localMessageMetadata);
|
|
280
310
|
// Notify that a GC node for the data store changed. This is used to detect if a deleted data store is
|
|
@@ -283,7 +313,11 @@ export class DataStores {
|
|
|
283
313
|
}
|
|
284
314
|
async getDataStore(id, requestHeaderData) {
|
|
285
315
|
const headerData = { ...defaultRuntimeHeaderData, ...requestHeaderData };
|
|
286
|
-
this.
|
|
316
|
+
if (this.checkAndLogIfDeleted(id, this.contexts.get(id), "Requested", "getDataStore", requestHeaderData)) {
|
|
317
|
+
// The requested data store has been deleted by gc. Create a 404 response exception.
|
|
318
|
+
const request = { url: id };
|
|
319
|
+
throw responseToException(createResponseError(404, "DataStore was deleted", request), request);
|
|
320
|
+
}
|
|
287
321
|
const context = await this.contexts.getBoundOrRemoted(id, headerData.wait);
|
|
288
322
|
if (context === undefined) {
|
|
289
323
|
// The requested data store does not exits. Throw a 404 response exception.
|
|
@@ -296,8 +330,8 @@ export class DataStores {
|
|
|
296
330
|
* Returns the data store requested with the given id if available. Otherwise, returns undefined.
|
|
297
331
|
*/
|
|
298
332
|
async getDataStoreIfAvailable(id, requestHeaderData) {
|
|
299
|
-
// If the data store has been deleted, return undefined.
|
|
300
|
-
if (this.
|
|
333
|
+
// If the data store has been deleted, log an error and return undefined.
|
|
334
|
+
if (this.checkAndLogIfDeleted(id, this.contexts.get(id), "Requested", "getDataStoreIfAvailable", requestHeaderData)) {
|
|
301
335
|
return undefined;
|
|
302
336
|
}
|
|
303
337
|
const headerData = { ...defaultRuntimeHeaderData, ...requestHeaderData };
|
|
@@ -308,43 +342,34 @@ export class DataStores {
|
|
|
308
342
|
return context;
|
|
309
343
|
}
|
|
310
344
|
/**
|
|
311
|
-
* Checks if the data store has been deleted by GC.
|
|
312
|
-
* @param id - data store id
|
|
313
|
-
* @param
|
|
314
|
-
* @param
|
|
345
|
+
* Checks if the data store has been deleted by GC. If so, log an error.
|
|
346
|
+
* @param id - The data store's id.
|
|
347
|
+
* @param context - The data store context.
|
|
348
|
+
* @param callSite - The function name this is called from.
|
|
349
|
+
* @param requestHeaderData - The request header information to log if the data store is deleted.
|
|
315
350
|
* @returns true if the data store is deleted. Otherwise, returns false.
|
|
316
351
|
*/
|
|
317
|
-
|
|
352
|
+
checkAndLogIfDeleted(id, context, deletedLogSuffix, callSite, requestHeaderData) {
|
|
318
353
|
const dataStoreNodePath = `/${id}`;
|
|
319
354
|
if (!this.isDataStoreDeleted(dataStoreNodePath)) {
|
|
320
355
|
return false;
|
|
321
356
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
isSummarizerClient: this.runtime.clientDetails.type === summarizerClientType,
|
|
327
|
-
id,
|
|
357
|
+
this.mc.logger.sendErrorEvent({
|
|
358
|
+
eventName: `GC_Deleted_DataStore_${deletedLogSuffix}`,
|
|
359
|
+
...tagCodeArtifacts({ id }),
|
|
360
|
+
callSite,
|
|
328
361
|
headers: JSON.stringify(requestHeaderData),
|
|
329
|
-
|
|
330
|
-
}
|
|
362
|
+
exists: context !== undefined,
|
|
363
|
+
});
|
|
331
364
|
return true;
|
|
332
365
|
}
|
|
333
|
-
/**
|
|
334
|
-
* Validate that the data store had not been deleted by GC.
|
|
335
|
-
* @param id - data store id
|
|
336
|
-
* @param requestHeaderData - the request header information to log if the validation detects the data store has been deleted
|
|
337
|
-
*/
|
|
338
|
-
validateNotDeleted(id, requestHeaderData) {
|
|
339
|
-
if (this.checkIfDeleted(id, requestHeaderData)) {
|
|
340
|
-
// The requested data store is removed by gc. Create a 404 gc response exception.
|
|
341
|
-
const request = { url: id };
|
|
342
|
-
throw responseToException(createResponseError(404, "DataStore was deleted", request), request);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
366
|
processSignal(fluidDataStoreId, message, local) {
|
|
346
|
-
this.validateNotDeleted(fluidDataStoreId);
|
|
347
367
|
const context = this.contexts.get(fluidDataStoreId);
|
|
368
|
+
// If the data store has been deleted, log an error and ignore this message. This helps prevent document
|
|
369
|
+
// corruption in case a deleted data store accidentally submitted a signal.
|
|
370
|
+
if (this.checkAndLogIfDeleted(fluidDataStoreId, context, "Changed", "processSignal")) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
348
373
|
if (!context) {
|
|
349
374
|
// Attach message may not have been processed yet
|
|
350
375
|
assert(!local, 0x163 /* "Missing datastore for local signal" */);
|
|
@@ -396,8 +421,13 @@ export class DataStores {
|
|
|
396
421
|
await Promise.all(Array.from(this.contexts)
|
|
397
422
|
.filter(([_, context]) => {
|
|
398
423
|
// Summarizer works only with clients with no local changes. A data store in attaching
|
|
399
|
-
// state indicates an op was sent to attach a local data store
|
|
400
|
-
|
|
424
|
+
// state indicates an op was sent to attach a local data store, and the the attach op
|
|
425
|
+
// had not yet round tripped back to the client.
|
|
426
|
+
if (context.attachState === AttachState.Attaching) {
|
|
427
|
+
// Formerly assert 0x588
|
|
428
|
+
const error = DataProcessingError.create("Local data store detected in attaching state during summarize", "summarize");
|
|
429
|
+
throw error;
|
|
430
|
+
}
|
|
401
431
|
return context.attachState === AttachState.Attached;
|
|
402
432
|
})
|
|
403
433
|
.map(async ([contextId, context]) => {
|
|
@@ -476,8 +506,13 @@ export class DataStores {
|
|
|
476
506
|
await Promise.all(Array.from(this.contexts)
|
|
477
507
|
.filter(([_, context]) => {
|
|
478
508
|
// Summarizer client and hence GC works only with clients with no local changes. A data store in
|
|
479
|
-
// attaching state indicates an op was sent to attach a local data store
|
|
480
|
-
|
|
509
|
+
// attaching state indicates an op was sent to attach a local data store, and the the attach op
|
|
510
|
+
// had not yet round tripped back to the client.
|
|
511
|
+
// Formerly assert 0x589
|
|
512
|
+
if (context.attachState === AttachState.Attaching) {
|
|
513
|
+
const error = DataProcessingError.create("Local data store detected in attaching state while running GC", "getGCData");
|
|
514
|
+
throw error;
|
|
515
|
+
}
|
|
481
516
|
return context.attachState === AttachState.Attached;
|
|
482
517
|
})
|
|
483
518
|
.map(async ([contextId, context]) => {
|
|
@@ -540,21 +575,23 @@ export class DataStores {
|
|
|
540
575
|
for (const route of sweepReadyDataStoreRoutes) {
|
|
541
576
|
const pathParts = route.split("/");
|
|
542
577
|
const dataStoreId = pathParts[1];
|
|
543
|
-
// TODO: GC:Validation - Skip any routes already deleted
|
|
544
578
|
// Ignore sub-data store routes because a data store and its sub-routes are deleted together, so, we only
|
|
545
579
|
// need to delete the data store.
|
|
546
580
|
if (pathParts.length > 2) {
|
|
547
581
|
continue;
|
|
548
582
|
}
|
|
549
|
-
|
|
583
|
+
const dataStoreContext = this.contexts.get(dataStoreId);
|
|
584
|
+
if (dataStoreContext === undefined) {
|
|
550
585
|
this.mc.logger.sendErrorEvent({
|
|
551
586
|
eventName: "DeletedDataStoreNotFound",
|
|
552
|
-
dataStoreId,
|
|
587
|
+
...tagCodeArtifacts({ id: dataStoreId }),
|
|
588
|
+
details: {
|
|
589
|
+
alreadyDeleted: this.isDataStoreDeleted(dataStoreId),
|
|
590
|
+
},
|
|
553
591
|
});
|
|
592
|
+
continue;
|
|
554
593
|
}
|
|
555
|
-
|
|
556
|
-
assert(dataStore !== undefined, 0x571 /* Attempting to delete unknown dataStore */);
|
|
557
|
-
dataStore.delete();
|
|
594
|
+
dataStoreContext.delete();
|
|
558
595
|
// Delete the contexts of sweep ready data stores.
|
|
559
596
|
this.contexts.delete(dataStoreId);
|
|
560
597
|
// Delete the summarizer node of the sweep ready data stores.
|