@fluidframework/container-loader 2.0.0-dev.4.4.0.162574 → 2.0.0-dev.5.3.2.178189
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/CHANGELOG.md +59 -0
- package/README.md +27 -3
- package/dist/catchUpMonitor.d.ts +1 -1
- package/dist/catchUpMonitor.d.ts.map +1 -1
- package/dist/catchUpMonitor.js.map +1 -1
- package/dist/connectionManager.d.ts +3 -2
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +32 -13
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionStateHandler.d.ts +18 -3
- package/dist/connectionStateHandler.d.ts.map +1 -1
- package/dist/connectionStateHandler.js +34 -9
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container.d.ts +99 -70
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +260 -218
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +24 -67
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js +28 -217
- package/dist/containerContext.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts +3 -3
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +29 -6
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/contracts.d.ts +9 -3
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/deltaManager.d.ts +22 -9
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +42 -31
- package/dist/deltaManager.js.map +1 -1
- package/dist/deltaQueue.d.ts +2 -3
- package/dist/deltaQueue.d.ts.map +1 -1
- package/dist/deltaQueue.js +2 -3
- package/dist/deltaQueue.js.map +1 -1
- package/dist/disposal.d.ts +13 -0
- package/dist/disposal.d.ts.map +1 -0
- package/dist/disposal.js +25 -0
- package/dist/disposal.js.map +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +9 -8
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +47 -61
- package/dist/loader.js.map +1 -1
- package/dist/noopHeuristic.d.ts +23 -0
- package/dist/noopHeuristic.d.ts.map +1 -0
- package/dist/{collabWindowTracker.js → noopHeuristic.js} +30 -42
- package/dist/noopHeuristic.js.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/protocol.d.ts +7 -12
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +17 -19
- package/dist/protocol.js.map +1 -1
- package/dist/protocolTreeDocumentStorageService.d.ts +1 -1
- package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/dist/protocolTreeDocumentStorageService.js.map +1 -1
- package/dist/quorum.d.ts +1 -17
- package/dist/quorum.d.ts.map +1 -1
- package/dist/quorum.js +1 -17
- package/dist/quorum.js.map +1 -1
- package/dist/retriableDocumentStorageService.d.ts +3 -2
- package/dist/retriableDocumentStorageService.d.ts.map +1 -1
- package/dist/retriableDocumentStorageService.js.map +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +8 -1
- package/dist/utils.js.map +1 -1
- package/lib/catchUpMonitor.d.ts +1 -1
- package/lib/catchUpMonitor.d.ts.map +1 -1
- package/lib/catchUpMonitor.js.map +1 -1
- package/lib/connectionManager.d.ts +3 -2
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +33 -14
- package/lib/connectionManager.js.map +1 -1
- package/lib/connectionStateHandler.d.ts +18 -3
- package/lib/connectionStateHandler.d.ts.map +1 -1
- package/lib/connectionStateHandler.js +35 -10
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container.d.ts +99 -70
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +264 -222
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts +24 -67
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js +28 -217
- package/lib/containerContext.js.map +1 -1
- package/lib/containerStorageAdapter.d.ts +3 -3
- package/lib/containerStorageAdapter.d.ts.map +1 -1
- package/lib/containerStorageAdapter.js +29 -6
- package/lib/containerStorageAdapter.js.map +1 -1
- package/lib/contracts.d.ts +9 -3
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/deltaManager.d.ts +22 -9
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +44 -33
- package/lib/deltaManager.js.map +1 -1
- package/lib/deltaQueue.d.ts +2 -3
- package/lib/deltaQueue.d.ts.map +1 -1
- package/lib/deltaQueue.js +2 -3
- package/lib/deltaQueue.js.map +1 -1
- package/lib/disposal.d.ts +13 -0
- package/lib/disposal.d.ts.map +1 -0
- package/lib/disposal.js +21 -0
- package/lib/disposal.js.map +1 -0
- package/lib/index.d.ts +1 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/loader.d.ts +9 -8
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +47 -61
- package/lib/loader.js.map +1 -1
- package/lib/noopHeuristic.d.ts +23 -0
- package/lib/noopHeuristic.d.ts.map +1 -0
- package/lib/{collabWindowTracker.js → noopHeuristic.js} +30 -42
- package/lib/noopHeuristic.js.map +1 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/protocol.d.ts +7 -12
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +15 -18
- package/lib/protocol.js.map +1 -1
- package/lib/protocolTreeDocumentStorageService.d.ts +1 -1
- package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/lib/protocolTreeDocumentStorageService.js.map +1 -1
- package/lib/quorum.d.ts +1 -17
- package/lib/quorum.d.ts.map +1 -1
- package/lib/quorum.js +1 -16
- package/lib/quorum.js.map +1 -1
- package/lib/retriableDocumentStorageService.d.ts +3 -2
- package/lib/retriableDocumentStorageService.d.ts.map +1 -1
- package/lib/retriableDocumentStorageService.js.map +1 -1
- package/lib/utils.d.ts +2 -0
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +7 -1
- package/lib/utils.js.map +1 -1
- package/package.json +22 -20
- package/src/catchUpMonitor.ts +1 -1
- package/src/connectionManager.ts +40 -22
- package/src/connectionStateHandler.ts +66 -17
- package/src/container.ts +464 -292
- package/src/containerContext.ts +33 -341
- package/src/containerStorageAdapter.ts +40 -10
- package/src/contracts.ts +11 -3
- package/src/deltaManager.ts +74 -45
- package/src/deltaQueue.ts +2 -3
- package/src/disposal.ts +25 -0
- package/src/index.ts +1 -8
- package/src/loader.ts +85 -83
- package/src/{collabWindowTracker.ts → noopHeuristic.ts} +37 -47
- package/src/packageVersion.ts +1 -1
- package/src/protocol.ts +18 -39
- package/src/protocolTreeDocumentStorageService.ts +1 -1
- package/src/quorum.ts +2 -31
- package/src/retriableDocumentStorageService.ts +4 -2
- package/src/utils.ts +15 -1
- package/dist/collabWindowTracker.d.ts +0 -19
- package/dist/collabWindowTracker.d.ts.map +0 -1
- package/dist/collabWindowTracker.js.map +0 -1
- package/dist/deltaManagerProxy.d.ts +0 -42
- package/dist/deltaManagerProxy.d.ts.map +0 -1
- package/dist/deltaManagerProxy.js +0 -79
- package/dist/deltaManagerProxy.js.map +0 -1
- package/lib/collabWindowTracker.d.ts +0 -19
- package/lib/collabWindowTracker.d.ts.map +0 -1
- package/lib/collabWindowTracker.js.map +0 -1
- package/lib/deltaManagerProxy.d.ts +0 -42
- package/lib/deltaManagerProxy.d.ts.map +0 -1
- package/lib/deltaManagerProxy.js +0 -74
- package/lib/deltaManagerProxy.js.map +0 -1
- package/src/deltaManagerProxy.ts +0 -109
|
@@ -2,19 +2,23 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import { IAudience, IContainerContext, IDeltaManager, ILoader, ICriticalContainerError, AttachState, ILoaderOptions, IFluidCodeDetails,
|
|
7
|
-
import {
|
|
5
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
6
|
+
import { IAudience, IContainerContext, IDeltaManager, ILoader, ICriticalContainerError, AttachState, ILoaderOptions, IFluidCodeDetails, IBatchMessage } from "@fluidframework/container-definitions";
|
|
7
|
+
import { FluidObject } from "@fluidframework/core-interfaces";
|
|
8
8
|
import { IDocumentStorageService } from "@fluidframework/driver-definitions";
|
|
9
|
-
import { IClientConfiguration, IClientDetails, IDocumentMessage,
|
|
10
|
-
|
|
9
|
+
import { IClientConfiguration, IClientDetails, IDocumentMessage, IQuorumClients, ISequencedDocumentMessage, ISnapshotTree, IVersion, MessageType, ISummaryContent } from "@fluidframework/protocol-definitions";
|
|
10
|
+
/**
|
|
11
|
+
* {@inheritDoc @fluidframework/container-definitions#IContainerContext}
|
|
12
|
+
*/
|
|
11
13
|
export declare class ContainerContext implements IContainerContext {
|
|
12
|
-
|
|
14
|
+
readonly options: ILoaderOptions;
|
|
13
15
|
readonly scope: FluidObject;
|
|
14
|
-
|
|
15
|
-
private readonly
|
|
16
|
-
private readonly _baseSnapshot;
|
|
16
|
+
readonly baseSnapshot: ISnapshotTree | undefined;
|
|
17
|
+
private readonly _version;
|
|
17
18
|
readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
|
|
19
|
+
readonly storage: IDocumentStorageService;
|
|
20
|
+
readonly quorum: IQuorumClients;
|
|
21
|
+
readonly audience: IAudience;
|
|
18
22
|
readonly loader: ILoader;
|
|
19
23
|
readonly submitFn: (type: MessageType, contents: any, batch: boolean, appData: any) => number;
|
|
20
24
|
readonly submitSummaryFn: (summaryOp: ISummaryContent, referenceSequenceNumber?: number) => number;
|
|
@@ -23,84 +27,37 @@ export declare class ContainerContext implements IContainerContext {
|
|
|
23
27
|
readonly submitSignalFn: (contents: any) => void;
|
|
24
28
|
readonly disposeFn: (error?: ICriticalContainerError) => void;
|
|
25
29
|
readonly closeFn: (error?: ICriticalContainerError) => void;
|
|
26
|
-
readonly version: string;
|
|
27
30
|
readonly updateDirtyContainerState: (dirty: boolean) => void;
|
|
31
|
+
readonly getAbsoluteUrl: (relativeUrl: string) => Promise<string | undefined>;
|
|
32
|
+
private readonly _getContainerDiagnosticId;
|
|
33
|
+
private readonly _getClientId;
|
|
34
|
+
private readonly _getServiceConfiguration;
|
|
35
|
+
private readonly _getAttachState;
|
|
36
|
+
private readonly _getConnected;
|
|
37
|
+
readonly getSpecifiedCodeDetails: () => IFluidCodeDetails | undefined;
|
|
38
|
+
readonly clientDetails: IClientDetails;
|
|
28
39
|
readonly existing: boolean;
|
|
40
|
+
readonly taggedLogger: ITelemetryLoggerExt;
|
|
29
41
|
readonly pendingLocalState?: unknown;
|
|
30
|
-
static createOrLoad(container: Container, scope: FluidObject, codeLoader: ICodeDetailsLoader, codeDetails: IFluidCodeDetails, baseSnapshot: ISnapshotTree | undefined, deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>, quorum: IQuorum, loader: ILoader, submitFn: (type: MessageType, contents: any, batch: boolean, appData: any) => number, submitSummaryFn: (summaryOp: ISummaryContent, referenceSequenceNumber?: number) => number, submitBatchFn: (batch: IBatchMessage[], referenceSequenceNumber?: number) => number, submitSignalFn: (contents: any) => void, disposeFn: (error?: ICriticalContainerError) => void, closeFn: (error?: ICriticalContainerError) => void, version: string, updateDirtyContainerState: (dirty: boolean) => void, existing: boolean, pendingLocalState?: unknown): Promise<ContainerContext>;
|
|
31
|
-
readonly taggedLogger: ITelemetryLogger;
|
|
32
42
|
readonly supportedFeatures: ReadonlyMap<string, unknown>;
|
|
33
43
|
get clientId(): string | undefined;
|
|
34
44
|
/**
|
|
35
45
|
* DISCLAIMER: this id is only for telemetry purposes. Not suitable for any other usages.
|
|
36
46
|
*/
|
|
37
47
|
get id(): string;
|
|
38
|
-
get clientDetails(): IClientDetails;
|
|
39
|
-
private _connected;
|
|
40
48
|
/**
|
|
41
49
|
* When true, ops are free to flow
|
|
42
50
|
* When false, ops should be kept as pending or rejected
|
|
43
51
|
*/
|
|
44
52
|
get connected(): boolean;
|
|
45
|
-
get canSummarize(): boolean;
|
|
46
53
|
get serviceConfiguration(): IClientConfiguration | undefined;
|
|
47
|
-
get audience(): IAudience;
|
|
48
|
-
get options(): ILoaderOptions;
|
|
49
|
-
get baseSnapshot(): ISnapshotTree | undefined;
|
|
50
|
-
get storage(): IDocumentStorageService;
|
|
51
|
-
private _runtime;
|
|
52
|
-
private get runtime();
|
|
53
54
|
private _disposed;
|
|
54
55
|
get disposed(): boolean;
|
|
55
|
-
|
|
56
|
-
private readonly _quorum;
|
|
57
|
-
get quorum(): IQuorumClients;
|
|
58
|
-
private readonly _fluidModuleP;
|
|
59
|
-
/**
|
|
60
|
-
* {@inheritDoc @fluidframework/container-definitions#IContainerContext.getEntryPoint}
|
|
61
|
-
*/
|
|
62
|
-
getEntryPoint?(): Promise<FluidObject | undefined>;
|
|
63
|
-
/**
|
|
64
|
-
* Emits events about the container context's lifecycle.
|
|
65
|
-
* Use it to coordinate things inside the ContainerContext class.
|
|
66
|
-
*/
|
|
67
|
-
private readonly lifecycleEvents;
|
|
68
|
-
constructor(container: Container, scope: FluidObject, codeLoader: ICodeDetailsLoader, _codeDetails: IFluidCodeDetails, _baseSnapshot: ISnapshotTree | undefined, deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>, quorum: IQuorum, loader: ILoader, submitFn: (type: MessageType, contents: any, batch: boolean, appData: any) => number, submitSummaryFn: (summaryOp: ISummaryContent, referenceSequenceNumber?: number) => number,
|
|
56
|
+
constructor(options: ILoaderOptions, scope: FluidObject, baseSnapshot: ISnapshotTree | undefined, _version: IVersion | undefined, deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>, storage: IDocumentStorageService, quorum: IQuorumClients, audience: IAudience, loader: ILoader, submitFn: (type: MessageType, contents: any, batch: boolean, appData: any) => number, submitSummaryFn: (summaryOp: ISummaryContent, referenceSequenceNumber?: number) => number,
|
|
69
57
|
/** @returns clientSequenceNumber of last message in a batch */
|
|
70
|
-
submitBatchFn: (batch: IBatchMessage[], referenceSequenceNumber?: number) => number, submitSignalFn: (contents: any) => void, disposeFn: (error?: ICriticalContainerError) => void, closeFn: (error?: ICriticalContainerError) => void,
|
|
71
|
-
/**
|
|
72
|
-
* @deprecated Temporary migratory API, to be removed when customers no longer need it.
|
|
73
|
-
* When removed, `ContainerContext` should only take an {@link @fluidframework/container-definitions#IQuorumClients}
|
|
74
|
-
* rather than an {@link @fluidframework/protocol-definitions#IQuorum}.
|
|
75
|
-
* See {@link @fluidframework/container-definitions#IContainerContext} for more details.
|
|
76
|
-
*/
|
|
77
|
-
getSpecifiedCodeDetails(): IFluidCodeDetails | undefined;
|
|
58
|
+
submitBatchFn: (batch: IBatchMessage[], referenceSequenceNumber?: number) => number, submitSignalFn: (contents: any) => void, disposeFn: (error?: ICriticalContainerError) => void, closeFn: (error?: ICriticalContainerError) => void, updateDirtyContainerState: (dirty: boolean) => void, getAbsoluteUrl: (relativeUrl: string) => Promise<string | undefined>, _getContainerDiagnosticId: () => string | undefined, _getClientId: () => string | undefined, _getServiceConfiguration: () => IClientConfiguration | undefined, _getAttachState: () => AttachState, _getConnected: () => boolean, getSpecifiedCodeDetails: () => IFluidCodeDetails | undefined, clientDetails: IClientDetails, existing: boolean, taggedLogger: ITelemetryLoggerExt, pendingLocalState?: unknown);
|
|
78
59
|
dispose(error?: Error): void;
|
|
79
60
|
getLoadedFromVersion(): IVersion | undefined;
|
|
80
61
|
get attachState(): AttachState;
|
|
81
|
-
/**
|
|
82
|
-
* Create a summary. Used when attaching or serializing a detached container.
|
|
83
|
-
*
|
|
84
|
-
* @param blobRedirectTable - A table passed during the attach process. While detached, blob upload is supported
|
|
85
|
-
* using IDs generated locally. After attach, these IDs cannot be used, so this table maps the old local IDs to the
|
|
86
|
-
* new storage IDs so requests can be redirected.
|
|
87
|
-
*/
|
|
88
|
-
createSummary(blobRedirectTable?: Map<string, string>): ISummaryTree;
|
|
89
|
-
setConnectionState(connected: boolean, clientId?: string): void;
|
|
90
|
-
process(message: ISequencedDocumentMessage, local: boolean): void;
|
|
91
|
-
processSignal(message: ISignalMessage, local: boolean): void;
|
|
92
|
-
request(path: IRequest): Promise<IResponse>;
|
|
93
|
-
getAbsoluteUrl(relativeUrl: string): Promise<string | undefined>;
|
|
94
|
-
getPendingLocalState(): unknown;
|
|
95
|
-
/**
|
|
96
|
-
* Determines if the current code details of the context
|
|
97
|
-
* satisfy the incoming constraint code details
|
|
98
|
-
*/
|
|
99
|
-
satisfies(constraintCodeDetails: IFluidCodeDetails): Promise<boolean>;
|
|
100
|
-
notifyOpReplay(message: ISequencedDocumentMessage): Promise<void>;
|
|
101
|
-
private getRuntimeFactory;
|
|
102
|
-
private instantiateRuntime;
|
|
103
|
-
private attachListener;
|
|
104
|
-
private loadCodeModule;
|
|
105
62
|
}
|
|
106
63
|
//# sourceMappingURL=containerContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerContext.d.ts","sourceRoot":"","sources":["../src/containerContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"containerContext.d.ts","sourceRoot":"","sources":["../src/containerContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EACN,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,OAAO,EACP,uBAAuB,EACvB,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,uBAAu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KAAK,IAAI,EACvC,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,uBAAuB,KAAK,IAAI,EACpD,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,uBAAuB,KAAK,IAAI,EAClD,yBAAyB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,EACnD,cAAc,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,EACnE,yBAAyB,EAAE,MAAM,MAAM,GAAG,SAAS,EACnD,YAAY,EAAE,MAAM,MAAM,GAAG,SAAS,EACtC,wBAAwB,EAAE,MAAM,oBAAoB,GAAG,SAAS,EAChE,eAAe,EAAE,MAAM,WAAW,EAClC,aAAa,EAAE,MAAM,OAAO,EAC7B,uBAAuB,EAAE,MAAM,iBAAiB,GAAG,SAAS,EAC5D,aAAa,EAAE,cAAc,EAC7B,QAAQ,EAAE,OAAO,EACjB,YAAY,EAAE,mBAAmB,EACjC,iBAAiB,CAAC,SAAS;IAGrC,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI;IAI5B,oBAAoB,IAAI,QAAQ,GAAG,SAAS;IAInD,IAAW,WAAW,IAAI,WAAW,CAEpC;CACD"}
|
package/lib/containerContext.js
CHANGED
|
@@ -2,22 +2,21 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { PerformanceEvent } from "@fluidframework/telemetry-utils";
|
|
9
|
-
import { UsageError } from "@fluidframework/container-utils";
|
|
10
|
-
const PackageNotFactoryError = "Code package does not implement IRuntimeFactory";
|
|
5
|
+
/**
|
|
6
|
+
* {@inheritDoc @fluidframework/container-definitions#IContainerContext}
|
|
7
|
+
*/
|
|
11
8
|
export class ContainerContext {
|
|
12
|
-
constructor(
|
|
9
|
+
constructor(options, scope, baseSnapshot, _version, deltaManager, storage, quorum, audience, loader, submitFn, submitSummaryFn,
|
|
13
10
|
/** @returns clientSequenceNumber of last message in a batch */
|
|
14
|
-
submitBatchFn, submitSignalFn, disposeFn, closeFn,
|
|
15
|
-
this.
|
|
11
|
+
submitBatchFn, submitSignalFn, disposeFn, closeFn, updateDirtyContainerState, getAbsoluteUrl, _getContainerDiagnosticId, _getClientId, _getServiceConfiguration, _getAttachState, _getConnected, getSpecifiedCodeDetails, clientDetails, existing, taggedLogger, pendingLocalState) {
|
|
12
|
+
this.options = options;
|
|
16
13
|
this.scope = scope;
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
19
|
-
this._baseSnapshot = _baseSnapshot;
|
|
14
|
+
this.baseSnapshot = baseSnapshot;
|
|
15
|
+
this._version = _version;
|
|
20
16
|
this.deltaManager = deltaManager;
|
|
17
|
+
this.storage = storage;
|
|
18
|
+
this.quorum = quorum;
|
|
19
|
+
this.audience = audience;
|
|
21
20
|
this.loader = loader;
|
|
22
21
|
this.submitFn = submitFn;
|
|
23
22
|
this.submitSummaryFn = submitSummaryFn;
|
|
@@ -25,20 +24,18 @@ export class ContainerContext {
|
|
|
25
24
|
this.submitSignalFn = submitSignalFn;
|
|
26
25
|
this.disposeFn = disposeFn;
|
|
27
26
|
this.closeFn = closeFn;
|
|
28
|
-
this.version = version;
|
|
29
27
|
this.updateDirtyContainerState = updateDirtyContainerState;
|
|
28
|
+
this.getAbsoluteUrl = getAbsoluteUrl;
|
|
29
|
+
this._getContainerDiagnosticId = _getContainerDiagnosticId;
|
|
30
|
+
this._getClientId = _getClientId;
|
|
31
|
+
this._getServiceConfiguration = _getServiceConfiguration;
|
|
32
|
+
this._getAttachState = _getAttachState;
|
|
33
|
+
this._getConnected = _getConnected;
|
|
34
|
+
this.getSpecifiedCodeDetails = getSpecifiedCodeDetails;
|
|
35
|
+
this.clientDetails = clientDetails;
|
|
30
36
|
this.existing = existing;
|
|
37
|
+
this.taggedLogger = taggedLogger;
|
|
31
38
|
this.pendingLocalState = pendingLocalState;
|
|
32
|
-
this._disposed = false;
|
|
33
|
-
/**
|
|
34
|
-
* Emits events about the container context's lifecycle.
|
|
35
|
-
* Use it to coordinate things inside the ContainerContext class.
|
|
36
|
-
*/
|
|
37
|
-
this.lifecycleEvents = new TypedEventEmitter();
|
|
38
|
-
this._connected = this.container.connected;
|
|
39
|
-
this._quorum = quorum;
|
|
40
|
-
this.taggedLogger = container.subLogger;
|
|
41
|
-
this._fluidModuleP = new LazyPromise(async () => this.loadCodeModule(_codeDetails));
|
|
42
39
|
this.supportedFeatures = new Map([
|
|
43
40
|
/**
|
|
44
41
|
* This version of the loader accepts `referenceSequenceNumber`, provided by the container runtime,
|
|
@@ -47,225 +44,39 @@ export class ContainerContext {
|
|
|
47
44
|
*/
|
|
48
45
|
["referenceSequenceNumbers", true],
|
|
49
46
|
]);
|
|
50
|
-
this.
|
|
51
|
-
}
|
|
52
|
-
static async createOrLoad(container, scope, codeLoader, codeDetails, baseSnapshot, deltaManager, quorum, loader, submitFn, submitSummaryFn, submitBatchFn, submitSignalFn, disposeFn, closeFn, version, updateDirtyContainerState, existing, pendingLocalState) {
|
|
53
|
-
const context = new ContainerContext(container, scope, codeLoader, codeDetails, baseSnapshot, deltaManager, quorum, loader, submitFn, submitSummaryFn, submitBatchFn, submitSignalFn, disposeFn, closeFn, version, updateDirtyContainerState, existing, pendingLocalState);
|
|
54
|
-
await context.instantiateRuntime(existing);
|
|
55
|
-
return context;
|
|
47
|
+
this._disposed = false;
|
|
56
48
|
}
|
|
57
49
|
get clientId() {
|
|
58
|
-
return this.
|
|
50
|
+
return this._getClientId();
|
|
59
51
|
}
|
|
60
52
|
/**
|
|
61
53
|
* DISCLAIMER: this id is only for telemetry purposes. Not suitable for any other usages.
|
|
62
54
|
*/
|
|
63
55
|
get id() {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return resolvedUrl.id;
|
|
67
|
-
}
|
|
68
|
-
return "";
|
|
69
|
-
}
|
|
70
|
-
get clientDetails() {
|
|
71
|
-
return this.container.clientDetails;
|
|
56
|
+
var _a;
|
|
57
|
+
return (_a = this._getContainerDiagnosticId()) !== null && _a !== void 0 ? _a : "";
|
|
72
58
|
}
|
|
73
59
|
/**
|
|
74
60
|
* When true, ops are free to flow
|
|
75
61
|
* When false, ops should be kept as pending or rejected
|
|
76
62
|
*/
|
|
77
63
|
get connected() {
|
|
78
|
-
return this.
|
|
79
|
-
}
|
|
80
|
-
get canSummarize() {
|
|
81
|
-
return "summarize" in this.runtime;
|
|
64
|
+
return this._getConnected();
|
|
82
65
|
}
|
|
83
66
|
get serviceConfiguration() {
|
|
84
|
-
return this.
|
|
85
|
-
}
|
|
86
|
-
get audience() {
|
|
87
|
-
return this.container.audience;
|
|
88
|
-
}
|
|
89
|
-
get options() {
|
|
90
|
-
return this.container.options;
|
|
91
|
-
}
|
|
92
|
-
get baseSnapshot() {
|
|
93
|
-
return this._baseSnapshot;
|
|
94
|
-
}
|
|
95
|
-
get storage() {
|
|
96
|
-
return this.container.storage;
|
|
97
|
-
}
|
|
98
|
-
get runtime() {
|
|
99
|
-
if (this._runtime === undefined) {
|
|
100
|
-
throw new Error("Attempted to access runtime before it was defined");
|
|
101
|
-
}
|
|
102
|
-
return this._runtime;
|
|
67
|
+
return this._getServiceConfiguration();
|
|
103
68
|
}
|
|
104
69
|
get disposed() {
|
|
105
70
|
return this._disposed;
|
|
106
71
|
}
|
|
107
|
-
get codeDetails() {
|
|
108
|
-
return this._codeDetails;
|
|
109
|
-
}
|
|
110
|
-
get quorum() {
|
|
111
|
-
return this._quorum;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* {@inheritDoc @fluidframework/container-definitions#IContainerContext.getEntryPoint}
|
|
115
|
-
*/
|
|
116
|
-
async getEntryPoint() {
|
|
117
|
-
var _a, _b;
|
|
118
|
-
if (this._disposed) {
|
|
119
|
-
throw new UsageError("The context is already disposed");
|
|
120
|
-
}
|
|
121
|
-
if (this._runtime !== undefined) {
|
|
122
|
-
return (_b = (_a = this._runtime) === null || _a === void 0 ? void 0 : _a.getEntryPoint) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
123
|
-
}
|
|
124
|
-
return new Promise((resolve, reject) => {
|
|
125
|
-
const runtimeInstantiatedHandler = () => {
|
|
126
|
-
var _a, _b;
|
|
127
|
-
assert(this._runtime !== undefined, 0x5a3 /* runtimeInstantiated fired but runtime is still undefined */);
|
|
128
|
-
resolve((_b = (_a = this._runtime).getEntryPoint) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
129
|
-
this.lifecycleEvents.off("disposed", disposedHandler);
|
|
130
|
-
};
|
|
131
|
-
const disposedHandler = () => {
|
|
132
|
-
reject(new Error("ContainerContext was disposed"));
|
|
133
|
-
this.lifecycleEvents.off("runtimeInstantiated", runtimeInstantiatedHandler);
|
|
134
|
-
};
|
|
135
|
-
this.lifecycleEvents.once("runtimeInstantiated", runtimeInstantiatedHandler);
|
|
136
|
-
this.lifecycleEvents.once("disposed", disposedHandler);
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* @deprecated Temporary migratory API, to be removed when customers no longer need it.
|
|
141
|
-
* When removed, `ContainerContext` should only take an {@link @fluidframework/container-definitions#IQuorumClients}
|
|
142
|
-
* rather than an {@link @fluidframework/protocol-definitions#IQuorum}.
|
|
143
|
-
* See {@link @fluidframework/container-definitions#IContainerContext} for more details.
|
|
144
|
-
*/
|
|
145
|
-
getSpecifiedCodeDetails() {
|
|
146
|
-
var _a;
|
|
147
|
-
return ((_a = this._quorum.get("code")) !== null && _a !== void 0 ? _a : this._quorum.get("code2"));
|
|
148
|
-
}
|
|
149
72
|
dispose(error) {
|
|
150
|
-
if (this._disposed) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
73
|
this._disposed = true;
|
|
154
|
-
this.lifecycleEvents.emit("disposed");
|
|
155
|
-
this.runtime.dispose(error);
|
|
156
|
-
this._quorum.dispose();
|
|
157
|
-
this.deltaManager.dispose();
|
|
158
74
|
}
|
|
159
75
|
getLoadedFromVersion() {
|
|
160
|
-
return this.
|
|
76
|
+
return this._version;
|
|
161
77
|
}
|
|
162
78
|
get attachState() {
|
|
163
|
-
return this.
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Create a summary. Used when attaching or serializing a detached container.
|
|
167
|
-
*
|
|
168
|
-
* @param blobRedirectTable - A table passed during the attach process. While detached, blob upload is supported
|
|
169
|
-
* using IDs generated locally. After attach, these IDs cannot be used, so this table maps the old local IDs to the
|
|
170
|
-
* new storage IDs so requests can be redirected.
|
|
171
|
-
*/
|
|
172
|
-
createSummary(blobRedirectTable) {
|
|
173
|
-
return this.runtime.createSummary(blobRedirectTable);
|
|
174
|
-
}
|
|
175
|
-
setConnectionState(connected, clientId) {
|
|
176
|
-
const runtime = this.runtime;
|
|
177
|
-
this._connected = connected;
|
|
178
|
-
runtime.setConnectionState(connected, clientId);
|
|
179
|
-
}
|
|
180
|
-
process(message, local) {
|
|
181
|
-
this.runtime.process(message, local);
|
|
182
|
-
}
|
|
183
|
-
processSignal(message, local) {
|
|
184
|
-
this.runtime.processSignal(message, local);
|
|
185
|
-
}
|
|
186
|
-
async request(path) {
|
|
187
|
-
return this.runtime.request(path);
|
|
188
|
-
}
|
|
189
|
-
async getAbsoluteUrl(relativeUrl) {
|
|
190
|
-
return this.container.getAbsoluteUrl(relativeUrl);
|
|
191
|
-
}
|
|
192
|
-
getPendingLocalState() {
|
|
193
|
-
return this.runtime.getPendingLocalState();
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Determines if the current code details of the context
|
|
197
|
-
* satisfy the incoming constraint code details
|
|
198
|
-
*/
|
|
199
|
-
async satisfies(constraintCodeDetails) {
|
|
200
|
-
var _a;
|
|
201
|
-
const comparers = [];
|
|
202
|
-
const maybeCompareCodeLoader = this.codeLoader;
|
|
203
|
-
if (maybeCompareCodeLoader.IFluidCodeDetailsComparer !== undefined) {
|
|
204
|
-
comparers.push(maybeCompareCodeLoader.IFluidCodeDetailsComparer);
|
|
205
|
-
}
|
|
206
|
-
const moduleWithDetails = await this._fluidModuleP;
|
|
207
|
-
const maybeCompareExport = (_a = moduleWithDetails.module) === null || _a === void 0 ? void 0 : _a.fluidExport;
|
|
208
|
-
if ((maybeCompareExport === null || maybeCompareExport === void 0 ? void 0 : maybeCompareExport.IFluidCodeDetailsComparer) !== undefined) {
|
|
209
|
-
comparers.push(maybeCompareExport.IFluidCodeDetailsComparer);
|
|
210
|
-
}
|
|
211
|
-
// if there are not comparers it is not possible to know
|
|
212
|
-
// if the current satisfy the incoming, so return false,
|
|
213
|
-
// as assuming they do not satisfy is safer .e.g we will
|
|
214
|
-
// reload, rather than potentially running with
|
|
215
|
-
// incompatible code
|
|
216
|
-
if (comparers.length === 0) {
|
|
217
|
-
return false;
|
|
218
|
-
}
|
|
219
|
-
for (const comparer of comparers) {
|
|
220
|
-
const satisfies = await comparer.satisfies(moduleWithDetails.details, constraintCodeDetails);
|
|
221
|
-
if (satisfies === false) {
|
|
222
|
-
return false;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
return true;
|
|
226
|
-
}
|
|
227
|
-
async notifyOpReplay(message) {
|
|
228
|
-
var _a, _b;
|
|
229
|
-
return (_b = (_a = this.runtime).notifyOpReplay) === null || _b === void 0 ? void 0 : _b.call(_a, message);
|
|
230
|
-
}
|
|
231
|
-
// #region private
|
|
232
|
-
async getRuntimeFactory() {
|
|
233
|
-
var _a;
|
|
234
|
-
const fluidExport = (_a = (await this._fluidModuleP).module) === null || _a === void 0 ? void 0 : _a.fluidExport;
|
|
235
|
-
const runtimeFactory = fluidExport === null || fluidExport === void 0 ? void 0 : fluidExport.IRuntimeFactory;
|
|
236
|
-
if (runtimeFactory === undefined) {
|
|
237
|
-
throw new Error(PackageNotFactoryError);
|
|
238
|
-
}
|
|
239
|
-
return runtimeFactory;
|
|
240
|
-
}
|
|
241
|
-
async instantiateRuntime(existing) {
|
|
242
|
-
const runtimeFactory = await this.getRuntimeFactory();
|
|
243
|
-
this._runtime = await PerformanceEvent.timedExecAsync(this.taggedLogger, { eventName: "InstantiateRuntime" }, async () => runtimeFactory.instantiateRuntime(this, existing));
|
|
244
|
-
this.lifecycleEvents.emit("runtimeInstantiated");
|
|
245
|
-
}
|
|
246
|
-
attachListener() {
|
|
247
|
-
this.container.once("attaching", () => {
|
|
248
|
-
this.runtime.setAttachState(AttachState.Attaching);
|
|
249
|
-
});
|
|
250
|
-
this.container.once("attached", () => {
|
|
251
|
-
this.runtime.setAttachState(AttachState.Attached);
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
async loadCodeModule(codeDetails) {
|
|
255
|
-
const loadCodeResult = await PerformanceEvent.timedExecAsync(this.taggedLogger, { eventName: "CodeLoad" }, async () => this.codeLoader.load(codeDetails));
|
|
256
|
-
if ("module" in loadCodeResult) {
|
|
257
|
-
const { module, details } = loadCodeResult;
|
|
258
|
-
return {
|
|
259
|
-
module,
|
|
260
|
-
details: details !== null && details !== void 0 ? details : codeDetails,
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
else {
|
|
264
|
-
// If "module" is not in the result, we are using a legacy ICodeLoader. Fix the result up with details.
|
|
265
|
-
// Once usage drops to 0 we can remove this compat path.
|
|
266
|
-
this.taggedLogger.sendTelemetryEvent({ eventName: "LegacyCodeLoader" });
|
|
267
|
-
return loadCodeResult;
|
|
268
|
-
}
|
|
79
|
+
return this._getAttachState();
|
|
269
80
|
}
|
|
270
81
|
}
|
|
271
82
|
//# sourceMappingURL=containerContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerContext.js","sourceRoot":"","sources":["../src/containerContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAON,WAAW,GAUX,MAAM,uCAAuC,CAAC;AAG/C,OAAO,EAAE,kB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OAAO,cAAP,OAAO,GAAI,WAAW;aAC/B,CAAC;SACF;aAAM;YACN,wGAAwG;YACxG,wDAAwD;YACxD,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC,CAAC;YACxE,OAAO,cAAc,CAAC;SACtB;IACF,CAAC;CAED","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, LazyPromise, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport {\n\tIAudience,\n\tIContainerContext,\n\tIDeltaManager,\n\tILoader,\n\tIRuntime,\n\tICriticalContainerError,\n\tAttachState,\n\tILoaderOptions,\n\tIRuntimeFactory,\n\tIProvideRuntimeFactory,\n\tIFluidCodeDetails,\n\tIFluidCodeDetailsComparer,\n\tIProvideFluidCodeDetailsComparer,\n\tICodeDetailsLoader,\n\tIFluidModuleWithDetails,\n\tIBatchMessage,\n} from \"@fluidframework/container-definitions\";\nimport { IRequest, IResponse, FluidObject } from \"@fluidframework/core-interfaces\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { isFluidResolvedUrl } from \"@fluidframework/driver-utils\";\nimport {\n\tIClientConfiguration,\n\tIClientDetails,\n\tIDocumentMessage,\n\tIQuorum,\n\tIQuorumClients,\n\tISequencedDocumentMessage,\n\tISignalMessage,\n\tISnapshotTree,\n\tISummaryTree,\n\tIVersion,\n\tMessageType,\n\tISummaryContent,\n} from \"@fluidframework/protocol-definitions\";\nimport { PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport { UsageError } from \"@fluidframework/container-utils\";\nimport { Container } from \"./container\";\n\nconst PackageNotFactoryError = \"Code package does not implement IRuntimeFactory\";\n\n/**\n * Events that {@link ContainerContext} can emit through its lifecycle.\n *\n * \"runtimeInstantiated\" - When an {@link @fluidframework/container-definitions#IRuntime} has been instantiated (by\n * calling instantiateRuntime() on the runtime factory), and this._runtime is set.\n *\n * \"disposed\" - When its dispose() method is called. The {@link ContainerContext} is no longer usable at that point.\n */\ntype ContextLifecycleEvents = \"runtimeInstantiated\" | \"disposed\";\n\nexport class ContainerContext implements IContainerContext {\n\tpublic static async createOrLoad(\n\t\tcontainer: Container,\n\t\tscope: FluidObject,\n\t\tcodeLoader: ICodeDetailsLoader,\n\t\tcodeDetails: IFluidCodeDetails,\n\t\tbaseSnapshot: ISnapshotTree | undefined,\n\t\tdeltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tquorum: IQuorum,\n\t\tloader: ILoader,\n\t\tsubmitFn: (type: MessageType, contents: any, batch: boolean, appData: any) => number,\n\t\tsubmitSummaryFn: (summaryOp: ISummaryContent, referenceSequenceNumber?: number) => number,\n\t\tsubmitBatchFn: (batch: IBatchMessage[], referenceSequenceNumber?: number) => number,\n\t\tsubmitSignalFn: (contents: any) => void,\n\t\tdisposeFn: (error?: ICriticalContainerError) => void,\n\t\tcloseFn: (error?: ICriticalContainerError) => void,\n\t\tversion: string,\n\t\tupdateDirtyContainerState: (dirty: boolean) => void,\n\t\texisting: boolean,\n\t\tpendingLocalState?: unknown,\n\t): Promise<ContainerContext> {\n\t\tconst context = new ContainerContext(\n\t\t\tcontainer,\n\t\t\tscope,\n\t\t\tcodeLoader,\n\t\t\tcodeDetails,\n\t\t\tbaseSnapshot,\n\t\t\tdeltaManager,\n\t\t\tquorum,\n\t\t\tloader,\n\t\t\tsubmitFn,\n\t\t\tsubmitSummaryFn,\n\t\t\tsubmitBatchFn,\n\t\t\tsubmitSignalFn,\n\t\t\tdisposeFn,\n\t\t\tcloseFn,\n\t\t\tversion,\n\t\t\tupdateDirtyContainerState,\n\t\t\texisting,\n\t\t\tpendingLocalState,\n\t\t);\n\t\tawait context.instantiateRuntime(existing);\n\t\treturn context;\n\t}\n\n\tpublic readonly taggedLogger: ITelemetryLogger;\n\tpublic readonly supportedFeatures: ReadonlyMap<string, unknown>;\n\n\tpublic get clientId(): string | undefined {\n\t\treturn this.container.clientId;\n\t}\n\n\t/**\n\t * DISCLAIMER: this id is only for telemetry purposes. Not suitable for any other usages.\n\t */\n\tpublic get id(): string {\n\t\tconst resolvedUrl = this.container.resolvedUrl;\n\t\tif (isFluidResolvedUrl(resolvedUrl)) {\n\t\t\treturn resolvedUrl.id;\n\t\t}\n\t\treturn \"\";\n\t}\n\n\tpublic get clientDetails(): IClientDetails {\n\t\treturn this.container.clientDetails;\n\t}\n\n\tprivate _connected: boolean;\n\t/**\n\t * When true, ops are free to flow\n\t * When false, ops should be kept as pending or rejected\n\t */\n\tpublic get connected(): boolean {\n\t\treturn this._connected;\n\t}\n\n\tpublic get canSummarize(): boolean {\n\t\treturn \"summarize\" in this.runtime;\n\t}\n\n\tpublic get serviceConfiguration(): IClientConfiguration | undefined {\n\t\treturn this.container.serviceConfiguration;\n\t}\n\n\tpublic get audience(): IAudience {\n\t\treturn this.container.audience;\n\t}\n\n\tpublic get options(): ILoaderOptions {\n\t\treturn this.container.options;\n\t}\n\n\tpublic get baseSnapshot() {\n\t\treturn this._baseSnapshot;\n\t}\n\n\tpublic get storage(): IDocumentStorageService {\n\t\treturn this.container.storage;\n\t}\n\n\tprivate _runtime: IRuntime | undefined;\n\tprivate get runtime() {\n\t\tif (this._runtime === undefined) {\n\t\t\tthrow new Error(\"Attempted to access runtime before it was defined\");\n\t\t}\n\t\treturn this._runtime;\n\t}\n\n\tprivate _disposed = false;\n\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\n\tpublic get codeDetails() {\n\t\treturn this._codeDetails;\n\t}\n\n\tprivate readonly _quorum: IQuorum;\n\tpublic get quorum(): IQuorumClients {\n\t\treturn this._quorum;\n\t}\n\n\tprivate readonly _fluidModuleP: Promise<IFluidModuleWithDetails>;\n\n\t/**\n\t * {@inheritDoc @fluidframework/container-definitions#IContainerContext.getEntryPoint}\n\t */\n\tpublic async getEntryPoint?(): Promise<FluidObject | undefined> {\n\t\tif (this._disposed) {\n\t\t\tthrow new UsageError(\"The context is already disposed\");\n\t\t}\n\t\tif (this._runtime !== undefined) {\n\t\t\treturn this._runtime?.getEntryPoint?.();\n\t\t}\n\t\treturn new Promise<FluidObject | undefined>((resolve, reject) => {\n\t\t\tconst runtimeInstantiatedHandler = () => {\n\t\t\t\tassert(\n\t\t\t\t\tthis._runtime !== undefined,\n\t\t\t\t\t0x5a3 /* runtimeInstantiated fired but runtime is still undefined */,\n\t\t\t\t);\n\t\t\t\tresolve(this._runtime.getEntryPoint?.());\n\t\t\t\tthis.lifecycleEvents.off(\"disposed\", disposedHandler);\n\t\t\t};\n\t\t\tconst disposedHandler = () => {\n\t\t\t\treject(new Error(\"ContainerContext was disposed\"));\n\t\t\t\tthis.lifecycleEvents.off(\"runtimeInstantiated\", runtimeInstantiatedHandler);\n\t\t\t};\n\t\t\tthis.lifecycleEvents.once(\"runtimeInstantiated\", runtimeInstantiatedHandler);\n\t\t\tthis.lifecycleEvents.once(\"disposed\", disposedHandler);\n\t\t});\n\t}\n\n\t/**\n\t * Emits events about the container context's lifecycle.\n\t * Use it to coordinate things inside the ContainerContext class.\n\t */\n\tprivate readonly lifecycleEvents = new TypedEventEmitter<ContextLifecycleEvents>();\n\n\tconstructor(\n\t\tprivate readonly container: Container,\n\t\tpublic readonly scope: FluidObject,\n\t\tprivate readonly codeLoader: ICodeDetailsLoader,\n\t\tprivate readonly _codeDetails: IFluidCodeDetails,\n\t\tprivate readonly _baseSnapshot: ISnapshotTree | undefined,\n\t\tpublic readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tquorum: IQuorum,\n\t\tpublic readonly loader: ILoader,\n\t\tpublic readonly submitFn: (\n\t\t\ttype: MessageType,\n\t\t\tcontents: any,\n\t\t\tbatch: boolean,\n\t\t\tappData: any,\n\t\t) => number,\n\t\tpublic readonly submitSummaryFn: (\n\t\t\tsummaryOp: ISummaryContent,\n\t\t\treferenceSequenceNumber?: number,\n\t\t) => number,\n\t\t/** @returns clientSequenceNumber of last message in a batch */\n\t\tpublic readonly submitBatchFn: (\n\t\t\tbatch: IBatchMessage[],\n\t\t\treferenceSequenceNumber?: number,\n\t\t) => number,\n\t\tpublic readonly submitSignalFn: (contents: any) => void,\n\t\tpublic readonly disposeFn: (error?: ICriticalContainerError) => void,\n\t\tpublic readonly closeFn: (error?: ICriticalContainerError) => void,\n\t\tpublic readonly version: string,\n\t\tpublic readonly updateDirtyContainerState: (dirty: boolean) => void,\n\t\tpublic readonly existing: boolean,\n\t\tpublic readonly pendingLocalState?: unknown,\n\t) {\n\t\tthis._connected = this.container.connected;\n\t\tthis._quorum = quorum;\n\t\tthis.taggedLogger = container.subLogger;\n\t\tthis._fluidModuleP = new LazyPromise<IFluidModuleWithDetails>(async () =>\n\t\t\tthis.loadCodeModule(_codeDetails),\n\t\t);\n\n\t\tthis.supportedFeatures = new Map([\n\t\t\t/**\n\t\t\t * This version of the loader accepts `referenceSequenceNumber`, provided by the container runtime,\n\t\t\t * as a parameter to the `submitBatchFn` and `submitSummaryFn` functions.\n\t\t\t * This is then used to set the reference sequence numbers of the submitted ops in the DeltaManager.\n\t\t\t */\n\t\t\t[\"referenceSequenceNumbers\", true],\n\t\t]);\n\t\tthis.attachListener();\n\t}\n\n\t/**\n\t * @deprecated Temporary migratory API, to be removed when customers no longer need it.\n\t * When removed, `ContainerContext` should only take an {@link @fluidframework/container-definitions#IQuorumClients}\n\t * rather than an {@link @fluidframework/protocol-definitions#IQuorum}.\n\t * See {@link @fluidframework/container-definitions#IContainerContext} for more details.\n\t */\n\tpublic getSpecifiedCodeDetails(): IFluidCodeDetails | undefined {\n\t\treturn (this._quorum.get(\"code\") ?? this._quorum.get(\"code2\")) as\n\t\t\t| IFluidCodeDetails\n\t\t\t| undefined;\n\t}\n\n\tpublic dispose(error?: Error): void {\n\t\tif (this._disposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._disposed = true;\n\n\t\tthis.lifecycleEvents.emit(\"disposed\");\n\t\tthis.runtime.dispose(error);\n\t\tthis._quorum.dispose();\n\t\tthis.deltaManager.dispose();\n\t}\n\n\tpublic getLoadedFromVersion(): IVersion | undefined {\n\t\treturn this.container.loadedFromVersion;\n\t}\n\n\tpublic get attachState(): AttachState {\n\t\treturn this.container.attachState;\n\t}\n\n\t/**\n\t * Create a summary. Used when attaching or serializing a detached container.\n\t *\n\t * @param blobRedirectTable - A table passed during the attach process. While detached, blob upload is supported\n\t * using IDs generated locally. After attach, these IDs cannot be used, so this table maps the old local IDs to the\n\t * new storage IDs so requests can be redirected.\n\t */\n\tpublic createSummary(blobRedirectTable?: Map<string, string>): ISummaryTree {\n\t\treturn this.runtime.createSummary(blobRedirectTable);\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\n\t\tconst runtime = this.runtime;\n\t\tthis._connected = connected;\n\t\truntime.setConnectionState(connected, clientId);\n\t}\n\n\tpublic process(message: ISequencedDocumentMessage, local: boolean) {\n\t\tthis.runtime.process(message, local);\n\t}\n\n\tpublic processSignal(message: ISignalMessage, local: boolean) {\n\t\tthis.runtime.processSignal(message, local);\n\t}\n\n\tpublic async request(path: IRequest): Promise<IResponse> {\n\t\treturn this.runtime.request(path);\n\t}\n\n\tpublic async getAbsoluteUrl(relativeUrl: string): Promise<string | undefined> {\n\t\treturn this.container.getAbsoluteUrl(relativeUrl);\n\t}\n\n\tpublic getPendingLocalState(): unknown {\n\t\treturn this.runtime.getPendingLocalState();\n\t}\n\n\t/**\n\t * Determines if the current code details of the context\n\t * satisfy the incoming constraint code details\n\t */\n\tpublic async satisfies(constraintCodeDetails: IFluidCodeDetails) {\n\t\tconst comparers: IFluidCodeDetailsComparer[] = [];\n\n\t\tconst maybeCompareCodeLoader = this.codeLoader;\n\t\tif (maybeCompareCodeLoader.IFluidCodeDetailsComparer !== undefined) {\n\t\t\tcomparers.push(maybeCompareCodeLoader.IFluidCodeDetailsComparer);\n\t\t}\n\n\t\tconst moduleWithDetails = await this._fluidModuleP;\n\t\tconst maybeCompareExport: Partial<IProvideFluidCodeDetailsComparer> | undefined =\n\t\t\tmoduleWithDetails.module?.fluidExport;\n\t\tif (maybeCompareExport?.IFluidCodeDetailsComparer !== undefined) {\n\t\t\tcomparers.push(maybeCompareExport.IFluidCodeDetailsComparer);\n\t\t}\n\n\t\t// if there are not comparers it is not possible to know\n\t\t// if the current satisfy the incoming, so return false,\n\t\t// as assuming they do not satisfy is safer .e.g we will\n\t\t// reload, rather than potentially running with\n\t\t// incompatible code\n\t\tif (comparers.length === 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tfor (const comparer of comparers) {\n\t\t\tconst satisfies = await comparer.satisfies(\n\t\t\t\tmoduleWithDetails.details,\n\t\t\t\tconstraintCodeDetails,\n\t\t\t);\n\t\t\tif (satisfies === false) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic async notifyOpReplay(message: ISequencedDocumentMessage): Promise<void> {\n\t\treturn this.runtime.notifyOpReplay?.(message);\n\t}\n\n\t// #region private\n\n\tprivate async getRuntimeFactory(): Promise<IRuntimeFactory> {\n\t\tconst fluidExport: FluidObject<IProvideRuntimeFactory> | undefined = (\n\t\t\tawait this._fluidModuleP\n\t\t).module?.fluidExport;\n\t\tconst runtimeFactory = fluidExport?.IRuntimeFactory;\n\t\tif (runtimeFactory === undefined) {\n\t\t\tthrow new Error(PackageNotFactoryError);\n\t\t}\n\n\t\treturn runtimeFactory;\n\t}\n\n\tprivate async instantiateRuntime(existing: boolean) {\n\t\tconst runtimeFactory = await this.getRuntimeFactory();\n\t\tthis._runtime = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.taggedLogger,\n\t\t\t{ eventName: \"InstantiateRuntime\" },\n\t\t\tasync () => runtimeFactory.instantiateRuntime(this, existing),\n\t\t);\n\t\tthis.lifecycleEvents.emit(\"runtimeInstantiated\");\n\t}\n\n\tprivate attachListener() {\n\t\tthis.container.once(\"attaching\", () => {\n\t\t\tthis.runtime.setAttachState(AttachState.Attaching);\n\t\t});\n\t\tthis.container.once(\"attached\", () => {\n\t\t\tthis.runtime.setAttachState(AttachState.Attached);\n\t\t});\n\t}\n\n\tprivate async loadCodeModule(codeDetails: IFluidCodeDetails): Promise<IFluidModuleWithDetails> {\n\t\tconst loadCodeResult = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.taggedLogger,\n\t\t\t{ eventName: \"CodeLoad\" },\n\t\t\tasync () => this.codeLoader.load(codeDetails),\n\t\t);\n\n\t\tif (\"module\" in loadCodeResult) {\n\t\t\tconst { module, details } = loadCodeResult;\n\t\t\treturn {\n\t\t\t\tmodule,\n\t\t\t\tdetails: details ?? codeDetails,\n\t\t\t};\n\t\t} else {\n\t\t\t// If \"module\" is not in the result, we are using a legacy ICodeLoader. Fix the result up with details.\n\t\t\t// Once usage drops to 0 we can remove this compat path.\n\t\t\tthis.taggedLogger.sendTelemetryEvent({ eventName: \"LegacyCodeLoader\" });\n\t\t\treturn loadCodeResult;\n\t\t}\n\t}\n\t// #endregion\n}\n"]}
|
|
1
|
+
{"version":3,"file":"containerContext.js","sourceRoot":"","sources":["../src/containerContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4BH;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAuC5B,YACiB,OAAuB,EACvB,KAAkB,EAClB,YAAuC,EACtC,QAA8B,EAC/B,YAAwE,EACxE,OAAgC,EAChC,MAAsB,EACtB,QAAmB,EACnB,MAAe,EACf,QAKL,EACK,eAGL;IACX,+DAA+D;IAC/C,aAGL,EACK,cAAuC,EACvC,SAAoD,EACpD,OAAkD,EAClD,yBAAmD,EACnD,cAAoE,EACnE,yBAAmD,EACnD,YAAsC,EACtC,wBAAgE,EAChE,eAAkC,EAClC,aAA4B,EAC7B,uBAA4D,EAC5D,aAA6B,EAC7B,QAAiB,EACjB,YAAiC,EACjC,iBAA2B;QAtC3B,YAAO,GAAP,OAAO,CAAgB;QACvB,UAAK,GAAL,KAAK,CAAa;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Aa,EAAE,CAAC;IAC7B,CAAC;IAED,IAAW,oBAAoB;QAC9B,OAAO,IAAI,CAAC,wBAAwB,EAAE,CAAC;IACxC,CAAC;IAID,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IA4CM,OAAO,CAAC,KAAa;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACvB,CAAC;IAEM,oBAAoB;QAC1B,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IAED,IAAW,WAAW;QACrB,OAAO,IAAI,CAAC,eAAe,EAAE,CAAC;IAC/B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport {\n\tIAudience,\n\tIContainerContext,\n\tIDeltaManager,\n\tILoader,\n\tICriticalContainerError,\n\tAttachState,\n\tILoaderOptions,\n\tIFluidCodeDetails,\n\tIBatchMessage,\n} from \"@fluidframework/container-definitions\";\nimport { FluidObject } from \"@fluidframework/core-interfaces\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport {\n\tIClientConfiguration,\n\tIClientDetails,\n\tIDocumentMessage,\n\tIQuorumClients,\n\tISequencedDocumentMessage,\n\tISnapshotTree,\n\tIVersion,\n\tMessageType,\n\tISummaryContent,\n} from \"@fluidframework/protocol-definitions\";\n\n/**\n * {@inheritDoc @fluidframework/container-definitions#IContainerContext}\n */\nexport class ContainerContext implements IContainerContext {\n\tpublic readonly supportedFeatures: ReadonlyMap<string, unknown> = new Map([\n\t\t/**\n\t\t * This version of the loader accepts `referenceSequenceNumber`, provided by the container runtime,\n\t\t * as a parameter to the `submitBatchFn` and `submitSummaryFn` functions.\n\t\t * This is then used to set the reference sequence numbers of the submitted ops in the DeltaManager.\n\t\t */\n\t\t[\"referenceSequenceNumbers\", true],\n\t]);\n\n\tpublic get clientId(): string | undefined {\n\t\treturn this._getClientId();\n\t}\n\n\t/**\n\t * DISCLAIMER: this id is only for telemetry purposes. Not suitable for any other usages.\n\t */\n\tpublic get id(): string {\n\t\treturn this._getContainerDiagnosticId() ?? \"\";\n\t}\n\n\t/**\n\t * When true, ops are free to flow\n\t * When false, ops should be kept as pending or rejected\n\t */\n\tpublic get connected(): boolean {\n\t\treturn this._getConnected();\n\t}\n\n\tpublic get serviceConfiguration(): IClientConfiguration | undefined {\n\t\treturn this._getServiceConfiguration();\n\t}\n\n\tprivate _disposed = false;\n\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\n\tconstructor(\n\t\tpublic readonly options: ILoaderOptions,\n\t\tpublic readonly scope: FluidObject,\n\t\tpublic readonly baseSnapshot: ISnapshotTree | undefined,\n\t\tprivate readonly _version: IVersion | undefined,\n\t\tpublic readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tpublic readonly storage: IDocumentStorageService,\n\t\tpublic readonly quorum: IQuorumClients,\n\t\tpublic readonly audience: IAudience,\n\t\tpublic readonly loader: ILoader,\n\t\tpublic readonly submitFn: (\n\t\t\ttype: MessageType,\n\t\t\tcontents: any,\n\t\t\tbatch: boolean,\n\t\t\tappData: any,\n\t\t) => number,\n\t\tpublic readonly submitSummaryFn: (\n\t\t\tsummaryOp: ISummaryContent,\n\t\t\treferenceSequenceNumber?: number,\n\t\t) => number,\n\t\t/** @returns clientSequenceNumber of last message in a batch */\n\t\tpublic readonly submitBatchFn: (\n\t\t\tbatch: IBatchMessage[],\n\t\t\treferenceSequenceNumber?: number,\n\t\t) => number,\n\t\tpublic readonly submitSignalFn: (contents: any) => void,\n\t\tpublic readonly disposeFn: (error?: ICriticalContainerError) => void,\n\t\tpublic readonly closeFn: (error?: ICriticalContainerError) => void,\n\t\tpublic readonly updateDirtyContainerState: (dirty: boolean) => void,\n\t\tpublic readonly getAbsoluteUrl: (relativeUrl: string) => Promise<string | undefined>,\n\t\tprivate readonly _getContainerDiagnosticId: () => string | undefined,\n\t\tprivate readonly _getClientId: () => string | undefined,\n\t\tprivate readonly _getServiceConfiguration: () => IClientConfiguration | undefined,\n\t\tprivate readonly _getAttachState: () => AttachState,\n\t\tprivate readonly _getConnected: () => boolean,\n\t\tpublic readonly getSpecifiedCodeDetails: () => IFluidCodeDetails | undefined,\n\t\tpublic readonly clientDetails: IClientDetails,\n\t\tpublic readonly existing: boolean,\n\t\tpublic readonly taggedLogger: ITelemetryLoggerExt,\n\t\tpublic readonly pendingLocalState?: unknown,\n\t) {}\n\n\tpublic dispose(error?: Error): void {\n\t\tthis._disposed = true;\n\t}\n\n\tpublic getLoadedFromVersion(): IVersion | undefined {\n\t\treturn this._version;\n\t}\n\n\tpublic get attachState(): AttachState {\n\t\treturn this._getAttachState();\n\t}\n}\n"]}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IDisposable
|
|
5
|
+
import { IDisposable } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
6
7
|
import { ISnapshotTreeWithBlobContents } from "@fluidframework/container-definitions";
|
|
7
8
|
import { FetchSource, IDocumentService, IDocumentStorageService, IDocumentStorageServicePolicies, ISummaryContext } from "@fluidframework/driver-definitions";
|
|
8
9
|
import { ICreateBlobResponse, ISnapshotTree, ISummaryHandle, ISummaryTree, IVersion } from "@fluidframework/protocol-definitions";
|
|
9
10
|
import { IDetachedBlobStorage } from "./loader";
|
|
10
11
|
/**
|
|
11
12
|
* Stringified blobs from a summary/snapshot tree.
|
|
12
|
-
* @deprecated this is an internal interface and will not longer be exported in future versions
|
|
13
13
|
* @internal
|
|
14
14
|
*/
|
|
15
15
|
export interface ISerializableBlobContents {
|
|
@@ -41,7 +41,7 @@ export declare class ContainerStorageAdapter implements IDocumentStorageService,
|
|
|
41
41
|
* upload, and fix it up with a protocol tree if needed
|
|
42
42
|
* @param forceEnableSummarizeProtocolTree - Enforce uploading a protocol summary regardless of the service's policy
|
|
43
43
|
*/
|
|
44
|
-
constructor(detachedBlobStorage: IDetachedBlobStorage | undefined, logger:
|
|
44
|
+
constructor(detachedBlobStorage: IDetachedBlobStorage | undefined, logger: ITelemetryLoggerExt,
|
|
45
45
|
/**
|
|
46
46
|
* ArrayBufferLikes or utf8 encoded strings, containing blobs from a snapshot
|
|
47
47
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerStorageAdapter.d.ts","sourceRoot":"","sources":["../src/containerStorageAdapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"containerStorageAdapter.d.ts","sourceRoot":"","sources":["../src/containerStorageAdapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EACN,WAAW,EACX,gBAAgB,EAChB,uBAAuB,EACvB,+BAA+B,EAC/B,eAAe,EACf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACN,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAIhD;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACzC,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,qBAAa,uBAAwB,YAAW,uBAAuB,EAAE,WAAW;IAsBlF,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,YAA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AG,OAAO,CAAC,YAAY,CAAC;IAI9D,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAG5E;AA+DD;;GAEG;AACH,wBAAsB,uBAAuB,CAC5C,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,uBAAuB,GAC9B,OAAO,CAAC,yBAAyB,CAAC,CAIpC;AAoCD;;GAEG;AACH,wBAAgB,uCAAuC,CACtD,QAAQ,EAAE,6BAA6B,GACrC,yBAAyB,CAI3B"}
|
|
@@ -155,11 +155,13 @@ class BlobOnlyStorage {
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
-
// runtime will write a tree to the summary containing
|
|
159
|
-
// which reference attachment blobs by ID
|
|
160
|
-
//
|
|
161
|
-
// the size of stashed change blobs
|
|
158
|
+
// runtime will write a tree to the summary containing "attachment" type entries
|
|
159
|
+
// which reference attachment blobs by ID, along with a blob containing the blob redirect table.
|
|
160
|
+
// However, some drivers do not support the "attachment" type and will convert them to "blob" type
|
|
161
|
+
// entries. We want to avoid saving these to reduce the size of stashed change blobs, but we
|
|
162
|
+
// need to make sure the blob redirect table is saved.
|
|
162
163
|
const blobsTreeName = ".blobs";
|
|
164
|
+
const redirectTableBlobName = ".redirectTable";
|
|
163
165
|
/**
|
|
164
166
|
* Get blob contents of a snapshot tree from storage (or, ideally, cache)
|
|
165
167
|
*/
|
|
@@ -171,7 +173,10 @@ export async function getBlobContentsFromTree(snapshot, storage) {
|
|
|
171
173
|
async function getBlobContentsFromTreeCore(tree, blobs, storage, root = true) {
|
|
172
174
|
const treePs = [];
|
|
173
175
|
for (const [key, subTree] of Object.entries(tree.trees)) {
|
|
174
|
-
if (
|
|
176
|
+
if (root && key === blobsTreeName) {
|
|
177
|
+
treePs.push(getBlobManagerTreeFromTree(subTree, blobs, storage));
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
175
180
|
treePs.push(getBlobContentsFromTreeCore(subTree, blobs, storage, false));
|
|
176
181
|
}
|
|
177
182
|
}
|
|
@@ -182,6 +187,13 @@ async function getBlobContentsFromTreeCore(tree, blobs, storage, root = true) {
|
|
|
182
187
|
}
|
|
183
188
|
return Promise.all(treePs);
|
|
184
189
|
}
|
|
190
|
+
// save redirect table from .blobs tree but nothing else
|
|
191
|
+
async function getBlobManagerTreeFromTree(tree, blobs, storage) {
|
|
192
|
+
const id = tree.blobs[redirectTableBlobName];
|
|
193
|
+
const blob = await storage.readBlob(id);
|
|
194
|
+
// ArrayBufferLike will not survive JSON.stringify()
|
|
195
|
+
blobs[id] = bufferToString(blob, "utf8");
|
|
196
|
+
}
|
|
185
197
|
/**
|
|
186
198
|
* Extract blob contents from a snapshot tree with blob contents
|
|
187
199
|
*/
|
|
@@ -192,7 +204,10 @@ export function getBlobContentsFromTreeWithBlobContents(snapshot) {
|
|
|
192
204
|
}
|
|
193
205
|
function getBlobContentsFromTreeWithBlobContentsCore(tree, blobs, root = true) {
|
|
194
206
|
for (const [key, subTree] of Object.entries(tree.trees)) {
|
|
195
|
-
if (
|
|
207
|
+
if (root && key === blobsTreeName) {
|
|
208
|
+
getBlobManagerTreeFromTreeWithBlobContents(subTree, blobs);
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
196
211
|
getBlobContentsFromTreeWithBlobContentsCore(subTree, blobs, false);
|
|
197
212
|
}
|
|
198
213
|
}
|
|
@@ -203,4 +218,12 @@ function getBlobContentsFromTreeWithBlobContentsCore(tree, blobs, root = true) {
|
|
|
203
218
|
blobs[id] = bufferToString(blob, "utf8");
|
|
204
219
|
}
|
|
205
220
|
}
|
|
221
|
+
// save redirect table from .blobs tree but nothing else
|
|
222
|
+
function getBlobManagerTreeFromTreeWithBlobContents(tree, blobs) {
|
|
223
|
+
const id = tree.blobs[redirectTableBlobName];
|
|
224
|
+
const blob = tree.blobsContents[id];
|
|
225
|
+
assert(blob !== undefined, 0x70f /* Blob must be present in blobsContents */);
|
|
226
|
+
// ArrayBufferLike will not survive JSON.stringify()
|
|
227
|
+
blobs[id] = bufferToString(blob, "utf8");
|
|
228
|
+
}
|
|
206
229
|
//# sourceMappingURL=containerStorageAdapter.js.map
|