@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/dist/containerContext.js
CHANGED
|
@@ -5,22 +5,21 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.ContainerContext = void 0;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
12
|
-
const container_utils_1 = require("@fluidframework/container-utils");
|
|
13
|
-
const PackageNotFactoryError = "Code package does not implement IRuntimeFactory";
|
|
8
|
+
/**
|
|
9
|
+
* {@inheritDoc @fluidframework/container-definitions#IContainerContext}
|
|
10
|
+
*/
|
|
14
11
|
class ContainerContext {
|
|
15
|
-
constructor(
|
|
12
|
+
constructor(options, scope, baseSnapshot, _version, deltaManager, storage, quorum, audience, loader, submitFn, submitSummaryFn,
|
|
16
13
|
/** @returns clientSequenceNumber of last message in a batch */
|
|
17
|
-
submitBatchFn, submitSignalFn, disposeFn, closeFn,
|
|
18
|
-
this.
|
|
14
|
+
submitBatchFn, submitSignalFn, disposeFn, closeFn, updateDirtyContainerState, getAbsoluteUrl, _getContainerDiagnosticId, _getClientId, _getServiceConfiguration, _getAttachState, _getConnected, getSpecifiedCodeDetails, clientDetails, existing, taggedLogger, pendingLocalState) {
|
|
15
|
+
this.options = options;
|
|
19
16
|
this.scope = scope;
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this._baseSnapshot = _baseSnapshot;
|
|
17
|
+
this.baseSnapshot = baseSnapshot;
|
|
18
|
+
this._version = _version;
|
|
23
19
|
this.deltaManager = deltaManager;
|
|
20
|
+
this.storage = storage;
|
|
21
|
+
this.quorum = quorum;
|
|
22
|
+
this.audience = audience;
|
|
24
23
|
this.loader = loader;
|
|
25
24
|
this.submitFn = submitFn;
|
|
26
25
|
this.submitSummaryFn = submitSummaryFn;
|
|
@@ -28,20 +27,18 @@ class ContainerContext {
|
|
|
28
27
|
this.submitSignalFn = submitSignalFn;
|
|
29
28
|
this.disposeFn = disposeFn;
|
|
30
29
|
this.closeFn = closeFn;
|
|
31
|
-
this.version = version;
|
|
32
30
|
this.updateDirtyContainerState = updateDirtyContainerState;
|
|
31
|
+
this.getAbsoluteUrl = getAbsoluteUrl;
|
|
32
|
+
this._getContainerDiagnosticId = _getContainerDiagnosticId;
|
|
33
|
+
this._getClientId = _getClientId;
|
|
34
|
+
this._getServiceConfiguration = _getServiceConfiguration;
|
|
35
|
+
this._getAttachState = _getAttachState;
|
|
36
|
+
this._getConnected = _getConnected;
|
|
37
|
+
this.getSpecifiedCodeDetails = getSpecifiedCodeDetails;
|
|
38
|
+
this.clientDetails = clientDetails;
|
|
33
39
|
this.existing = existing;
|
|
40
|
+
this.taggedLogger = taggedLogger;
|
|
34
41
|
this.pendingLocalState = pendingLocalState;
|
|
35
|
-
this._disposed = false;
|
|
36
|
-
/**
|
|
37
|
-
* Emits events about the container context's lifecycle.
|
|
38
|
-
* Use it to coordinate things inside the ContainerContext class.
|
|
39
|
-
*/
|
|
40
|
-
this.lifecycleEvents = new common_utils_1.TypedEventEmitter();
|
|
41
|
-
this._connected = this.container.connected;
|
|
42
|
-
this._quorum = quorum;
|
|
43
|
-
this.taggedLogger = container.subLogger;
|
|
44
|
-
this._fluidModuleP = new common_utils_1.LazyPromise(async () => this.loadCodeModule(_codeDetails));
|
|
45
42
|
this.supportedFeatures = new Map([
|
|
46
43
|
/**
|
|
47
44
|
* This version of the loader accepts `referenceSequenceNumber`, provided by the container runtime,
|
|
@@ -50,225 +47,39 @@ class ContainerContext {
|
|
|
50
47
|
*/
|
|
51
48
|
["referenceSequenceNumbers", true],
|
|
52
49
|
]);
|
|
53
|
-
this.
|
|
54
|
-
}
|
|
55
|
-
static async createOrLoad(container, scope, codeLoader, codeDetails, baseSnapshot, deltaManager, quorum, loader, submitFn, submitSummaryFn, submitBatchFn, submitSignalFn, disposeFn, closeFn, version, updateDirtyContainerState, existing, pendingLocalState) {
|
|
56
|
-
const context = new ContainerContext(container, scope, codeLoader, codeDetails, baseSnapshot, deltaManager, quorum, loader, submitFn, submitSummaryFn, submitBatchFn, submitSignalFn, disposeFn, closeFn, version, updateDirtyContainerState, existing, pendingLocalState);
|
|
57
|
-
await context.instantiateRuntime(existing);
|
|
58
|
-
return context;
|
|
50
|
+
this._disposed = false;
|
|
59
51
|
}
|
|
60
52
|
get clientId() {
|
|
61
|
-
return this.
|
|
53
|
+
return this._getClientId();
|
|
62
54
|
}
|
|
63
55
|
/**
|
|
64
56
|
* DISCLAIMER: this id is only for telemetry purposes. Not suitable for any other usages.
|
|
65
57
|
*/
|
|
66
58
|
get id() {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return resolvedUrl.id;
|
|
70
|
-
}
|
|
71
|
-
return "";
|
|
72
|
-
}
|
|
73
|
-
get clientDetails() {
|
|
74
|
-
return this.container.clientDetails;
|
|
59
|
+
var _a;
|
|
60
|
+
return (_a = this._getContainerDiagnosticId()) !== null && _a !== void 0 ? _a : "";
|
|
75
61
|
}
|
|
76
62
|
/**
|
|
77
63
|
* When true, ops are free to flow
|
|
78
64
|
* When false, ops should be kept as pending or rejected
|
|
79
65
|
*/
|
|
80
66
|
get connected() {
|
|
81
|
-
return this.
|
|
82
|
-
}
|
|
83
|
-
get canSummarize() {
|
|
84
|
-
return "summarize" in this.runtime;
|
|
67
|
+
return this._getConnected();
|
|
85
68
|
}
|
|
86
69
|
get serviceConfiguration() {
|
|
87
|
-
return this.
|
|
88
|
-
}
|
|
89
|
-
get audience() {
|
|
90
|
-
return this.container.audience;
|
|
91
|
-
}
|
|
92
|
-
get options() {
|
|
93
|
-
return this.container.options;
|
|
94
|
-
}
|
|
95
|
-
get baseSnapshot() {
|
|
96
|
-
return this._baseSnapshot;
|
|
97
|
-
}
|
|
98
|
-
get storage() {
|
|
99
|
-
return this.container.storage;
|
|
100
|
-
}
|
|
101
|
-
get runtime() {
|
|
102
|
-
if (this._runtime === undefined) {
|
|
103
|
-
throw new Error("Attempted to access runtime before it was defined");
|
|
104
|
-
}
|
|
105
|
-
return this._runtime;
|
|
70
|
+
return this._getServiceConfiguration();
|
|
106
71
|
}
|
|
107
72
|
get disposed() {
|
|
108
73
|
return this._disposed;
|
|
109
74
|
}
|
|
110
|
-
get codeDetails() {
|
|
111
|
-
return this._codeDetails;
|
|
112
|
-
}
|
|
113
|
-
get quorum() {
|
|
114
|
-
return this._quorum;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* {@inheritDoc @fluidframework/container-definitions#IContainerContext.getEntryPoint}
|
|
118
|
-
*/
|
|
119
|
-
async getEntryPoint() {
|
|
120
|
-
var _a, _b;
|
|
121
|
-
if (this._disposed) {
|
|
122
|
-
throw new container_utils_1.UsageError("The context is already disposed");
|
|
123
|
-
}
|
|
124
|
-
if (this._runtime !== undefined) {
|
|
125
|
-
return (_b = (_a = this._runtime) === null || _a === void 0 ? void 0 : _a.getEntryPoint) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
126
|
-
}
|
|
127
|
-
return new Promise((resolve, reject) => {
|
|
128
|
-
const runtimeInstantiatedHandler = () => {
|
|
129
|
-
var _a, _b;
|
|
130
|
-
(0, common_utils_1.assert)(this._runtime !== undefined, 0x5a3 /* runtimeInstantiated fired but runtime is still undefined */);
|
|
131
|
-
resolve((_b = (_a = this._runtime).getEntryPoint) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
132
|
-
this.lifecycleEvents.off("disposed", disposedHandler);
|
|
133
|
-
};
|
|
134
|
-
const disposedHandler = () => {
|
|
135
|
-
reject(new Error("ContainerContext was disposed"));
|
|
136
|
-
this.lifecycleEvents.off("runtimeInstantiated", runtimeInstantiatedHandler);
|
|
137
|
-
};
|
|
138
|
-
this.lifecycleEvents.once("runtimeInstantiated", runtimeInstantiatedHandler);
|
|
139
|
-
this.lifecycleEvents.once("disposed", disposedHandler);
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* @deprecated Temporary migratory API, to be removed when customers no longer need it.
|
|
144
|
-
* When removed, `ContainerContext` should only take an {@link @fluidframework/container-definitions#IQuorumClients}
|
|
145
|
-
* rather than an {@link @fluidframework/protocol-definitions#IQuorum}.
|
|
146
|
-
* See {@link @fluidframework/container-definitions#IContainerContext} for more details.
|
|
147
|
-
*/
|
|
148
|
-
getSpecifiedCodeDetails() {
|
|
149
|
-
var _a;
|
|
150
|
-
return ((_a = this._quorum.get("code")) !== null && _a !== void 0 ? _a : this._quorum.get("code2"));
|
|
151
|
-
}
|
|
152
75
|
dispose(error) {
|
|
153
|
-
if (this._disposed) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
76
|
this._disposed = true;
|
|
157
|
-
this.lifecycleEvents.emit("disposed");
|
|
158
|
-
this.runtime.dispose(error);
|
|
159
|
-
this._quorum.dispose();
|
|
160
|
-
this.deltaManager.dispose();
|
|
161
77
|
}
|
|
162
78
|
getLoadedFromVersion() {
|
|
163
|
-
return this.
|
|
79
|
+
return this._version;
|
|
164
80
|
}
|
|
165
81
|
get attachState() {
|
|
166
|
-
return this.
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Create a summary. Used when attaching or serializing a detached container.
|
|
170
|
-
*
|
|
171
|
-
* @param blobRedirectTable - A table passed during the attach process. While detached, blob upload is supported
|
|
172
|
-
* using IDs generated locally. After attach, these IDs cannot be used, so this table maps the old local IDs to the
|
|
173
|
-
* new storage IDs so requests can be redirected.
|
|
174
|
-
*/
|
|
175
|
-
createSummary(blobRedirectTable) {
|
|
176
|
-
return this.runtime.createSummary(blobRedirectTable);
|
|
177
|
-
}
|
|
178
|
-
setConnectionState(connected, clientId) {
|
|
179
|
-
const runtime = this.runtime;
|
|
180
|
-
this._connected = connected;
|
|
181
|
-
runtime.setConnectionState(connected, clientId);
|
|
182
|
-
}
|
|
183
|
-
process(message, local) {
|
|
184
|
-
this.runtime.process(message, local);
|
|
185
|
-
}
|
|
186
|
-
processSignal(message, local) {
|
|
187
|
-
this.runtime.processSignal(message, local);
|
|
188
|
-
}
|
|
189
|
-
async request(path) {
|
|
190
|
-
return this.runtime.request(path);
|
|
191
|
-
}
|
|
192
|
-
async getAbsoluteUrl(relativeUrl) {
|
|
193
|
-
return this.container.getAbsoluteUrl(relativeUrl);
|
|
194
|
-
}
|
|
195
|
-
getPendingLocalState() {
|
|
196
|
-
return this.runtime.getPendingLocalState();
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Determines if the current code details of the context
|
|
200
|
-
* satisfy the incoming constraint code details
|
|
201
|
-
*/
|
|
202
|
-
async satisfies(constraintCodeDetails) {
|
|
203
|
-
var _a;
|
|
204
|
-
const comparers = [];
|
|
205
|
-
const maybeCompareCodeLoader = this.codeLoader;
|
|
206
|
-
if (maybeCompareCodeLoader.IFluidCodeDetailsComparer !== undefined) {
|
|
207
|
-
comparers.push(maybeCompareCodeLoader.IFluidCodeDetailsComparer);
|
|
208
|
-
}
|
|
209
|
-
const moduleWithDetails = await this._fluidModuleP;
|
|
210
|
-
const maybeCompareExport = (_a = moduleWithDetails.module) === null || _a === void 0 ? void 0 : _a.fluidExport;
|
|
211
|
-
if ((maybeCompareExport === null || maybeCompareExport === void 0 ? void 0 : maybeCompareExport.IFluidCodeDetailsComparer) !== undefined) {
|
|
212
|
-
comparers.push(maybeCompareExport.IFluidCodeDetailsComparer);
|
|
213
|
-
}
|
|
214
|
-
// if there are not comparers it is not possible to know
|
|
215
|
-
// if the current satisfy the incoming, so return false,
|
|
216
|
-
// as assuming they do not satisfy is safer .e.g we will
|
|
217
|
-
// reload, rather than potentially running with
|
|
218
|
-
// incompatible code
|
|
219
|
-
if (comparers.length === 0) {
|
|
220
|
-
return false;
|
|
221
|
-
}
|
|
222
|
-
for (const comparer of comparers) {
|
|
223
|
-
const satisfies = await comparer.satisfies(moduleWithDetails.details, constraintCodeDetails);
|
|
224
|
-
if (satisfies === false) {
|
|
225
|
-
return false;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
return true;
|
|
229
|
-
}
|
|
230
|
-
async notifyOpReplay(message) {
|
|
231
|
-
var _a, _b;
|
|
232
|
-
return (_b = (_a = this.runtime).notifyOpReplay) === null || _b === void 0 ? void 0 : _b.call(_a, message);
|
|
233
|
-
}
|
|
234
|
-
// #region private
|
|
235
|
-
async getRuntimeFactory() {
|
|
236
|
-
var _a;
|
|
237
|
-
const fluidExport = (_a = (await this._fluidModuleP).module) === null || _a === void 0 ? void 0 : _a.fluidExport;
|
|
238
|
-
const runtimeFactory = fluidExport === null || fluidExport === void 0 ? void 0 : fluidExport.IRuntimeFactory;
|
|
239
|
-
if (runtimeFactory === undefined) {
|
|
240
|
-
throw new Error(PackageNotFactoryError);
|
|
241
|
-
}
|
|
242
|
-
return runtimeFactory;
|
|
243
|
-
}
|
|
244
|
-
async instantiateRuntime(existing) {
|
|
245
|
-
const runtimeFactory = await this.getRuntimeFactory();
|
|
246
|
-
this._runtime = await telemetry_utils_1.PerformanceEvent.timedExecAsync(this.taggedLogger, { eventName: "InstantiateRuntime" }, async () => runtimeFactory.instantiateRuntime(this, existing));
|
|
247
|
-
this.lifecycleEvents.emit("runtimeInstantiated");
|
|
248
|
-
}
|
|
249
|
-
attachListener() {
|
|
250
|
-
this.container.once("attaching", () => {
|
|
251
|
-
this.runtime.setAttachState(container_definitions_1.AttachState.Attaching);
|
|
252
|
-
});
|
|
253
|
-
this.container.once("attached", () => {
|
|
254
|
-
this.runtime.setAttachState(container_definitions_1.AttachState.Attached);
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
async loadCodeModule(codeDetails) {
|
|
258
|
-
const loadCodeResult = await telemetry_utils_1.PerformanceEvent.timedExecAsync(this.taggedLogger, { eventName: "CodeLoad" }, async () => this.codeLoader.load(codeDetails));
|
|
259
|
-
if ("module" in loadCodeResult) {
|
|
260
|
-
const { module, details } = loadCodeResult;
|
|
261
|
-
return {
|
|
262
|
-
module,
|
|
263
|
-
details: details !== null && details !== void 0 ? details : codeDetails,
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
else {
|
|
267
|
-
// If "module" is not in the result, we are using a legacy ICodeLoader. Fix the result up with details.
|
|
268
|
-
// Once usage drops to 0 we can remove this compat path.
|
|
269
|
-
this.taggedLogger.sendTelemetryEvent({ eventName: "LegacyCodeLoader" });
|
|
270
|
-
return loadCodeResult;
|
|
271
|
-
}
|
|
82
|
+
return this._getAttachState();
|
|
272
83
|
}
|
|
273
84
|
}
|
|
274
85
|
exports.ContainerContext = ContainerContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerContext.js","sourceRoot":"","sources":["../src/containerContext.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAAsF;AACtF,iFAiB+C;AAG/C,+DAAkE;AAelE,qEAAmE;AACnE,qEAA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CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC,CAAC;YACxE,OAAO,cAAc,CAAC;SACtB;IACF,CAAC;CAED;AAxXD,4CAwXC","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,MAAa,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;QAClB,iBAAY,GAAZ,YAAY,CAA2B;QACtC,aAAQ,GAAR,QAAQ,CAAsB;QAC/B,iBAAY,GAAZ,YAAY,CAA4D;QACxE,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ID,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;AA5FD,4CA4FC","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,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,2BAA2B;IA1B7C,OAAO,CAAC,eAAe,CAAiD;IAExE,OAAO,CAA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AAC;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"}
|
|
@@ -159,11 +159,13 @@ class BlobOnlyStorage {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
// runtime will write a tree to the summary containing
|
|
163
|
-
// which reference attachment blobs by ID
|
|
164
|
-
//
|
|
165
|
-
// the size of stashed change blobs
|
|
162
|
+
// runtime will write a tree to the summary containing "attachment" type entries
|
|
163
|
+
// which reference attachment blobs by ID, along with a blob containing the blob redirect table.
|
|
164
|
+
// However, some drivers do not support the "attachment" type and will convert them to "blob" type
|
|
165
|
+
// entries. We want to avoid saving these to reduce the size of stashed change blobs, but we
|
|
166
|
+
// need to make sure the blob redirect table is saved.
|
|
166
167
|
const blobsTreeName = ".blobs";
|
|
168
|
+
const redirectTableBlobName = ".redirectTable";
|
|
167
169
|
/**
|
|
168
170
|
* Get blob contents of a snapshot tree from storage (or, ideally, cache)
|
|
169
171
|
*/
|
|
@@ -176,7 +178,10 @@ exports.getBlobContentsFromTree = getBlobContentsFromTree;
|
|
|
176
178
|
async function getBlobContentsFromTreeCore(tree, blobs, storage, root = true) {
|
|
177
179
|
const treePs = [];
|
|
178
180
|
for (const [key, subTree] of Object.entries(tree.trees)) {
|
|
179
|
-
if (
|
|
181
|
+
if (root && key === blobsTreeName) {
|
|
182
|
+
treePs.push(getBlobManagerTreeFromTree(subTree, blobs, storage));
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
180
185
|
treePs.push(getBlobContentsFromTreeCore(subTree, blobs, storage, false));
|
|
181
186
|
}
|
|
182
187
|
}
|
|
@@ -187,6 +192,13 @@ async function getBlobContentsFromTreeCore(tree, blobs, storage, root = true) {
|
|
|
187
192
|
}
|
|
188
193
|
return Promise.all(treePs);
|
|
189
194
|
}
|
|
195
|
+
// save redirect table from .blobs tree but nothing else
|
|
196
|
+
async function getBlobManagerTreeFromTree(tree, blobs, storage) {
|
|
197
|
+
const id = tree.blobs[redirectTableBlobName];
|
|
198
|
+
const blob = await storage.readBlob(id);
|
|
199
|
+
// ArrayBufferLike will not survive JSON.stringify()
|
|
200
|
+
blobs[id] = (0, common_utils_1.bufferToString)(blob, "utf8");
|
|
201
|
+
}
|
|
190
202
|
/**
|
|
191
203
|
* Extract blob contents from a snapshot tree with blob contents
|
|
192
204
|
*/
|
|
@@ -198,7 +210,10 @@ function getBlobContentsFromTreeWithBlobContents(snapshot) {
|
|
|
198
210
|
exports.getBlobContentsFromTreeWithBlobContents = getBlobContentsFromTreeWithBlobContents;
|
|
199
211
|
function getBlobContentsFromTreeWithBlobContentsCore(tree, blobs, root = true) {
|
|
200
212
|
for (const [key, subTree] of Object.entries(tree.trees)) {
|
|
201
|
-
if (
|
|
213
|
+
if (root && key === blobsTreeName) {
|
|
214
|
+
getBlobManagerTreeFromTreeWithBlobContents(subTree, blobs);
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
202
217
|
getBlobContentsFromTreeWithBlobContentsCore(subTree, blobs, false);
|
|
203
218
|
}
|
|
204
219
|
}
|
|
@@ -209,4 +224,12 @@ function getBlobContentsFromTreeWithBlobContentsCore(tree, blobs, root = true) {
|
|
|
209
224
|
blobs[id] = (0, common_utils_1.bufferToString)(blob, "utf8");
|
|
210
225
|
}
|
|
211
226
|
}
|
|
227
|
+
// save redirect table from .blobs tree but nothing else
|
|
228
|
+
function getBlobManagerTreeFromTreeWithBlobContents(tree, blobs) {
|
|
229
|
+
const id = tree.blobs[redirectTableBlobName];
|
|
230
|
+
const blob = tree.blobsContents[id];
|
|
231
|
+
(0, common_utils_1.assert)(blob !== undefined, 0x70f /* Blob must be present in blobsContents */);
|
|
232
|
+
// ArrayBufferLike will not survive JSON.stringify()
|
|
233
|
+
blobs[id] = (0, common_utils_1.bufferToString)(blob, "utf8");
|
|
234
|
+
}
|
|
212
235
|
//# sourceMappingURL=containerStorageAdapter.js.map
|