@fluidframework/container-runtime 2.0.0-dev-rc.5.0.0.268409 → 2.0.0-dev-rc.5.0.0.270987
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/biome.jsonc +4 -0
- 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 +8 -9
- package/dist/channelCollection.d.ts.map +1 -1
- package/dist/channelCollection.js +71 -51
- 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 +23 -37
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +159 -133
- 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 +8 -9
- package/lib/channelCollection.d.ts.map +1 -1
- package/lib/channelCollection.js +72 -53
- 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 +23 -37
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +162 -136
- 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 +23 -20
- package/src/batchTracker.ts +1 -1
- package/src/blobManager.ts +1 -39
- package/src/channelCollection.ts +63 -76
- package/src/connectionTelemetry.ts +5 -2
- package/src/containerRuntime.ts +9 -32
- package/src/dataStoreContext.ts +38 -79
- 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/dist/dataStore.js
CHANGED
|
@@ -29,6 +29,15 @@ var AliasState;
|
|
|
29
29
|
AliasState["None"] = "None";
|
|
30
30
|
})(AliasState || (AliasState = {}));
|
|
31
31
|
class DataStore {
|
|
32
|
+
fluidDataStoreChannel;
|
|
33
|
+
internalId;
|
|
34
|
+
channelCollection;
|
|
35
|
+
logger;
|
|
36
|
+
parentContext;
|
|
37
|
+
aliasState = AliasState.None;
|
|
38
|
+
alias;
|
|
39
|
+
pendingAliases;
|
|
40
|
+
aliasResult;
|
|
32
41
|
/**
|
|
33
42
|
* {@inheritDoc @fluidframework/runtime-definitions#IDataStore.trySetAlias}
|
|
34
43
|
*/
|
|
@@ -120,7 +129,6 @@ class DataStore {
|
|
|
120
129
|
this.channelCollection = channelCollection;
|
|
121
130
|
this.logger = logger;
|
|
122
131
|
this.parentContext = parentContext;
|
|
123
|
-
this.aliasState = AliasState.None;
|
|
124
132
|
this.pendingAliases = channelCollection.pendingAliases;
|
|
125
133
|
}
|
|
126
134
|
async ackBasedPromise(executor) {
|
package/dist/dataStore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStore.js","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iFAAoE;AAGpE,kEAA8E;AAM9E,uEAIkD;AAGlD,uDAAyD;AAazD;;;;;GAKG;AACI,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;AAPW,QAAA,uBAAuB,2BAOlC;AAEK,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;AALhF,QAAA,kBAAkB,sBAK8D;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,qBAAU,CAAC,sCAAsC,KAAK,GAAG,CAAC,CAAC;QACtE,CAAC;QAED,QAAQ,IAAI,CAAC,UAAU,EAAE,CAAC;YACzB,yEAAyE;YACzE,wDAAwD;YACxD,KAAK,UAAU,CAAC,QAAQ;gBACvB,IAAA,iBAAM,EACL,IAAI,CAAC,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IT 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,iFAAoE;AAGpE,kEAA8E;AAM9E,uEAIkD;AAGlD,uDAAyD;AAazD;;;;;GAKG;AACI,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;AAPW,QAAA,uBAAuB,2BAOlC;AAEK,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,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E;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";
|
|
@@ -27,10 +27,8 @@ export interface ISnapshotDetails {
|
|
|
27
27
|
* @internal
|
|
28
28
|
*/
|
|
29
29
|
export interface IFluidDataStoreContextInternal extends IFluidDataStoreContext {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
type: string;
|
|
33
|
-
};
|
|
30
|
+
getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
|
|
31
|
+
getAttachGCData(telemetryContext?: ITelemetryContext): IGarbageCollectionData;
|
|
34
32
|
getInitialSnapshotDetails(): Promise<ISnapshotDetails>;
|
|
35
33
|
realize(): Promise<IFluidDataStoreChannel>;
|
|
36
34
|
isRoot(): Promise<boolean>;
|
|
@@ -224,20 +222,6 @@ export declare abstract class FluidDataStoreContext extends TypedEventEmitter<IF
|
|
|
224
222
|
*/
|
|
225
223
|
updateUsedRoutes(usedRoutes: string[]): void;
|
|
226
224
|
/**
|
|
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
225
|
* Called when a new outbound reference is added to another node. This is used by garbage collection to identify
|
|
242
226
|
* all references added in the system.
|
|
243
227
|
*
|
|
@@ -284,15 +268,15 @@ export declare abstract class FluidDataStoreContext extends TypedEventEmitter<IF
|
|
|
284
268
|
protected bindRuntime(channel: IFluidDataStoreChannel, existing: boolean): Promise<void>;
|
|
285
269
|
getAbsoluteUrl(relativeUrl: string): Promise<string | undefined>;
|
|
286
270
|
/**
|
|
287
|
-
* Get the
|
|
271
|
+
* Get the summary required when attaching this context's DataStore.
|
|
288
272
|
* Used for both Container Attach and DataStore Attach.
|
|
289
|
-
*
|
|
290
|
-
* @returns the summary, type, and GC Data for this context's DataStore.
|
|
291
273
|
*/
|
|
292
|
-
abstract
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
274
|
+
abstract getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
|
|
275
|
+
/**
|
|
276
|
+
* Get the GC Data for the initial state being attached so remote clients can learn of this DataStore's
|
|
277
|
+
* outbound routes.
|
|
278
|
+
*/
|
|
279
|
+
abstract getAttachGCData(telemetryContext?: ITelemetryContext): IGarbageCollectionData;
|
|
296
280
|
abstract getInitialSnapshotDetails(): Promise<ISnapshotDetails>;
|
|
297
281
|
/**
|
|
298
282
|
* @deprecated Sets the datastore as root, for aliasing purposes: #7948
|
|
@@ -328,12 +312,13 @@ export declare class RemoteFluidDataStoreContext extends FluidDataStoreContext {
|
|
|
328
312
|
private readonly initialSnapshotDetailsP;
|
|
329
313
|
getInitialSnapshotDetails(): Promise<ISnapshotDetails>;
|
|
330
314
|
/**
|
|
331
|
-
* @see FluidDataStoreContext.
|
|
315
|
+
* @see FluidDataStoreContext.getAttachSummary
|
|
332
316
|
*/
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
317
|
+
getAttachSummary(): ISummaryTreeWithStats;
|
|
318
|
+
/**
|
|
319
|
+
* @see FluidDataStoreContext.getAttachGCData
|
|
320
|
+
*/
|
|
321
|
+
getAttachGCData(telemetryContext?: ITelemetryContext): IGarbageCollectionData;
|
|
337
322
|
}
|
|
338
323
|
/**
|
|
339
324
|
* Base class for detached & attached context classes
|
|
@@ -348,12 +333,13 @@ export declare class LocalFluidDataStoreContextBase extends FluidDataStoreContex
|
|
|
348
333
|
constructor(props: ILocalFluidDataStoreContextProps);
|
|
349
334
|
setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void;
|
|
350
335
|
/**
|
|
351
|
-
* @see FluidDataStoreContext.
|
|
336
|
+
* @see FluidDataStoreContext.getAttachSummary
|
|
337
|
+
*/
|
|
338
|
+
getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
|
|
339
|
+
/**
|
|
340
|
+
* @see FluidDataStoreContext.getAttachGCData
|
|
352
341
|
*/
|
|
353
|
-
|
|
354
|
-
attachSummary: ISummaryTreeWithStats;
|
|
355
|
-
type: string;
|
|
356
|
-
};
|
|
342
|
+
getAttachGCData(telemetryContext?: ITelemetryContext): IGarbageCollectionData;
|
|
357
343
|
private readonly initialSnapshotDetailsP;
|
|
358
344
|
getInitialSnapshotDetails(): Promise<ISnapshotDetails>;
|
|
359
345
|
/**
|
|
@@ -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;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,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,oC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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/dist/dataStoreContext.js
CHANGED
|
@@ -32,6 +32,9 @@ exports.createAttributesBlob = createAttributesBlob;
|
|
|
32
32
|
* @internal
|
|
33
33
|
*/
|
|
34
34
|
class FluidDataStoreContext extends client_utils_1.TypedEventEmitter {
|
|
35
|
+
existing;
|
|
36
|
+
isLocalDataStore;
|
|
37
|
+
makeLocallyVisibleFn;
|
|
35
38
|
get packagePath() {
|
|
36
39
|
(0, internal_1.assert)(this.pkg !== undefined, 0x139 /* "Undefined package path" */);
|
|
37
40
|
return this.pkg;
|
|
@@ -73,18 +76,30 @@ class FluidDataStoreContext extends client_utils_1.TypedEventEmitter {
|
|
|
73
76
|
get idCompressor() {
|
|
74
77
|
return this.parentContext.idCompressor;
|
|
75
78
|
}
|
|
79
|
+
_disposed = false;
|
|
76
80
|
get disposed() {
|
|
77
81
|
return this._disposed;
|
|
78
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* A Tombstoned object has been unreferenced long enough that GC knows it won't be referenced again.
|
|
85
|
+
* Tombstoned objects are eventually deleted by GC.
|
|
86
|
+
*/
|
|
87
|
+
_tombstoned = false;
|
|
79
88
|
get tombstoned() {
|
|
80
89
|
return this._tombstoned;
|
|
81
90
|
}
|
|
91
|
+
/** If true, throw an error when a tombstone data store is used. */
|
|
92
|
+
gcThrowOnTombstoneUsage;
|
|
93
|
+
gcTombstoneEnforcementAllowed;
|
|
94
|
+
/** If true, this means that this data store context and its children have been removed from the runtime */
|
|
95
|
+
deleted = false;
|
|
82
96
|
get attachState() {
|
|
83
97
|
return this._attachState;
|
|
84
98
|
}
|
|
85
99
|
get IFluidDataStoreRegistry() {
|
|
86
100
|
return this.registry;
|
|
87
101
|
}
|
|
102
|
+
baseSnapshotSequenceNumber;
|
|
88
103
|
/**
|
|
89
104
|
* A datastore is considered as root if it
|
|
90
105
|
* 1. is root in memory - see isInMemoryRoot
|
|
@@ -114,23 +129,41 @@ class FluidDataStoreContext extends client_utils_1.TypedEventEmitter {
|
|
|
114
129
|
isInMemoryRoot() {
|
|
115
130
|
return this._isInMemoryRoot;
|
|
116
131
|
}
|
|
132
|
+
registry;
|
|
133
|
+
detachedRuntimeCreation = false;
|
|
134
|
+
channel;
|
|
135
|
+
loaded = false;
|
|
136
|
+
pending = [];
|
|
137
|
+
channelP;
|
|
138
|
+
_baseSnapshot;
|
|
139
|
+
_attachState;
|
|
140
|
+
_isInMemoryRoot = false;
|
|
141
|
+
summarizerNode;
|
|
142
|
+
mc;
|
|
143
|
+
thresholdOpsCounter;
|
|
144
|
+
static pendingOpsCountThreshold = 1000;
|
|
145
|
+
/**
|
|
146
|
+
* If the summarizer makes local changes, a telemetry event is logged. This has the potential to be very noisy.
|
|
147
|
+
* So, adding a count of how many telemetry events are logged per data store context. This can be
|
|
148
|
+
* controlled via feature flags.
|
|
149
|
+
*/
|
|
150
|
+
localChangesTelemetryCount;
|
|
151
|
+
// The used routes of this node as per the last GC run. This is used to update the used routes of the channel
|
|
152
|
+
// if it realizes after GC is run.
|
|
153
|
+
lastUsedRoutes;
|
|
154
|
+
id;
|
|
155
|
+
_containerRuntime;
|
|
156
|
+
parentContext;
|
|
157
|
+
storage;
|
|
158
|
+
scope;
|
|
159
|
+
// Represents the group to which the data store belongs too.
|
|
160
|
+
loadingGroupId;
|
|
161
|
+
pkg;
|
|
117
162
|
constructor(props, existing, isLocalDataStore, makeLocallyVisibleFn) {
|
|
118
163
|
super();
|
|
119
164
|
this.existing = existing;
|
|
120
165
|
this.isLocalDataStore = isLocalDataStore;
|
|
121
166
|
this.makeLocallyVisibleFn = makeLocallyVisibleFn;
|
|
122
|
-
this._disposed = false;
|
|
123
|
-
/**
|
|
124
|
-
* A Tombstoned object has been unreferenced long enough that GC knows it won't be referenced again.
|
|
125
|
-
* Tombstoned objects are eventually deleted by GC.
|
|
126
|
-
*/
|
|
127
|
-
this._tombstoned = false;
|
|
128
|
-
/** If true, this means that this data store context and its children have been removed from the runtime */
|
|
129
|
-
this.deleted = false;
|
|
130
|
-
this.detachedRuntimeCreation = false;
|
|
131
|
-
this.loaded = false;
|
|
132
|
-
this.pending = [];
|
|
133
|
-
this._isInMemoryRoot = false;
|
|
134
167
|
this._containerRuntime = props.parentContext.containerRuntime;
|
|
135
168
|
this.parentContext = props.parentContext;
|
|
136
169
|
this.id = props.id;
|
|
@@ -402,26 +435,6 @@ class FluidDataStoreContext extends client_utils_1.TypedEventEmitter {
|
|
|
402
435
|
}
|
|
403
436
|
}
|
|
404
437
|
/**
|
|
405
|
-
* @deprecated There is no replacement for this, its functionality is no longer needed at this layer.
|
|
406
|
-
* It will be removed in a future release, sometime after 2.0.0-internal.8.0.0
|
|
407
|
-
*
|
|
408
|
-
* Similar capability is exposed with from/to string paths instead of handles via @see addedGCOutboundRoute
|
|
409
|
-
*
|
|
410
|
-
* Called when a new outbound reference is added to another node. This is used by garbage collection to identify
|
|
411
|
-
* all references added in the system.
|
|
412
|
-
* @param srcHandle - The handle of the node that added the reference.
|
|
413
|
-
* @param outboundHandle - The handle of the outbound node that is referenced.
|
|
414
|
-
*/
|
|
415
|
-
addedGCOutboundReference(srcHandle, outboundHandle) {
|
|
416
|
-
// By default, skip this call since the ContainerRuntime will detect the outbound route directly.
|
|
417
|
-
if (this.mc.config.getBoolean(index_js_1.detectOutboundRoutesViaDDSKey) === true) {
|
|
418
|
-
// Note: The ContainerRuntime code will check this same setting to avoid double counting.
|
|
419
|
-
this.parentContext.addedGCOutboundReference?.((0, internal_4.toFluidHandleInternal)(srcHandle), (0, internal_4.toFluidHandleInternal)(outboundHandle));
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
/**
|
|
423
|
-
* (Same as @see addedGCOutboundReference, but with string paths instead of handles)
|
|
424
|
-
*
|
|
425
438
|
* Called when a new outbound reference is added to another node. This is used by garbage collection to identify
|
|
426
439
|
* all references added in the system.
|
|
427
440
|
*
|
|
@@ -429,7 +442,7 @@ class FluidDataStoreContext extends client_utils_1.TypedEventEmitter {
|
|
|
429
442
|
* @param toPath - The absolute path of the outbound node that is referenced.
|
|
430
443
|
*/
|
|
431
444
|
addedGCOutboundRoute(fromPath, toPath) {
|
|
432
|
-
this.parentContext.
|
|
445
|
+
this.parentContext.addedGCOutboundRoute(fromPath, toPath);
|
|
433
446
|
}
|
|
434
447
|
/**
|
|
435
448
|
* Updates the used routes of the channel and its child contexts. The channel must be loaded before calling this.
|
|
@@ -655,68 +668,16 @@ class FluidDataStoreContext extends client_utils_1.TypedEventEmitter {
|
|
|
655
668
|
}
|
|
656
669
|
}
|
|
657
670
|
exports.FluidDataStoreContext = FluidDataStoreContext;
|
|
658
|
-
FluidDataStoreContext.pendingOpsCountThreshold = 1000;
|
|
659
671
|
/** @internal */
|
|
660
672
|
class RemoteFluidDataStoreContext extends FluidDataStoreContext {
|
|
673
|
+
// Tells whether we need to fetch the snapshot before use. This is to support Data Virtualization.
|
|
674
|
+
snapshotFetchRequired;
|
|
675
|
+
runtime;
|
|
676
|
+
blobContents;
|
|
661
677
|
constructor(props) {
|
|
662
678
|
super(props, true /* existing */, false /* isLocalDataStore */, () => {
|
|
663
679
|
throw new Error("Already attached");
|
|
664
680
|
});
|
|
665
|
-
this.initialSnapshotDetailsP = new internal_1.LazyPromise(async () => {
|
|
666
|
-
// Sequence number of the snapshot.
|
|
667
|
-
let sequenceNumber;
|
|
668
|
-
// Check whether we need to fetch the snapshot first to load.
|
|
669
|
-
if (this.snapshotFetchRequired === undefined && this._baseSnapshot?.groupId !== undefined) {
|
|
670
|
-
(0, internal_1.assert)(this.blobContents !== undefined, 0x97a /* Blob contents should be present to evaluate */);
|
|
671
|
-
(0, internal_1.assert)(this._baseSnapshot !== undefined, 0x97b /* snapshotTree should be present to evaluate */);
|
|
672
|
-
this.snapshotFetchRequired = (0, internal_4.isSnapshotFetchRequiredForLoadingGroupId)(this._baseSnapshot, this.blobContents);
|
|
673
|
-
}
|
|
674
|
-
if (this.snapshotFetchRequired) {
|
|
675
|
-
(0, internal_1.assert)(this.loadingGroupId !== undefined, 0x8f5 /* groupId should be present to fetch snapshot */);
|
|
676
|
-
const snapshot = await this.runtime.getSnapshotForLoadingGroupId([this.loadingGroupId], [this.id]);
|
|
677
|
-
this._baseSnapshot = snapshot.snapshotTree;
|
|
678
|
-
sequenceNumber = snapshot.sequenceNumber;
|
|
679
|
-
this.snapshotFetchRequired = false;
|
|
680
|
-
}
|
|
681
|
-
let tree = this.baseSnapshot;
|
|
682
|
-
let isRootDataStore = true;
|
|
683
|
-
if (!!tree && tree.blobs[index_js_2.dataStoreAttributesBlobName] !== undefined) {
|
|
684
|
-
// Need to get through snapshot and use that to populate extraBlobs
|
|
685
|
-
// eslint-disable-next-line import/no-deprecated
|
|
686
|
-
const attributes = await (0, internal_2.readAndParse)(this.storage, tree.blobs[index_js_2.dataStoreAttributesBlobName]);
|
|
687
|
-
let pkgFromSnapshot;
|
|
688
|
-
// Use the snapshotFormatVersion to determine how the pkg is encoded in the snapshot.
|
|
689
|
-
// For snapshotFormatVersion = "0.1" (1) or above, pkg is jsonified, otherwise it is just a string.
|
|
690
|
-
const formatVersion = (0, index_js_2.getAttributesFormatVersion)(attributes);
|
|
691
|
-
if (formatVersion < 1) {
|
|
692
|
-
pkgFromSnapshot =
|
|
693
|
-
attributes.pkg.startsWith('["') && attributes.pkg.endsWith('"]')
|
|
694
|
-
? JSON.parse(attributes.pkg)
|
|
695
|
-
: [attributes.pkg];
|
|
696
|
-
}
|
|
697
|
-
else {
|
|
698
|
-
pkgFromSnapshot = JSON.parse(attributes.pkg);
|
|
699
|
-
}
|
|
700
|
-
this.pkg = pkgFromSnapshot;
|
|
701
|
-
/**
|
|
702
|
-
* If there is no isRootDataStore in the attributes blob, set it to true. This will ensure that
|
|
703
|
-
* data stores in older documents are not garbage collected incorrectly. This may lead to additional
|
|
704
|
-
* roots in the document but they won't break.
|
|
705
|
-
*/
|
|
706
|
-
isRootDataStore = attributes.isRootDataStore ?? true;
|
|
707
|
-
if ((0, index_js_2.hasIsolatedChannels)(attributes)) {
|
|
708
|
-
tree = tree.trees[internal_3.channelsTreeName];
|
|
709
|
-
(0, internal_1.assert)(tree !== undefined, 0x1fe /* "isolated channels subtree should exist in remote datastore snapshot" */);
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
(0, internal_1.assert)(this.pkg !== undefined, 0x8f6 /* The datastore context package should be defined */);
|
|
713
|
-
return {
|
|
714
|
-
pkg: this.pkg,
|
|
715
|
-
isRootDataStore,
|
|
716
|
-
snapshot: tree,
|
|
717
|
-
sequenceNumber,
|
|
718
|
-
};
|
|
719
|
-
});
|
|
720
681
|
this.runtime = props.parentContext.containerRuntime;
|
|
721
682
|
if ((0, internal_2.isInstanceOfISnapshot)(props.snapshot)) {
|
|
722
683
|
this.blobContents = props.snapshot.blobContents;
|
|
@@ -740,13 +701,74 @@ class RemoteFluidDataStoreContext extends FluidDataStoreContext {
|
|
|
740
701
|
4. attach op for this data store is processed - setAttachState() is called.
|
|
741
702
|
*/
|
|
742
703
|
setAttachState(attachState) { }
|
|
704
|
+
initialSnapshotDetailsP = new internal_1.LazyPromise(async () => {
|
|
705
|
+
// Sequence number of the snapshot.
|
|
706
|
+
let sequenceNumber;
|
|
707
|
+
// Check whether we need to fetch the snapshot first to load.
|
|
708
|
+
if (this.snapshotFetchRequired === undefined && this._baseSnapshot?.groupId !== undefined) {
|
|
709
|
+
(0, internal_1.assert)(this.blobContents !== undefined, 0x97a /* Blob contents should be present to evaluate */);
|
|
710
|
+
(0, internal_1.assert)(this._baseSnapshot !== undefined, 0x97b /* snapshotTree should be present to evaluate */);
|
|
711
|
+
this.snapshotFetchRequired = (0, internal_4.isSnapshotFetchRequiredForLoadingGroupId)(this._baseSnapshot, this.blobContents);
|
|
712
|
+
}
|
|
713
|
+
if (this.snapshotFetchRequired) {
|
|
714
|
+
(0, internal_1.assert)(this.loadingGroupId !== undefined, 0x8f5 /* groupId should be present to fetch snapshot */);
|
|
715
|
+
const snapshot = await this.runtime.getSnapshotForLoadingGroupId([this.loadingGroupId], [this.id]);
|
|
716
|
+
this._baseSnapshot = snapshot.snapshotTree;
|
|
717
|
+
sequenceNumber = snapshot.sequenceNumber;
|
|
718
|
+
this.snapshotFetchRequired = false;
|
|
719
|
+
}
|
|
720
|
+
let tree = this.baseSnapshot;
|
|
721
|
+
let isRootDataStore = true;
|
|
722
|
+
if (!!tree && tree.blobs[index_js_2.dataStoreAttributesBlobName] !== undefined) {
|
|
723
|
+
// Need to get through snapshot and use that to populate extraBlobs
|
|
724
|
+
// eslint-disable-next-line import/no-deprecated
|
|
725
|
+
const attributes = await (0, internal_2.readAndParse)(this.storage, tree.blobs[index_js_2.dataStoreAttributesBlobName]);
|
|
726
|
+
let pkgFromSnapshot;
|
|
727
|
+
// Use the snapshotFormatVersion to determine how the pkg is encoded in the snapshot.
|
|
728
|
+
// For snapshotFormatVersion = "0.1" (1) or above, pkg is jsonified, otherwise it is just a string.
|
|
729
|
+
const formatVersion = (0, index_js_2.getAttributesFormatVersion)(attributes);
|
|
730
|
+
if (formatVersion < 1) {
|
|
731
|
+
pkgFromSnapshot =
|
|
732
|
+
attributes.pkg.startsWith('["') && attributes.pkg.endsWith('"]')
|
|
733
|
+
? JSON.parse(attributes.pkg)
|
|
734
|
+
: [attributes.pkg];
|
|
735
|
+
}
|
|
736
|
+
else {
|
|
737
|
+
pkgFromSnapshot = JSON.parse(attributes.pkg);
|
|
738
|
+
}
|
|
739
|
+
this.pkg = pkgFromSnapshot;
|
|
740
|
+
/**
|
|
741
|
+
* If there is no isRootDataStore in the attributes blob, set it to true. This will ensure that
|
|
742
|
+
* data stores in older documents are not garbage collected incorrectly. This may lead to additional
|
|
743
|
+
* roots in the document but they won't break.
|
|
744
|
+
*/
|
|
745
|
+
isRootDataStore = attributes.isRootDataStore ?? true;
|
|
746
|
+
if ((0, index_js_2.hasIsolatedChannels)(attributes)) {
|
|
747
|
+
tree = tree.trees[internal_3.channelsTreeName];
|
|
748
|
+
(0, internal_1.assert)(tree !== undefined, 0x1fe /* "isolated channels subtree should exist in remote datastore snapshot" */);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
(0, internal_1.assert)(this.pkg !== undefined, 0x8f6 /* The datastore context package should be defined */);
|
|
752
|
+
return {
|
|
753
|
+
pkg: this.pkg,
|
|
754
|
+
isRootDataStore,
|
|
755
|
+
snapshot: tree,
|
|
756
|
+
sequenceNumber,
|
|
757
|
+
};
|
|
758
|
+
});
|
|
743
759
|
async getInitialSnapshotDetails() {
|
|
744
760
|
return this.initialSnapshotDetailsP;
|
|
745
761
|
}
|
|
746
762
|
/**
|
|
747
|
-
* @see FluidDataStoreContext.
|
|
763
|
+
* @see FluidDataStoreContext.getAttachSummary
|
|
748
764
|
*/
|
|
749
|
-
|
|
765
|
+
getAttachSummary() {
|
|
766
|
+
throw new Error("Cannot attach remote store");
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* @see FluidDataStoreContext.getAttachGCData
|
|
770
|
+
*/
|
|
771
|
+
getAttachGCData(telemetryContext) {
|
|
750
772
|
throw new Error("Cannot attach remote store");
|
|
751
773
|
}
|
|
752
774
|
}
|
|
@@ -756,39 +778,13 @@ exports.RemoteFluidDataStoreContext = RemoteFluidDataStoreContext;
|
|
|
756
778
|
* @internal
|
|
757
779
|
*/
|
|
758
780
|
class LocalFluidDataStoreContextBase extends FluidDataStoreContext {
|
|
781
|
+
snapshotTree;
|
|
782
|
+
/**
|
|
783
|
+
* @deprecated 0.16 Issue #1635, #3631
|
|
784
|
+
*/
|
|
785
|
+
createProps;
|
|
759
786
|
constructor(props) {
|
|
760
787
|
super(props, props.snapshotTree !== undefined /* existing */, true /* isLocalDataStore */, props.makeLocallyVisibleFn);
|
|
761
|
-
this.initialSnapshotDetailsP = new internal_1.LazyPromise(async () => {
|
|
762
|
-
let snapshot = this.snapshotTree;
|
|
763
|
-
// eslint-disable-next-line import/no-deprecated
|
|
764
|
-
let attributes;
|
|
765
|
-
let isRootDataStore = false;
|
|
766
|
-
if (snapshot !== undefined) {
|
|
767
|
-
// Get the dataStore attributes.
|
|
768
|
-
// Note: storage can be undefined in special case while detached.
|
|
769
|
-
attributes = await (0, index_js_2.getFluidDataStoreAttributes)(this.storage, snapshot);
|
|
770
|
-
if ((0, index_js_2.hasIsolatedChannels)(attributes)) {
|
|
771
|
-
snapshot = snapshot.trees[internal_3.channelsTreeName];
|
|
772
|
-
(0, internal_1.assert)(snapshot !== undefined, 0x1ff /* "isolated channels subtree should exist in local datastore snapshot" */);
|
|
773
|
-
}
|
|
774
|
-
if (this.pkg === undefined) {
|
|
775
|
-
this.pkg = JSON.parse(attributes.pkg);
|
|
776
|
-
// If there is no isRootDataStore in the attributes blob, set it to true. This ensures that data
|
|
777
|
-
// stores in older documents are not garbage collected incorrectly. This may lead to additional
|
|
778
|
-
// roots in the document but they won't break.
|
|
779
|
-
if (attributes.isRootDataStore ?? true) {
|
|
780
|
-
isRootDataStore = true;
|
|
781
|
-
this.setInMemoryRoot();
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
(0, internal_1.assert)(this.pkg !== undefined, 0x152 /* "pkg should be available in local data store" */);
|
|
786
|
-
return {
|
|
787
|
-
pkg: this.pkg,
|
|
788
|
-
isRootDataStore,
|
|
789
|
-
snapshot,
|
|
790
|
-
};
|
|
791
|
-
});
|
|
792
788
|
// Summarizer client should not create local data stores.
|
|
793
789
|
this.identifyLocalChangeInSummarizer("DataStoreCreatedInSummarizer");
|
|
794
790
|
this.snapshotTree = props.snapshotTree;
|
|
@@ -834,9 +830,9 @@ class LocalFluidDataStoreContextBase extends FluidDataStoreContext {
|
|
|
834
830
|
}
|
|
835
831
|
}
|
|
836
832
|
/**
|
|
837
|
-
* @see FluidDataStoreContext.
|
|
833
|
+
* @see FluidDataStoreContext.getAttachSummary
|
|
838
834
|
*/
|
|
839
|
-
|
|
835
|
+
getAttachSummary(telemetryContext) {
|
|
840
836
|
(0, internal_1.assert)(this.channel !== undefined, 0x14f /* "There should be a channel when generating attach message" */);
|
|
841
837
|
(0, internal_1.assert)(this.pkg !== undefined, 0x150 /* "pkg should be available in local data store context" */);
|
|
842
838
|
const attachSummary = this.channel.getAttachSummary(telemetryContext);
|
|
@@ -845,21 +841,50 @@ class LocalFluidDataStoreContextBase extends FluidDataStoreContext {
|
|
|
845
841
|
// Add data store's attributes to the summary.
|
|
846
842
|
const attributes = createAttributes(this.pkg, this.isInMemoryRoot());
|
|
847
843
|
(0, internal_4.addBlobToSummary)(attachSummary, index_js_2.dataStoreAttributesBlobName, JSON.stringify(attributes));
|
|
848
|
-
if (includeGCData) {
|
|
849
|
-
const gcData = this.channel.getAttachGCData?.(telemetryContext);
|
|
850
|
-
if (gcData !== undefined) {
|
|
851
|
-
(0, internal_4.addBlobToSummary)(attachSummary, internal_3.gcDataBlobKey, JSON.stringify(gcData));
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
844
|
// Add loadingGroupId to the summary
|
|
855
845
|
if (this.loadingGroupId !== undefined) {
|
|
856
846
|
attachSummary.summary.groupId = this.loadingGroupId;
|
|
857
847
|
}
|
|
848
|
+
return attachSummary;
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* @see FluidDataStoreContext.getAttachGCData
|
|
852
|
+
*/
|
|
853
|
+
getAttachGCData(telemetryContext) {
|
|
854
|
+
(0, internal_1.assert)(this.channel !== undefined, "There should be a channel when generating attach GC data");
|
|
855
|
+
return this.channel.getAttachGCData(telemetryContext);
|
|
856
|
+
}
|
|
857
|
+
initialSnapshotDetailsP = new internal_1.LazyPromise(async () => {
|
|
858
|
+
let snapshot = this.snapshotTree;
|
|
859
|
+
// eslint-disable-next-line import/no-deprecated
|
|
860
|
+
let attributes;
|
|
861
|
+
let isRootDataStore = false;
|
|
862
|
+
if (snapshot !== undefined) {
|
|
863
|
+
// Get the dataStore attributes.
|
|
864
|
+
// Note: storage can be undefined in special case while detached.
|
|
865
|
+
attributes = await (0, index_js_2.getFluidDataStoreAttributes)(this.storage, snapshot);
|
|
866
|
+
if ((0, index_js_2.hasIsolatedChannels)(attributes)) {
|
|
867
|
+
snapshot = snapshot.trees[internal_3.channelsTreeName];
|
|
868
|
+
(0, internal_1.assert)(snapshot !== undefined, 0x1ff /* "isolated channels subtree should exist in local datastore snapshot" */);
|
|
869
|
+
}
|
|
870
|
+
if (this.pkg === undefined) {
|
|
871
|
+
this.pkg = JSON.parse(attributes.pkg);
|
|
872
|
+
// If there is no isRootDataStore in the attributes blob, set it to true. This ensures that data
|
|
873
|
+
// stores in older documents are not garbage collected incorrectly. This may lead to additional
|
|
874
|
+
// roots in the document but they won't break.
|
|
875
|
+
if (attributes.isRootDataStore ?? true) {
|
|
876
|
+
isRootDataStore = true;
|
|
877
|
+
this.setInMemoryRoot();
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
(0, internal_1.assert)(this.pkg !== undefined, 0x152 /* "pkg should be available in local data store" */);
|
|
858
882
|
return {
|
|
859
|
-
|
|
860
|
-
|
|
883
|
+
pkg: this.pkg,
|
|
884
|
+
isRootDataStore,
|
|
885
|
+
snapshot,
|
|
861
886
|
};
|
|
862
|
-
}
|
|
887
|
+
});
|
|
863
888
|
async getInitialSnapshotDetails() {
|
|
864
889
|
return this.initialSnapshotDetailsP;
|
|
865
890
|
}
|
|
@@ -907,6 +932,7 @@ class LocalDetachedFluidDataStoreContext extends LocalFluidDataStoreContextBase
|
|
|
907
932
|
this.detachedRuntimeCreation = true;
|
|
908
933
|
this.channelToDataStoreFn = props.channelToDataStoreFn;
|
|
909
934
|
}
|
|
935
|
+
channelToDataStoreFn;
|
|
910
936
|
async attachRuntime(registry, dataStoreChannel) {
|
|
911
937
|
(0, internal_1.assert)(this.detachedRuntimeCreation, 0x154 /* "runtime creation is already attached" */);
|
|
912
938
|
this.detachedRuntimeCreation = false;
|