@fluidframework/container-runtime 2.0.0-dev-rc.5.0.0.268409 → 2.0.0-dev-rc.5.0.0.270401
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/api-report/container-runtime.alpha.api.md +3 -8
- package/api-report/container-runtime.beta.api.md +2 -2
- package/api-report/container-runtime.public.api.md +2 -2
- package/container-runtime.test-files.tar +0 -0
- package/dist/batchTracker.js +5 -1
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.d.ts +1 -18
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +39 -48
- package/dist/blobManager.js.map +1 -1
- package/dist/channelCollection.d.ts +2 -11
- package/dist/channelCollection.d.ts.map +1 -1
- package/dist/channelCollection.js +33 -48
- package/dist/channelCollection.js.map +1 -1
- package/dist/connectionTelemetry.d.ts +1 -2
- package/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js +32 -14
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/containerHandleContext.js +4 -0
- package/dist/containerHandleContext.js.map +1 -1
- package/dist/containerRuntime.d.ts +7 -18
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +145 -43
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.js +9 -1
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +2 -16
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +142 -120
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.js +29 -28
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/dataStoreRegistry.js +1 -0
- package/dist/dataStoreRegistry.js.map +1 -1
- package/dist/deltaManagerProxies.d.ts +4 -4
- package/dist/deltaManagerProxies.d.ts.map +1 -1
- package/dist/deltaManagerProxies.js +33 -28
- package/dist/deltaManagerProxies.js.map +1 -1
- package/dist/deltaScheduler.d.ts +1 -2
- package/dist/deltaScheduler.d.ts.map +1 -1
- package/dist/deltaScheduler.js +13 -9
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/error.js +2 -1
- package/dist/error.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +37 -17
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +0 -4
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js +1 -3
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcSummaryStateTracker.js +19 -14
- package/dist/gc/gcSummaryStateTracker.js.map +1 -1
- package/dist/gc/gcTelemetry.js +12 -5
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/gc/gcUnreferencedStateTracker.js +12 -1
- 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 +1 -2
- package/dist/gc/index.js.map +1 -1
- package/dist/messageTypes.d.ts +1 -1
- package/dist/messageTypes.d.ts.map +1 -1
- package/dist/messageTypes.js.map +1 -1
- package/dist/opLifecycle/batchManager.js +5 -3
- package/dist/opLifecycle/batchManager.js.map +1 -1
- package/dist/opLifecycle/opCompressor.js +1 -0
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opDecompressor.js +6 -4
- package/dist/opLifecycle/opDecompressor.js.map +1 -1
- package/dist/opLifecycle/opGroupingManager.d.ts +1 -1
- package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
- package/dist/opLifecycle/opGroupingManager.js +3 -1
- package/dist/opLifecycle/opGroupingManager.js.map +1 -1
- package/dist/opLifecycle/opSplitter.d.ts +1 -1
- package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
- package/dist/opLifecycle/opSplitter.js +6 -0
- package/dist/opLifecycle/opSplitter.js.map +1 -1
- package/dist/opLifecycle/outbox.js +15 -10
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.js +3 -0
- package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/dist/opProperties.d.ts +1 -1
- package/dist/opProperties.d.ts.map +1 -1
- package/dist/opProperties.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.map +1 -1
- package/dist/pendingStateManager.js +34 -18
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/scheduleManager.d.ts +1 -2
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js +15 -4
- package/dist/scheduleManager.js.map +1 -1
- package/dist/storageServiceWithAttachBlobs.js +1 -0
- package/dist/storageServiceWithAttachBlobs.js.map +1 -1
- package/dist/summary/documentSchema.js +17 -1
- package/dist/summary/documentSchema.js.map +1 -1
- package/dist/summary/orderedClientElection.js +19 -11
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.js +4 -2
- package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/summary/runningSummarizer.d.ts +1 -1
- package/dist/summary/runningSummarizer.d.ts.map +1 -1
- package/dist/summary/runningSummarizer.js +56 -38
- package/dist/summary/runningSummarizer.js.map +1 -1
- package/dist/summary/summarizer.js +17 -8
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerClientElection.js +18 -7
- package/dist/summary/summarizerClientElection.js.map +1 -1
- package/dist/summary/summarizerHeuristics.js +30 -25
- package/dist/summary/summarizerHeuristics.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.d.ts +1 -2
- package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.js +12 -3
- package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.js +2 -0
- package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js +20 -6
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +2 -2
- package/dist/summary/summarizerTypes.d.ts.map +1 -1
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts +1 -2
- package/dist/summary/summaryCollection.d.ts.map +1 -1
- package/dist/summary/summaryCollection.js +23 -11
- package/dist/summary/summaryCollection.js.map +1 -1
- package/dist/summary/summaryFormat.d.ts +1 -2
- package/dist/summary/summaryFormat.d.ts.map +1 -1
- package/dist/summary/summaryFormat.js.map +1 -1
- package/dist/summary/summaryGenerator.js +12 -5
- package/dist/summary/summaryGenerator.js.map +1 -1
- package/dist/summary/summaryManager.js +58 -48
- package/dist/summary/summaryManager.js.map +1 -1
- package/dist/throttler.js +4 -1
- package/dist/throttler.js.map +1 -1
- package/lib/batchTracker.js +5 -1
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager.d.ts +1 -18
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +39 -48
- package/lib/blobManager.js.map +1 -1
- package/lib/channelCollection.d.ts +2 -11
- package/lib/channelCollection.d.ts.map +1 -1
- package/lib/channelCollection.js +34 -49
- package/lib/channelCollection.js.map +1 -1
- package/lib/connectionTelemetry.d.ts +1 -2
- package/lib/connectionTelemetry.d.ts.map +1 -1
- package/lib/connectionTelemetry.js +33 -15
- package/lib/connectionTelemetry.js.map +1 -1
- package/lib/containerHandleContext.js +4 -0
- package/lib/containerHandleContext.js.map +1 -1
- package/lib/containerRuntime.d.ts +7 -18
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +145 -43
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.js +9 -1
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +2 -16
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +144 -122
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreContexts.js +29 -28
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/dataStoreRegistry.js +1 -0
- package/lib/dataStoreRegistry.js.map +1 -1
- package/lib/deltaManagerProxies.d.ts +4 -4
- package/lib/deltaManagerProxies.d.ts.map +1 -1
- package/lib/deltaManagerProxies.js +33 -28
- package/lib/deltaManagerProxies.js.map +1 -1
- package/lib/deltaScheduler.d.ts +1 -2
- package/lib/deltaScheduler.d.ts.map +1 -1
- package/lib/deltaScheduler.js +13 -9
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/error.js +2 -1
- package/lib/error.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +37 -17
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +0 -4
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js +0 -2
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcSummaryStateTracker.js +19 -14
- package/lib/gc/gcSummaryStateTracker.js.map +1 -1
- package/lib/gc/gcTelemetry.js +12 -5
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/gc/gcUnreferencedStateTracker.js +12 -1
- 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/messageTypes.d.ts +1 -1
- package/lib/messageTypes.d.ts.map +1 -1
- package/lib/messageTypes.js.map +1 -1
- package/lib/opLifecycle/batchManager.js +5 -3
- package/lib/opLifecycle/batchManager.js.map +1 -1
- package/lib/opLifecycle/opCompressor.js +1 -0
- package/lib/opLifecycle/opCompressor.js.map +1 -1
- package/lib/opLifecycle/opDecompressor.d.ts +1 -1
- package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opDecompressor.js +6 -4
- package/lib/opLifecycle/opDecompressor.js.map +1 -1
- package/lib/opLifecycle/opGroupingManager.d.ts +1 -1
- package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
- package/lib/opLifecycle/opGroupingManager.js +3 -1
- package/lib/opLifecycle/opGroupingManager.js.map +1 -1
- package/lib/opLifecycle/opSplitter.d.ts +1 -1
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
- package/lib/opLifecycle/opSplitter.js +6 -0
- package/lib/opLifecycle/opSplitter.js.map +1 -1
- package/lib/opLifecycle/outbox.js +15 -10
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.js +4 -1
- package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/lib/opProperties.d.ts +1 -1
- package/lib/opProperties.d.ts.map +1 -1
- package/lib/opProperties.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.map +1 -1
- package/lib/pendingStateManager.js +34 -18
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/scheduleManager.d.ts +1 -2
- package/lib/scheduleManager.d.ts.map +1 -1
- package/lib/scheduleManager.js +15 -4
- package/lib/scheduleManager.js.map +1 -1
- package/lib/storageServiceWithAttachBlobs.js +1 -0
- package/lib/storageServiceWithAttachBlobs.js.map +1 -1
- package/lib/summary/documentSchema.js +17 -1
- package/lib/summary/documentSchema.js.map +1 -1
- package/lib/summary/orderedClientElection.js +19 -11
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/runWhileConnectedCoordinator.js +4 -2
- package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/lib/summary/runningSummarizer.d.ts +1 -1
- package/lib/summary/runningSummarizer.d.ts.map +1 -1
- package/lib/summary/runningSummarizer.js +57 -39
- package/lib/summary/runningSummarizer.js.map +1 -1
- package/lib/summary/summarizer.js +17 -8
- package/lib/summary/summarizer.js.map +1 -1
- package/lib/summary/summarizerClientElection.js +18 -7
- package/lib/summary/summarizerClientElection.js.map +1 -1
- package/lib/summary/summarizerHeuristics.js +30 -25
- package/lib/summary/summarizerHeuristics.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.d.ts +1 -2
- package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.js +12 -3
- package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.js +2 -0
- package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js +20 -6
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/lib/summary/summarizerTypes.d.ts +2 -2
- package/lib/summary/summarizerTypes.d.ts.map +1 -1
- package/lib/summary/summarizerTypes.js.map +1 -1
- package/lib/summary/summaryCollection.d.ts +1 -2
- package/lib/summary/summaryCollection.d.ts.map +1 -1
- package/lib/summary/summaryCollection.js +23 -11
- package/lib/summary/summaryCollection.js.map +1 -1
- package/lib/summary/summaryFormat.d.ts +1 -2
- package/lib/summary/summaryFormat.d.ts.map +1 -1
- package/lib/summary/summaryFormat.js.map +1 -1
- package/lib/summary/summaryGenerator.js +12 -5
- package/lib/summary/summaryGenerator.js.map +1 -1
- package/lib/summary/summaryManager.js +58 -48
- package/lib/summary/summaryManager.js.map +1 -1
- package/lib/throttler.js +4 -1
- package/lib/throttler.js.map +1 -1
- package/package.json +17 -17
- package/src/batchTracker.ts +1 -1
- package/src/blobManager.ts +1 -39
- package/src/channelCollection.ts +19 -72
- package/src/connectionTelemetry.ts +5 -2
- package/src/containerRuntime.ts +9 -32
- package/src/dataStoreContext.ts +4 -38
- package/src/deltaManagerProxies.ts +3 -5
- package/src/deltaScheduler.ts +4 -2
- package/src/gc/garbageCollection.ts +0 -2
- package/src/gc/gcDefinitions.ts +0 -4
- package/src/gc/index.ts +0 -1
- package/src/messageTypes.ts +1 -1
- package/src/opLifecycle/opDecompressor.ts +1 -1
- package/src/opLifecycle/opGroupingManager.ts +1 -1
- package/src/opLifecycle/opSplitter.ts +1 -1
- package/src/opLifecycle/remoteMessageProcessor.ts +4 -2
- package/src/opProperties.ts +4 -2
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +16 -5
- package/src/scheduleManager.ts +4 -2
- package/src/summary/runningSummarizer.ts +5 -2
- package/src/summary/summarizerNode/summarizerNode.ts +5 -2
- package/src/summary/summarizerTypes.ts +5 -2
- package/src/summary/summaryCollection.ts +1 -1
- package/src/summary/summaryFormat.ts +2 -1
- package/tsconfig.json +2 -0
package/lib/dataStore.js
CHANGED
|
@@ -24,6 +24,15 @@ var AliasState;
|
|
|
24
24
|
AliasState["None"] = "None";
|
|
25
25
|
})(AliasState || (AliasState = {}));
|
|
26
26
|
class DataStore {
|
|
27
|
+
fluidDataStoreChannel;
|
|
28
|
+
internalId;
|
|
29
|
+
channelCollection;
|
|
30
|
+
logger;
|
|
31
|
+
parentContext;
|
|
32
|
+
aliasState = AliasState.None;
|
|
33
|
+
alias;
|
|
34
|
+
pendingAliases;
|
|
35
|
+
aliasResult;
|
|
27
36
|
/**
|
|
28
37
|
* {@inheritDoc @fluidframework/runtime-definitions#IDataStore.trySetAlias}
|
|
29
38
|
*/
|
|
@@ -115,7 +124,6 @@ class DataStore {
|
|
|
115
124
|
this.channelCollection = channelCollection;
|
|
116
125
|
this.logger = logger;
|
|
117
126
|
this.parentContext = parentContext;
|
|
118
|
-
this.aliasState = AliasState.None;
|
|
119
127
|
this.pendingAliases = channelCollection.pendingAliases;
|
|
120
128
|
}
|
|
121
129
|
async ackBasedPromise(executor) {
|
package/lib/dataStore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStore.js","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAGpE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAM9E,OAAO,EAEN,gBAAgB,EAChB,UAAU,GACV,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAazD;;;;;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,iBAAoC,EACpC,MAA2B,EACd,EAAE,CAAC,IAAI,SAAS,CAAC,qBAAqB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAC;AAE7F,IAAK,UAIJ;AAJD,WAAK,UAAU;IACd,iCAAmB,CAAA;IACnB,mCAAqB,CAAA;IACrB,2BAAa,CAAA;AACd,CAAC,EAJI,UAAU,KAAV,UAAU,QAId;AAED,MAAM,SAAS;IAMd;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,KAAa;QAC9B,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,UAAU,CAAC,sCAAsC,KAAK,GAAG,CAAC,CAAC;QACtE,CAAC;QAED,QAAQ,IAAI,CAAC,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E,CAAC,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { FluidObject } from \"@fluidframework/core-interfaces\";\nimport { type IFluidHandleInternal } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport {\n\tAliasResult,\n\tIDataStore,\n\tIFluidDataStoreChannel,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tTelemetryDataTag,\n\tUsageError,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ChannelCollection } from \"./channelCollection.js\";\nimport { ContainerMessageType } from \"./messageTypes.js\";\n\n/**\n * Interface for an op to be used for assigning an\n * alias to a datastore\n */\nexport interface IDataStoreAliasMessage {\n\t/** 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\tchannelCollection: ChannelCollection,\n\tlogger: ITelemetryLoggerExt,\n): IDataStore => new DataStore(fluidDataStoreChannel, internalId, channelCollection, logger);\n\nenum AliasState {\n\tAliased = \"Aliased\",\n\tAliasing = \"Aliasing\",\n\tNone = \"None\",\n}\n\nclass DataStore implements IDataStore {\n\tprivate aliasState: AliasState = AliasState.None;\n\tprivate alias: string | undefined;\n\tprivate readonly pendingAliases: Map<string, Promise<AliasResult>>;\n\tprivate aliasResult: Promise<AliasResult> | undefined;\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.trySetAlias}\n\t */\n\tasync trySetAlias(alias: string): Promise<AliasResult> {\n\t\tif (alias.includes(\"/\")) {\n\t\t\tthrow new UsageError(`The alias cannot contain slashes: '${alias}'`);\n\t\t}\n\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\t\tthis.fluidDataStoreChannel.makeVisibleAndAttachGraph();\n\n\t\tif (this.parentContext.attachState === AttachState.Detached) {\n\t\t\tconst localResult = this.channelCollection.processAliasMessageCore(\n\t\t\t\tthis.internalId,\n\t\t\t\talias,\n\t\t\t);\n\t\t\t// Explicitly lock-out future attempts of aliasing,\n\t\t\t// regardless of result\n\t\t\tthis.aliasState = AliasState.Aliased;\n\t\t\treturn localResult ? \"Success\" : \"Conflict\";\n\t\t}\n\n\t\tconst aliased = await this.ackBasedPromise<boolean>((resolve) => {\n\t\t\tthis.parentContext.submitMessage(ContainerMessageType.Alias, message, resolve);\n\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"AliasingException\",\n\t\t\t\t\t\talias: {\n\t\t\t\t\t\t\tvalue: alias,\n\t\t\t\t\t\t\ttag: TelemetryDataTag.UserData,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinternalId: {\n\t\t\t\t\t\t\tvalue: this.internalId,\n\t\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\n\t\t\t\treturn false;\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tthis.pendingAliases.delete(alias);\n\t\t\t});\n\n\t\tif (!aliased) {\n\t\t\tthis.aliasState = AliasState.None;\n\t\t\tthis.aliasResult = undefined;\n\t\t\treturn \"Conflict\";\n\t\t}\n\n\t\tthis.alias = alias;\n\t\tthis.aliasState = AliasState.Aliased;\n\t\treturn \"Success\";\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.entryPoint}\n\t */\n\tget entryPoint(): IFluidHandleInternal<FluidObject> {\n\t\treturn this.fluidDataStoreChannel.entryPoint;\n\t}\n\n\tconstructor(\n\t\tprivate readonly fluidDataStoreChannel: IFluidDataStoreChannel,\n\t\tprivate readonly internalId: string,\n\t\tprivate readonly channelCollection: ChannelCollection,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly parentContext = channelCollection.parentContext,\n\t) {\n\t\tthis.pendingAliases = channelCollection.pendingAliases;\n\t}\n\n\tprivate async ackBasedPromise<T>(\n\t\texecutor: (\n\t\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\t\treject: (reason?: 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.parentContext.containerRuntime.disposed) {\n\t\t\t\trejectBecauseDispose();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.parentContext.containerRuntime.on(\"dispose\", rejectBecauseDispose);\n\t\t\texecutor(resolve, reject);\n\t\t}).finally(() => {\n\t\t\tthis.parentContext.containerRuntime.off(\"dispose\", rejectBecauseDispose);\n\t\t});\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dataStore.js","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAGpE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAM9E,OAAO,EAEN,gBAAgB,EAChB,UAAU,GACV,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAazD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACtC,0BAA+B,EACwB,EAAE;IACzD,OAAO,CACN,OAAO,0BAA0B,EAAE,UAAU,KAAK,Q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Aa,GAAb,aAAa,CAAkC;QAEhE,IAAI,CAAC,cAAc,GAAG,iBAAiB,CAAC,cAAc,CAAC;IACxD,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,aAAa,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;gBAClD,oBAAoB,EAAE,CAAC;gBACvB,OAAO;YACR,CAAC;YAED,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;YACxE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;YACf,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { FluidObject } from \"@fluidframework/core-interfaces\";\nimport { type IFluidHandleInternal } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport {\n\tAliasResult,\n\tIDataStore,\n\tIFluidDataStoreChannel,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tTelemetryDataTag,\n\tUsageError,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ChannelCollection } from \"./channelCollection.js\";\nimport { ContainerMessageType } from \"./messageTypes.js\";\n\n/**\n * Interface for an op to be used for assigning an\n * alias to a datastore\n */\nexport interface IDataStoreAliasMessage {\n\t/** 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\tchannelCollection: ChannelCollection,\n\tlogger: ITelemetryLoggerExt,\n): IDataStore => new DataStore(fluidDataStoreChannel, internalId, channelCollection, logger);\n\nenum AliasState {\n\tAliased = \"Aliased\",\n\tAliasing = \"Aliasing\",\n\tNone = \"None\",\n}\n\nclass DataStore implements IDataStore {\n\tprivate aliasState: AliasState = AliasState.None;\n\tprivate alias: string | undefined;\n\tprivate readonly pendingAliases: Map<string, Promise<AliasResult>>;\n\tprivate aliasResult: Promise<AliasResult> | undefined;\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.trySetAlias}\n\t */\n\tasync trySetAlias(alias: string): Promise<AliasResult> {\n\t\tif (alias.includes(\"/\")) {\n\t\t\tthrow new UsageError(`The alias cannot contain slashes: '${alias}'`);\n\t\t}\n\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\t\tthis.fluidDataStoreChannel.makeVisibleAndAttachGraph();\n\n\t\tif (this.parentContext.attachState === AttachState.Detached) {\n\t\t\tconst localResult = this.channelCollection.processAliasMessageCore(\n\t\t\t\tthis.internalId,\n\t\t\t\talias,\n\t\t\t);\n\t\t\t// Explicitly lock-out future attempts of aliasing,\n\t\t\t// regardless of result\n\t\t\tthis.aliasState = AliasState.Aliased;\n\t\t\treturn localResult ? \"Success\" : \"Conflict\";\n\t\t}\n\n\t\tconst aliased = await this.ackBasedPromise<boolean>((resolve) => {\n\t\t\tthis.parentContext.submitMessage(ContainerMessageType.Alias, message, resolve);\n\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"AliasingException\",\n\t\t\t\t\t\talias: {\n\t\t\t\t\t\t\tvalue: alias,\n\t\t\t\t\t\t\ttag: TelemetryDataTag.UserData,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinternalId: {\n\t\t\t\t\t\t\tvalue: this.internalId,\n\t\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\n\t\t\t\treturn false;\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tthis.pendingAliases.delete(alias);\n\t\t\t});\n\n\t\tif (!aliased) {\n\t\t\tthis.aliasState = AliasState.None;\n\t\t\tthis.aliasResult = undefined;\n\t\t\treturn \"Conflict\";\n\t\t}\n\n\t\tthis.alias = alias;\n\t\tthis.aliasState = AliasState.Aliased;\n\t\treturn \"Success\";\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.entryPoint}\n\t */\n\tget entryPoint(): IFluidHandleInternal<FluidObject> {\n\t\treturn this.fluidDataStoreChannel.entryPoint;\n\t}\n\n\tconstructor(\n\t\tprivate readonly fluidDataStoreChannel: IFluidDataStoreChannel,\n\t\tprivate readonly internalId: string,\n\t\tprivate readonly channelCollection: ChannelCollection,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly parentContext = channelCollection.parentContext,\n\t) {\n\t\tthis.pendingAliases = channelCollection.pendingAliases;\n\t}\n\n\tprivate async ackBasedPromise<T>(\n\t\texecutor: (\n\t\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\t\treject: (reason?: 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.parentContext.containerRuntime.disposed) {\n\t\t\t\trejectBecauseDispose();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.parentContext.containerRuntime.on(\"dispose\", rejectBecauseDispose);\n\t\t\texecutor(resolve, reject);\n\t\t}).finally(() => {\n\t\t\tthis.parentContext.containerRuntime.off(\"dispose\", rejectBecauseDispose);\n\t\t});\n\t}\n}\n"]}
|
|
@@ -7,8 +7,8 @@ import { AttachState, IAudience } from "@fluidframework/container-definitions";
|
|
|
7
7
|
import { IDeltaManager } from "@fluidframework/container-definitions/internal";
|
|
8
8
|
import { FluidObject, IDisposable, IRequest, IResponse, type IEvent } from "@fluidframework/core-interfaces";
|
|
9
9
|
import { type IFluidHandleInternal } from "@fluidframework/core-interfaces/internal";
|
|
10
|
-
import { IClientDetails, IQuorumClients
|
|
11
|
-
import { IDocumentStorageService, type ISnapshot, IDocumentMessage, ISnapshotTree, ITreeEntry } from "@fluidframework/driver-definitions/internal";
|
|
10
|
+
import { IClientDetails, IQuorumClients } from "@fluidframework/driver-definitions";
|
|
11
|
+
import { IDocumentStorageService, type ISnapshot, IDocumentMessage, ISnapshotTree, ITreeEntry, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
12
12
|
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
13
13
|
import { ISummaryTreeWithStats, ITelemetryContext, IGarbageCollectionData, CreateChildSummarizerNodeFn, CreateChildSummarizerNodeParam, IContainerRuntimeBase, IDataStore, IFluidDataStoreChannel, IFluidDataStoreContext, IFluidDataStoreContextDetached, IFluidDataStoreRegistry, IFluidParentContext, IGarbageCollectionDetailsBase, IProvideFluidDataStoreFactory, ISummarizeResult, ISummarizerNodeWithGC, SummarizeInternalFn, IInboundSignalMessage } from "@fluidframework/runtime-definitions/internal";
|
|
14
14
|
import { MonitoringContext } from "@fluidframework/telemetry-utils/internal";
|
|
@@ -224,20 +224,6 @@ export declare abstract class FluidDataStoreContext extends TypedEventEmitter<IF
|
|
|
224
224
|
*/
|
|
225
225
|
updateUsedRoutes(usedRoutes: string[]): void;
|
|
226
226
|
/**
|
|
227
|
-
* @deprecated There is no replacement for this, its functionality is no longer needed at this layer.
|
|
228
|
-
* It will be removed in a future release, sometime after 2.0.0-internal.8.0.0
|
|
229
|
-
*
|
|
230
|
-
* Similar capability is exposed with from/to string paths instead of handles via @see addedGCOutboundRoute
|
|
231
|
-
*
|
|
232
|
-
* Called when a new outbound reference is added to another node. This is used by garbage collection to identify
|
|
233
|
-
* all references added in the system.
|
|
234
|
-
* @param srcHandle - The handle of the node that added the reference.
|
|
235
|
-
* @param outboundHandle - The handle of the outbound node that is referenced.
|
|
236
|
-
*/
|
|
237
|
-
addedGCOutboundReference(srcHandle: IFluidHandleInternal, outboundHandle: IFluidHandleInternal): void;
|
|
238
|
-
/**
|
|
239
|
-
* (Same as @see addedGCOutboundReference, but with string paths instead of handles)
|
|
240
|
-
*
|
|
241
227
|
* Called when a new outbound reference is added to another node. This is used by garbage collection to identify
|
|
242
228
|
* all references added in the system.
|
|
243
229
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreContext.d.ts","sourceRoot":"","sources":["../src/dataStoreContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC/E,OAAO,EACN,WAAW,EACX,WAAW,EACX,QAAQ,EACR,SAAS,EAET,KAAK,MAAM,EACX,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAErF,OAAO,
|
|
1
|
+
{"version":3,"file":"dataStoreContext.d.ts","sourceRoot":"","sources":["../src/dataStoreContext.ts"],"names":[],"mappings":"AAAA;;;GAGG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AAG,CAAC;gBAEtB,KAAK,EAAE,gCAAgC;IAe5C,cAAc,CAAC,WAAW,EAAE,WAAW,CAAC,SAAS,GAAG,WAAW,CAAC,QAAQ,GAAG,IAAI;IA4CtF;;OAEG;IACI,aAAa,CACnB,aAAa,EAAE,OAAO,EACtB,gBAAgB,CAAC,EAAE,iBAAiB,GAClC;QACF,aAAa,EAAE,qBAAqB,CAAC;QACrC,IAAI,EAAE,MAAM,CAAC;KACb;IAoCD,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAkCrC;IAEU,yBAAyB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAInE;;;;;;OAMG;IACI,MAAM;CAcb;AAED;;;;;;GAMG;AACH,qBAAa,0BAA2B,SAAQ,8BAA8B;gBACjE,KAAK,EAAE,gCAAgC;CAGnD;AAED;;;;;GAKG;AACH,qBAAa,kCACZ,SAAQ,8BACR,YAAW,8BAA8B;gBAE7B,KAAK,EAAE,wCAAwC;IAK3D,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAkD;IAE1E,aAAa,CACzB,QAAQ,EAAE,6BAA6B,EACvC,gBAAgB,EAAE,sBAAsB,GACtC,OAAO,CAAC,UAAU,CAAC;IAiCT,yBAAyB,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAQnE"}
|
package/lib/dataStoreContext.js
CHANGED
|
@@ -7,9 +7,9 @@ import { AttachState } from "@fluidframework/container-definitions";
|
|
|
7
7
|
import { assert, LazyPromise, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
8
8
|
import { BlobTreeEntry, isInstanceOfISnapshot, readAndParse, } from "@fluidframework/driver-utils/internal";
|
|
9
9
|
import { channelsTreeName, gcDataBlobKey, } from "@fluidframework/runtime-definitions/internal";
|
|
10
|
-
import { addBlobToSummary, isSnapshotFetchRequiredForLoadingGroupId,
|
|
10
|
+
import { addBlobToSummary, isSnapshotFetchRequiredForLoadingGroupId, } from "@fluidframework/runtime-utils/internal";
|
|
11
11
|
import { DataCorruptionError, DataProcessingError, LoggingError, ThresholdCounter, createChildMonitoringContext, extractSafePropertiesFromMessage, generateStack, tagCodeArtifacts, } from "@fluidframework/telemetry-utils/internal";
|
|
12
|
-
import {
|
|
12
|
+
import { sendGCUnexpectedUsageEvent } from "./gc/index.js";
|
|
13
13
|
import { dataStoreAttributesBlobName, getAttributesFormatVersion, getFluidDataStoreAttributes, hasIsolatedChannels, summarizerClientType, wrapSummaryInChannelsTree, } from "./summary/index.js";
|
|
14
14
|
function createAttributes(pkg, isRootDataStore) {
|
|
15
15
|
const stringifiedPkg = JSON.stringify(pkg);
|
|
@@ -28,6 +28,9 @@ export function createAttributesBlob(pkg, isRootDataStore) {
|
|
|
28
28
|
* @internal
|
|
29
29
|
*/
|
|
30
30
|
export class FluidDataStoreContext extends TypedEventEmitter {
|
|
31
|
+
existing;
|
|
32
|
+
isLocalDataStore;
|
|
33
|
+
makeLocallyVisibleFn;
|
|
31
34
|
get packagePath() {
|
|
32
35
|
assert(this.pkg !== undefined, 0x139 /* "Undefined package path" */);
|
|
33
36
|
return this.pkg;
|
|
@@ -69,18 +72,30 @@ export class FluidDataStoreContext extends TypedEventEmitter {
|
|
|
69
72
|
get idCompressor() {
|
|
70
73
|
return this.parentContext.idCompressor;
|
|
71
74
|
}
|
|
75
|
+
_disposed = false;
|
|
72
76
|
get disposed() {
|
|
73
77
|
return this._disposed;
|
|
74
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* A Tombstoned object has been unreferenced long enough that GC knows it won't be referenced again.
|
|
81
|
+
* Tombstoned objects are eventually deleted by GC.
|
|
82
|
+
*/
|
|
83
|
+
_tombstoned = false;
|
|
75
84
|
get tombstoned() {
|
|
76
85
|
return this._tombstoned;
|
|
77
86
|
}
|
|
87
|
+
/** If true, throw an error when a tombstone data store is used. */
|
|
88
|
+
gcThrowOnTombstoneUsage;
|
|
89
|
+
gcTombstoneEnforcementAllowed;
|
|
90
|
+
/** If true, this means that this data store context and its children have been removed from the runtime */
|
|
91
|
+
deleted = false;
|
|
78
92
|
get attachState() {
|
|
79
93
|
return this._attachState;
|
|
80
94
|
}
|
|
81
95
|
get IFluidDataStoreRegistry() {
|
|
82
96
|
return this.registry;
|
|
83
97
|
}
|
|
98
|
+
baseSnapshotSequenceNumber;
|
|
84
99
|
/**
|
|
85
100
|
* A datastore is considered as root if it
|
|
86
101
|
* 1. is root in memory - see isInMemoryRoot
|
|
@@ -110,23 +125,41 @@ export class FluidDataStoreContext extends TypedEventEmitter {
|
|
|
110
125
|
isInMemoryRoot() {
|
|
111
126
|
return this._isInMemoryRoot;
|
|
112
127
|
}
|
|
128
|
+
registry;
|
|
129
|
+
detachedRuntimeCreation = false;
|
|
130
|
+
channel;
|
|
131
|
+
loaded = false;
|
|
132
|
+
pending = [];
|
|
133
|
+
channelP;
|
|
134
|
+
_baseSnapshot;
|
|
135
|
+
_attachState;
|
|
136
|
+
_isInMemoryRoot = false;
|
|
137
|
+
summarizerNode;
|
|
138
|
+
mc;
|
|
139
|
+
thresholdOpsCounter;
|
|
140
|
+
static pendingOpsCountThreshold = 1000;
|
|
141
|
+
/**
|
|
142
|
+
* If the summarizer makes local changes, a telemetry event is logged. This has the potential to be very noisy.
|
|
143
|
+
* So, adding a count of how many telemetry events are logged per data store context. This can be
|
|
144
|
+
* controlled via feature flags.
|
|
145
|
+
*/
|
|
146
|
+
localChangesTelemetryCount;
|
|
147
|
+
// The used routes of this node as per the last GC run. This is used to update the used routes of the channel
|
|
148
|
+
// if it realizes after GC is run.
|
|
149
|
+
lastUsedRoutes;
|
|
150
|
+
id;
|
|
151
|
+
_containerRuntime;
|
|
152
|
+
parentContext;
|
|
153
|
+
storage;
|
|
154
|
+
scope;
|
|
155
|
+
// Represents the group to which the data store belongs too.
|
|
156
|
+
loadingGroupId;
|
|
157
|
+
pkg;
|
|
113
158
|
constructor(props, existing, isLocalDataStore, makeLocallyVisibleFn) {
|
|
114
159
|
super();
|
|
115
160
|
this.existing = existing;
|
|
116
161
|
this.isLocalDataStore = isLocalDataStore;
|
|
117
162
|
this.makeLocallyVisibleFn = makeLocallyVisibleFn;
|
|
118
|
-
this._disposed = false;
|
|
119
|
-
/**
|
|
120
|
-
* A Tombstoned object has been unreferenced long enough that GC knows it won't be referenced again.
|
|
121
|
-
* Tombstoned objects are eventually deleted by GC.
|
|
122
|
-
*/
|
|
123
|
-
this._tombstoned = false;
|
|
124
|
-
/** If true, this means that this data store context and its children have been removed from the runtime */
|
|
125
|
-
this.deleted = false;
|
|
126
|
-
this.detachedRuntimeCreation = false;
|
|
127
|
-
this.loaded = false;
|
|
128
|
-
this.pending = [];
|
|
129
|
-
this._isInMemoryRoot = false;
|
|
130
163
|
this._containerRuntime = props.parentContext.containerRuntime;
|
|
131
164
|
this.parentContext = props.parentContext;
|
|
132
165
|
this.id = props.id;
|
|
@@ -398,26 +431,6 @@ export class FluidDataStoreContext extends TypedEventEmitter {
|
|
|
398
431
|
}
|
|
399
432
|
}
|
|
400
433
|
/**
|
|
401
|
-
* @deprecated There is no replacement for this, its functionality is no longer needed at this layer.
|
|
402
|
-
* It will be removed in a future release, sometime after 2.0.0-internal.8.0.0
|
|
403
|
-
*
|
|
404
|
-
* Similar capability is exposed with from/to string paths instead of handles via @see addedGCOutboundRoute
|
|
405
|
-
*
|
|
406
|
-
* Called when a new outbound reference is added to another node. This is used by garbage collection to identify
|
|
407
|
-
* all references added in the system.
|
|
408
|
-
* @param srcHandle - The handle of the node that added the reference.
|
|
409
|
-
* @param outboundHandle - The handle of the outbound node that is referenced.
|
|
410
|
-
*/
|
|
411
|
-
addedGCOutboundReference(srcHandle, outboundHandle) {
|
|
412
|
-
// By default, skip this call since the ContainerRuntime will detect the outbound route directly.
|
|
413
|
-
if (this.mc.config.getBoolean(detectOutboundRoutesViaDDSKey) === true) {
|
|
414
|
-
// Note: The ContainerRuntime code will check this same setting to avoid double counting.
|
|
415
|
-
this.parentContext.addedGCOutboundReference?.(toFluidHandleInternal(srcHandle), toFluidHandleInternal(outboundHandle));
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
/**
|
|
419
|
-
* (Same as @see addedGCOutboundReference, but with string paths instead of handles)
|
|
420
|
-
*
|
|
421
434
|
* Called when a new outbound reference is added to another node. This is used by garbage collection to identify
|
|
422
435
|
* all references added in the system.
|
|
423
436
|
*
|
|
@@ -425,7 +438,7 @@ export class FluidDataStoreContext extends TypedEventEmitter {
|
|
|
425
438
|
* @param toPath - The absolute path of the outbound node that is referenced.
|
|
426
439
|
*/
|
|
427
440
|
addedGCOutboundRoute(fromPath, toPath) {
|
|
428
|
-
this.parentContext.
|
|
441
|
+
this.parentContext.addedGCOutboundRoute(fromPath, toPath);
|
|
429
442
|
}
|
|
430
443
|
/**
|
|
431
444
|
* Updates the used routes of the channel and its child contexts. The channel must be loaded before calling this.
|
|
@@ -650,68 +663,16 @@ export class FluidDataStoreContext extends TypedEventEmitter {
|
|
|
650
663
|
return this.parentContext.uploadBlob(blob, signal);
|
|
651
664
|
}
|
|
652
665
|
}
|
|
653
|
-
FluidDataStoreContext.pendingOpsCountThreshold = 1000;
|
|
654
666
|
/** @internal */
|
|
655
667
|
export class RemoteFluidDataStoreContext extends FluidDataStoreContext {
|
|
668
|
+
// Tells whether we need to fetch the snapshot before use. This is to support Data Virtualization.
|
|
669
|
+
snapshotFetchRequired;
|
|
670
|
+
runtime;
|
|
671
|
+
blobContents;
|
|
656
672
|
constructor(props) {
|
|
657
673
|
super(props, true /* existing */, false /* isLocalDataStore */, () => {
|
|
658
674
|
throw new Error("Already attached");
|
|
659
675
|
});
|
|
660
|
-
this.initialSnapshotDetailsP = new LazyPromise(async () => {
|
|
661
|
-
// Sequence number of the snapshot.
|
|
662
|
-
let sequenceNumber;
|
|
663
|
-
// Check whether we need to fetch the snapshot first to load.
|
|
664
|
-
if (this.snapshotFetchRequired === undefined && this._baseSnapshot?.groupId !== undefined) {
|
|
665
|
-
assert(this.blobContents !== undefined, 0x97a /* Blob contents should be present to evaluate */);
|
|
666
|
-
assert(this._baseSnapshot !== undefined, 0x97b /* snapshotTree should be present to evaluate */);
|
|
667
|
-
this.snapshotFetchRequired = isSnapshotFetchRequiredForLoadingGroupId(this._baseSnapshot, this.blobContents);
|
|
668
|
-
}
|
|
669
|
-
if (this.snapshotFetchRequired) {
|
|
670
|
-
assert(this.loadingGroupId !== undefined, 0x8f5 /* groupId should be present to fetch snapshot */);
|
|
671
|
-
const snapshot = await this.runtime.getSnapshotForLoadingGroupId([this.loadingGroupId], [this.id]);
|
|
672
|
-
this._baseSnapshot = snapshot.snapshotTree;
|
|
673
|
-
sequenceNumber = snapshot.sequenceNumber;
|
|
674
|
-
this.snapshotFetchRequired = false;
|
|
675
|
-
}
|
|
676
|
-
let tree = this.baseSnapshot;
|
|
677
|
-
let isRootDataStore = true;
|
|
678
|
-
if (!!tree && tree.blobs[dataStoreAttributesBlobName] !== undefined) {
|
|
679
|
-
// Need to get through snapshot and use that to populate extraBlobs
|
|
680
|
-
// eslint-disable-next-line import/no-deprecated
|
|
681
|
-
const attributes = await readAndParse(this.storage, tree.blobs[dataStoreAttributesBlobName]);
|
|
682
|
-
let pkgFromSnapshot;
|
|
683
|
-
// Use the snapshotFormatVersion to determine how the pkg is encoded in the snapshot.
|
|
684
|
-
// For snapshotFormatVersion = "0.1" (1) or above, pkg is jsonified, otherwise it is just a string.
|
|
685
|
-
const formatVersion = getAttributesFormatVersion(attributes);
|
|
686
|
-
if (formatVersion < 1) {
|
|
687
|
-
pkgFromSnapshot =
|
|
688
|
-
attributes.pkg.startsWith('["') && attributes.pkg.endsWith('"]')
|
|
689
|
-
? JSON.parse(attributes.pkg)
|
|
690
|
-
: [attributes.pkg];
|
|
691
|
-
}
|
|
692
|
-
else {
|
|
693
|
-
pkgFromSnapshot = JSON.parse(attributes.pkg);
|
|
694
|
-
}
|
|
695
|
-
this.pkg = pkgFromSnapshot;
|
|
696
|
-
/**
|
|
697
|
-
* If there is no isRootDataStore in the attributes blob, set it to true. This will ensure that
|
|
698
|
-
* data stores in older documents are not garbage collected incorrectly. This may lead to additional
|
|
699
|
-
* roots in the document but they won't break.
|
|
700
|
-
*/
|
|
701
|
-
isRootDataStore = attributes.isRootDataStore ?? true;
|
|
702
|
-
if (hasIsolatedChannels(attributes)) {
|
|
703
|
-
tree = tree.trees[channelsTreeName];
|
|
704
|
-
assert(tree !== undefined, 0x1fe /* "isolated channels subtree should exist in remote datastore snapshot" */);
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
assert(this.pkg !== undefined, 0x8f6 /* The datastore context package should be defined */);
|
|
708
|
-
return {
|
|
709
|
-
pkg: this.pkg,
|
|
710
|
-
isRootDataStore,
|
|
711
|
-
snapshot: tree,
|
|
712
|
-
sequenceNumber,
|
|
713
|
-
};
|
|
714
|
-
});
|
|
715
676
|
this.runtime = props.parentContext.containerRuntime;
|
|
716
677
|
if (isInstanceOfISnapshot(props.snapshot)) {
|
|
717
678
|
this.blobContents = props.snapshot.blobContents;
|
|
@@ -735,6 +696,61 @@ export class RemoteFluidDataStoreContext extends FluidDataStoreContext {
|
|
|
735
696
|
4. attach op for this data store is processed - setAttachState() is called.
|
|
736
697
|
*/
|
|
737
698
|
setAttachState(attachState) { }
|
|
699
|
+
initialSnapshotDetailsP = new LazyPromise(async () => {
|
|
700
|
+
// Sequence number of the snapshot.
|
|
701
|
+
let sequenceNumber;
|
|
702
|
+
// Check whether we need to fetch the snapshot first to load.
|
|
703
|
+
if (this.snapshotFetchRequired === undefined && this._baseSnapshot?.groupId !== undefined) {
|
|
704
|
+
assert(this.blobContents !== undefined, 0x97a /* Blob contents should be present to evaluate */);
|
|
705
|
+
assert(this._baseSnapshot !== undefined, 0x97b /* snapshotTree should be present to evaluate */);
|
|
706
|
+
this.snapshotFetchRequired = isSnapshotFetchRequiredForLoadingGroupId(this._baseSnapshot, this.blobContents);
|
|
707
|
+
}
|
|
708
|
+
if (this.snapshotFetchRequired) {
|
|
709
|
+
assert(this.loadingGroupId !== undefined, 0x8f5 /* groupId should be present to fetch snapshot */);
|
|
710
|
+
const snapshot = await this.runtime.getSnapshotForLoadingGroupId([this.loadingGroupId], [this.id]);
|
|
711
|
+
this._baseSnapshot = snapshot.snapshotTree;
|
|
712
|
+
sequenceNumber = snapshot.sequenceNumber;
|
|
713
|
+
this.snapshotFetchRequired = false;
|
|
714
|
+
}
|
|
715
|
+
let tree = this.baseSnapshot;
|
|
716
|
+
let isRootDataStore = true;
|
|
717
|
+
if (!!tree && tree.blobs[dataStoreAttributesBlobName] !== undefined) {
|
|
718
|
+
// Need to get through snapshot and use that to populate extraBlobs
|
|
719
|
+
// eslint-disable-next-line import/no-deprecated
|
|
720
|
+
const attributes = await readAndParse(this.storage, tree.blobs[dataStoreAttributesBlobName]);
|
|
721
|
+
let pkgFromSnapshot;
|
|
722
|
+
// Use the snapshotFormatVersion to determine how the pkg is encoded in the snapshot.
|
|
723
|
+
// For snapshotFormatVersion = "0.1" (1) or above, pkg is jsonified, otherwise it is just a string.
|
|
724
|
+
const formatVersion = getAttributesFormatVersion(attributes);
|
|
725
|
+
if (formatVersion < 1) {
|
|
726
|
+
pkgFromSnapshot =
|
|
727
|
+
attributes.pkg.startsWith('["') && attributes.pkg.endsWith('"]')
|
|
728
|
+
? JSON.parse(attributes.pkg)
|
|
729
|
+
: [attributes.pkg];
|
|
730
|
+
}
|
|
731
|
+
else {
|
|
732
|
+
pkgFromSnapshot = JSON.parse(attributes.pkg);
|
|
733
|
+
}
|
|
734
|
+
this.pkg = pkgFromSnapshot;
|
|
735
|
+
/**
|
|
736
|
+
* If there is no isRootDataStore in the attributes blob, set it to true. This will ensure that
|
|
737
|
+
* data stores in older documents are not garbage collected incorrectly. This may lead to additional
|
|
738
|
+
* roots in the document but they won't break.
|
|
739
|
+
*/
|
|
740
|
+
isRootDataStore = attributes.isRootDataStore ?? true;
|
|
741
|
+
if (hasIsolatedChannels(attributes)) {
|
|
742
|
+
tree = tree.trees[channelsTreeName];
|
|
743
|
+
assert(tree !== undefined, 0x1fe /* "isolated channels subtree should exist in remote datastore snapshot" */);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
assert(this.pkg !== undefined, 0x8f6 /* The datastore context package should be defined */);
|
|
747
|
+
return {
|
|
748
|
+
pkg: this.pkg,
|
|
749
|
+
isRootDataStore,
|
|
750
|
+
snapshot: tree,
|
|
751
|
+
sequenceNumber,
|
|
752
|
+
};
|
|
753
|
+
});
|
|
738
754
|
async getInitialSnapshotDetails() {
|
|
739
755
|
return this.initialSnapshotDetailsP;
|
|
740
756
|
}
|
|
@@ -750,39 +766,13 @@ export class RemoteFluidDataStoreContext extends FluidDataStoreContext {
|
|
|
750
766
|
* @internal
|
|
751
767
|
*/
|
|
752
768
|
export class LocalFluidDataStoreContextBase extends FluidDataStoreContext {
|
|
769
|
+
snapshotTree;
|
|
770
|
+
/**
|
|
771
|
+
* @deprecated 0.16 Issue #1635, #3631
|
|
772
|
+
*/
|
|
773
|
+
createProps;
|
|
753
774
|
constructor(props) {
|
|
754
775
|
super(props, props.snapshotTree !== undefined /* existing */, true /* isLocalDataStore */, props.makeLocallyVisibleFn);
|
|
755
|
-
this.initialSnapshotDetailsP = new LazyPromise(async () => {
|
|
756
|
-
let snapshot = this.snapshotTree;
|
|
757
|
-
// eslint-disable-next-line import/no-deprecated
|
|
758
|
-
let attributes;
|
|
759
|
-
let isRootDataStore = false;
|
|
760
|
-
if (snapshot !== undefined) {
|
|
761
|
-
// Get the dataStore attributes.
|
|
762
|
-
// Note: storage can be undefined in special case while detached.
|
|
763
|
-
attributes = await getFluidDataStoreAttributes(this.storage, snapshot);
|
|
764
|
-
if (hasIsolatedChannels(attributes)) {
|
|
765
|
-
snapshot = snapshot.trees[channelsTreeName];
|
|
766
|
-
assert(snapshot !== undefined, 0x1ff /* "isolated channels subtree should exist in local datastore snapshot" */);
|
|
767
|
-
}
|
|
768
|
-
if (this.pkg === undefined) {
|
|
769
|
-
this.pkg = JSON.parse(attributes.pkg);
|
|
770
|
-
// If there is no isRootDataStore in the attributes blob, set it to true. This ensures that data
|
|
771
|
-
// stores in older documents are not garbage collected incorrectly. This may lead to additional
|
|
772
|
-
// roots in the document but they won't break.
|
|
773
|
-
if (attributes.isRootDataStore ?? true) {
|
|
774
|
-
isRootDataStore = true;
|
|
775
|
-
this.setInMemoryRoot();
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
assert(this.pkg !== undefined, 0x152 /* "pkg should be available in local data store" */);
|
|
780
|
-
return {
|
|
781
|
-
pkg: this.pkg,
|
|
782
|
-
isRootDataStore,
|
|
783
|
-
snapshot,
|
|
784
|
-
};
|
|
785
|
-
});
|
|
786
776
|
// Summarizer client should not create local data stores.
|
|
787
777
|
this.identifyLocalChangeInSummarizer("DataStoreCreatedInSummarizer");
|
|
788
778
|
this.snapshotTree = props.snapshotTree;
|
|
@@ -854,6 +844,37 @@ export class LocalFluidDataStoreContextBase extends FluidDataStoreContext {
|
|
|
854
844
|
type: this.pkg[this.pkg.length - 1],
|
|
855
845
|
};
|
|
856
846
|
}
|
|
847
|
+
initialSnapshotDetailsP = new LazyPromise(async () => {
|
|
848
|
+
let snapshot = this.snapshotTree;
|
|
849
|
+
// eslint-disable-next-line import/no-deprecated
|
|
850
|
+
let attributes;
|
|
851
|
+
let isRootDataStore = false;
|
|
852
|
+
if (snapshot !== undefined) {
|
|
853
|
+
// Get the dataStore attributes.
|
|
854
|
+
// Note: storage can be undefined in special case while detached.
|
|
855
|
+
attributes = await getFluidDataStoreAttributes(this.storage, snapshot);
|
|
856
|
+
if (hasIsolatedChannels(attributes)) {
|
|
857
|
+
snapshot = snapshot.trees[channelsTreeName];
|
|
858
|
+
assert(snapshot !== undefined, 0x1ff /* "isolated channels subtree should exist in local datastore snapshot" */);
|
|
859
|
+
}
|
|
860
|
+
if (this.pkg === undefined) {
|
|
861
|
+
this.pkg = JSON.parse(attributes.pkg);
|
|
862
|
+
// If there is no isRootDataStore in the attributes blob, set it to true. This ensures that data
|
|
863
|
+
// stores in older documents are not garbage collected incorrectly. This may lead to additional
|
|
864
|
+
// roots in the document but they won't break.
|
|
865
|
+
if (attributes.isRootDataStore ?? true) {
|
|
866
|
+
isRootDataStore = true;
|
|
867
|
+
this.setInMemoryRoot();
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
assert(this.pkg !== undefined, 0x152 /* "pkg should be available in local data store" */);
|
|
872
|
+
return {
|
|
873
|
+
pkg: this.pkg,
|
|
874
|
+
isRootDataStore,
|
|
875
|
+
snapshot,
|
|
876
|
+
};
|
|
877
|
+
});
|
|
857
878
|
async getInitialSnapshotDetails() {
|
|
858
879
|
return this.initialSnapshotDetailsP;
|
|
859
880
|
}
|
|
@@ -899,6 +920,7 @@ export class LocalDetachedFluidDataStoreContext extends LocalFluidDataStoreConte
|
|
|
899
920
|
this.detachedRuntimeCreation = true;
|
|
900
921
|
this.channelToDataStoreFn = props.channelToDataStoreFn;
|
|
901
922
|
}
|
|
923
|
+
channelToDataStoreFn;
|
|
902
924
|
async attachRuntime(registry, dataStoreChannel) {
|
|
903
925
|
assert(this.detachedRuntimeCreation, 0x154 /* "runtime creation is already attached" */);
|
|
904
926
|
this.detachedRuntimeCreation = false;
|