@fluidframework/container-runtime 2.0.0-internal.3.0.5 → 2.0.0-internal.3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +19 -19
- package/.mocharc.js +2 -2
- package/api-extractor.json +2 -2
- package/dist/batchTracker.d.ts.map +1 -1
- package/dist/batchTracker.js +2 -1
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.d.ts +9 -2
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +80 -33
- package/dist/blobManager.js.map +1 -1
- package/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js +11 -9
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/containerHandleContext.d.ts.map +1 -1
- package/dist/containerHandleContext.js +3 -1
- package/dist/containerHandleContext.js.map +1 -1
- package/dist/containerRuntime.d.ts +11 -1
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +116 -72
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +11 -9
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +18 -13
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +68 -55
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.d.ts.map +1 -1
- package/dist/dataStoreContexts.js +7 -3
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/dataStoreRegistry.d.ts.map +1 -1
- package/dist/dataStoreRegistry.js +3 -1
- package/dist/dataStoreRegistry.js.map +1 -1
- package/dist/dataStores.d.ts +26 -1
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +103 -18
- package/dist/dataStores.js.map +1 -1
- package/dist/deltaScheduler.d.ts.map +1 -1
- package/dist/deltaScheduler.js +8 -3
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/garbageCollection.d.ts +33 -14
- package/dist/garbageCollection.d.ts.map +1 -1
- package/dist/garbageCollection.js +178 -92
- package/dist/garbageCollection.js.map +1 -1
- package/dist/garbageCollectionConstants.d.ts +1 -0
- package/dist/garbageCollectionConstants.d.ts.map +1 -1
- package/dist/garbageCollectionConstants.js +4 -1
- package/dist/garbageCollectionConstants.js.map +1 -1
- package/dist/garbageCollectionHelpers.d.ts +26 -0
- package/dist/garbageCollectionHelpers.d.ts.map +1 -0
- package/dist/garbageCollectionHelpers.js +45 -0
- package/dist/garbageCollectionHelpers.js.map +1 -0
- package/dist/gcSweepReadyUsageDetection.d.ts +5 -5
- package/dist/gcSweepReadyUsageDetection.d.ts.map +1 -1
- package/dist/gcSweepReadyUsageDetection.js +14 -10
- package/dist/gcSweepReadyUsageDetection.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/opLifecycle/batchManager.d.ts +5 -5
- package/dist/opLifecycle/batchManager.d.ts.map +1 -1
- package/dist/opLifecycle/batchManager.js +19 -12
- package/dist/opLifecycle/batchManager.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts.map +1 -1
- package/dist/opLifecycle/definitions.js.map +1 -1
- package/dist/opLifecycle/index.d.ts.map +1 -1
- package/dist/opLifecycle/index.js.map +1 -1
- package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts +0 -4
- package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opDecompressor.js +7 -43
- package/dist/opLifecycle/opDecompressor.js.map +1 -1
- package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
- package/dist/opLifecycle/opSplitter.js +4 -1
- package/dist/opLifecycle/opSplitter.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +20 -19
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/dist/opProperties.d.ts.map +1 -1
- package/dist/opProperties.js +1 -3
- package/dist/opProperties.js.map +1 -1
- package/dist/orderedClientElection.d.ts.map +1 -1
- package/dist/orderedClientElection.js +10 -4
- package/dist/orderedClientElection.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 +7 -0
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +7 -4
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/runWhileConnectedCoordinator.d.ts.map +1 -1
- package/dist/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/runningSummarizer.d.ts.map +1 -1
- package/dist/runningSummarizer.js +34 -21
- package/dist/runningSummarizer.js.map +1 -1
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js +3 -2
- package/dist/scheduleManager.js.map +1 -1
- package/dist/serializedSnapshotStorage.d.ts +2 -2
- package/dist/serializedSnapshotStorage.d.ts.map +1 -1
- package/dist/serializedSnapshotStorage.js +5 -3
- package/dist/serializedSnapshotStorage.js.map +1 -1
- package/dist/summarizer.d.ts +2 -2
- package/dist/summarizer.d.ts.map +1 -1
- package/dist/summarizer.js +37 -17
- package/dist/summarizer.js.map +1 -1
- package/dist/summarizerClientElection.d.ts.map +1 -1
- package/dist/summarizerClientElection.js.map +1 -1
- package/dist/summarizerHandle.d.ts.map +1 -1
- package/dist/summarizerHandle.js.map +1 -1
- package/dist/summarizerHeuristics.d.ts.map +1 -1
- package/dist/summarizerHeuristics.js +6 -9
- package/dist/summarizerHeuristics.js.map +1 -1
- package/dist/summarizerTypes.d.ts +21 -21
- package/dist/summarizerTypes.d.ts.map +1 -1
- package/dist/summarizerTypes.js.map +1 -1
- package/dist/summaryCollection.d.ts.map +1 -1
- package/dist/summaryCollection.js +18 -8
- package/dist/summaryCollection.js.map +1 -1
- package/dist/summaryFormat.d.ts +5 -2
- package/dist/summaryFormat.d.ts.map +1 -1
- package/dist/summaryFormat.js +18 -10
- package/dist/summaryFormat.js.map +1 -1
- package/dist/summaryGenerator.d.ts.map +1 -1
- package/dist/summaryGenerator.js +35 -16
- package/dist/summaryGenerator.js.map +1 -1
- package/dist/summaryManager.d.ts.map +1 -1
- package/dist/summaryManager.js +21 -9
- package/dist/summaryManager.js.map +1 -1
- package/dist/throttler.d.ts +2 -2
- package/dist/throttler.d.ts.map +1 -1
- package/dist/throttler.js +4 -4
- package/dist/throttler.js.map +1 -1
- package/garbageCollection.md +15 -2
- package/lib/batchTracker.d.ts.map +1 -1
- package/lib/batchTracker.js +2 -1
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager.d.ts +9 -2
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +82 -35
- package/lib/blobManager.js.map +1 -1
- package/lib/connectionTelemetry.d.ts.map +1 -1
- package/lib/connectionTelemetry.js +11 -9
- package/lib/connectionTelemetry.js.map +1 -1
- package/lib/containerHandleContext.d.ts.map +1 -1
- package/lib/containerHandleContext.js +3 -1
- package/lib/containerHandleContext.js.map +1 -1
- package/lib/containerRuntime.d.ts +11 -1
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +122 -78
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js +11 -9
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +18 -13
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +71 -58
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreContexts.d.ts.map +1 -1
- package/lib/dataStoreContexts.js +7 -3
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/dataStoreRegistry.d.ts.map +1 -1
- package/lib/dataStoreRegistry.js +3 -1
- package/lib/dataStoreRegistry.js.map +1 -1
- package/lib/dataStores.d.ts +26 -1
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +109 -24
- package/lib/dataStores.js.map +1 -1
- package/lib/deltaScheduler.d.ts.map +1 -1
- package/lib/deltaScheduler.js +9 -4
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/garbageCollection.d.ts +33 -14
- package/lib/garbageCollection.d.ts.map +1 -1
- package/lib/garbageCollection.js +180 -94
- package/lib/garbageCollection.js.map +1 -1
- package/lib/garbageCollectionConstants.d.ts +1 -0
- package/lib/garbageCollectionConstants.d.ts.map +1 -1
- package/lib/garbageCollectionConstants.js +3 -0
- package/lib/garbageCollectionConstants.js.map +1 -1
- package/lib/garbageCollectionHelpers.d.ts +26 -0
- package/lib/garbageCollectionHelpers.d.ts.map +1 -0
- package/lib/garbageCollectionHelpers.js +40 -0
- package/lib/garbageCollectionHelpers.js.map +1 -0
- package/lib/gcSweepReadyUsageDetection.d.ts +5 -5
- package/lib/gcSweepReadyUsageDetection.d.ts.map +1 -1
- package/lib/gcSweepReadyUsageDetection.js +14 -10
- package/lib/gcSweepReadyUsageDetection.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/opLifecycle/batchManager.d.ts +5 -5
- package/lib/opLifecycle/batchManager.d.ts.map +1 -1
- package/lib/opLifecycle/batchManager.js +19 -12
- package/lib/opLifecycle/batchManager.js.map +1 -1
- package/lib/opLifecycle/definitions.d.ts.map +1 -1
- package/lib/opLifecycle/definitions.js.map +1 -1
- package/lib/opLifecycle/index.d.ts.map +1 -1
- package/lib/opLifecycle/index.js.map +1 -1
- package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opCompressor.js.map +1 -1
- package/lib/opLifecycle/opDecompressor.d.ts +0 -4
- package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opDecompressor.js +7 -43
- package/lib/opLifecycle/opDecompressor.js.map +1 -1
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
- package/lib/opLifecycle/opSplitter.js +5 -2
- package/lib/opLifecycle/opSplitter.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +20 -19
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/lib/opProperties.d.ts.map +1 -1
- package/lib/opProperties.js +1 -3
- package/lib/opProperties.js.map +1 -1
- package/lib/orderedClientElection.d.ts.map +1 -1
- package/lib/orderedClientElection.js +10 -4
- package/lib/orderedClientElection.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 +7 -0
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +7 -4
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/runWhileConnectedCoordinator.d.ts.map +1 -1
- package/lib/runWhileConnectedCoordinator.js.map +1 -1
- package/lib/runningSummarizer.d.ts.map +1 -1
- package/lib/runningSummarizer.js +35 -22
- package/lib/runningSummarizer.js.map +1 -1
- package/lib/scheduleManager.d.ts.map +1 -1
- package/lib/scheduleManager.js +3 -2
- package/lib/scheduleManager.js.map +1 -1
- package/lib/serializedSnapshotStorage.d.ts +2 -2
- package/lib/serializedSnapshotStorage.d.ts.map +1 -1
- package/lib/serializedSnapshotStorage.js +5 -3
- package/lib/serializedSnapshotStorage.js.map +1 -1
- package/lib/summarizer.d.ts +2 -2
- package/lib/summarizer.d.ts.map +1 -1
- package/lib/summarizer.js +37 -17
- package/lib/summarizer.js.map +1 -1
- package/lib/summarizerClientElection.d.ts.map +1 -1
- package/lib/summarizerClientElection.js.map +1 -1
- package/lib/summarizerHandle.d.ts.map +1 -1
- package/lib/summarizerHandle.js.map +1 -1
- package/lib/summarizerHeuristics.d.ts.map +1 -1
- package/lib/summarizerHeuristics.js +6 -9
- package/lib/summarizerHeuristics.js.map +1 -1
- package/lib/summarizerTypes.d.ts +21 -21
- package/lib/summarizerTypes.d.ts.map +1 -1
- package/lib/summarizerTypes.js.map +1 -1
- package/lib/summaryCollection.d.ts.map +1 -1
- package/lib/summaryCollection.js +18 -8
- package/lib/summaryCollection.js.map +1 -1
- package/lib/summaryFormat.d.ts +5 -2
- package/lib/summaryFormat.d.ts.map +1 -1
- package/lib/summaryFormat.js +20 -12
- package/lib/summaryFormat.js.map +1 -1
- package/lib/summaryGenerator.d.ts.map +1 -1
- package/lib/summaryGenerator.js +35 -16
- package/lib/summaryGenerator.js.map +1 -1
- package/lib/summaryManager.d.ts.map +1 -1
- package/lib/summaryManager.js +21 -9
- package/lib/summaryManager.js.map +1 -1
- package/lib/throttler.d.ts +2 -2
- package/lib/throttler.d.ts.map +1 -1
- package/lib/throttler.js +4 -4
- package/lib/throttler.js.map +1 -1
- package/package.json +121 -115
- package/prettier.config.cjs +1 -1
- package/src/batchTracker.ts +54 -49
- package/src/blobManager.ts +793 -672
- package/src/connectionTelemetry.ts +280 -249
- package/src/containerHandleContext.ts +27 -29
- package/src/containerRuntime.ts +3168 -2988
- package/src/dataStore.ts +172 -159
- package/src/dataStoreContext.ts +1098 -1055
- package/src/dataStoreContexts.ts +178 -161
- package/src/dataStoreRegistry.ts +25 -20
- package/src/dataStores.ts +884 -728
- package/src/deltaScheduler.ts +158 -150
- package/src/garbageCollection.ts +1860 -1688
- package/src/garbageCollectionConstants.ts +3 -0
- package/src/garbageCollectionHelpers.ts +61 -0
- package/src/gcSweepReadyUsageDetection.ts +89 -83
- package/src/index.ts +67 -66
- package/src/opLifecycle/README.md +152 -0
- package/src/opLifecycle/batchManager.ts +145 -141
- package/src/opLifecycle/definitions.ts +29 -29
- package/src/opLifecycle/index.ts +5 -5
- package/src/opLifecycle/opCompressor.ts +54 -53
- package/src/opLifecycle/opDecompressor.ts +100 -128
- package/src/opLifecycle/opSplitter.ts +214 -188
- package/src/opLifecycle/outbox.ts +204 -195
- package/src/opLifecycle/remoteMessageProcessor.ts +62 -62
- package/src/opProperties.ts +11 -9
- package/src/orderedClientElection.ts +489 -457
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +384 -338
- package/src/runWhileConnectedCoordinator.ts +78 -71
- package/src/runningSummarizer.ts +619 -581
- package/src/scheduleManager.ts +299 -269
- package/src/serializedSnapshotStorage.ts +126 -112
- package/src/summarizer.ts +417 -381
- package/src/summarizerClientElection.ts +107 -100
- package/src/summarizerHandle.ts +11 -9
- package/src/summarizerHeuristics.ts +183 -186
- package/src/summarizerTypes.ts +344 -330
- package/src/summaryCollection.ts +378 -349
- package/src/summaryFormat.ts +165 -143
- package/src/summaryGenerator.ts +465 -410
- package/src/summaryManager.ts +377 -348
- package/src/throttler.ts +131 -122
- package/tsconfig.esnext.json +6 -6
- package/tsconfig.json +9 -13
- package/dist/garbageCollectionTombstoneUtils.d.ts +0 -14
- package/dist/garbageCollectionTombstoneUtils.d.ts.map +0 -1
- package/dist/garbageCollectionTombstoneUtils.js +0 -23
- package/dist/garbageCollectionTombstoneUtils.js.map +0 -1
- package/lib/garbageCollectionTombstoneUtils.d.ts +0 -14
- package/lib/garbageCollectionTombstoneUtils.d.ts.map +0 -1
- package/lib/garbageCollectionTombstoneUtils.js +0 -19
- package/lib/garbageCollectionTombstoneUtils.js.map +0 -1
- package/src/garbageCollectionTombstoneUtils.ts +0 -28
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;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"dataStore.d.ts","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAKtE,OAAO,EAEN,UAAU,EACV,sBAAsB,EACtB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACtC,uCAAuC;IACvC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,qDAAqD;IACrD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,+BACP,GAAG,yDAM/B,CAAC;AAEF,eAAO,MAAM,kBAAkB,0BACP,sBAAsB,cACjC,MAAM,WACT,gBAAgB,cACb,UAAU,UACd,gBAAgB,KACtB,UAA2F,CAAC"}
|
package/lib/dataStore.js
CHANGED
|
@@ -13,8 +13,8 @@ import { TelemetryDataTag } from "@fluidframework/telemetry-utils";
|
|
|
13
13
|
* @returns True if the {@link IDataStoreAliasMessage} is fully implemented, false otherwise
|
|
14
14
|
*/
|
|
15
15
|
export const isDataStoreAliasMessage = (maybeDataStoreAliasMessage) => {
|
|
16
|
-
return typeof (maybeDataStoreAliasMessage === null || maybeDataStoreAliasMessage === void 0 ? void 0 : maybeDataStoreAliasMessage.internalId) === "string"
|
|
17
|
-
|
|
16
|
+
return (typeof (maybeDataStoreAliasMessage === null || maybeDataStoreAliasMessage === void 0 ? void 0 : maybeDataStoreAliasMessage.internalId) === "string" &&
|
|
17
|
+
typeof (maybeDataStoreAliasMessage === null || maybeDataStoreAliasMessage === void 0 ? void 0 : maybeDataStoreAliasMessage.alias) === "string");
|
|
18
18
|
};
|
|
19
19
|
export const channelToDataStore = (fluidDataStoreChannel, internalId, runtime, datastores, logger) => new DataStore(fluidDataStoreChannel, internalId, runtime, datastores, logger);
|
|
20
20
|
var AliasState;
|
|
@@ -59,7 +59,8 @@ class DataStore {
|
|
|
59
59
|
// or for this alias, so it is safe to continue execution
|
|
60
60
|
break;
|
|
61
61
|
}
|
|
62
|
-
default:
|
|
62
|
+
default:
|
|
63
|
+
unreachableCase(this.aliasState);
|
|
63
64
|
}
|
|
64
65
|
this.aliasState = AliasState.Aliasing;
|
|
65
66
|
this.aliasResult = this.trySetAliasInternal(alias);
|
|
@@ -79,8 +80,7 @@ class DataStore {
|
|
|
79
80
|
this.aliasState = AliasState.Aliased;
|
|
80
81
|
return localResult ? "Success" : "Conflict";
|
|
81
82
|
}
|
|
82
|
-
const aliased = await this
|
|
83
|
-
.ackBasedPromise((resolve) => {
|
|
83
|
+
const aliased = await this.ackBasedPromise((resolve) => {
|
|
84
84
|
this.runtime.submitDataStoreAliasOp(message, resolve);
|
|
85
85
|
})
|
|
86
86
|
.catch((error) => {
|
|
@@ -96,7 +96,8 @@ class DataStore {
|
|
|
96
96
|
},
|
|
97
97
|
}, error);
|
|
98
98
|
return false;
|
|
99
|
-
})
|
|
99
|
+
})
|
|
100
|
+
.finally(() => {
|
|
100
101
|
this.pendingAliases.delete(alias);
|
|
101
102
|
});
|
|
102
103
|
if (!aliased) {
|
|
@@ -117,12 +118,13 @@ class DataStore {
|
|
|
117
118
|
get entryPoint() {
|
|
118
119
|
return this.fluidDataStoreChannel.entryPoint;
|
|
119
120
|
}
|
|
120
|
-
get IFluidRouter() {
|
|
121
|
+
get IFluidRouter() {
|
|
122
|
+
return this.fluidDataStoreChannel;
|
|
123
|
+
}
|
|
121
124
|
async ackBasedPromise(executor) {
|
|
122
125
|
let rejectBecauseDispose;
|
|
123
126
|
return new Promise((resolve, reject) => {
|
|
124
|
-
rejectBecauseDispose =
|
|
125
|
-
() => reject(new Error("ContainerRuntime disposed while this ack-based Promise was pending"));
|
|
127
|
+
rejectBecauseDispose = () => reject(new Error("ContainerRuntime disposed while this ack-based Promise was pending"));
|
|
126
128
|
if (this.runtime.disposed) {
|
|
127
129
|
rejectBecauseDispose();
|
|
128
130
|
return;
|
package/lib/dataStore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStore.js","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAQ7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAenE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACnC,0BAA+B,EACqB,EAAE;IACtD,OAAO,OAAO,CAAA,0BAA0B,aAA1B,0BAA0B,uBAA1B,0BAA0B,CAAE,UAAU,CAAA,KAAK,QAAQ;WAC1D,OAAO,CAAA,0BAA0B,aAA1B,0BAA0B,uBAA1B,0BAA0B,CAAE,KAAK,CAAA,KAAK,QAAQ,CAAC;AACjE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAC9B,qBAA6C,EAC7C,UAAkB,EAClB,OAAyB,EACzB,UAAsB,EACtB,MAAwB,EACd,EAAE,CAAC,IAAI,SAAS,CAAC,qBAAqB,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;AAE/F,IAAK,UAIJ;AAJD,WAAK,UAAU;IACX,iCAAmB,CAAA;IACnB,mCAAqB,CAAA;IACrB,2BAAa,CAAA;AACjB,CAAC,EAJI,UAAU,KAAV,UAAU,QAId;AAED,MAAM,SAAS;IA2GX,YACqB,qBAA6C,EAC7C,UAAkB,EAClB,OAAyB,EACzB,UAAsB,EACtB,MAAwB;QAJxB,0BAAqB,GAArB,qBAAqB,CAAwB;QAC7C,eAAU,GAAV,UAAU,CAAQ;QAClB,YAAO,GAAP,OAAO,CAAkB;QACzB,eAAU,GAAV,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;QACtD,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, unreachableCase } from \"@fluidframework/common-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { UsageError } from \"@fluidframework/container-utils\";\nimport {\n FluidObject,\n IFluidHandle,\n IRequest,\n IResponse,\n} from \"@fluidframework/core-interfaces\";\nimport { AliasResult, IDataStore, IFluidDataStoreChannel } from \"@fluidframework/runtime-definitions\";\nimport { TelemetryDataTag } from \"@fluidframework/telemetry-utils\";\nimport { ContainerRuntime } from \"./containerRuntime\";\nimport { DataStores } from \"./dataStores\";\n\n/**\n * Interface for an op to be used for assigning an\n * alias to a datastore\n */\nexport interface IDataStoreAliasMessage {\n /** The internal id of the datastore */\n readonly internalId: string;\n /** The alias name to be assigned to the datastore */\n readonly alias: string;\n}\n\n/**\n * Type guard that returns true if the given alias message is actually an instance of\n * a class which implements {@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 maybeDataStoreAliasMessage: any,\n): maybeDataStoreAliasMessage is IDataStoreAliasMessage => {\n return typeof maybeDataStoreAliasMessage?.internalId === \"string\"\n && typeof maybeDataStoreAliasMessage?.alias === \"string\";\n};\n\nexport const channelToDataStore = (\n fluidDataStoreChannel: IFluidDataStoreChannel,\n internalId: string,\n runtime: ContainerRuntime,\n datastores: DataStores,\n logger: ITelemetryLogger,\n): IDataStore => new DataStore(fluidDataStoreChannel, internalId, runtime, datastores, logger);\n\nenum AliasState {\n Aliased = \"Aliased\",\n Aliasing = \"Aliasing\",\n None = \"None\",\n}\n\nclass DataStore implements IDataStore {\n private aliasState: AliasState = AliasState.None;\n private alias: string | undefined;\n private readonly pendingAliases: Map<string, Promise<AliasResult>>;\n private aliasResult: Promise<AliasResult> | undefined;\n\n async trySetAlias(alias: string): Promise<AliasResult> {\n if (alias.includes(\"/\")) {\n throw new UsageError(`The alias cannot contain slashes: '${alias}'`);\n }\n\n switch (this.aliasState) {\n // If we're already aliasing, check if it's for the same value and return\n // the stored promise, otherwise return 'AlreadyAliased'\n case AliasState.Aliasing:\n assert(this.aliasResult !== undefined,\n 0x316 /* There should be a cached promise of in-progress aliasing */);\n await this.aliasResult;\n return this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\n // If this datastore is already aliased, return true only if this\n // is a repeated call for the same alias\n case AliasState.Aliased:\n return this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\n case AliasState.None: {\n const existingAlias = this.pendingAliases.get(alias);\n if (existingAlias !== undefined) {\n // There is already another datastore which will be aliased\n // to the same name\n return \"Conflict\";\n }\n\n // There is no current or past alias operation for this datastore,\n // or for this alias, so it is safe to continue execution\n break;\n }\n\n default: unreachableCase(this.aliasState);\n }\n\n this.aliasState = AliasState.Aliasing;\n this.aliasResult = this.trySetAliasInternal(alias);\n this.pendingAliases.set(alias, this.aliasResult);\n return this.aliasResult;\n }\n\n async trySetAliasInternal(alias: string): Promise<AliasResult> {\n const message: IDataStoreAliasMessage = {\n internalId: this.internalId,\n alias,\n };\n\n this.fluidDataStoreChannel.makeVisibleAndAttachGraph();\n\n if (this.runtime.attachState === AttachState.Detached) {\n const localResult = this.datastores.processAliasMessageCore(message);\n // Explicitly lock-out future attempts of aliasing,\n // regardless of result\n this.aliasState = AliasState.Aliased;\n return localResult ? \"Success\" : \"Conflict\";\n }\n\n const aliased = await this\n .ackBasedPromise<boolean>((resolve) => {\n this.runtime.submitDataStoreAliasOp(message, resolve);\n })\n .catch((error) => {\n this.logger.sendErrorEvent({\n eventName: \"AliasingException\",\n alias: {\n value: alias,\n tag: TelemetryDataTag.UserData,\n },\n internalId: {\n value: this.internalId,\n tag: TelemetryDataTag.CodeArtifact,\n },\n }, error);\n\n return false;\n }).finally(() => {\n this.pendingAliases.delete(alias);\n });\n\n if (!aliased) {\n this.aliasState = AliasState.None;\n this.aliasResult = undefined;\n return \"Conflict\";\n }\n\n this.alias = alias;\n this.aliasState = AliasState.Aliased;\n return \"Success\";\n }\n\n async request(request: IRequest): Promise<IResponse> {\n return this.fluidDataStoreChannel.request(request);\n }\n\n /**\n * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.entryPoint}\n */\n get entryPoint(): IFluidHandle<FluidObject> | undefined {\n return this.fluidDataStoreChannel.entryPoint;\n }\n\n constructor(\n private readonly fluidDataStoreChannel: IFluidDataStoreChannel,\n private readonly internalId: string,\n private readonly runtime: ContainerRuntime,\n private readonly datastores: DataStores,\n private readonly logger: ITelemetryLogger,\n ) {\n this.pendingAliases = datastores.pendingAliases;\n }\n\n public get IFluidRouter() { return this.fluidDataStoreChannel; }\n\n private async ackBasedPromise<T>(\n executor: (resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void) => void,\n ): Promise<T> {\n let rejectBecauseDispose: () => void;\n return new Promise<T>((resolve, reject) => {\n rejectBecauseDispose =\n () => reject(new Error(\"ContainerRuntime disposed while this ack-based Promise was pending\"));\n\n if (this.runtime.disposed) {\n rejectBecauseDispose();\n return;\n }\n\n this.runtime.on(\"dispose\", rejectBecauseDispose);\n executor(resolve, reject);\n }).finally(() => {\n this.runtime.off(\"dispose\", rejectBecauseDispose);\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dataStore.js","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAO7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAenE;;;;;GAKG;AACH,MAAM,CAA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C9B,OAAO,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACpD,CAAC;IAED;;OAEG;IACH,IAAI,UAAU;QACb,OAAO,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC;IAC9C,CAAC;IAYD,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC,qBAAqB,CAAC;IACnC,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 { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, unreachableCase } from \"@fluidframework/common-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { UsageError } from \"@fluidframework/container-utils\";\nimport { FluidObject, IFluidHandle, IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport {\n\tAliasResult,\n\tIDataStore,\n\tIFluidDataStoreChannel,\n} from \"@fluidframework/runtime-definitions\";\nimport { TelemetryDataTag } from \"@fluidframework/telemetry-utils\";\nimport { ContainerRuntime } from \"./containerRuntime\";\nimport { DataStores } from \"./dataStores\";\n\n/**\n * Interface for an op to be used for assigning an\n * alias to a datastore\n */\nexport interface IDataStoreAliasMessage {\n\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: ITelemetryLogger,\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\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\tasync 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> | undefined {\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: ITelemetryLogger,\n\t) {\n\t\tthis.pendingAliases = datastores.pendingAliases;\n\t}\n\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(\"dispose\", rejectBecauseDispose);\n\t\t});\n\t}\n}\n"]}
|
|
@@ -10,6 +10,7 @@ import { IDocumentStorageService } from "@fluidframework/driver-definitions";
|
|
|
10
10
|
import { IClientDetails, IDocumentMessage, IQuorumClients, ISequencedDocumentMessage, ISnapshotTree, ITreeEntry } from "@fluidframework/protocol-definitions";
|
|
11
11
|
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
12
12
|
import { BindState, CreateChildSummarizerNodeFn, CreateChildSummarizerNodeParam, IAttachMessage, IFluidDataStoreChannel, IFluidDataStoreContext, IFluidDataStoreContextDetached, IFluidDataStoreContextEvents, IFluidDataStoreRegistry, IGarbageCollectionData, IGarbageCollectionDetailsBase, IInboundSignalMessage, IProvideFluidDataStoreFactory, ISummarizeResult, ISummarizerNodeWithGC, SummarizeInternalFn, ITelemetryContext } from "@fluidframework/runtime-definitions";
|
|
13
|
+
import { MonitoringContext } from "@fluidframework/telemetry-utils";
|
|
13
14
|
import { ContainerRuntime } from "./containerRuntime";
|
|
14
15
|
export declare function createAttributesBlob(pkg: readonly string[], isRootDataStore: boolean): ITreeEntry;
|
|
15
16
|
interface ISnapshotDetails {
|
|
@@ -72,6 +73,8 @@ export declare abstract class FluidDataStoreContext extends TypedEventEmitter<IF
|
|
|
72
73
|
get tombstoned(): boolean;
|
|
73
74
|
/** If true, throw an error when a tombstone data store is used. */
|
|
74
75
|
private readonly throwOnTombstoneUsage;
|
|
76
|
+
/** If true, this means that this data store context and its children have been removed from the runtime */
|
|
77
|
+
private deleted;
|
|
75
78
|
get attachState(): AttachState;
|
|
76
79
|
get IFluidDataStoreRegistry(): IFluidDataStoreRegistry | undefined;
|
|
77
80
|
/**
|
|
@@ -101,15 +104,9 @@ export declare abstract class FluidDataStoreContext extends TypedEventEmitter<IF
|
|
|
101
104
|
protected _attachState: AttachState;
|
|
102
105
|
private _isInMemoryRoot;
|
|
103
106
|
protected readonly summarizerNode: ISummarizerNodeWithGC;
|
|
104
|
-
|
|
107
|
+
protected readonly mc: MonitoringContext;
|
|
105
108
|
private readonly thresholdOpsCounter;
|
|
106
109
|
private static readonly pendingOpsCountThreshold;
|
|
107
|
-
/**
|
|
108
|
-
* If the summarizer makes local changes, a telemetry event is logged. This has the potential to be very noisy.
|
|
109
|
-
* So, adding a count of how many telemetry events are logged per data store context. This can be
|
|
110
|
-
* controlled via feature flags.
|
|
111
|
-
*/
|
|
112
|
-
private localChangesTelemetryCount;
|
|
113
110
|
private lastUsedRoutes;
|
|
114
111
|
readonly id: string;
|
|
115
112
|
private readonly _containerRuntime;
|
|
@@ -119,6 +116,12 @@ export declare abstract class FluidDataStoreContext extends TypedEventEmitter<IF
|
|
|
119
116
|
constructor(props: IFluidDataStoreContextProps, existing: boolean, bindState: BindState, // Used to assert for state tracking purposes
|
|
120
117
|
isLocalDataStore: boolean, makeLocallyVisibleFn: () => void);
|
|
121
118
|
dispose(): void;
|
|
119
|
+
/**
|
|
120
|
+
* When delete is called, that means that the data store is permanently removed from the runtime, and will not show up in future summaries
|
|
121
|
+
* This function is called to prevent ops from being generated from this data store once it has been deleted. Furthermore, this data store
|
|
122
|
+
* should not receive any ops/signals.
|
|
123
|
+
*/
|
|
124
|
+
delete(): void;
|
|
122
125
|
setTombstone(tombstone: boolean): void;
|
|
123
126
|
private rejectDeferredRealize;
|
|
124
127
|
realize(): Promise<IFluidDataStoreChannel>;
|
|
@@ -228,12 +231,6 @@ export declare abstract class FluidDataStoreContext extends TypedEventEmitter<IF
|
|
|
228
231
|
rollback(contents: any, localOpMetadata: unknown): void;
|
|
229
232
|
applyStashedOp(contents: any): Promise<unknown>;
|
|
230
233
|
private verifyNotClosed;
|
|
231
|
-
/**
|
|
232
|
-
* Summarizer client should not have local changes. These changes can become part of the summary and can break
|
|
233
|
-
* eventual consistency. For example, the next summary (say at ref seq# 100) may contain these changes whereas
|
|
234
|
-
* other clients that are up-to-date till seq# 100 may not have them yet.
|
|
235
|
-
*/
|
|
236
|
-
protected identifyLocalChangeInSummarizer(eventName: string, type?: string): void;
|
|
237
234
|
getCreateChildSummarizerNodeFn(id: string, createParam: CreateChildSummarizerNodeParam): (summarizeInternal: SummarizeInternalFn, getGCDataFn: (fullGC?: boolean | undefined) => Promise<IGarbageCollectionData>, getBaseGCDetailsFn?: (() => Promise<IGarbageCollectionDetailsBase>) | undefined) => ISummarizerNodeWithGC;
|
|
238
235
|
uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>>;
|
|
239
236
|
}
|
|
@@ -260,6 +257,14 @@ export declare class LocalFluidDataStoreContextBase extends FluidDataStoreContex
|
|
|
260
257
|
generateAttachMessage(): IAttachMessage;
|
|
261
258
|
getInitialSnapshotDetails(): Promise<ISnapshotDetails>;
|
|
262
259
|
getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase>;
|
|
260
|
+
/**
|
|
261
|
+
* A context should only be marked as deleted when its a remote context.
|
|
262
|
+
* Session Expiry at the runtime level should have closed the container creating the local data store context
|
|
263
|
+
* before delete is even possible. Session Expiry is at 30 days, and sweep is done 36+ days later from the time
|
|
264
|
+
* it was unreferenced. Thus the sweeping container should have loaded from a snapshot and thus creating a remote
|
|
265
|
+
* context.
|
|
266
|
+
*/
|
|
267
|
+
delete(): void;
|
|
263
268
|
}
|
|
264
269
|
/**
|
|
265
270
|
* context implementation for "attached" data store runtime.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreContext.d.ts","sourceRoot":"","sources":["../src/dataStoreContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,O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D;AAED;;;;;GAKG;AACH,qBAAa,kCACZ,SAAQ,8BACR,YAAW,8BAA8B;gBAE7B,KAAK,EAAE,gCAAgC;IAKtC,aAAa,CACzB,QAAQ,EAAE,6BAA6B,EACvC,gBAAgB,EAAE,sBAAsB;IAgC5B,yBAAyB,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAQnE"}
|
package/lib/dataStoreContext.js
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { AttachState, } from "@fluidframework/container-definitions";
|
|
6
|
-
import { assert, Deferred, LazyPromise, TypedEventEmitter
|
|
6
|
+
import { assert, Deferred, LazyPromise, TypedEventEmitter } from "@fluidframework/common-utils";
|
|
7
7
|
import { readAndParse } from "@fluidframework/driver-utils";
|
|
8
8
|
import { BlobTreeEntry } from "@fluidframework/protocol-base";
|
|
9
9
|
import { BindState, channelsTreeName, } from "@fluidframework/runtime-definitions";
|
|
10
|
-
import { addBlobToSummary, convertSummaryTreeToITree
|
|
11
|
-
import { ChildLogger,
|
|
10
|
+
import { addBlobToSummary, convertSummaryTreeToITree } from "@fluidframework/runtime-utils";
|
|
11
|
+
import { ChildLogger, loggerToMonitoringContext, LoggingError, TelemetryDataTag, ThresholdCounter, } from "@fluidframework/telemetry-utils";
|
|
12
12
|
import { DataCorruptionError, DataProcessingError, extractSafePropertiesFromMessage, } from "@fluidframework/container-utils";
|
|
13
13
|
import { dataStoreAttributesBlobName, hasIsolatedChannels, wrapSummaryInChannelsTree, getAttributesFormatVersion, getFluidDataStoreAttributes, } from "./summaryFormat";
|
|
14
14
|
import { throwOnTombstoneUsageKey } from "./garbageCollectionConstants";
|
|
15
|
-
import {
|
|
15
|
+
import { sendGCUnexpectedUsageEvent } from "./garbageCollectionHelpers";
|
|
16
16
|
import { summarizerClientType } from "./summarizerClientElection";
|
|
17
17
|
function createAttributes(pkg, isRootDataStore) {
|
|
18
18
|
const stringifiedPkg = JSON.stringify(pkg);
|
|
@@ -32,7 +32,6 @@ export function createAttributesBlob(pkg, isRootDataStore) {
|
|
|
32
32
|
export class FluidDataStoreContext extends TypedEventEmitter {
|
|
33
33
|
constructor(props, existing, bindState, // Used to assert for state tracking purposes
|
|
34
34
|
isLocalDataStore, makeLocallyVisibleFn) {
|
|
35
|
-
var _a;
|
|
36
35
|
super();
|
|
37
36
|
this.existing = existing;
|
|
38
37
|
this.bindState = bindState;
|
|
@@ -44,6 +43,8 @@ export class FluidDataStoreContext extends TypedEventEmitter {
|
|
|
44
43
|
* loading.
|
|
45
44
|
*/
|
|
46
45
|
this._tombstoned = false;
|
|
46
|
+
/** If true, this means that this data store context and its children have been removed from the runtime */
|
|
47
|
+
this.deleted = false;
|
|
47
48
|
this.detachedRuntimeCreation = false;
|
|
48
49
|
this.loaded = false;
|
|
49
50
|
this.pending = [];
|
|
@@ -56,8 +57,10 @@ export class FluidDataStoreContext extends TypedEventEmitter {
|
|
|
56
57
|
// URIs use slashes as delimiters. Handles use URIs.
|
|
57
58
|
// Thus having slashes in types almost guarantees trouble down the road!
|
|
58
59
|
assert(!this.id.includes("/"), 0x13a /* Data store ID contains slash */);
|
|
59
|
-
this._attachState =
|
|
60
|
-
this.containerRuntime.attachState
|
|
60
|
+
this._attachState =
|
|
61
|
+
this.containerRuntime.attachState !== AttachState.Detached && this.existing
|
|
62
|
+
? this.containerRuntime.attachState
|
|
63
|
+
: AttachState.Detached;
|
|
61
64
|
this.bindToContext = () => {
|
|
62
65
|
assert(this.bindState === BindState.NotBound, 0x13b /* "datastore context is already in bound state" */);
|
|
63
66
|
this.bindState = BindState.Binding;
|
|
@@ -72,10 +75,8 @@ export class FluidDataStoreContext extends TypedEventEmitter {
|
|
|
72
75
|
// Tombstone should only throw when the feature flag is enabled and the client isn't a summarizer
|
|
73
76
|
this.throwOnTombstoneUsage =
|
|
74
77
|
this.mc.config.getBoolean(throwOnTombstoneUsageKey) === true &&
|
|
78
|
+
this._containerRuntime.gcTombstoneEnforcementAllowed &&
|
|
75
79
|
this.clientDetails.type !== summarizerClientType;
|
|
76
|
-
// By default, a data store can log maximum 10 local changes telemetry in summarizer.
|
|
77
|
-
this.localChangesTelemetryCount =
|
|
78
|
-
(_a = this.mc.config.getNumber("Fluid.Telemetry.LocalChangesTelemetryCount")) !== null && _a !== void 0 ? _a : 10;
|
|
79
80
|
}
|
|
80
81
|
get packagePath() {
|
|
81
82
|
assert(this.pkg !== undefined, 0x139 /* "Undefined package path" */);
|
|
@@ -114,8 +115,12 @@ export class FluidDataStoreContext extends TypedEventEmitter {
|
|
|
114
115
|
get baseSnapshot() {
|
|
115
116
|
return this._baseSnapshot;
|
|
116
117
|
}
|
|
117
|
-
get disposed() {
|
|
118
|
-
|
|
118
|
+
get disposed() {
|
|
119
|
+
return this._disposed;
|
|
120
|
+
}
|
|
121
|
+
get tombstoned() {
|
|
122
|
+
return this._tombstoned;
|
|
123
|
+
}
|
|
119
124
|
get attachState() {
|
|
120
125
|
return this._attachState;
|
|
121
126
|
}
|
|
@@ -149,21 +154,30 @@ export class FluidDataStoreContext extends TypedEventEmitter {
|
|
|
149
154
|
// Dispose any pending runtime after it gets fulfilled
|
|
150
155
|
// Errors are logged where this.channelDeferred is consumed/generated (realizeCore(), bindRuntime())
|
|
151
156
|
if (this.channelDeferred) {
|
|
152
|
-
this.channelDeferred.promise
|
|
157
|
+
this.channelDeferred.promise
|
|
158
|
+
.then((runtime) => {
|
|
153
159
|
runtime.dispose();
|
|
154
|
-
})
|
|
160
|
+
})
|
|
161
|
+
.catch((error) => { });
|
|
155
162
|
}
|
|
156
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* When delete is called, that means that the data store is permanently removed from the runtime, and will not show up in future summaries
|
|
166
|
+
* This function is called to prevent ops from being generated from this data store once it has been deleted. Furthermore, this data store
|
|
167
|
+
* should not receive any ops/signals.
|
|
168
|
+
*/
|
|
169
|
+
delete() {
|
|
170
|
+
this.deleted = true;
|
|
171
|
+
}
|
|
157
172
|
setTombstone(tombstone) {
|
|
158
173
|
if (this.tombstoned === tombstone) {
|
|
159
174
|
return;
|
|
160
175
|
}
|
|
161
176
|
this._tombstoned = tombstone;
|
|
162
177
|
}
|
|
163
|
-
rejectDeferredRealize(reason,
|
|
178
|
+
rejectDeferredRealize(reason, packageName) {
|
|
164
179
|
throw new LoggingError(reason, {
|
|
165
|
-
|
|
166
|
-
fullPackageName: packagePathToTelemetryProperty(fullPackageName),
|
|
180
|
+
packageName: { value: packageName, tag: TelemetryDataTag.CodeArtifact },
|
|
167
181
|
});
|
|
168
182
|
}
|
|
169
183
|
async realize() {
|
|
@@ -178,7 +192,6 @@ export class FluidDataStoreContext extends TypedEventEmitter {
|
|
|
178
192
|
value: this.id,
|
|
179
193
|
tag: TelemetryDataTag.CodeArtifact,
|
|
180
194
|
},
|
|
181
|
-
packageName: packagePathToTelemetryProperty(this.pkg),
|
|
182
195
|
});
|
|
183
196
|
(_a = this.channelDeferred) === null || _a === void 0 ? void 0 : _a.reject(errorWrapped);
|
|
184
197
|
this.logger.sendErrorEvent({ eventName: "RealizeError" }, errorWrapped);
|
|
@@ -196,18 +209,18 @@ export class FluidDataStoreContext extends TypedEventEmitter {
|
|
|
196
209
|
let lastPkg;
|
|
197
210
|
for (const pkg of packages) {
|
|
198
211
|
if (!registry) {
|
|
199
|
-
this.rejectDeferredRealize("No registry for package", lastPkg
|
|
212
|
+
this.rejectDeferredRealize("No registry for package", lastPkg);
|
|
200
213
|
}
|
|
201
214
|
lastPkg = pkg;
|
|
202
215
|
entry = await registry.get(pkg);
|
|
203
216
|
if (!entry) {
|
|
204
|
-
this.rejectDeferredRealize("Registry does not contain entry for the package", pkg
|
|
217
|
+
this.rejectDeferredRealize("Registry does not contain entry for the package", pkg);
|
|
205
218
|
}
|
|
206
219
|
registry = entry.IFluidDataStoreRegistry;
|
|
207
220
|
}
|
|
208
221
|
const factory = entry === null || entry === void 0 ? void 0 : entry.IFluidDataStoreFactory;
|
|
209
222
|
if (factory === undefined) {
|
|
210
|
-
this.rejectDeferredRealize("Can't find factory for package", lastPkg
|
|
223
|
+
this.rejectDeferredRealize("Can't find factory for package", lastPkg);
|
|
211
224
|
}
|
|
212
225
|
return { factory, registry };
|
|
213
226
|
}
|
|
@@ -377,7 +390,9 @@ export class FluidDataStoreContext extends TypedEventEmitter {
|
|
|
377
390
|
return;
|
|
378
391
|
}
|
|
379
392
|
// Remove the route to this data store, if it exists.
|
|
380
|
-
const usedChannelRoutes = this.lastUsedRoutes.filter((id) => {
|
|
393
|
+
const usedChannelRoutes = this.lastUsedRoutes.filter((id) => {
|
|
394
|
+
return id !== "/" && id !== "";
|
|
395
|
+
});
|
|
381
396
|
this.channel.updateUsedRoutes(usedChannelRoutes);
|
|
382
397
|
}
|
|
383
398
|
/**
|
|
@@ -394,8 +409,6 @@ export class FluidDataStoreContext extends TypedEventEmitter {
|
|
|
394
409
|
content,
|
|
395
410
|
type,
|
|
396
411
|
};
|
|
397
|
-
// Summarizer clients should not submit messages.
|
|
398
|
-
this.identifyLocalChangeInSummarizer("DataStoreMessageSubmittedInSummarizer", type);
|
|
399
412
|
this._containerRuntime.submitDataStoreOp(this.id, fluidDataStoreContent, localOpMetadata);
|
|
400
413
|
}
|
|
401
414
|
/**
|
|
@@ -467,7 +480,8 @@ export class FluidDataStoreContext extends TypedEventEmitter {
|
|
|
467
480
|
catch (error) {
|
|
468
481
|
(_a = this.channelDeferred) === null || _a === void 0 ? void 0 : _a.reject(error);
|
|
469
482
|
this.logger.sendErrorEvent({
|
|
470
|
-
eventName: "BindRuntimeError",
|
|
483
|
+
eventName: "BindRuntimeError",
|
|
484
|
+
fluidDataStoreId: {
|
|
471
485
|
value: this.id,
|
|
472
486
|
tag: TelemetryDataTag.CodeArtifact,
|
|
473
487
|
},
|
|
@@ -512,16 +526,25 @@ export class FluidDataStoreContext extends TypedEventEmitter {
|
|
|
512
526
|
return this.channel.applyStashedOp(innerContents.content);
|
|
513
527
|
}
|
|
514
528
|
verifyNotClosed(callSite, checkTombstone = true, safeTelemetryProps = {}) {
|
|
529
|
+
if (this.deleted) {
|
|
530
|
+
const messageString = `Context is deleted! Call site [${callSite}]`;
|
|
531
|
+
const error = new DataCorruptionError(messageString, safeTelemetryProps);
|
|
532
|
+
this.mc.logger.sendErrorEvent({
|
|
533
|
+
eventName: "GC_Deleted_DataStore_Changed",
|
|
534
|
+
callSite,
|
|
535
|
+
}, error);
|
|
536
|
+
throw error;
|
|
537
|
+
}
|
|
515
538
|
if (this._disposed) {
|
|
516
539
|
throw new Error(`Context is closed! Call site [${callSite}]`);
|
|
517
540
|
}
|
|
518
541
|
if (checkTombstone && this.tombstoned) {
|
|
519
542
|
const messageString = `Context is tombstoned! Call site [${callSite}]`;
|
|
520
543
|
const error = new DataCorruptionError(messageString, safeTelemetryProps);
|
|
521
|
-
|
|
544
|
+
sendGCUnexpectedUsageEvent(this.mc, {
|
|
522
545
|
eventName: "GC_Tombstone_DataStore_Changed",
|
|
523
546
|
category: this.throwOnTombstoneUsage ? "error" : "generic",
|
|
524
|
-
|
|
547
|
+
gcTombstoneEnforcementAllowed: this._containerRuntime.gcTombstoneEnforcementAllowed,
|
|
525
548
|
callSite,
|
|
526
549
|
}, this.pkg, error);
|
|
527
550
|
if (this.throwOnTombstoneUsage) {
|
|
@@ -529,32 +552,6 @@ export class FluidDataStoreContext extends TypedEventEmitter {
|
|
|
529
552
|
}
|
|
530
553
|
}
|
|
531
554
|
}
|
|
532
|
-
/**
|
|
533
|
-
* Summarizer client should not have local changes. These changes can become part of the summary and can break
|
|
534
|
-
* eventual consistency. For example, the next summary (say at ref seq# 100) may contain these changes whereas
|
|
535
|
-
* other clients that are up-to-date till seq# 100 may not have them yet.
|
|
536
|
-
*/
|
|
537
|
-
identifyLocalChangeInSummarizer(eventName, type) {
|
|
538
|
-
var _a, _b;
|
|
539
|
-
if (this.clientDetails.type !== summarizerClientType || this.localChangesTelemetryCount <= 0) {
|
|
540
|
-
return;
|
|
541
|
-
}
|
|
542
|
-
// Log a telemetry if there are local changes in the summarizer. This will give us data on how often
|
|
543
|
-
// this is happening and which data stores do this. The eventual goal is to disallow local changes
|
|
544
|
-
// in the summarizer and the data will help us plan this.
|
|
545
|
-
this.mc.logger.sendTelemetryEvent({
|
|
546
|
-
eventName,
|
|
547
|
-
type,
|
|
548
|
-
fluidDataStoreId: {
|
|
549
|
-
value: this.id,
|
|
550
|
-
tag: TelemetryDataTag.CodeArtifact,
|
|
551
|
-
},
|
|
552
|
-
packageName: packagePathToTelemetryProperty(this.pkg),
|
|
553
|
-
isSummaryInProgress: (_b = (_a = this.summarizerNode).isSummaryInProgress) === null || _b === void 0 ? void 0 : _b.call(_a),
|
|
554
|
-
stack: generateStack(),
|
|
555
|
-
});
|
|
556
|
-
this.localChangesTelemetryCount--;
|
|
557
|
-
}
|
|
558
555
|
getCreateChildSummarizerNodeFn(id, createParam) {
|
|
559
556
|
return (summarizeInternal, getGCDataFn, getBaseGCDetailsFn) => this.summarizerNode.createChild(summarizeInternal, id, createParam,
|
|
560
557
|
// DDS will not create failure summaries
|
|
@@ -582,9 +579,10 @@ export class RemoteFluidDataStoreContext extends FluidDataStoreContext {
|
|
|
582
579
|
// For snapshotFormatVersion = "0.1" (1) or above, pkg is jsonified, otherwise it is just a string.
|
|
583
580
|
const formatVersion = getAttributesFormatVersion(attributes);
|
|
584
581
|
if (formatVersion < 1) {
|
|
585
|
-
pkgFromSnapshot =
|
|
586
|
-
|
|
587
|
-
|
|
582
|
+
pkgFromSnapshot =
|
|
583
|
+
attributes.pkg.startsWith('["') && attributes.pkg.endsWith('"]')
|
|
584
|
+
? JSON.parse(attributes.pkg)
|
|
585
|
+
: [attributes.pkg];
|
|
588
586
|
}
|
|
589
587
|
else {
|
|
590
588
|
pkgFromSnapshot = JSON.parse(attributes.pkg);
|
|
@@ -633,8 +631,6 @@ export class RemoteFluidDataStoreContext extends FluidDataStoreContext {
|
|
|
633
631
|
export class LocalFluidDataStoreContextBase extends FluidDataStoreContext {
|
|
634
632
|
constructor(props) {
|
|
635
633
|
super(props, props.snapshotTree !== undefined ? true : false /* existing */, props.snapshotTree ? BindState.Bound : BindState.NotBound, true /* isLocalDataStore */, props.makeLocallyVisibleFn);
|
|
636
|
-
// Summarizer client should not create local data stores.
|
|
637
|
-
this.identifyLocalChangeInSummarizer("DataStoreCreatedInSummarizer");
|
|
638
634
|
this.snapshotTree = props.snapshotTree;
|
|
639
635
|
if (props.isRootDataStore === true) {
|
|
640
636
|
this.setInMemoryRoot();
|
|
@@ -705,6 +701,23 @@ export class LocalFluidDataStoreContextBase extends FluidDataStoreContext {
|
|
|
705
701
|
// Local data store does not have initial summary.
|
|
706
702
|
return {};
|
|
707
703
|
}
|
|
704
|
+
/**
|
|
705
|
+
* A context should only be marked as deleted when its a remote context.
|
|
706
|
+
* Session Expiry at the runtime level should have closed the container creating the local data store context
|
|
707
|
+
* before delete is even possible. Session Expiry is at 30 days, and sweep is done 36+ days later from the time
|
|
708
|
+
* it was unreferenced. Thus the sweeping container should have loaded from a snapshot and thus creating a remote
|
|
709
|
+
* context.
|
|
710
|
+
*/
|
|
711
|
+
delete() {
|
|
712
|
+
// TODO: GC:Validation - potentially prevent this from happening or asserting. Maybe throw here.
|
|
713
|
+
sendGCUnexpectedUsageEvent(this.mc, {
|
|
714
|
+
eventName: "GC_Deleted_DataStore_Unexpected_Delete",
|
|
715
|
+
message: "Unexpected deletion of a local data store context",
|
|
716
|
+
category: "error",
|
|
717
|
+
gcTombstoneEnforcementAllowed: undefined,
|
|
718
|
+
}, this.pkg);
|
|
719
|
+
super.delete();
|
|
720
|
+
}
|
|
708
721
|
}
|
|
709
722
|
/**
|
|
710
723
|
* context implementation for "attached" data store runtime.
|