@fluidframework/container-runtime 2.0.0-internal.3.0.5 → 2.0.0-internal.3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +19 -19
- package/.mocharc.js +2 -2
- package/api-extractor.json +2 -2
- package/dist/batchTracker.d.ts.map +1 -1
- package/dist/batchTracker.js +2 -1
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.d.ts +9 -2
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +80 -33
- package/dist/blobManager.js.map +1 -1
- package/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js +11 -9
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/containerHandleContext.d.ts.map +1 -1
- package/dist/containerHandleContext.js +3 -1
- package/dist/containerHandleContext.js.map +1 -1
- package/dist/containerRuntime.d.ts +11 -1
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +116 -72
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +11 -9
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +18 -13
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +68 -55
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.d.ts.map +1 -1
- package/dist/dataStoreContexts.js +7 -3
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/dataStoreRegistry.d.ts.map +1 -1
- package/dist/dataStoreRegistry.js +3 -1
- package/dist/dataStoreRegistry.js.map +1 -1
- package/dist/dataStores.d.ts +26 -1
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +103 -18
- package/dist/dataStores.js.map +1 -1
- package/dist/deltaScheduler.d.ts.map +1 -1
- package/dist/deltaScheduler.js +8 -3
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/garbageCollection.d.ts +33 -14
- package/dist/garbageCollection.d.ts.map +1 -1
- package/dist/garbageCollection.js +178 -92
- package/dist/garbageCollection.js.map +1 -1
- package/dist/garbageCollectionConstants.d.ts +1 -0
- package/dist/garbageCollectionConstants.d.ts.map +1 -1
- package/dist/garbageCollectionConstants.js +4 -1
- package/dist/garbageCollectionConstants.js.map +1 -1
- package/dist/garbageCollectionHelpers.d.ts +26 -0
- package/dist/garbageCollectionHelpers.d.ts.map +1 -0
- package/dist/garbageCollectionHelpers.js +45 -0
- package/dist/garbageCollectionHelpers.js.map +1 -0
- package/dist/gcSweepReadyUsageDetection.d.ts +5 -5
- package/dist/gcSweepReadyUsageDetection.d.ts.map +1 -1
- package/dist/gcSweepReadyUsageDetection.js +14 -10
- package/dist/gcSweepReadyUsageDetection.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/opLifecycle/batchManager.d.ts +5 -5
- package/dist/opLifecycle/batchManager.d.ts.map +1 -1
- package/dist/opLifecycle/batchManager.js +19 -12
- package/dist/opLifecycle/batchManager.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts.map +1 -1
- package/dist/opLifecycle/definitions.js.map +1 -1
- package/dist/opLifecycle/index.d.ts.map +1 -1
- package/dist/opLifecycle/index.js.map +1 -1
- package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts +0 -4
- package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opDecompressor.js +7 -43
- package/dist/opLifecycle/opDecompressor.js.map +1 -1
- package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
- package/dist/opLifecycle/opSplitter.js +4 -1
- package/dist/opLifecycle/opSplitter.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +20 -19
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/dist/opProperties.d.ts.map +1 -1
- package/dist/opProperties.js +1 -3
- package/dist/opProperties.js.map +1 -1
- package/dist/orderedClientElection.d.ts.map +1 -1
- package/dist/orderedClientElection.js +10 -4
- package/dist/orderedClientElection.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/pendingStateManager.d.ts +7 -0
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +7 -4
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/runWhileConnectedCoordinator.d.ts.map +1 -1
- package/dist/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/runningSummarizer.d.ts.map +1 -1
- package/dist/runningSummarizer.js +34 -21
- package/dist/runningSummarizer.js.map +1 -1
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js +3 -2
- package/dist/scheduleManager.js.map +1 -1
- package/dist/serializedSnapshotStorage.d.ts +2 -2
- package/dist/serializedSnapshotStorage.d.ts.map +1 -1
- package/dist/serializedSnapshotStorage.js +5 -3
- package/dist/serializedSnapshotStorage.js.map +1 -1
- package/dist/summarizer.d.ts +2 -2
- package/dist/summarizer.d.ts.map +1 -1
- package/dist/summarizer.js +37 -17
- package/dist/summarizer.js.map +1 -1
- package/dist/summarizerClientElection.d.ts.map +1 -1
- package/dist/summarizerClientElection.js.map +1 -1
- package/dist/summarizerHandle.d.ts.map +1 -1
- package/dist/summarizerHandle.js.map +1 -1
- package/dist/summarizerHeuristics.d.ts.map +1 -1
- package/dist/summarizerHeuristics.js +6 -9
- package/dist/summarizerHeuristics.js.map +1 -1
- package/dist/summarizerTypes.d.ts +21 -21
- package/dist/summarizerTypes.d.ts.map +1 -1
- package/dist/summarizerTypes.js.map +1 -1
- package/dist/summaryCollection.d.ts.map +1 -1
- package/dist/summaryCollection.js +18 -8
- package/dist/summaryCollection.js.map +1 -1
- package/dist/summaryFormat.d.ts +5 -2
- package/dist/summaryFormat.d.ts.map +1 -1
- package/dist/summaryFormat.js +18 -10
- package/dist/summaryFormat.js.map +1 -1
- package/dist/summaryGenerator.d.ts.map +1 -1
- package/dist/summaryGenerator.js +35 -16
- package/dist/summaryGenerator.js.map +1 -1
- package/dist/summaryManager.d.ts.map +1 -1
- package/dist/summaryManager.js +21 -9
- package/dist/summaryManager.js.map +1 -1
- package/dist/throttler.d.ts +2 -2
- package/dist/throttler.d.ts.map +1 -1
- package/dist/throttler.js +4 -4
- package/dist/throttler.js.map +1 -1
- package/garbageCollection.md +15 -2
- package/lib/batchTracker.d.ts.map +1 -1
- package/lib/batchTracker.js +2 -1
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager.d.ts +9 -2
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +82 -35
- package/lib/blobManager.js.map +1 -1
- package/lib/connectionTelemetry.d.ts.map +1 -1
- package/lib/connectionTelemetry.js +11 -9
- package/lib/connectionTelemetry.js.map +1 -1
- package/lib/containerHandleContext.d.ts.map +1 -1
- package/lib/containerHandleContext.js +3 -1
- package/lib/containerHandleContext.js.map +1 -1
- package/lib/containerRuntime.d.ts +11 -1
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +122 -78
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js +11 -9
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +18 -13
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +71 -58
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreContexts.d.ts.map +1 -1
- package/lib/dataStoreContexts.js +7 -3
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/dataStoreRegistry.d.ts.map +1 -1
- package/lib/dataStoreRegistry.js +3 -1
- package/lib/dataStoreRegistry.js.map +1 -1
- package/lib/dataStores.d.ts +26 -1
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +109 -24
- package/lib/dataStores.js.map +1 -1
- package/lib/deltaScheduler.d.ts.map +1 -1
- package/lib/deltaScheduler.js +9 -4
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/garbageCollection.d.ts +33 -14
- package/lib/garbageCollection.d.ts.map +1 -1
- package/lib/garbageCollection.js +180 -94
- package/lib/garbageCollection.js.map +1 -1
- package/lib/garbageCollectionConstants.d.ts +1 -0
- package/lib/garbageCollectionConstants.d.ts.map +1 -1
- package/lib/garbageCollectionConstants.js +3 -0
- package/lib/garbageCollectionConstants.js.map +1 -1
- package/lib/garbageCollectionHelpers.d.ts +26 -0
- package/lib/garbageCollectionHelpers.d.ts.map +1 -0
- package/lib/garbageCollectionHelpers.js +40 -0
- package/lib/garbageCollectionHelpers.js.map +1 -0
- package/lib/gcSweepReadyUsageDetection.d.ts +5 -5
- package/lib/gcSweepReadyUsageDetection.d.ts.map +1 -1
- package/lib/gcSweepReadyUsageDetection.js +14 -10
- package/lib/gcSweepReadyUsageDetection.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/opLifecycle/batchManager.d.ts +5 -5
- package/lib/opLifecycle/batchManager.d.ts.map +1 -1
- package/lib/opLifecycle/batchManager.js +19 -12
- package/lib/opLifecycle/batchManager.js.map +1 -1
- package/lib/opLifecycle/definitions.d.ts.map +1 -1
- package/lib/opLifecycle/definitions.js.map +1 -1
- package/lib/opLifecycle/index.d.ts.map +1 -1
- package/lib/opLifecycle/index.js.map +1 -1
- package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opCompressor.js.map +1 -1
- package/lib/opLifecycle/opDecompressor.d.ts +0 -4
- package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opDecompressor.js +7 -43
- package/lib/opLifecycle/opDecompressor.js.map +1 -1
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
- package/lib/opLifecycle/opSplitter.js +5 -2
- package/lib/opLifecycle/opSplitter.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +20 -19
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/lib/opProperties.d.ts.map +1 -1
- package/lib/opProperties.js +1 -3
- package/lib/opProperties.js.map +1 -1
- package/lib/orderedClientElection.d.ts.map +1 -1
- package/lib/orderedClientElection.js +10 -4
- package/lib/orderedClientElection.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/pendingStateManager.d.ts +7 -0
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +7 -4
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/runWhileConnectedCoordinator.d.ts.map +1 -1
- package/lib/runWhileConnectedCoordinator.js.map +1 -1
- package/lib/runningSummarizer.d.ts.map +1 -1
- package/lib/runningSummarizer.js +35 -22
- package/lib/runningSummarizer.js.map +1 -1
- package/lib/scheduleManager.d.ts.map +1 -1
- package/lib/scheduleManager.js +3 -2
- package/lib/scheduleManager.js.map +1 -1
- package/lib/serializedSnapshotStorage.d.ts +2 -2
- package/lib/serializedSnapshotStorage.d.ts.map +1 -1
- package/lib/serializedSnapshotStorage.js +5 -3
- package/lib/serializedSnapshotStorage.js.map +1 -1
- package/lib/summarizer.d.ts +2 -2
- package/lib/summarizer.d.ts.map +1 -1
- package/lib/summarizer.js +37 -17
- package/lib/summarizer.js.map +1 -1
- package/lib/summarizerClientElection.d.ts.map +1 -1
- package/lib/summarizerClientElection.js.map +1 -1
- package/lib/summarizerHandle.d.ts.map +1 -1
- package/lib/summarizerHandle.js.map +1 -1
- package/lib/summarizerHeuristics.d.ts.map +1 -1
- package/lib/summarizerHeuristics.js +6 -9
- package/lib/summarizerHeuristics.js.map +1 -1
- package/lib/summarizerTypes.d.ts +21 -21
- package/lib/summarizerTypes.d.ts.map +1 -1
- package/lib/summarizerTypes.js.map +1 -1
- package/lib/summaryCollection.d.ts.map +1 -1
- package/lib/summaryCollection.js +18 -8
- package/lib/summaryCollection.js.map +1 -1
- package/lib/summaryFormat.d.ts +5 -2
- package/lib/summaryFormat.d.ts.map +1 -1
- package/lib/summaryFormat.js +20 -12
- package/lib/summaryFormat.js.map +1 -1
- package/lib/summaryGenerator.d.ts.map +1 -1
- package/lib/summaryGenerator.js +35 -16
- package/lib/summaryGenerator.js.map +1 -1
- package/lib/summaryManager.d.ts.map +1 -1
- package/lib/summaryManager.js +21 -9
- package/lib/summaryManager.js.map +1 -1
- package/lib/throttler.d.ts +2 -2
- package/lib/throttler.d.ts.map +1 -1
- package/lib/throttler.js +4 -4
- package/lib/throttler.js.map +1 -1
- package/package.json +121 -115
- package/prettier.config.cjs +1 -1
- package/src/batchTracker.ts +54 -49
- package/src/blobManager.ts +793 -672
- package/src/connectionTelemetry.ts +280 -249
- package/src/containerHandleContext.ts +27 -29
- package/src/containerRuntime.ts +3168 -2988
- package/src/dataStore.ts +172 -159
- package/src/dataStoreContext.ts +1098 -1055
- package/src/dataStoreContexts.ts +178 -161
- package/src/dataStoreRegistry.ts +25 -20
- package/src/dataStores.ts +884 -728
- package/src/deltaScheduler.ts +158 -150
- package/src/garbageCollection.ts +1860 -1688
- package/src/garbageCollectionConstants.ts +3 -0
- package/src/garbageCollectionHelpers.ts +61 -0
- package/src/gcSweepReadyUsageDetection.ts +89 -83
- package/src/index.ts +67 -66
- package/src/opLifecycle/README.md +152 -0
- package/src/opLifecycle/batchManager.ts +145 -141
- package/src/opLifecycle/definitions.ts +29 -29
- package/src/opLifecycle/index.ts +5 -5
- package/src/opLifecycle/opCompressor.ts +54 -53
- package/src/opLifecycle/opDecompressor.ts +100 -128
- package/src/opLifecycle/opSplitter.ts +214 -188
- package/src/opLifecycle/outbox.ts +204 -195
- package/src/opLifecycle/remoteMessageProcessor.ts +62 -62
- package/src/opProperties.ts +11 -9
- package/src/orderedClientElection.ts +489 -457
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +384 -338
- package/src/runWhileConnectedCoordinator.ts +78 -71
- package/src/runningSummarizer.ts +619 -581
- package/src/scheduleManager.ts +299 -269
- package/src/serializedSnapshotStorage.ts +126 -112
- package/src/summarizer.ts +417 -381
- package/src/summarizerClientElection.ts +107 -100
- package/src/summarizerHandle.ts +11 -9
- package/src/summarizerHeuristics.ts +183 -186
- package/src/summarizerTypes.ts +344 -330
- package/src/summaryCollection.ts +378 -349
- package/src/summaryFormat.ts +165 -143
- package/src/summaryGenerator.ts +465 -410
- package/src/summaryManager.ts +377 -348
- package/src/throttler.ts +131 -122
- package/tsconfig.esnext.json +6 -6
- package/tsconfig.json +9 -13
- package/dist/garbageCollectionTombstoneUtils.d.ts +0 -14
- package/dist/garbageCollectionTombstoneUtils.d.ts.map +0 -1
- package/dist/garbageCollectionTombstoneUtils.js +0 -23
- package/dist/garbageCollectionTombstoneUtils.js.map +0 -1
- package/lib/garbageCollectionTombstoneUtils.d.ts +0 -14
- package/lib/garbageCollectionTombstoneUtils.d.ts.map +0 -1
- package/lib/garbageCollectionTombstoneUtils.js +0 -19
- package/lib/garbageCollectionTombstoneUtils.js.map +0 -1
- package/src/garbageCollectionTombstoneUtils.ts +0 -28
package/src/summaryFormat.ts
CHANGED
|
@@ -6,36 +6,44 @@
|
|
|
6
6
|
import { assert } from "@fluidframework/common-utils";
|
|
7
7
|
import { IDocumentStorageService } from "@fluidframework/driver-definitions";
|
|
8
8
|
import { readAndParse } from "@fluidframework/driver-utils";
|
|
9
|
-
import {
|
|
10
|
-
|
|
9
|
+
import {
|
|
10
|
+
ISequencedDocumentMessage,
|
|
11
|
+
ISnapshotTree,
|
|
12
|
+
SummaryType,
|
|
13
|
+
} from "@fluidframework/protocol-definitions";
|
|
14
|
+
import {
|
|
15
|
+
channelsTreeName,
|
|
16
|
+
gcTreeKey,
|
|
17
|
+
ISummaryTreeWithStats,
|
|
18
|
+
} from "@fluidframework/runtime-definitions";
|
|
11
19
|
|
|
12
20
|
type OmitAttributesVersions<T> = Omit<T, "snapshotFormatVersion" | "summaryFormatVersion">;
|
|
13
21
|
interface IFluidDataStoreAttributes0 {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
readonly snapshotFormatVersion?: undefined;
|
|
23
|
+
readonly summaryFormatVersion?: undefined;
|
|
24
|
+
pkg: string;
|
|
25
|
+
/**
|
|
26
|
+
* This tells whether a data store is root. Root data stores are never collected.
|
|
27
|
+
* Non-root data stores may be collected if they are not used. If this is not present, default it to
|
|
28
|
+
* true. This will ensure that older data stores are incorrectly collected.
|
|
29
|
+
*/
|
|
30
|
+
readonly isRootDataStore?: boolean;
|
|
23
31
|
}
|
|
24
32
|
interface IFluidDataStoreAttributes1 extends OmitAttributesVersions<IFluidDataStoreAttributes0> {
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
readonly snapshotFormatVersion: "0.1";
|
|
34
|
+
readonly summaryFormatVersion?: undefined;
|
|
27
35
|
}
|
|
28
36
|
interface IFluidDataStoreAttributes2 extends OmitAttributesVersions<IFluidDataStoreAttributes1> {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
/** Switch from snapshotFormatVersion to summaryFormatVersion */
|
|
38
|
+
readonly snapshotFormatVersion?: undefined;
|
|
39
|
+
readonly summaryFormatVersion: 2;
|
|
40
|
+
/**
|
|
41
|
+
* True if channels are not isolated in .channels subtrees, otherwise isolated.
|
|
42
|
+
* This is required in both datastore attributes as well as the root container,
|
|
43
|
+
* because reused summary handles may cause different format versions in each
|
|
44
|
+
* datastore subtree within the summary.
|
|
45
|
+
*/
|
|
46
|
+
readonly disableIsolatedChannels?: true;
|
|
39
47
|
}
|
|
40
48
|
/**
|
|
41
49
|
* Added IFluidDataStoreAttributes similar to IChannelAttributes which will tell the attributes of a
|
|
@@ -43,133 +51,140 @@ interface IFluidDataStoreAttributes2 extends OmitAttributesVersions<IFluidDataSt
|
|
|
43
51
|
* snapshotFormatVersion.
|
|
44
52
|
*/
|
|
45
53
|
export type ReadFluidDataStoreAttributes =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
| IFluidDataStoreAttributes0
|
|
55
|
+
| IFluidDataStoreAttributes1
|
|
56
|
+
| IFluidDataStoreAttributes2;
|
|
49
57
|
export type WriteFluidDataStoreAttributes = IFluidDataStoreAttributes1 | IFluidDataStoreAttributes2;
|
|
50
58
|
|
|
51
59
|
export function getAttributesFormatVersion(attributes: ReadFluidDataStoreAttributes): number {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
60
|
+
if (attributes.summaryFormatVersion) {
|
|
61
|
+
/**
|
|
62
|
+
* Version 2+: Introduces .channels trees for isolation of
|
|
63
|
+
* channel trees from data store objects.
|
|
64
|
+
*/
|
|
65
|
+
return attributes.summaryFormatVersion;
|
|
66
|
+
} else if (attributes.snapshotFormatVersion === "0.1") {
|
|
67
|
+
/**
|
|
68
|
+
* Version 1: from this version the pkg within the data store
|
|
69
|
+
* attributes blob is a JSON array rather than a string.
|
|
70
|
+
*/
|
|
71
|
+
return 1;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Version 0: format version is missing from summary.
|
|
75
|
+
* This indicates it is an older version.
|
|
76
|
+
*/
|
|
77
|
+
return 0;
|
|
70
78
|
}
|
|
71
79
|
|
|
72
80
|
export function hasIsolatedChannels(attributes: ReadFluidDataStoreAttributes): boolean {
|
|
73
|
-
|
|
81
|
+
return !!attributes.summaryFormatVersion && !attributes.disableIsolatedChannels;
|
|
74
82
|
}
|
|
75
83
|
export interface IContainerRuntimeMetadata extends ICreateContainerMetadata, IGCMetadata {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
readonly summaryFormatVersion: 1;
|
|
85
|
+
/** The last message processed at the time of summary. Only primitive property types are added to the summary. */
|
|
86
|
+
readonly message: ISummaryMetadataMessage | undefined;
|
|
87
|
+
/** True if channels are not isolated in .channels subtrees, otherwise isolated. */
|
|
88
|
+
readonly disableIsolatedChannels?: true;
|
|
89
|
+
/** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */
|
|
90
|
+
readonly summaryNumber?: number;
|
|
83
91
|
}
|
|
84
92
|
|
|
85
93
|
export interface ICreateContainerMetadata {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
94
|
+
/** Runtime version of the container when it was first created */
|
|
95
|
+
createContainerRuntimeVersion?: string;
|
|
96
|
+
/** Timestamp of the container when it was first created */
|
|
97
|
+
createContainerTimestamp?: number;
|
|
90
98
|
}
|
|
91
99
|
|
|
92
100
|
/** @see IGCMetadata.gcFeatureMatrix */
|
|
93
101
|
export interface GCFeatureMatrix {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
/**
|
|
103
|
+
* The Tombstone Generation value in effect when this file was created.
|
|
104
|
+
* Gives a way for an app to disqualify old files from GC Tombstone enforcement
|
|
105
|
+
* Provided via Container Runtime Options
|
|
106
|
+
*/
|
|
107
|
+
tombstoneGeneration?: number;
|
|
100
108
|
}
|
|
101
109
|
|
|
102
110
|
export type GCVersion = number;
|
|
103
111
|
export interface IGCMetadata {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
+
/**
|
|
113
|
+
* The version of the GC code that was run to generate the GC data that is written in the summary.
|
|
114
|
+
* If the persisted value doesn't match the current value in the code, saved GC data will be discarded and regenerated from scratch.
|
|
115
|
+
* Also, used to determine whether GC is enabled for this container or not:
|
|
116
|
+
* - A value of 0 or undefined means GC is disabled.
|
|
117
|
+
* - A value greater than 0 means GC is enabled.
|
|
118
|
+
*/
|
|
119
|
+
readonly gcFeature?: GCVersion;
|
|
112
120
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
121
|
+
/**
|
|
122
|
+
* A collection of different numerical "Generations" for different features,
|
|
123
|
+
* used to determine feature availability over time.
|
|
124
|
+
* This info may come from multiple sources (FF code, config service, app via Container Runtime Options),
|
|
125
|
+
* and pertains to aspects of the document that may be fixed for its lifetime.
|
|
126
|
+
*
|
|
127
|
+
* For each dimension, if the persisted value doesn't match the currently provided value,
|
|
128
|
+
* then this file does not support the corresponding feature as currently implemented.
|
|
129
|
+
*
|
|
130
|
+
* Guidance is that if no value is provided at runtime, it should result in the current default behavior.
|
|
131
|
+
*/
|
|
132
|
+
readonly gcFeatureMatrix?: GCFeatureMatrix;
|
|
133
|
+
/**
|
|
134
|
+
* Tells whether the GC sweep phase is enabled for this container.
|
|
135
|
+
* - True means sweep phase is enabled.
|
|
136
|
+
* - False means sweep phase is disabled. If GC is disabled as per gcFeature, sweep is also disabled.
|
|
137
|
+
*/
|
|
138
|
+
readonly sweepEnabled?: boolean;
|
|
139
|
+
/** If this is present, the session for this container will expire after this time and the container will close */
|
|
140
|
+
readonly sessionExpiryTimeoutMs?: number;
|
|
141
|
+
/** How long to wait after an object is unreferenced before deleting it via GC Sweep */
|
|
142
|
+
readonly sweepTimeoutMs?: number;
|
|
133
143
|
}
|
|
134
144
|
|
|
135
145
|
/** The properties of an ISequencedDocumentMessage to be stored in the metadata blob in summary. */
|
|
136
|
-
export type ISummaryMetadataMessage = Pick<
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
146
|
+
export type ISummaryMetadataMessage = Pick<
|
|
147
|
+
ISequencedDocumentMessage,
|
|
148
|
+
| "clientId"
|
|
149
|
+
| "clientSequenceNumber"
|
|
150
|
+
| "minimumSequenceNumber"
|
|
151
|
+
| "referenceSequenceNumber"
|
|
152
|
+
| "sequenceNumber"
|
|
153
|
+
| "timestamp"
|
|
154
|
+
| "type"
|
|
155
|
+
>;
|
|
144
156
|
|
|
145
157
|
/**
|
|
146
158
|
* Extracts the properties from an ISequencedDocumentMessage as defined by ISummaryMetadataMessage. This message is
|
|
147
159
|
* added to the metadata blob in summary.
|
|
148
160
|
*/
|
|
149
161
|
export const extractSummaryMetadataMessage = (
|
|
150
|
-
|
|
151
|
-
): ISummaryMetadataMessage | undefined =>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
162
|
+
message?: ISequencedDocumentMessage,
|
|
163
|
+
): ISummaryMetadataMessage | undefined =>
|
|
164
|
+
message === undefined
|
|
165
|
+
? undefined
|
|
166
|
+
: {
|
|
167
|
+
clientId: message.clientId,
|
|
168
|
+
clientSequenceNumber: message.clientSequenceNumber,
|
|
169
|
+
minimumSequenceNumber: message.minimumSequenceNumber,
|
|
170
|
+
referenceSequenceNumber: message.referenceSequenceNumber,
|
|
171
|
+
sequenceNumber: message.sequenceNumber,
|
|
172
|
+
timestamp: message.timestamp,
|
|
173
|
+
type: message.type,
|
|
174
|
+
};
|
|
160
175
|
|
|
161
176
|
export function getMetadataFormatVersion(metadata?: IContainerRuntimeMetadata): number {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
177
|
+
/**
|
|
178
|
+
* Version 2+: Introduces runtime sequence number for data verification.
|
|
179
|
+
*
|
|
180
|
+
* Version 1+: Introduces .metadata blob and .channels trees for isolation of
|
|
181
|
+
* data store trees from container-level objects.
|
|
182
|
+
* Also introduces enableGC option stored in the summary.
|
|
183
|
+
*
|
|
184
|
+
* Version 0: metadata blob missing; format version is missing from summary.
|
|
185
|
+
* This indicates it is an older version.
|
|
186
|
+
*/
|
|
187
|
+
return metadata?.summaryFormatVersion ?? 0;
|
|
173
188
|
}
|
|
174
189
|
|
|
175
190
|
export const aliasBlobName = ".aliases";
|
|
@@ -179,15 +194,15 @@ export const electedSummarizerBlobName = ".electedSummarizer";
|
|
|
179
194
|
export const blobsTreeName = ".blobs";
|
|
180
195
|
|
|
181
196
|
export function rootHasIsolatedChannels(metadata?: IContainerRuntimeMetadata): boolean {
|
|
182
|
-
|
|
197
|
+
return !!metadata && !metadata.disableIsolatedChannels;
|
|
183
198
|
}
|
|
184
199
|
|
|
185
200
|
export function getGCVersion(metadata?: IGCMetadata): GCVersion {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
201
|
+
if (!metadata) {
|
|
202
|
+
// Force to 0/disallowed in prior versions
|
|
203
|
+
return 0;
|
|
204
|
+
}
|
|
205
|
+
return metadata.gcFeature ?? 0;
|
|
191
206
|
}
|
|
192
207
|
|
|
193
208
|
export const protocolTreeName = ".protocol";
|
|
@@ -198,7 +213,13 @@ export const protocolTreeName = ".protocol";
|
|
|
198
213
|
* isolated data stores namespace. Without the namespace, this must
|
|
199
214
|
* be used to prevent name collisions with data store IDs.
|
|
200
215
|
*/
|
|
201
|
-
export const nonDataStorePaths = [
|
|
216
|
+
export const nonDataStorePaths = [
|
|
217
|
+
protocolTreeName,
|
|
218
|
+
".logTail",
|
|
219
|
+
".serviceProtocol",
|
|
220
|
+
blobsTreeName,
|
|
221
|
+
gcTreeKey,
|
|
222
|
+
];
|
|
202
223
|
|
|
203
224
|
export const dataStoreAttributesBlobName = ".component";
|
|
204
225
|
|
|
@@ -232,25 +253,26 @@ export const dataStoreAttributesBlobName = ".component";
|
|
|
232
253
|
* And adds +1 to treeNodeCount in stats.
|
|
233
254
|
*/
|
|
234
255
|
export function wrapSummaryInChannelsTree(summarizeResult: ISummaryTreeWithStats): void {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
256
|
+
summarizeResult.summary = {
|
|
257
|
+
type: SummaryType.Tree,
|
|
258
|
+
tree: { [channelsTreeName]: summarizeResult.summary },
|
|
259
|
+
};
|
|
260
|
+
summarizeResult.stats.treeNodeCount++;
|
|
240
261
|
}
|
|
241
262
|
|
|
242
263
|
export async function getFluidDataStoreAttributes(
|
|
243
|
-
|
|
244
|
-
|
|
264
|
+
storage: IDocumentStorageService,
|
|
265
|
+
snapshot: ISnapshotTree,
|
|
245
266
|
): Promise<ReadFluidDataStoreAttributes> {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
267
|
+
const attributes = await readAndParse<ReadFluidDataStoreAttributes>(
|
|
268
|
+
storage,
|
|
269
|
+
snapshot.blobs[dataStoreAttributesBlobName],
|
|
270
|
+
);
|
|
271
|
+
// Use the snapshotFormatVersion to determine how the pkg is encoded in the snapshot.
|
|
272
|
+
// For snapshotFormatVersion = "0.1" (1) or above, pkg is jsonified, otherwise it is just a string.
|
|
273
|
+
// However the feature of loading a detached container from snapshot, is added when the
|
|
274
|
+
// snapshotFormatVersion is at least "0.1" (1), so we don't expect it to be anything else.
|
|
275
|
+
const formatVersion = getAttributesFormatVersion(attributes);
|
|
276
|
+
assert(formatVersion > 0, 0x1d5 /* Invalid snapshot format version */);
|
|
277
|
+
return attributes;
|
|
256
278
|
}
|