@fluidframework/container-runtime 0.55.2 → 0.56.2
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/dist/containerRuntime.d.ts +3 -12
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +24 -38
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStoreContext.d.ts +42 -29
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +27 -49
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStores.d.ts +2 -1
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +74 -16
- package/dist/dataStores.js.map +1 -1
- package/dist/garbageCollection.d.ts +22 -9
- package/dist/garbageCollection.d.ts.map +1 -1
- package/dist/garbageCollection.js +55 -35
- package/dist/garbageCollection.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -17
- package/dist/index.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/runningSummarizer.d.ts.map +1 -1
- package/dist/runningSummarizer.js +2 -9
- package/dist/runningSummarizer.js.map +1 -1
- package/dist/summarizerTypes.d.ts +2 -0
- package/dist/summarizerTypes.d.ts.map +1 -1
- package/dist/summarizerTypes.js.map +1 -1
- package/dist/summaryFormat.d.ts.map +1 -1
- package/dist/summaryFormat.js +2 -1
- package/dist/summaryFormat.js.map +1 -1
- package/dist/summaryGenerator.d.ts +0 -5
- package/dist/summaryGenerator.d.ts.map +1 -1
- package/dist/summaryGenerator.js +2 -1
- package/dist/summaryGenerator.js.map +1 -1
- package/garbageCollection.md +33 -0
- package/lib/containerRuntime.d.ts +3 -12
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +25 -39
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStoreContext.d.ts +42 -29
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +25 -47
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStores.d.ts +2 -1
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +75 -17
- package/lib/dataStores.js.map +1 -1
- package/lib/garbageCollection.d.ts +22 -9
- package/lib/garbageCollection.d.ts.map +1 -1
- package/lib/garbageCollection.js +55 -35
- package/lib/garbageCollection.js.map +1 -1
- package/lib/index.d.ts +6 -6
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -6
- package/lib/index.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/runningSummarizer.d.ts.map +1 -1
- package/lib/runningSummarizer.js +2 -9
- package/lib/runningSummarizer.js.map +1 -1
- package/lib/summarizerTypes.d.ts +2 -0
- package/lib/summarizerTypes.d.ts.map +1 -1
- package/lib/summarizerTypes.js.map +1 -1
- package/lib/summaryFormat.d.ts.map +1 -1
- package/lib/summaryFormat.js +2 -1
- package/lib/summaryFormat.js.map +1 -1
- package/lib/summaryGenerator.d.ts +0 -5
- package/lib/summaryGenerator.d.ts.map +1 -1
- package/lib/summaryGenerator.js +2 -1
- package/lib/summaryGenerator.js.map +1 -1
- package/package.json +14 -14
- package/src/containerRuntime.ts +38 -42
- package/src/dataStoreContext.ts +76 -122
- package/src/dataStores.ts +75 -48
- package/src/garbageCollection.ts +62 -39
- package/src/index.ts +51 -6
- package/src/packageVersion.ts +1 -1
- package/src/runningSummarizer.ts +2 -7
- package/src/summarizerTypes.ts +2 -0
- package/src/summaryFormat.ts +2 -1
- package/src/summaryGenerator.ts +2 -6
package/src/containerRuntime.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { EventEmitter } from "events";
|
|
7
|
-
import { ITelemetryGenericEvent, ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
7
|
+
import { ITelemetryBaseLogger, ITelemetryGenericEvent, ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
8
8
|
import {
|
|
9
9
|
FluidObject,
|
|
10
10
|
IFluidHandle,
|
|
@@ -50,7 +50,6 @@ import {
|
|
|
50
50
|
import { DriverHeader, IDocumentStorageService, ISummaryContext } from "@fluidframework/driver-definitions";
|
|
51
51
|
import { readAndParse, BlobAggregationStorage } from "@fluidframework/driver-utils";
|
|
52
52
|
import {
|
|
53
|
-
CreateProcessingError,
|
|
54
53
|
DataCorruptionError,
|
|
55
54
|
GenericError,
|
|
56
55
|
UsageError,
|
|
@@ -290,6 +289,16 @@ type IRuntimeMessageMetadata = undefined | {
|
|
|
290
289
|
batch?: boolean;
|
|
291
290
|
};
|
|
292
291
|
|
|
292
|
+
/**
|
|
293
|
+
* @deprecated
|
|
294
|
+
* Untagged logger is unsupported going forward. There are old loaders with old ContainerContexts that only
|
|
295
|
+
* have the untagged logger, so to accommodate that scenario the below interface is used. It can be removed once
|
|
296
|
+
* its usage is removed from TaggedLoggerAdapter fallback.
|
|
297
|
+
*/
|
|
298
|
+
interface OldContainerContextWithLogger extends IContainerContext {
|
|
299
|
+
logger: ITelemetryBaseLogger;
|
|
300
|
+
};
|
|
301
|
+
|
|
293
302
|
// Local storage key to set the default flush mode to TurnBased
|
|
294
303
|
const turnBasedFlushModeKey = "Fluid.ContainerRuntime.FlushModeTurnBased";
|
|
295
304
|
|
|
@@ -642,7 +651,9 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
|
|
|
642
651
|
existing?: boolean,
|
|
643
652
|
): Promise<ContainerRuntime> {
|
|
644
653
|
// If taggedLogger exists, use it. Otherwise, wrap the vanilla logger:
|
|
645
|
-
|
|
654
|
+
// back-compat: Remove the TaggedLoggerAdapter fallback once all the host are using loader > 0.45
|
|
655
|
+
const passLogger = context.taggedLogger ?? new TaggedLoggerAdapter((context as
|
|
656
|
+
OldContainerContextWithLogger).logger);
|
|
646
657
|
const logger = ChildLogger.create(passLogger, undefined, {
|
|
647
658
|
all: {
|
|
648
659
|
runtimeVersion: pkgVersion,
|
|
@@ -758,13 +769,6 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
|
|
|
758
769
|
return runtime;
|
|
759
770
|
}
|
|
760
771
|
|
|
761
|
-
/**
|
|
762
|
-
* @deprecated This will be removed in a later release. Deprecated in 0.53
|
|
763
|
-
*/
|
|
764
|
-
public get id(): string {
|
|
765
|
-
return this.context.id;
|
|
766
|
-
}
|
|
767
|
-
|
|
768
772
|
public get options(): ILoaderOptions {
|
|
769
773
|
return this.context.options;
|
|
770
774
|
}
|
|
@@ -885,6 +889,9 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
|
|
|
885
889
|
|
|
886
890
|
private dirtyContainer = false;
|
|
887
891
|
private emitDirtyDocumentEvent = true;
|
|
892
|
+
|
|
893
|
+
private summarizerWarning = (warning: ContainerWarning) =>
|
|
894
|
+
this.mc.logger.sendTelemetryEvent({ eventName: "summarizerWarning" }, warning);
|
|
888
895
|
/**
|
|
889
896
|
* Summarizer is responsible for coordinating when to send generate and send summaries.
|
|
890
897
|
* It is the main entry point for summary work.
|
|
@@ -902,14 +909,6 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
|
|
|
902
909
|
|
|
903
910
|
private readonly dataStores: DataStores;
|
|
904
911
|
|
|
905
|
-
/**
|
|
906
|
-
* True, if GC data should be written at root of the summary tree.
|
|
907
|
-
* False, if data stores should write GC blobs in their summary tree.
|
|
908
|
-
*/
|
|
909
|
-
public get writeGCDataAtRoot(): boolean {
|
|
910
|
-
return this.garbageCollector.writeDataAtRoot;
|
|
911
|
-
}
|
|
912
|
-
|
|
913
912
|
/**
|
|
914
913
|
* True if generating summaries with isolated channels is
|
|
915
914
|
* explicitly disabled. This only affects how summaries are written,
|
|
@@ -1051,6 +1050,7 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
|
|
|
1051
1050
|
async () => this.garbageCollector.getDataStoreBaseGCDetails(),
|
|
1052
1051
|
(id: string) => this.garbageCollector.nodeChanged(id),
|
|
1053
1052
|
new Map<string, string>(dataStoreAliasMap),
|
|
1053
|
+
this.garbageCollector.writeDataAtRoot,
|
|
1054
1054
|
);
|
|
1055
1055
|
|
|
1056
1056
|
this.blobManager = new BlobManager(
|
|
@@ -1165,7 +1165,7 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
|
|
|
1165
1165
|
},
|
|
1166
1166
|
this.runtimeOptions.summaryOptions.summarizerOptions,
|
|
1167
1167
|
);
|
|
1168
|
-
this.summaryManager.on("summarizerWarning", this.
|
|
1168
|
+
this.summaryManager.on("summarizerWarning", this.summarizerWarning);
|
|
1169
1169
|
this.summaryManager.start();
|
|
1170
1170
|
}
|
|
1171
1171
|
}
|
|
@@ -1231,7 +1231,7 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
|
|
|
1231
1231
|
}, error);
|
|
1232
1232
|
|
|
1233
1233
|
if (this.summaryManager !== undefined) {
|
|
1234
|
-
this.summaryManager.off("summarizerWarning", this.
|
|
1234
|
+
this.summaryManager.off("summarizerWarning", this.summarizerWarning);
|
|
1235
1235
|
this.summaryManager.dispose();
|
|
1236
1236
|
}
|
|
1237
1237
|
this.garbageCollector.dispose();
|
|
@@ -1383,7 +1383,7 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
|
|
|
1383
1383
|
return convertSummaryTreeToITree(summaryResult.summary);
|
|
1384
1384
|
}
|
|
1385
1385
|
|
|
1386
|
-
private
|
|
1386
|
+
private addContainerStateToSummary(summaryTree: ISummaryTreeWithStats) {
|
|
1387
1387
|
addBlobToSummary(summaryTree, metadataBlobName, JSON.stringify(this.formMetadata()));
|
|
1388
1388
|
if (this.chunkMap.size > 0) {
|
|
1389
1389
|
const content = JSON.stringify([...this.chunkMap]);
|
|
@@ -1408,7 +1408,7 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
|
|
|
1408
1408
|
addTreeToSummary(summaryTree, blobsTreeName, blobsTree);
|
|
1409
1409
|
}
|
|
1410
1410
|
|
|
1411
|
-
if (this.
|
|
1411
|
+
if (this.garbageCollector.writeDataAtRoot) {
|
|
1412
1412
|
const gcSummary = this.garbageCollector.summarize();
|
|
1413
1413
|
if (gcSummary !== undefined) {
|
|
1414
1414
|
addTreeToSummary(summaryTree, gcTreeKey, gcSummary);
|
|
@@ -1660,20 +1660,18 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
|
|
|
1660
1660
|
const savedFlushMode = this.flushMode;
|
|
1661
1661
|
this.setFlushMode(FlushMode.TurnBased);
|
|
1662
1662
|
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
this.setFlushMode(savedFlushMode);
|
|
1667
|
-
} catch(error) {
|
|
1668
|
-
this.closeFn(CreateProcessingError(error, "orderSequentially"));
|
|
1669
|
-
throw error; // throw the original error for the consumer of the runtime
|
|
1670
|
-
}
|
|
1663
|
+
this.trackOrderSequentiallyCalls(callback);
|
|
1664
|
+
this.flush();
|
|
1665
|
+
this.setFlushMode(savedFlushMode);
|
|
1671
1666
|
}
|
|
1672
1667
|
|
|
1673
1668
|
private trackOrderSequentiallyCalls(callback: () => void): void {
|
|
1674
1669
|
try {
|
|
1675
1670
|
this._orderSequentiallyCalls++;
|
|
1676
1671
|
callback();
|
|
1672
|
+
} catch (error) {
|
|
1673
|
+
this.closeFn(new GenericError("orderSequentiallyCallbackException", error));
|
|
1674
|
+
throw error; // throw the original error for the consumer of the runtime
|
|
1677
1675
|
} finally {
|
|
1678
1676
|
this._orderSequentiallyCalls--;
|
|
1679
1677
|
}
|
|
@@ -1723,7 +1721,7 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
|
|
|
1723
1721
|
}
|
|
1724
1722
|
|
|
1725
1723
|
private canSendOps() {
|
|
1726
|
-
return this.connected && !this.deltaManager.readonly;
|
|
1724
|
+
return this.connected && !this.deltaManager.readOnlyInfo.readonly;
|
|
1727
1725
|
}
|
|
1728
1726
|
|
|
1729
1727
|
public getQuorum(): IQuorumClients {
|
|
@@ -1735,11 +1733,6 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
|
|
|
1735
1733
|
return this.context.audience!;
|
|
1736
1734
|
}
|
|
1737
1735
|
|
|
1738
|
-
// @deprecated Needs to become private
|
|
1739
|
-
public readonly raiseContainerWarning = (warning: ContainerWarning) => {
|
|
1740
|
-
this.context.raiseContainerWarning(warning);
|
|
1741
|
-
};
|
|
1742
|
-
|
|
1743
1736
|
/**
|
|
1744
1737
|
* Returns true of container is dirty, i.e. there are some pending local changes that
|
|
1745
1738
|
* either were not sent out to delta stream or were not yet acknowledged.
|
|
@@ -1810,7 +1803,7 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
|
|
|
1810
1803
|
// Wrap data store summaries in .channels subtree.
|
|
1811
1804
|
wrapSummaryInChannelsTree(summarizeResult);
|
|
1812
1805
|
}
|
|
1813
|
-
this.
|
|
1806
|
+
this.addContainerStateToSummary(summarizeResult);
|
|
1814
1807
|
return summarizeResult.summary;
|
|
1815
1808
|
}
|
|
1816
1809
|
|
|
@@ -1833,7 +1826,7 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
|
|
|
1833
1826
|
wrapSummaryInChannelsTree(summarizeResult);
|
|
1834
1827
|
pathPartsForChildren = [channelsTreeName];
|
|
1835
1828
|
}
|
|
1836
|
-
this.
|
|
1829
|
+
this.addContainerStateToSummary(summarizeResult);
|
|
1837
1830
|
return {
|
|
1838
1831
|
...summarizeResult,
|
|
1839
1832
|
id: "",
|
|
@@ -1858,6 +1851,8 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
|
|
|
1858
1851
|
/** True to run GC sweep phase after the mark phase */
|
|
1859
1852
|
runSweep?: boolean,
|
|
1860
1853
|
}): Promise<ISummaryTreeWithStats> {
|
|
1854
|
+
this.verifyNotClosed();
|
|
1855
|
+
|
|
1861
1856
|
const { summaryLogger, fullTree = false, trackState = true, runGC = true, runSweep, fullGC } = options;
|
|
1862
1857
|
|
|
1863
1858
|
if (runGC) {
|
|
@@ -2015,13 +2010,13 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
|
|
|
2015
2010
|
|
|
2016
2011
|
const trace = Trace.start();
|
|
2017
2012
|
let summarizeResult: ISummaryTreeWithStats;
|
|
2013
|
+
// If the GC state needs to be reset, we need to force a full tree summary and update the unreferenced
|
|
2014
|
+
// state of all the nodes.
|
|
2015
|
+
const forcedFullTree = this.garbageCollector.summaryStateNeedsReset;
|
|
2018
2016
|
try {
|
|
2019
2017
|
summarizeResult = await this.summarize({
|
|
2020
2018
|
summaryLogger,
|
|
2021
|
-
|
|
2022
|
-
// running full summary. This is used to handle scenarios where we upgrade the GC version because we
|
|
2023
|
-
// cannot trust the data from the previous GC version anymore.
|
|
2024
|
-
fullTree: fullTree || this.garbageCollector.hasGCVersionChanged,
|
|
2019
|
+
fullTree: fullTree || forcedFullTree,
|
|
2025
2020
|
trackState: true,
|
|
2026
2021
|
runGC: this.garbageCollector.shouldRunGC,
|
|
2027
2022
|
});
|
|
@@ -2049,6 +2044,7 @@ export class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents>
|
|
|
2049
2044
|
summaryTree,
|
|
2050
2045
|
summaryStats,
|
|
2051
2046
|
generateDuration: trace.trace().duration,
|
|
2047
|
+
forcedFullTree,
|
|
2052
2048
|
} as const;
|
|
2053
2049
|
|
|
2054
2050
|
continueResult = checkContinue();
|
package/src/dataStoreContext.ts
CHANGED
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
IAudience,
|
|
15
15
|
IDeltaManager,
|
|
16
|
-
ContainerWarning,
|
|
17
16
|
BindState,
|
|
18
17
|
AttachState,
|
|
19
18
|
ILoaderOptions,
|
|
@@ -120,6 +119,36 @@ interface FluidDataStoreMessage {
|
|
|
120
119
|
type: string;
|
|
121
120
|
}
|
|
122
121
|
|
|
122
|
+
/** Properties necessary for creating a FluidDataStoreContext */
|
|
123
|
+
export interface IFluidDataStoreContextProps {
|
|
124
|
+
readonly id: string;
|
|
125
|
+
readonly runtime: ContainerRuntime;
|
|
126
|
+
readonly storage: IDocumentStorageService;
|
|
127
|
+
readonly scope: FluidObject;
|
|
128
|
+
readonly createSummarizerNodeFn: CreateChildSummarizerNodeFn;
|
|
129
|
+
readonly writeGCDataAtRoot: boolean;
|
|
130
|
+
readonly disableIsolatedChannels: boolean;
|
|
131
|
+
readonly pkg?: Readonly<string[]>;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** Properties necessary for creating a local FluidDataStoreContext */
|
|
135
|
+
export interface ILocalFluidDataStoreContextProps extends IFluidDataStoreContextProps {
|
|
136
|
+
readonly pkg: Readonly<string[]> | undefined;
|
|
137
|
+
readonly snapshotTree: ISnapshotTree | undefined;
|
|
138
|
+
readonly isRootDataStore: boolean | undefined;
|
|
139
|
+
readonly bindChannelFn: (channel: IFluidDataStoreChannel) => void;
|
|
140
|
+
/**
|
|
141
|
+
* @deprecated 0.16 Issue #1635, #3631
|
|
142
|
+
*/
|
|
143
|
+
readonly createProps?: any;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Properties necessary for creating a remote FluidDataStoreContext */
|
|
147
|
+
export interface IRemoteFluidDataStoreContextProps extends IFluidDataStoreContextProps {
|
|
148
|
+
readonly snapshotTree: ISnapshotTree | string | undefined;
|
|
149
|
+
readonly getBaseGCDetails: () => Promise<IGarbageCollectionDetailsBase | undefined>;
|
|
150
|
+
}
|
|
151
|
+
|
|
123
152
|
/**
|
|
124
153
|
* Represents the context for the store. This context is passed to the store runtime.
|
|
125
154
|
*/
|
|
@@ -186,15 +215,6 @@ export abstract class FluidDataStoreContext extends TypedEventEmitter<IFluidData
|
|
|
186
215
|
return (await this.getInitialSnapshotDetails()).isRootDataStore;
|
|
187
216
|
}
|
|
188
217
|
|
|
189
|
-
protected get disableIsolatedChannels(): boolean {
|
|
190
|
-
return this._containerRuntime.disableIsolatedChannels;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/** Tells whether GC data will be written at the root of the summary tree. If so, data store should not write it. */
|
|
194
|
-
protected get writeGCDataAtRoot(): boolean {
|
|
195
|
-
return this._containerRuntime.writeGCDataAtRoot;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
218
|
protected registry: IFluidDataStoreRegistry | undefined;
|
|
199
219
|
|
|
200
220
|
protected detachedRuntimeCreation = false;
|
|
@@ -214,23 +234,34 @@ export abstract class FluidDataStoreContext extends TypedEventEmitter<IFluidData
|
|
|
214
234
|
// if it realizes after GC is run.
|
|
215
235
|
private lastUsedState: { usedRoutes: string[], gcTimestamp?: number } | undefined;
|
|
216
236
|
|
|
237
|
+
public readonly id: string;
|
|
238
|
+
private readonly _containerRuntime: ContainerRuntime;
|
|
239
|
+
public readonly storage: IDocumentStorageService;
|
|
240
|
+
public readonly scope: FluidObject;
|
|
241
|
+
private readonly writeGCDataAtRoot: boolean;
|
|
242
|
+
protected readonly disableIsolatedChannels: boolean;
|
|
243
|
+
protected pkg?: readonly string[];
|
|
244
|
+
|
|
217
245
|
constructor(
|
|
218
|
-
|
|
219
|
-
public readonly id: string,
|
|
246
|
+
props: IFluidDataStoreContextProps,
|
|
220
247
|
private readonly existing: boolean,
|
|
221
|
-
public readonly storage: IDocumentStorageService,
|
|
222
|
-
public readonly scope: FluidObject | FluidObject,
|
|
223
|
-
createSummarizerNode: CreateChildSummarizerNodeFn,
|
|
224
248
|
private bindState: BindState,
|
|
225
249
|
public readonly isLocalDataStore: boolean,
|
|
226
|
-
|
|
227
|
-
protected pkg?: readonly string[],
|
|
250
|
+
bindChannelFn: (channel: IFluidDataStoreChannel) => void,
|
|
228
251
|
) {
|
|
229
252
|
super();
|
|
230
253
|
|
|
254
|
+
this._containerRuntime = props.runtime;
|
|
255
|
+
this.id = props.id;
|
|
256
|
+
this.storage = props.storage;
|
|
257
|
+
this.scope = props.scope;
|
|
258
|
+
this.writeGCDataAtRoot = props.writeGCDataAtRoot;
|
|
259
|
+
this.disableIsolatedChannels = props.disableIsolatedChannels;
|
|
260
|
+
this.pkg = props.pkg;
|
|
261
|
+
|
|
231
262
|
// URIs use slashes as delimiters. Handles use URIs.
|
|
232
263
|
// Thus having slashes in types almost guarantees trouble down the road!
|
|
233
|
-
assert(id.indexOf("/") === -1, 0x13a /* `Data store ID contains slash: ${id}` */);
|
|
264
|
+
assert(this.id.indexOf("/") === -1, 0x13a /* `Data store ID contains slash: ${id}` */);
|
|
234
265
|
|
|
235
266
|
this._attachState = this.containerRuntime.attachState !== AttachState.Detached && this.existing ?
|
|
236
267
|
this.containerRuntime.attachState : AttachState.Detached;
|
|
@@ -239,14 +270,14 @@ export abstract class FluidDataStoreContext extends TypedEventEmitter<IFluidData
|
|
|
239
270
|
assert(this.bindState === BindState.NotBound, 0x13b /* "datastore context is already in bound state" */);
|
|
240
271
|
this.bindState = BindState.Binding;
|
|
241
272
|
assert(this.channel !== undefined, 0x13c /* "undefined channel on datastore context" */);
|
|
242
|
-
|
|
273
|
+
bindChannelFn(this.channel);
|
|
243
274
|
this.bindState = BindState.Bound;
|
|
244
275
|
};
|
|
245
276
|
|
|
246
277
|
const thisSummarizeInternal =
|
|
247
278
|
async (fullTree: boolean, trackState: boolean) => this.summarizeInternal(fullTree, trackState);
|
|
248
279
|
|
|
249
|
-
this.summarizerNode =
|
|
280
|
+
this.summarizerNode = props.createSummarizerNodeFn(
|
|
250
281
|
thisSummarizeInternal,
|
|
251
282
|
async (fullGC?: boolean) => this.getGCDataInternal(fullGC),
|
|
252
283
|
async () => this.getBaseGCDetails(),
|
|
@@ -581,11 +612,6 @@ export abstract class FluidDataStoreContext extends TypedEventEmitter<IFluidData
|
|
|
581
612
|
return this._containerRuntime.submitDataStoreSignal(this.id, type, content);
|
|
582
613
|
}
|
|
583
614
|
|
|
584
|
-
// @deprecated Warnings are being deprecated
|
|
585
|
-
public raiseContainerWarning(warning: ContainerWarning): void {
|
|
586
|
-
this.containerRuntime.raiseContainerWarning(warning);
|
|
587
|
-
}
|
|
588
|
-
|
|
589
615
|
protected bindRuntime(channel: IFluidDataStoreChannel) {
|
|
590
616
|
if (this.channel) {
|
|
591
617
|
throw new Error("Runtime already bound");
|
|
@@ -702,37 +728,25 @@ export abstract class FluidDataStoreContext extends TypedEventEmitter<IFluidData
|
|
|
702
728
|
}
|
|
703
729
|
}
|
|
704
730
|
|
|
705
|
-
export class
|
|
731
|
+
export class RemoteFluidDataStoreContext extends FluidDataStoreContext {
|
|
706
732
|
private isRootDataStore: boolean | undefined;
|
|
733
|
+
private readonly initSnapshotValue: ISnapshotTree | string | undefined;
|
|
707
734
|
private readonly baseGCDetailsP: Promise<IGarbageCollectionDetailsBase>;
|
|
708
735
|
|
|
709
|
-
constructor(
|
|
710
|
-
id: string,
|
|
711
|
-
private readonly initSnapshotValue: ISnapshotTree | string | undefined,
|
|
712
|
-
getBaseGCDetails: () => Promise<IGarbageCollectionDetailsBase | undefined>,
|
|
713
|
-
runtime: ContainerRuntime,
|
|
714
|
-
storage: IDocumentStorageService,
|
|
715
|
-
scope: FluidObject,
|
|
716
|
-
createSummarizerNode: CreateChildSummarizerNodeFn,
|
|
717
|
-
pkg?: string[],
|
|
718
|
-
) {
|
|
736
|
+
constructor(props: IRemoteFluidDataStoreContextProps) {
|
|
719
737
|
super(
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
true,
|
|
723
|
-
storage,
|
|
724
|
-
scope,
|
|
725
|
-
createSummarizerNode,
|
|
738
|
+
props,
|
|
739
|
+
true /* existing */,
|
|
726
740
|
BindState.Bound,
|
|
727
|
-
false
|
|
741
|
+
false /* isLocalDataStore */,
|
|
728
742
|
() => {
|
|
729
743
|
throw new Error("Already attached");
|
|
730
744
|
},
|
|
731
|
-
pkg,
|
|
732
745
|
);
|
|
733
746
|
|
|
747
|
+
this.initSnapshotValue = props.snapshotTree;
|
|
734
748
|
this.baseGCDetailsP = new LazyPromise<IGarbageCollectionDetailsBase>(async () => {
|
|
735
|
-
return (await getBaseGCDetails()) ?? {};
|
|
749
|
+
return (await props.getBaseGCDetails()) ?? {};
|
|
736
750
|
});
|
|
737
751
|
}
|
|
738
752
|
|
|
@@ -831,32 +845,20 @@ export class RemotedFluidDataStoreContext extends FluidDataStoreContext {
|
|
|
831
845
|
* Base class for detached & attached context classes
|
|
832
846
|
*/
|
|
833
847
|
export class LocalFluidDataStoreContextBase extends FluidDataStoreContext {
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
storage: IDocumentStorageService,
|
|
839
|
-
scope: FluidObject,
|
|
840
|
-
createSummarizerNode: CreateChildSummarizerNodeFn,
|
|
841
|
-
bindChannel: (channel: IFluidDataStoreChannel) => void,
|
|
842
|
-
private readonly snapshotTree: ISnapshotTree | undefined,
|
|
843
|
-
protected isRootDataStore: boolean | undefined,
|
|
844
|
-
/**
|
|
845
|
-
* @deprecated 0.16 Issue #1635, #3631
|
|
846
|
-
*/
|
|
847
|
-
public readonly createProps?: any,
|
|
848
|
-
) {
|
|
848
|
+
private readonly snapshotTree: ISnapshotTree | undefined;
|
|
849
|
+
protected isRootDataStore: boolean | undefined;
|
|
850
|
+
|
|
851
|
+
constructor(props: ILocalFluidDataStoreContextProps) {
|
|
849
852
|
super(
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
snapshotTree
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
pkg);
|
|
853
|
+
props,
|
|
854
|
+
props.snapshotTree !== undefined ? true : false /* existing */,
|
|
855
|
+
props.snapshotTree ? BindState.Bound : BindState.NotBound,
|
|
856
|
+
true /* isLocalDataStore */,
|
|
857
|
+
props.bindChannelFn,
|
|
858
|
+
);
|
|
859
|
+
|
|
860
|
+
this.snapshotTree = props.snapshotTree;
|
|
861
|
+
this.isRootDataStore = props.isRootDataStore;
|
|
860
862
|
this.attachListeners();
|
|
861
863
|
}
|
|
862
864
|
|
|
@@ -892,11 +894,6 @@ export class LocalFluidDataStoreContextBase extends FluidDataStoreContext {
|
|
|
892
894
|
);
|
|
893
895
|
addBlobToSummary(summarizeResult, dataStoreAttributesBlobName, JSON.stringify(attributes));
|
|
894
896
|
|
|
895
|
-
// Add GC data to the summary if it's not written at the root.
|
|
896
|
-
if (!this.writeGCDataAtRoot) {
|
|
897
|
-
addBlobToSummary(summarizeResult, gcBlobKey, JSON.stringify(this.summarizerNode.getGCSummaryDetails()));
|
|
898
|
-
}
|
|
899
|
-
|
|
900
897
|
// Attach message needs the summary in ITree format. Convert the ISummaryTree into an ITree.
|
|
901
898
|
const snapshot = convertSummaryTreeToITree(summarizeResult.summary);
|
|
902
899
|
|
|
@@ -970,32 +967,8 @@ export class LocalFluidDataStoreContextBase extends FluidDataStoreContext {
|
|
|
970
967
|
* Runtime is created using data store factory that is associated with this context.
|
|
971
968
|
*/
|
|
972
969
|
export class LocalFluidDataStoreContext extends LocalFluidDataStoreContextBase {
|
|
973
|
-
constructor(
|
|
974
|
-
|
|
975
|
-
pkg: string[] | undefined,
|
|
976
|
-
runtime: ContainerRuntime,
|
|
977
|
-
storage: IDocumentStorageService,
|
|
978
|
-
scope: FluidObject & FluidObject,
|
|
979
|
-
createSummarizerNode: CreateChildSummarizerNodeFn,
|
|
980
|
-
bindChannel: (channel: IFluidDataStoreChannel) => void,
|
|
981
|
-
snapshotTree: ISnapshotTree | undefined,
|
|
982
|
-
isRootDataStore: boolean | undefined,
|
|
983
|
-
/**
|
|
984
|
-
* @deprecated 0.16 Issue #1635, #3631
|
|
985
|
-
*/
|
|
986
|
-
createProps?: any,
|
|
987
|
-
) {
|
|
988
|
-
super(
|
|
989
|
-
id,
|
|
990
|
-
pkg,
|
|
991
|
-
runtime,
|
|
992
|
-
storage,
|
|
993
|
-
scope,
|
|
994
|
-
createSummarizerNode,
|
|
995
|
-
bindChannel,
|
|
996
|
-
snapshotTree,
|
|
997
|
-
isRootDataStore,
|
|
998
|
-
createProps);
|
|
970
|
+
constructor(props: ILocalFluidDataStoreContextProps) {
|
|
971
|
+
super(props);
|
|
999
972
|
}
|
|
1000
973
|
}
|
|
1001
974
|
|
|
@@ -1009,27 +982,8 @@ export class LocalDetachedFluidDataStoreContext
|
|
|
1009
982
|
extends LocalFluidDataStoreContextBase
|
|
1010
983
|
implements IFluidDataStoreContextDetached
|
|
1011
984
|
{
|
|
1012
|
-
constructor(
|
|
1013
|
-
|
|
1014
|
-
pkg: Readonly<string[]>,
|
|
1015
|
-
runtime: ContainerRuntime,
|
|
1016
|
-
storage: IDocumentStorageService,
|
|
1017
|
-
scope: FluidObject & FluidObject,
|
|
1018
|
-
createSummarizerNode: CreateChildSummarizerNodeFn,
|
|
1019
|
-
bindChannel: (channel: IFluidDataStoreChannel) => void,
|
|
1020
|
-
isRootDataStore: boolean,
|
|
1021
|
-
) {
|
|
1022
|
-
super(
|
|
1023
|
-
id,
|
|
1024
|
-
pkg,
|
|
1025
|
-
runtime,
|
|
1026
|
-
storage,
|
|
1027
|
-
scope,
|
|
1028
|
-
createSummarizerNode,
|
|
1029
|
-
bindChannel,
|
|
1030
|
-
undefined,
|
|
1031
|
-
isRootDataStore,
|
|
1032
|
-
);
|
|
985
|
+
constructor(props: ILocalFluidDataStoreContextProps) {
|
|
986
|
+
super(props);
|
|
1033
987
|
this.detachedRuntimeCreation = true;
|
|
1034
988
|
}
|
|
1035
989
|
|