@fluidframework/container-loader 2.51.0 → 2.53.0-350190
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 +4 -0
- package/dist/connectionManager.d.ts +7 -1
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +28 -1
- package/dist/connectionManager.js.map +1 -1
- package/dist/container.d.ts +11 -8
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +37 -22
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +49 -25
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js +29 -38
- package/dist/containerContext.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts +10 -3
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +12 -3
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/serializedStateManager.d.ts +2 -2
- package/dist/serializedStateManager.d.ts.map +1 -1
- package/dist/serializedStateManager.js +5 -5
- package/dist/serializedStateManager.js.map +1 -1
- package/lib/connectionManager.d.ts +7 -1
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +28 -1
- package/lib/connectionManager.js.map +1 -1
- package/lib/container.d.ts +11 -8
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +37 -22
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts +49 -25
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js +29 -38
- package/lib/containerContext.js.map +1 -1
- package/lib/containerStorageAdapter.d.ts +10 -3
- package/lib/containerStorageAdapter.d.ts.map +1 -1
- package/lib/containerStorageAdapter.js +12 -3
- package/lib/containerStorageAdapter.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/serializedStateManager.d.ts +2 -2
- package/lib/serializedStateManager.d.ts.map +1 -1
- package/lib/serializedStateManager.js +5 -5
- package/lib/serializedStateManager.js.map +1 -1
- package/package.json +14 -14
- package/src/connectionManager.ts +38 -0
- package/src/container.ts +50 -59
- package/src/containerContext.ts +128 -52
- package/src/containerStorageAdapter.ts +19 -6
- package/src/packageVersion.ts +1 -1
- package/src/serializedStateManager.ts +5 -9
package/src/containerContext.ts
CHANGED
|
@@ -18,12 +18,12 @@ import {
|
|
|
18
18
|
ILoader,
|
|
19
19
|
ILoaderOptions,
|
|
20
20
|
IDeltaManager,
|
|
21
|
+
type IContainerStorageService,
|
|
21
22
|
} from "@fluidframework/container-definitions/internal";
|
|
22
23
|
import { type FluidObject } from "@fluidframework/core-interfaces";
|
|
23
24
|
import { type ISignalEnvelope } from "@fluidframework/core-interfaces/internal";
|
|
24
25
|
import { IClientDetails, IQuorumClients } from "@fluidframework/driver-definitions";
|
|
25
26
|
import {
|
|
26
|
-
IDocumentStorageService,
|
|
27
27
|
ISnapshot,
|
|
28
28
|
IDocumentMessage,
|
|
29
29
|
ISnapshotTree,
|
|
@@ -34,8 +34,53 @@ import {
|
|
|
34
34
|
} from "@fluidframework/driver-definitions/internal";
|
|
35
35
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
36
36
|
|
|
37
|
+
import type { ConnectionState } from "./connectionState.js";
|
|
37
38
|
import { loaderCompatDetailsForRuntime } from "./loaderLayerCompatState.js";
|
|
38
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Configuration object for ContainerContext constructor.
|
|
42
|
+
*/
|
|
43
|
+
export interface IContainerContextConfig {
|
|
44
|
+
readonly options: ILoaderOptions;
|
|
45
|
+
readonly scope: FluidObject;
|
|
46
|
+
readonly baseSnapshot: ISnapshotTree | undefined;
|
|
47
|
+
readonly version: IVersion | undefined;
|
|
48
|
+
readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
|
|
49
|
+
readonly storage: IContainerStorageService;
|
|
50
|
+
readonly quorum: IQuorumClients;
|
|
51
|
+
readonly audience: IAudience;
|
|
52
|
+
readonly loader: ILoader;
|
|
53
|
+
readonly submitFn: (
|
|
54
|
+
type: MessageType,
|
|
55
|
+
contents: unknown,
|
|
56
|
+
batch: boolean,
|
|
57
|
+
appData: unknown,
|
|
58
|
+
) => number;
|
|
59
|
+
readonly submitSummaryFn: (
|
|
60
|
+
summaryOp: ISummaryContent,
|
|
61
|
+
referenceSequenceNumber?: number,
|
|
62
|
+
) => number;
|
|
63
|
+
readonly submitBatchFn: (batch: IBatchMessage[], referenceSequenceNumber?: number) => number;
|
|
64
|
+
readonly submitSignalFn: (
|
|
65
|
+
content: unknown | ISignalEnvelope,
|
|
66
|
+
targetClientId?: string,
|
|
67
|
+
) => void;
|
|
68
|
+
readonly disposeFn: (error?: ICriticalContainerError) => void;
|
|
69
|
+
readonly closeFn: (error?: ICriticalContainerError) => void;
|
|
70
|
+
readonly updateDirtyContainerState: (dirty: boolean) => void;
|
|
71
|
+
readonly getAbsoluteUrl: (relativeUrl: string) => Promise<string | undefined>;
|
|
72
|
+
readonly getContainerDiagnosticId: () => string | undefined;
|
|
73
|
+
readonly getClientId: () => string | undefined;
|
|
74
|
+
readonly getAttachState: () => AttachState;
|
|
75
|
+
readonly getConnected: () => boolean;
|
|
76
|
+
readonly getConnectionState: () => ConnectionState;
|
|
77
|
+
readonly clientDetails: IClientDetails;
|
|
78
|
+
readonly existing: boolean;
|
|
79
|
+
readonly taggedLogger: ITelemetryLoggerExt;
|
|
80
|
+
readonly pendingLocalState?: unknown;
|
|
81
|
+
readonly snapshotWithContents?: ISnapshot;
|
|
82
|
+
}
|
|
83
|
+
|
|
39
84
|
/**
|
|
40
85
|
* {@inheritDoc @fluidframework/container-definitions#IContainerContext}
|
|
41
86
|
*/
|
|
@@ -52,6 +97,58 @@ export class ContainerContext implements IContainerContext, IProvideLayerCompatD
|
|
|
52
97
|
["referenceSequenceNumbers", true],
|
|
53
98
|
]);
|
|
54
99
|
|
|
100
|
+
public readonly options: ILoaderOptions;
|
|
101
|
+
public readonly scope: FluidObject;
|
|
102
|
+
public readonly baseSnapshot: ISnapshotTree | undefined;
|
|
103
|
+
public readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
|
|
104
|
+
public readonly storage: IContainerStorageService;
|
|
105
|
+
public readonly quorum: IQuorumClients;
|
|
106
|
+
public readonly audience: IAudience;
|
|
107
|
+
public readonly loader: ILoader;
|
|
108
|
+
public readonly submitFn: (
|
|
109
|
+
type: MessageType,
|
|
110
|
+
contents: unknown,
|
|
111
|
+
batch: boolean,
|
|
112
|
+
appData: unknown,
|
|
113
|
+
) => number;
|
|
114
|
+
public readonly submitSummaryFn: (
|
|
115
|
+
summaryOp: ISummaryContent,
|
|
116
|
+
referenceSequenceNumber?: number,
|
|
117
|
+
) => number;
|
|
118
|
+
/**
|
|
119
|
+
* @returns clientSequenceNumber of last message in a batch
|
|
120
|
+
*/
|
|
121
|
+
public readonly submitBatchFn: (
|
|
122
|
+
batch: IBatchMessage[],
|
|
123
|
+
referenceSequenceNumber?: number,
|
|
124
|
+
) => number;
|
|
125
|
+
/**
|
|
126
|
+
* `unknown` should be removed once `@alpha` tag is removed from IContainerContext
|
|
127
|
+
* @see {@link https://dev.azure.com/fluidframework/internal/_workitems/edit/7462}
|
|
128
|
+
* Any changes to submitSignalFn `content` should be checked internally by temporarily changing IContainerContext and removing all `unknown`s
|
|
129
|
+
*/
|
|
130
|
+
public readonly submitSignalFn: (
|
|
131
|
+
content: unknown | ISignalEnvelope,
|
|
132
|
+
targetClientId?: string,
|
|
133
|
+
) => void;
|
|
134
|
+
public readonly disposeFn: (error?: ICriticalContainerError) => void;
|
|
135
|
+
public readonly closeFn: (error?: ICriticalContainerError) => void;
|
|
136
|
+
public readonly updateDirtyContainerState: (dirty: boolean) => void;
|
|
137
|
+
public readonly getAbsoluteUrl: (relativeUrl: string) => Promise<string | undefined>;
|
|
138
|
+
public readonly clientDetails: IClientDetails;
|
|
139
|
+
public readonly existing: boolean;
|
|
140
|
+
public readonly taggedLogger: ITelemetryLoggerExt;
|
|
141
|
+
public readonly pendingLocalState: unknown;
|
|
142
|
+
public readonly snapshotWithContents: ISnapshot | undefined;
|
|
143
|
+
|
|
144
|
+
public readonly getConnectionState: () => ConnectionState;
|
|
145
|
+
|
|
146
|
+
private readonly _getClientId: () => string | undefined;
|
|
147
|
+
private readonly _getContainerDiagnosticId: () => string | undefined;
|
|
148
|
+
private readonly _getConnected: () => boolean;
|
|
149
|
+
private readonly _getAttachState: () => AttachState;
|
|
150
|
+
private readonly version: IVersion | undefined;
|
|
151
|
+
|
|
55
152
|
public get clientId(): string | undefined {
|
|
56
153
|
return this._getClientId();
|
|
57
154
|
}
|
|
@@ -79,60 +176,39 @@ export class ContainerContext implements IContainerContext, IProvideLayerCompatD
|
|
|
79
176
|
return loaderCompatDetailsForRuntime;
|
|
80
177
|
}
|
|
81
178
|
|
|
82
|
-
constructor(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
*/
|
|
105
|
-
public readonly submitBatchFn: (
|
|
106
|
-
batch: IBatchMessage[],
|
|
107
|
-
referenceSequenceNumber?: number,
|
|
108
|
-
) => number,
|
|
179
|
+
constructor(config: IContainerContextConfig) {
|
|
180
|
+
this.options = config.options;
|
|
181
|
+
this.scope = config.scope;
|
|
182
|
+
this.baseSnapshot = config.baseSnapshot;
|
|
183
|
+
this.deltaManager = config.deltaManager;
|
|
184
|
+
this.storage = config.storage;
|
|
185
|
+
this.quorum = config.quorum;
|
|
186
|
+
this.audience = config.audience;
|
|
187
|
+
this.loader = config.loader;
|
|
188
|
+
this.submitFn = config.submitFn;
|
|
189
|
+
this.submitSummaryFn = config.submitSummaryFn;
|
|
190
|
+
this.submitBatchFn = config.submitBatchFn;
|
|
191
|
+
this.submitSignalFn = config.submitSignalFn;
|
|
192
|
+
this.disposeFn = config.disposeFn;
|
|
193
|
+
this.closeFn = config.closeFn;
|
|
194
|
+
this.updateDirtyContainerState = config.updateDirtyContainerState;
|
|
195
|
+
this.getAbsoluteUrl = config.getAbsoluteUrl;
|
|
196
|
+
this.clientDetails = config.clientDetails;
|
|
197
|
+
this.existing = config.existing;
|
|
198
|
+
this.taggedLogger = config.taggedLogger;
|
|
199
|
+
this.pendingLocalState = config.pendingLocalState;
|
|
200
|
+
this.snapshotWithContents = config.snapshotWithContents;
|
|
109
201
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
targetClientId?: string,
|
|
118
|
-
) => void,
|
|
119
|
-
public readonly disposeFn: (error?: ICriticalContainerError) => void,
|
|
120
|
-
public readonly closeFn: (error?: ICriticalContainerError) => void,
|
|
121
|
-
public readonly updateDirtyContainerState: (dirty: boolean) => void,
|
|
122
|
-
public readonly getAbsoluteUrl: (relativeUrl: string) => Promise<string | undefined>,
|
|
123
|
-
private readonly _getContainerDiagnosticId: () => string | undefined,
|
|
124
|
-
private readonly _getClientId: () => string | undefined,
|
|
125
|
-
private readonly _getAttachState: () => AttachState,
|
|
126
|
-
private readonly _getConnected: () => boolean,
|
|
127
|
-
public readonly clientDetails: IClientDetails,
|
|
128
|
-
public readonly existing: boolean,
|
|
129
|
-
public readonly taggedLogger: ITelemetryLoggerExt,
|
|
130
|
-
public readonly pendingLocalState?: unknown,
|
|
131
|
-
public readonly snapshotWithContents?: ISnapshot,
|
|
132
|
-
) {}
|
|
202
|
+
this.getConnectionState = config.getConnectionState;
|
|
203
|
+
this._getClientId = config.getClientId;
|
|
204
|
+
this._getContainerDiagnosticId = config.getContainerDiagnosticId;
|
|
205
|
+
this._getConnected = config.getConnected;
|
|
206
|
+
this._getAttachState = config.getAttachState;
|
|
207
|
+
this.version = config.version;
|
|
208
|
+
}
|
|
133
209
|
|
|
134
210
|
public getLoadedFromVersion(): IVersion | undefined {
|
|
135
|
-
return this.
|
|
211
|
+
return this.version;
|
|
136
212
|
}
|
|
137
213
|
|
|
138
214
|
public get attachState(): AttachState {
|
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { bufferToString, stringToBuffer } from "@fluid-internal/client-utils";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
ISnapshotTreeWithBlobContents,
|
|
9
|
+
type IContainerStorageService,
|
|
10
|
+
} from "@fluidframework/container-definitions/internal";
|
|
8
11
|
import { IDisposable } from "@fluidframework/core-interfaces";
|
|
9
12
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
10
13
|
import { ISummaryHandle, ISummaryTree } from "@fluidframework/driver-definitions";
|
|
@@ -47,7 +50,7 @@ export interface ISerializableBlobContents {
|
|
|
47
50
|
export class ContainerStorageAdapter
|
|
48
51
|
implements
|
|
49
52
|
ISerializedStateManagerDocumentStorageService,
|
|
50
|
-
|
|
53
|
+
IContainerStorageService,
|
|
51
54
|
IDisposable
|
|
52
55
|
{
|
|
53
56
|
private _storageService: IDocumentStorageService & Partial<IDisposable>;
|
|
@@ -159,6 +162,10 @@ export class ContainerStorageAdapter
|
|
|
159
162
|
return undefined;
|
|
160
163
|
}
|
|
161
164
|
|
|
165
|
+
public get maximumCacheDurationMs(): IDocumentStorageServicePolicies["maximumCacheDurationMs"] {
|
|
166
|
+
return this.policies?.maximumCacheDurationMs;
|
|
167
|
+
}
|
|
168
|
+
|
|
162
169
|
public async getSnapshotTree(
|
|
163
170
|
version?: IVersion,
|
|
164
171
|
scenarioName?: string,
|
|
@@ -241,13 +248,19 @@ export class ContainerStorageAdapter
|
|
|
241
248
|
return this._storageService.uploadSummaryWithContext(summary, context);
|
|
242
249
|
}
|
|
243
250
|
|
|
244
|
-
public async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {
|
|
245
|
-
return this._storageService.downloadSummary(handle);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
251
|
public async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {
|
|
249
252
|
return this._storageService.createBlob(file);
|
|
250
253
|
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* {@link IRuntimeStorageService.downloadSummary}.
|
|
257
|
+
*
|
|
258
|
+
* @deprecated - This API is deprecated and will be removed in a future release. No replacement is planned as
|
|
259
|
+
* it is unused in the Runtime and below layers.
|
|
260
|
+
*/
|
|
261
|
+
public async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {
|
|
262
|
+
return this._storageService.downloadSummary(handle);
|
|
263
|
+
}
|
|
251
264
|
}
|
|
252
265
|
|
|
253
266
|
/**
|
package/src/packageVersion.ts
CHANGED
|
@@ -4,10 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { stringToBuffer } from "@fluid-internal/client-utils";
|
|
7
|
-
import {
|
|
8
|
-
IGetPendingLocalStateProps,
|
|
9
|
-
IRuntime,
|
|
10
|
-
} from "@fluidframework/container-definitions/internal";
|
|
7
|
+
import { IRuntime } from "@fluidframework/container-definitions/internal";
|
|
11
8
|
import type {
|
|
12
9
|
IEventProvider,
|
|
13
10
|
IEvent,
|
|
@@ -422,7 +419,6 @@ export class SerializedStateManager {
|
|
|
422
419
|
* to be stored and used to rehydrate the container at a later time.
|
|
423
420
|
*/
|
|
424
421
|
public async getPendingLocalState(
|
|
425
|
-
props: IGetPendingLocalStateProps,
|
|
426
422
|
clientId: string | undefined,
|
|
427
423
|
runtime: Pick<IRuntime, "getPendingLocalState">,
|
|
428
424
|
resolvedUrl: IResolvedUrl,
|
|
@@ -432,9 +428,9 @@ export class SerializedStateManager {
|
|
|
432
428
|
{
|
|
433
429
|
eventName: "getPendingLocalState",
|
|
434
430
|
details: {
|
|
435
|
-
notifyImminentClosure:
|
|
436
|
-
sessionExpiryTimerStarted:
|
|
437
|
-
snapshotSequenceNumber:
|
|
431
|
+
notifyImminentClosure: false,
|
|
432
|
+
sessionExpiryTimerStarted: undefined,
|
|
433
|
+
snapshotSequenceNumber: undefined,
|
|
438
434
|
processedOpsSize: this.processedOps.length,
|
|
439
435
|
},
|
|
440
436
|
clientId,
|
|
@@ -445,7 +441,7 @@ export class SerializedStateManager {
|
|
|
445
441
|
}
|
|
446
442
|
assert(this.snapshot !== undefined, 0x8e5 /* no base data */);
|
|
447
443
|
const pendingRuntimeState = await runtime.getPendingLocalState({
|
|
448
|
-
|
|
444
|
+
notifyImminentClosure: false,
|
|
449
445
|
snapshotSequenceNumber: this.snapshot.snapshotSequenceNumber,
|
|
450
446
|
sessionExpiryTimerStarted: this.snapshot.snapshotFetchedTime,
|
|
451
447
|
});
|