@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/lib/channelCollection.js
CHANGED
|
@@ -6,15 +6,15 @@ import { AttachState } from "@fluidframework/container-definitions";
|
|
|
6
6
|
import { assert, Lazy, LazyPromise } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { FluidObjectHandle } from "@fluidframework/datastore/internal";
|
|
8
8
|
import { buildSnapshotTree, getSnapshotTree, isInstanceOfISnapshot, } from "@fluidframework/driver-utils/internal";
|
|
9
|
-
import { CreateSummarizerNodeSource, channelsTreeName, } from "@fluidframework/runtime-definitions/internal";
|
|
10
|
-
import { GCDataBuilder, RequestParser, SummaryTreeBuilder, convertSnapshotTreeToSummaryTree, convertSummaryTreeToITree, create404Response, createResponseError, encodeCompactIdToString, isSerializedHandle, processAttachMessageGCData, responseToException, unpackChildNodesUsedRoutes, } from "@fluidframework/runtime-utils/internal";
|
|
9
|
+
import { CreateSummarizerNodeSource, channelsTreeName, gcDataBlobKey, } from "@fluidframework/runtime-definitions/internal";
|
|
10
|
+
import { GCDataBuilder, RequestParser, SummaryTreeBuilder, addBlobToSummary, convertSnapshotTreeToSummaryTree, convertSummaryTreeToITree, create404Response, createResponseError, encodeCompactIdToString, isSerializedHandle, processAttachMessageGCData, responseToException, unpackChildNodesUsedRoutes, } from "@fluidframework/runtime-utils/internal";
|
|
11
11
|
import { DataCorruptionError, DataProcessingError, LoggingError, createChildLogger, createChildMonitoringContext, extractSafePropertiesFromMessage, tagCodeArtifacts, } from "@fluidframework/telemetry-utils/internal";
|
|
12
12
|
import { DeletedResponseHeaderKey, defaultRuntimeHeaderData, } from "./containerRuntime.js";
|
|
13
13
|
import { channelToDataStore, isDataStoreAliasMessage, } from "./dataStore.js";
|
|
14
14
|
import { LocalDetachedFluidDataStoreContext, LocalFluidDataStoreContext, RemoteFluidDataStoreContext, createAttributesBlob, } from "./dataStoreContext.js";
|
|
15
15
|
import { DataStoreContexts } from "./dataStoreContexts.js";
|
|
16
16
|
import { FluidDataStoreRegistry } from "./dataStoreRegistry.js";
|
|
17
|
-
import { GCNodeType,
|
|
17
|
+
import { GCNodeType, urlToGCNodePath } from "./gc/index.js";
|
|
18
18
|
import { ContainerMessageType } from "./messageTypes.js";
|
|
19
19
|
import { StorageServiceWithAttachBlobs } from "./storageServiceWithAttachBlobs.js";
|
|
20
20
|
import { nonDataStorePaths, rootHasIsolatedChannels, } from "./summary/index.js";
|
|
@@ -96,8 +96,8 @@ export function wrapContext(context) {
|
|
|
96
96
|
uploadBlob: async (...args) => {
|
|
97
97
|
return context.uploadBlob(...args);
|
|
98
98
|
},
|
|
99
|
-
|
|
100
|
-
return context.
|
|
99
|
+
addedGCOutboundRoute: (...args) => {
|
|
100
|
+
return context.addedGCOutboundRoute(...args);
|
|
101
101
|
},
|
|
102
102
|
getCreateChildSummarizerNodeFn: (...args) => {
|
|
103
103
|
return context.getCreateChildSummarizerNodeFn?.(...args);
|
|
@@ -140,33 +140,42 @@ export function wrapContextForInnerChannel(id, parentContext) {
|
|
|
140
140
|
};
|
|
141
141
|
return context;
|
|
142
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Returns the type of the given local data store from its package path.
|
|
145
|
+
*/
|
|
146
|
+
export function getLocalDataStoreType(localDataStore) {
|
|
147
|
+
return localDataStore.packagePath[localDataStore.packagePath.length - 1];
|
|
148
|
+
}
|
|
143
149
|
/**
|
|
144
150
|
* This class encapsulates data store handling. Currently it is only used by the container runtime,
|
|
145
151
|
* but eventually could be hosted on any channel once we formalize the channel api boundary.
|
|
146
152
|
* @internal
|
|
147
153
|
*/
|
|
148
154
|
export class ChannelCollection {
|
|
155
|
+
baseSnapshot;
|
|
156
|
+
parentContext;
|
|
157
|
+
gcNodeUpdated;
|
|
158
|
+
isDataStoreDeleted;
|
|
159
|
+
aliasMap;
|
|
160
|
+
// Stores tracked by the Domain
|
|
161
|
+
pendingAttach = new Map();
|
|
162
|
+
// 0.24 back-compat attachingBeforeSummary
|
|
163
|
+
attachOpFiredForDataStore = new Set();
|
|
164
|
+
mc;
|
|
165
|
+
disposeOnce = new Lazy(() => this.contexts.dispose());
|
|
166
|
+
entryPoint;
|
|
167
|
+
containerLoadStats;
|
|
168
|
+
pendingAliasMap = new Map();
|
|
169
|
+
contexts;
|
|
170
|
+
aliasedDataStores;
|
|
149
171
|
constructor(baseSnapshot, parentContext, baseLogger, gcNodeUpdated, isDataStoreDeleted, aliasMap, provideEntryPoint) {
|
|
150
172
|
this.baseSnapshot = baseSnapshot;
|
|
151
173
|
this.parentContext = parentContext;
|
|
152
174
|
this.gcNodeUpdated = gcNodeUpdated;
|
|
153
175
|
this.isDataStoreDeleted = isDataStoreDeleted;
|
|
154
176
|
this.aliasMap = aliasMap;
|
|
155
|
-
// Stores tracked by the Domain
|
|
156
|
-
this.pendingAttach = new Map();
|
|
157
|
-
// 0.24 back-compat attachingBeforeSummary
|
|
158
|
-
this.attachOpFiredForDataStore = new Set();
|
|
159
|
-
this.disposeOnce = new Lazy(() => this.contexts.dispose());
|
|
160
|
-
// Stores the ids of new data stores between two GC runs. This is used to notify the garbage collector of new
|
|
161
|
-
// root data stores that are added.
|
|
162
|
-
this.dataStoresSinceLastGC = [];
|
|
163
|
-
this.pendingAliasMap = new Map();
|
|
164
|
-
/** For sampling. Only log once per container */
|
|
165
|
-
this.shouldSendAttachLog = true;
|
|
166
|
-
this.dispose = () => this.disposeOnce.value;
|
|
167
177
|
this.mc = createChildMonitoringContext({ logger: baseLogger });
|
|
168
178
|
this.contexts = new DataStoreContexts(baseLogger);
|
|
169
|
-
this.containerRuntimeHandle = new FluidObjectHandle(this.parentContext, "/", this.parentContext.IFluidHandleContext);
|
|
170
179
|
this.entryPoint = new FluidObjectHandle(new LazyPromise(async () => provideEntryPoint(this)), "", this.parentContext.IFluidHandleContext);
|
|
171
180
|
this.aliasedDataStores = new Set(aliasMap.values());
|
|
172
181
|
// Extract stores stored inside the snapshot
|
|
@@ -241,6 +250,8 @@ export class ChannelCollection {
|
|
|
241
250
|
const pendingAliasPromise = this.pendingAliases.get(maybeAlias);
|
|
242
251
|
return pendingAliasPromise ?? "Success";
|
|
243
252
|
}
|
|
253
|
+
/** For sampling. Only log once per container */
|
|
254
|
+
shouldSendAttachLog = true;
|
|
244
255
|
wrapContextForInnerChannel(id) {
|
|
245
256
|
return wrapContextForInnerChannel(id, this.parentContext);
|
|
246
257
|
}
|
|
@@ -254,12 +265,11 @@ export class ChannelCollection {
|
|
|
254
265
|
}
|
|
255
266
|
processAttachMessage(message, local) {
|
|
256
267
|
const attachMessage = message.contents;
|
|
257
|
-
this.dataStoresSinceLastGC.push(attachMessage.id);
|
|
258
268
|
// We need to process the GC Data for both local and remote attach messages
|
|
259
269
|
const foundGCData = processAttachMessageGCData(attachMessage.snapshot, (nodeId, toPath) => {
|
|
260
270
|
// nodeId is the relative path under the node being attached. Always starts with "/", but no trailing "/" after an id
|
|
261
271
|
const fromPath = `/${attachMessage.id}${nodeId === "/" ? "" : nodeId}`;
|
|
262
|
-
this.parentContext.
|
|
272
|
+
this.parentContext.addedGCOutboundRoute(fromPath, toPath);
|
|
263
273
|
});
|
|
264
274
|
// Only log once per container to avoid noise/cost.
|
|
265
275
|
// Allows longitudinal tracking of various state (e.g. foundGCData), and some sampled details
|
|
@@ -353,8 +363,7 @@ export class ChannelCollection {
|
|
|
353
363
|
});
|
|
354
364
|
return false;
|
|
355
365
|
}
|
|
356
|
-
|
|
357
|
-
this.parentContext.addedGCOutboundReference?.(this.containerRuntimeHandle, handle);
|
|
366
|
+
this.parentContext.addedGCOutboundRoute("/", `/${internalId}`);
|
|
358
367
|
this.aliasMap.set(alias, context.id);
|
|
359
368
|
this.aliasedDataStores.add(context.id);
|
|
360
369
|
context.setInMemoryRoot();
|
|
@@ -365,14 +374,17 @@ export class ChannelCollection {
|
|
|
365
374
|
}
|
|
366
375
|
/** Package up the context's attach summary etc into an IAttachMessage */
|
|
367
376
|
generateAttachMessage(localContext) {
|
|
368
|
-
|
|
369
|
-
const
|
|
377
|
+
// Get the attach summary.
|
|
378
|
+
const attachSummary = localContext.getAttachSummary();
|
|
379
|
+
// Get the GC data and add it to the attach summary.
|
|
380
|
+
const attachGCData = localContext.getAttachGCData();
|
|
381
|
+
addBlobToSummary(attachSummary, gcDataBlobKey, JSON.stringify(attachGCData));
|
|
370
382
|
// Attach message needs the summary in ITree format. Convert the ISummaryTree into an ITree.
|
|
371
383
|
const snapshot = convertSummaryTreeToITree(attachSummary.summary);
|
|
372
384
|
return {
|
|
373
385
|
id: localContext.id,
|
|
374
386
|
snapshot,
|
|
375
|
-
type,
|
|
387
|
+
type: getLocalDataStoreType(localContext),
|
|
376
388
|
};
|
|
377
389
|
}
|
|
378
390
|
/**
|
|
@@ -462,6 +474,7 @@ export class ChannelCollection {
|
|
|
462
474
|
get disposed() {
|
|
463
475
|
return this.disposeOnce.evaluated;
|
|
464
476
|
}
|
|
477
|
+
dispose = () => this.disposeOnce.value;
|
|
465
478
|
reSubmit(type, content, localOpMetadata) {
|
|
466
479
|
switch (type) {
|
|
467
480
|
case ContainerMessageType.Attach:
|
|
@@ -566,7 +579,7 @@ export class ChannelCollection {
|
|
|
566
579
|
this.pendingAttach.set(message.id, message);
|
|
567
580
|
}
|
|
568
581
|
}
|
|
569
|
-
process(message, local, localMessageMetadata
|
|
582
|
+
process(message, local, localMessageMetadata) {
|
|
570
583
|
switch (message.type) {
|
|
571
584
|
case ContainerMessageType.Attach:
|
|
572
585
|
this.processAttachMessage(message, local);
|
|
@@ -583,13 +596,8 @@ export class ChannelCollection {
|
|
|
583
596
|
contents: innerContents.content,
|
|
584
597
|
};
|
|
585
598
|
this.processChannelOp(envelope.address, transformed, local, localMessageMetadata);
|
|
586
|
-
//
|
|
587
|
-
|
|
588
|
-
if (this.mc.config.getBoolean(detectOutboundRoutesViaDDSKey) !== true &&
|
|
589
|
-
addedOutboundReference !== undefined) {
|
|
590
|
-
// Notify GC of any outbound references that were added by this op.
|
|
591
|
-
detectOutboundReferences(envelope.address, transformed.contents, addedOutboundReference);
|
|
592
|
-
}
|
|
599
|
+
// Notify GC of any outbound references that were added by this op.
|
|
600
|
+
detectOutboundReferences(envelope.address, transformed.contents, (fromPath, toPath) => this.parentContext.addedGCOutboundRoute(fromPath, toPath));
|
|
593
601
|
break;
|
|
594
602
|
}
|
|
595
603
|
default:
|
|
@@ -674,9 +682,9 @@ export class ChannelCollection {
|
|
|
674
682
|
? urlToGCNodePath(originalRequest.url)
|
|
675
683
|
: dataStoreNodePath;
|
|
676
684
|
// Log the package details asynchronously since getInitialSnapshotDetails is async
|
|
677
|
-
const
|
|
678
|
-
if (
|
|
679
|
-
|
|
685
|
+
const recentlyDeletedContext = this.contexts.getRecentlyDeletedContext(id);
|
|
686
|
+
if (recentlyDeletedContext !== undefined) {
|
|
687
|
+
recentlyDeletedContext
|
|
680
688
|
.getInitialSnapshotDetails()
|
|
681
689
|
.then((details) => {
|
|
682
690
|
return details.pkg.join("/");
|
|
@@ -806,8 +814,7 @@ export class ChannelCollection {
|
|
|
806
814
|
.map(([key, value]) => {
|
|
807
815
|
let dataStoreSummary;
|
|
808
816
|
if (value.isLoaded) {
|
|
809
|
-
dataStoreSummary = value.
|
|
810
|
-
/* includeGCCData: */ false, telemetryContext).attachSummary;
|
|
817
|
+
dataStoreSummary = value.getAttachSummary(telemetryContext);
|
|
811
818
|
}
|
|
812
819
|
else {
|
|
813
820
|
// If this data store is not yet loaded, then there should be no changes in the snapshot from
|
|
@@ -821,21 +828,30 @@ export class ChannelCollection {
|
|
|
821
828
|
return builder.getSummaryTree();
|
|
822
829
|
}
|
|
823
830
|
/**
|
|
824
|
-
*
|
|
825
|
-
* The garbage collector needs to know all outbound references that are added. Since root data stores are not
|
|
826
|
-
* explicitly marked as referenced, notify GC of new root data stores that were added since the last GC run.
|
|
831
|
+
* Gets the GC data. Used when attaching or serializing a detached container.
|
|
827
832
|
*/
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
833
|
+
getAttachGCData(telemetryContext) {
|
|
834
|
+
const builder = new GCDataBuilder();
|
|
835
|
+
// Attaching graph of some stores can cause other stores to get bound too.
|
|
836
|
+
// So keep taking summary until no new stores get bound.
|
|
837
|
+
let notBoundContextsLength;
|
|
838
|
+
do {
|
|
839
|
+
notBoundContextsLength = this.contexts.notBoundLength();
|
|
840
|
+
// Iterate over each data store and ask for its GC data.
|
|
841
|
+
Array.from(this.contexts)
|
|
842
|
+
.filter(([key, _]) =>
|
|
843
|
+
// Take GC data of bounded data stores only.
|
|
844
|
+
!this.contexts.isNotBound(key))
|
|
845
|
+
.map(([key, value]) => {
|
|
846
|
+
const contextGCData = value.getAttachGCData(telemetryContext);
|
|
847
|
+
// Prefix the child's id to the ids of its GC nodes so they can be identified as belonging to the child.
|
|
848
|
+
// This also gradually builds the id of each node to be a path from the root.
|
|
849
|
+
builder.prefixAndAddNodes(key, contextGCData.gcNodes);
|
|
850
|
+
});
|
|
851
|
+
} while (notBoundContextsLength !== this.contexts.notBoundLength());
|
|
852
|
+
// Get the outbound routes (aliased data stores) and add a GC node for this channel.
|
|
853
|
+
builder.addNode("/", Array.from(this.aliasedDataStores));
|
|
854
|
+
return builder.getGCData();
|
|
839
855
|
}
|
|
840
856
|
/**
|
|
841
857
|
* Generates data used for garbage collection. It does the following:
|
|
@@ -1113,12 +1129,15 @@ export function detectOutboundReferences(address, contents, addedOutboundReferen
|
|
|
1113
1129
|
}
|
|
1114
1130
|
/** @internal */
|
|
1115
1131
|
export class ChannelCollectionFactory {
|
|
1132
|
+
provideEntryPoint;
|
|
1133
|
+
ctor;
|
|
1134
|
+
type = "ChannelCollectionChannel";
|
|
1135
|
+
IFluidDataStoreRegistry;
|
|
1116
1136
|
constructor(registryEntries,
|
|
1117
1137
|
// ADO:7302 We need a better type here
|
|
1118
1138
|
provideEntryPoint, ctor) {
|
|
1119
1139
|
this.provideEntryPoint = provideEntryPoint;
|
|
1120
1140
|
this.ctor = ctor;
|
|
1121
|
-
this.type = "ChannelCollectionChannel";
|
|
1122
1141
|
this.IFluidDataStoreRegistry = new FluidDataStoreRegistry(registryEntries);
|
|
1123
1142
|
}
|
|
1124
1143
|
get IFluidDataStoreFactory() {
|