@fluidframework/container-loader 2.0.0-dev-rc.2.0.0.246488 → 2.0.0-dev-rc.3.0.0.253463
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/api-report/container-loader.api.md +11 -11
- package/dist/attachment.d.ts +6 -9
- package/dist/attachment.d.ts.map +1 -1
- package/dist/attachment.js +3 -3
- package/dist/attachment.js.map +1 -1
- package/dist/audience.d.ts +1 -1
- package/dist/audience.d.ts.map +1 -1
- package/dist/audience.js +2 -2
- package/dist/audience.js.map +1 -1
- package/dist/catchUpMonitor.d.ts +1 -1
- package/dist/catchUpMonitor.d.ts.map +1 -1
- package/dist/catchUpMonitor.js +2 -2
- package/dist/catchUpMonitor.js.map +1 -1
- package/dist/connectionManager.d.ts +4 -4
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +42 -42
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionStateHandler.d.ts +3 -3
- package/dist/connectionStateHandler.d.ts.map +1 -1
- package/dist/connectionStateHandler.js +27 -27
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container-loader-alpha.d.ts +11 -11
- package/dist/container-loader-beta.d.ts +11 -11
- package/dist/container-loader-public.d.ts +11 -11
- package/dist/container-loader-untrimmed.d.ts +11 -11
- package/dist/container.d.ts +9 -46
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +96 -108
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +19 -7
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js +7 -2
- 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 +6 -6
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/contracts.d.ts +4 -3
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +2 -2
- package/dist/contracts.js.map +1 -1
- package/dist/debugLogger.d.ts +2 -1
- package/dist/debugLogger.d.ts.map +1 -1
- package/dist/debugLogger.js +4 -4
- package/dist/debugLogger.js.map +1 -1
- package/dist/deltaManager.d.ts +7 -6
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +45 -45
- package/dist/deltaManager.js.map +1 -1
- package/dist/deltaQueue.d.ts +1 -1
- package/dist/deltaQueue.d.ts.map +1 -1
- package/dist/deltaQueue.js +5 -5
- package/dist/deltaQueue.js.map +1 -1
- package/dist/error.d.ts +3 -2
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +5 -5
- package/dist/error.js.map +1 -1
- package/dist/loader.d.ts +4 -4
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +23 -23
- package/dist/loader.js.map +1 -1
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts +2 -2
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.js +2 -2
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -1
- package/dist/noopHeuristic.d.ts +1 -1
- package/dist/noopHeuristic.d.ts.map +1 -1
- package/dist/noopHeuristic.js +6 -6
- package/dist/noopHeuristic.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/protocol.d.ts +1 -1
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +2 -2
- package/dist/protocol.js.map +1 -1
- package/dist/protocolTreeDocumentStorageService.d.ts +4 -4
- package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/dist/protocolTreeDocumentStorageService.js.map +1 -1
- package/dist/quorum.d.ts +1 -1
- package/dist/quorum.d.ts.map +1 -1
- package/dist/quorum.js.map +1 -1
- package/dist/retriableDocumentStorageService.d.ts +2 -2
- package/dist/retriableDocumentStorageService.d.ts.map +1 -1
- package/dist/retriableDocumentStorageService.js +7 -7
- package/dist/retriableDocumentStorageService.js.map +1 -1
- package/dist/serializedStateManager.d.ts +87 -16
- package/dist/serializedStateManager.d.ts.map +1 -1
- package/dist/serializedStateManager.js +164 -80
- package/dist/serializedStateManager.js.map +1 -1
- package/dist/utils.d.ts +6 -7
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +39 -23
- package/dist/utils.js.map +1 -1
- package/lib/attachment.d.ts +6 -9
- package/lib/attachment.d.ts.map +1 -1
- package/lib/attachment.js +1 -1
- package/lib/attachment.js.map +1 -1
- package/lib/audience.d.ts +1 -1
- package/lib/audience.d.ts.map +1 -1
- package/lib/audience.js +1 -1
- package/lib/audience.js.map +1 -1
- package/lib/catchUpMonitor.d.ts +1 -1
- package/lib/catchUpMonitor.d.ts.map +1 -1
- package/lib/catchUpMonitor.js +1 -1
- package/lib/catchUpMonitor.js.map +1 -1
- package/lib/connectionManager.d.ts +4 -4
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +5 -5
- package/lib/connectionManager.js.map +1 -1
- package/lib/connectionStateHandler.d.ts +3 -3
- package/lib/connectionStateHandler.d.ts.map +1 -1
- package/lib/connectionStateHandler.js +2 -2
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container-loader-alpha.d.ts +11 -11
- package/lib/container-loader-beta.d.ts +11 -11
- package/lib/container-loader-public.d.ts +11 -11
- package/lib/container-loader-untrimmed.d.ts +11 -11
- package/lib/container.d.ts +9 -46
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +28 -40
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts +19 -7
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js +7 -2
- 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 +2 -2
- package/lib/containerStorageAdapter.js.map +1 -1
- package/lib/contracts.d.ts +4 -3
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/debugLogger.d.ts +2 -1
- package/lib/debugLogger.d.ts.map +1 -1
- package/lib/debugLogger.js +1 -1
- package/lib/debugLogger.js.map +1 -1
- package/lib/deltaManager.d.ts +7 -6
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +5 -5
- package/lib/deltaManager.js.map +1 -1
- package/lib/deltaQueue.d.ts +1 -1
- package/lib/deltaQueue.d.ts.map +1 -1
- package/lib/deltaQueue.js +2 -2
- package/lib/deltaQueue.js.map +1 -1
- package/lib/error.d.ts +3 -2
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js +2 -2
- package/lib/error.js.map +1 -1
- package/lib/loader.d.ts +4 -4
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +4 -4
- package/lib/loader.js.map +1 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts +2 -2
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.js +2 -2
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -1
- package/lib/noopHeuristic.d.ts +1 -1
- package/lib/noopHeuristic.d.ts.map +1 -1
- package/lib/noopHeuristic.js +2 -2
- package/lib/noopHeuristic.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/protocol.d.ts +1 -1
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +1 -1
- package/lib/protocol.js.map +1 -1
- package/lib/protocolTreeDocumentStorageService.d.ts +4 -4
- package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/lib/protocolTreeDocumentStorageService.js.map +1 -1
- package/lib/quorum.d.ts +1 -1
- package/lib/quorum.d.ts.map +1 -1
- package/lib/quorum.js.map +1 -1
- package/lib/retriableDocumentStorageService.d.ts +2 -2
- package/lib/retriableDocumentStorageService.d.ts.map +1 -1
- package/lib/retriableDocumentStorageService.js +3 -3
- package/lib/retriableDocumentStorageService.js.map +1 -1
- package/lib/serializedStateManager.d.ts +87 -16
- package/lib/serializedStateManager.d.ts.map +1 -1
- package/lib/serializedStateManager.js +156 -75
- package/lib/serializedStateManager.js.map +1 -1
- package/lib/tsdoc-metadata.json +11 -0
- package/lib/utils.d.ts +6 -7
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +27 -12
- package/lib/utils.js.map +1 -1
- package/package.json +19 -28
- package/src/attachment.ts +9 -8
- package/src/audience.ts +2 -2
- package/src/catchUpMonitor.ts +2 -2
- package/src/connectionManager.ts +19 -19
- package/src/connectionStateHandler.ts +7 -7
- package/src/container.ts +78 -133
- package/src/containerContext.ts +22 -12
- package/src/containerStorageAdapter.ts +7 -6
- package/src/contracts.ts +4 -5
- package/src/debugLogger.ts +3 -4
- package/src/deltaManager.ts +31 -25
- package/src/deltaQueue.ts +2 -2
- package/src/error.ts +5 -4
- package/src/loader.ts +25 -23
- package/src/location-redirection-utilities/resolveWithLocationRedirection.ts +4 -4
- package/src/noopHeuristic.ts +3 -3
- package/src/packageVersion.ts +1 -1
- package/src/protocol.ts +2 -2
- package/src/protocolTreeDocumentStorageService.ts +4 -1
- package/src/quorum.ts +1 -1
- package/src/retriableDocumentStorageService.ts +6 -5
- package/src/serializedStateManager.ts +276 -110
- package/src/utils.ts +51 -20
- package/lib/test/attachment.spec.js +0 -380
- package/lib/test/attachment.spec.js.map +0 -1
- package/lib/test/catchUpMonitor.spec.js +0 -88
- package/lib/test/catchUpMonitor.spec.js.map +0 -1
- package/lib/test/connectionManager.spec.js +0 -201
- package/lib/test/connectionManager.spec.js.map +0 -1
- package/lib/test/connectionStateHandler.spec.js +0 -555
- package/lib/test/connectionStateHandler.spec.js.map +0 -1
- package/lib/test/container.spec.js +0 -64
- package/lib/test/container.spec.js.map +0 -1
- package/lib/test/deltaManager.spec.js +0 -405
- package/lib/test/deltaManager.spec.js.map +0 -1
- package/lib/test/loader.spec.js +0 -212
- package/lib/test/loader.spec.js.map +0 -1
- package/lib/test/locationRedirectionTests.spec.js +0 -44
- package/lib/test/locationRedirectionTests.spec.js.map +0 -1
- package/lib/test/serializedStateManager.spec.js +0 -148
- package/lib/test/serializedStateManager.spec.js.map +0 -1
- package/lib/test/snapshotConversionTest.spec.js +0 -79
- package/lib/test/snapshotConversionTest.spec.js.map +0 -1
- package/lib/test/types/validateContainerLoaderPrevious.generated.js +0 -38
- package/lib/test/types/validateContainerLoaderPrevious.generated.js.map +0 -1
- package/lib/test/utils.spec.js +0 -31
- package/lib/test/utils.spec.js.map +0 -1
package/src/container.ts
CHANGED
|
@@ -3,38 +3,40 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { v4 as uuid } from "uuid";
|
|
7
|
-
import { assert, unreachableCase, isPromiseLike } from "@fluidframework/core-utils";
|
|
8
6
|
import { TypedEventEmitter, performance } from "@fluid-internal/client-utils";
|
|
9
|
-
import {
|
|
10
|
-
IEvent,
|
|
11
|
-
ITelemetryBaseProperties,
|
|
12
|
-
FluidObject,
|
|
13
|
-
LogLevel,
|
|
14
|
-
IRequest,
|
|
15
|
-
} from "@fluidframework/core-interfaces";
|
|
16
7
|
import {
|
|
17
8
|
AttachState,
|
|
18
|
-
ContainerWarning,
|
|
19
9
|
IAudience,
|
|
10
|
+
ICriticalContainerError,
|
|
11
|
+
IDeltaManager,
|
|
12
|
+
ReadOnlyInfo,
|
|
13
|
+
} from "@fluidframework/container-definitions";
|
|
14
|
+
import {
|
|
15
|
+
ContainerWarning,
|
|
20
16
|
IBatchMessage,
|
|
21
17
|
ICodeDetailsLoader,
|
|
22
18
|
IContainer,
|
|
23
19
|
IContainerEvents,
|
|
24
20
|
IContainerLoadMode,
|
|
25
|
-
ICriticalContainerError,
|
|
26
|
-
IDeltaManager,
|
|
27
21
|
IFluidCodeDetails,
|
|
28
|
-
|
|
22
|
+
IFluidCodeDetailsComparer,
|
|
29
23
|
IFluidModuleWithDetails,
|
|
30
|
-
|
|
24
|
+
IGetPendingLocalStateProps,
|
|
25
|
+
IHostLoader,
|
|
31
26
|
IProvideFluidCodeDetailsComparer,
|
|
32
|
-
|
|
27
|
+
IProvideRuntimeFactory,
|
|
33
28
|
IRuntime,
|
|
34
|
-
ReadOnlyInfo,
|
|
35
29
|
isFluidCodeDetails,
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
} from "@fluidframework/container-definitions/internal";
|
|
31
|
+
import {
|
|
32
|
+
FluidObject,
|
|
33
|
+
IEvent,
|
|
34
|
+
IRequest,
|
|
35
|
+
ITelemetryBaseProperties,
|
|
36
|
+
LogLevel,
|
|
37
|
+
} from "@fluidframework/core-interfaces";
|
|
38
|
+
import { type ISignalEnvelope } from "@fluidframework/core-interfaces/internal";
|
|
39
|
+
import { assert, isPromiseLike, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
38
40
|
import {
|
|
39
41
|
IDocumentService,
|
|
40
42
|
IDocumentServiceFactory,
|
|
@@ -43,16 +45,16 @@ import {
|
|
|
43
45
|
ISnapshot,
|
|
44
46
|
IThrottlingWarning,
|
|
45
47
|
IUrlResolver,
|
|
46
|
-
} from "@fluidframework/driver-definitions";
|
|
48
|
+
} from "@fluidframework/driver-definitions/internal";
|
|
47
49
|
import {
|
|
48
|
-
|
|
50
|
+
MessageType2,
|
|
49
51
|
OnlineStatus,
|
|
50
|
-
isOnline,
|
|
51
52
|
isCombinedAppAndProtocolSummary,
|
|
52
|
-
MessageType2,
|
|
53
53
|
isInstanceOfISnapshot,
|
|
54
|
+
isOnline,
|
|
55
|
+
readAndParse,
|
|
54
56
|
runWithRetry,
|
|
55
|
-
} from "@fluidframework/driver-utils";
|
|
57
|
+
} from "@fluidframework/driver-utils/internal";
|
|
56
58
|
import { IQuorumSnapshot } from "@fluidframework/protocol-base";
|
|
57
59
|
import {
|
|
58
60
|
IClient,
|
|
@@ -73,59 +75,65 @@ import {
|
|
|
73
75
|
MessageType,
|
|
74
76
|
SummaryType,
|
|
75
77
|
} from "@fluidframework/protocol-definitions";
|
|
78
|
+
import { ITelemetryLoggerExt, type TelemetryEventCategory } from "@fluidframework/telemetry-utils";
|
|
76
79
|
import {
|
|
77
|
-
createChildLogger,
|
|
78
80
|
EventEmitterWithErrorHandling,
|
|
81
|
+
GenericError,
|
|
82
|
+
IFluidErrorBase,
|
|
83
|
+
MonitoringContext,
|
|
79
84
|
PerformanceEvent,
|
|
80
|
-
|
|
85
|
+
UsageError,
|
|
81
86
|
connectedEventName,
|
|
82
|
-
|
|
83
|
-
MonitoringContext,
|
|
87
|
+
createChildLogger,
|
|
84
88
|
createChildMonitoringContext,
|
|
85
|
-
wrapError,
|
|
86
|
-
ITelemetryLoggerExt,
|
|
87
89
|
formatTick,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
} from "@fluidframework/telemetry-utils";
|
|
90
|
+
normalizeError,
|
|
91
|
+
raiseConnectedEvent,
|
|
92
|
+
wrapError,
|
|
93
|
+
} from "@fluidframework/telemetry-utils/internal";
|
|
93
94
|
import structuredClone from "@ungap/structured-clone";
|
|
95
|
+
import { v4 as uuid } from "uuid";
|
|
96
|
+
|
|
97
|
+
import { AttachProcessProps, AttachmentData, runRetriableAttachProcess } from "./attachment.js";
|
|
94
98
|
import { Audience } from "./audience.js";
|
|
99
|
+
import { ConnectionManager } from "./connectionManager.js";
|
|
100
|
+
import { ConnectionState } from "./connectionState.js";
|
|
101
|
+
import { IConnectionStateHandler, createConnectionStateHandler } from "./connectionStateHandler.js";
|
|
95
102
|
import { ContainerContext } from "./containerContext.js";
|
|
103
|
+
import { ContainerStorageAdapter } from "./containerStorageAdapter.js";
|
|
96
104
|
import {
|
|
97
|
-
ReconnectMode,
|
|
98
|
-
IConnectionManagerFactoryArgs,
|
|
99
|
-
getPackageName,
|
|
100
105
|
IConnectionDetailsInternal,
|
|
106
|
+
IConnectionManagerFactoryArgs,
|
|
101
107
|
IConnectionStateChangeReason,
|
|
108
|
+
ReconnectMode,
|
|
109
|
+
getPackageName,
|
|
102
110
|
} from "./contracts.js";
|
|
103
111
|
import { DeltaManager, IConnectionArgs } from "./deltaManager.js";
|
|
104
112
|
import { IDetachedBlobStorage, ILoaderOptions, RelativeLoader } from "./loader.js";
|
|
113
|
+
import { NoopHeuristic } from "./noopHeuristic.js";
|
|
105
114
|
import { pkgVersion } from "./packageVersion.js";
|
|
106
|
-
import {
|
|
107
|
-
|
|
115
|
+
import {
|
|
116
|
+
IProtocolHandler,
|
|
117
|
+
ProtocolHandler,
|
|
118
|
+
ProtocolHandlerBuilder,
|
|
119
|
+
protocolHandlerShouldProcessSignal,
|
|
120
|
+
} from "./protocol.js";
|
|
121
|
+
import { initQuorumValuesFromCodeDetails } from "./quorum.js";
|
|
122
|
+
import {
|
|
123
|
+
type IPendingContainerState,
|
|
124
|
+
type IPendingDetachedContainerState,
|
|
125
|
+
SerializedStateManager,
|
|
126
|
+
} from "./serializedStateManager.js";
|
|
108
127
|
import {
|
|
109
128
|
ISnapshotTreeWithBlobContents,
|
|
110
129
|
combineAppAndProtocolSummary,
|
|
111
|
-
getProtocolSnapshotTree,
|
|
112
|
-
getSnapshotTreeAndBlobsFromSerializedContainer,
|
|
113
130
|
combineSnapshotTreeAndSnapshotBlobs,
|
|
114
131
|
getDetachedContainerStateFromSerializedContainer,
|
|
132
|
+
getDocumentAttributes,
|
|
133
|
+
getProtocolSnapshotTree,
|
|
134
|
+
getSnapshotTreeAndBlobsFromSerializedContainer,
|
|
115
135
|
runSingle,
|
|
116
136
|
} from "./utils.js";
|
|
117
|
-
import { initQuorumValuesFromCodeDetails } from "./quorum.js";
|
|
118
|
-
import { NoopHeuristic } from "./noopHeuristic.js";
|
|
119
|
-
import { ConnectionManager } from "./connectionManager.js";
|
|
120
|
-
import { ConnectionState } from "./connectionState.js";
|
|
121
|
-
import {
|
|
122
|
-
IProtocolHandler,
|
|
123
|
-
ProtocolHandler,
|
|
124
|
-
ProtocolHandlerBuilder,
|
|
125
|
-
protocolHandlerShouldProcessSignal,
|
|
126
|
-
} from "./protocol.js";
|
|
127
|
-
import { AttachProcessProps, AttachmentData, runRetriableAttachProcess } from "./attachment.js";
|
|
128
|
-
import { SerializedStateManager } from "./serializedStateManager.js";
|
|
129
137
|
|
|
130
138
|
const detachedContainerRefSeqNumber = 0;
|
|
131
139
|
|
|
@@ -335,46 +343,6 @@ export async function ReportIfTooLong(
|
|
|
335
343
|
}
|
|
336
344
|
}
|
|
337
345
|
|
|
338
|
-
/**
|
|
339
|
-
* State saved by a container at close time, to be used to load a new instance
|
|
340
|
-
* of the container to the same state
|
|
341
|
-
* @internal
|
|
342
|
-
*/
|
|
343
|
-
export interface IPendingContainerState {
|
|
344
|
-
attached: true;
|
|
345
|
-
pendingRuntimeState: unknown;
|
|
346
|
-
/**
|
|
347
|
-
* Snapshot from which container initially loaded.
|
|
348
|
-
*/
|
|
349
|
-
baseSnapshot: ISnapshotTree;
|
|
350
|
-
/**
|
|
351
|
-
* Serializable blobs from the base snapshot. Used to load offline since
|
|
352
|
-
* storage is not available.
|
|
353
|
-
*/
|
|
354
|
-
snapshotBlobs: ISerializableBlobContents;
|
|
355
|
-
/**
|
|
356
|
-
* All ops since base snapshot sequence number up to the latest op
|
|
357
|
-
* seen when the container was closed. Used to apply stashed (saved pending)
|
|
358
|
-
* ops at the same sequence number at which they were made.
|
|
359
|
-
*/
|
|
360
|
-
savedOps: ISequencedDocumentMessage[];
|
|
361
|
-
url: string;
|
|
362
|
-
clientId?: string;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
/**
|
|
366
|
-
* State saved by a container in detached state, to be used to load a new instance
|
|
367
|
-
* of the container to the same state (rehydrate)
|
|
368
|
-
* @internal
|
|
369
|
-
*/
|
|
370
|
-
export interface IPendingDetachedContainerState {
|
|
371
|
-
attached: false;
|
|
372
|
-
baseSnapshot: ISnapshotTree;
|
|
373
|
-
snapshotBlobs: ISerializableBlobContents;
|
|
374
|
-
hasAttachmentBlobs: boolean;
|
|
375
|
-
pendingRuntimeState?: unknown;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
346
|
const summarizerClientType = "summarizer";
|
|
379
347
|
|
|
380
348
|
interface IContainerLifecycleEvents extends IEvent {
|
|
@@ -1188,17 +1156,16 @@ export class Container
|
|
|
1188
1156
|
this.captureProtocolSummary(),
|
|
1189
1157
|
);
|
|
1190
1158
|
|
|
1191
|
-
const {
|
|
1159
|
+
const { baseSnapshot, snapshotBlobs } =
|
|
1192
1160
|
getSnapshotTreeAndBlobsFromSerializedContainer(combinedSummary);
|
|
1193
|
-
|
|
1194
1161
|
const pendingRuntimeState =
|
|
1195
1162
|
attachingData !== undefined ? this.runtime.getPendingLocalState() : undefined;
|
|
1196
1163
|
assert(!isPromiseLike(pendingRuntimeState), 0x8e3 /* should not be a promise */);
|
|
1197
1164
|
|
|
1198
1165
|
const detachedContainerState: IPendingDetachedContainerState = {
|
|
1199
1166
|
attached: false,
|
|
1200
|
-
baseSnapshot
|
|
1201
|
-
snapshotBlobs
|
|
1167
|
+
baseSnapshot,
|
|
1168
|
+
snapshotBlobs,
|
|
1202
1169
|
pendingRuntimeState,
|
|
1203
1170
|
hasAttachmentBlobs: !!this.detachedBlobStorage && this.detachedBlobStorage.size > 0,
|
|
1204
1171
|
};
|
|
@@ -1578,15 +1545,19 @@ export class Container
|
|
|
1578
1545
|
};
|
|
1579
1546
|
|
|
1580
1547
|
timings.phase2 = performance.now();
|
|
1548
|
+
|
|
1549
|
+
const supportGetSnapshotApi: boolean =
|
|
1550
|
+
this.mc.config.getBoolean("Fluid.Container.UseLoadingGroupIdForSnapshotFetch") ===
|
|
1551
|
+
true && this.service?.policies?.supportGetSnapshotApi === true;
|
|
1581
1552
|
// Fetch specified snapshot.
|
|
1582
|
-
const {
|
|
1553
|
+
const { baseSnapshot, version } = await this.serializedStateManager.fetchSnapshot(
|
|
1583
1554
|
specifiedVersion,
|
|
1584
|
-
|
|
1555
|
+
supportGetSnapshotApi,
|
|
1585
1556
|
);
|
|
1586
1557
|
this._loadedFromVersion = version;
|
|
1587
|
-
const attributes: IDocumentAttributes = await
|
|
1558
|
+
const attributes: IDocumentAttributes = await getDocumentAttributes(
|
|
1588
1559
|
this.storageAdapter,
|
|
1589
|
-
|
|
1560
|
+
baseSnapshot,
|
|
1590
1561
|
);
|
|
1591
1562
|
|
|
1592
1563
|
// If we saved ops, we will replay them and don't need DeltaManager to fetch them
|
|
@@ -1676,17 +1647,17 @@ export class Container
|
|
|
1676
1647
|
await this.initializeProtocolStateFromSnapshot(
|
|
1677
1648
|
attributes,
|
|
1678
1649
|
this.storageAdapter,
|
|
1679
|
-
|
|
1650
|
+
baseSnapshot,
|
|
1680
1651
|
);
|
|
1681
1652
|
|
|
1682
1653
|
timings.phase3 = performance.now();
|
|
1683
1654
|
const codeDetails = this.getCodeDetailsFromQuorum();
|
|
1684
1655
|
await this.instantiateRuntime(
|
|
1685
1656
|
codeDetails,
|
|
1686
|
-
|
|
1657
|
+
baseSnapshot,
|
|
1687
1658
|
// give runtime a dummy value so it knows we're loading from a stash blob
|
|
1688
1659
|
pendingLocalState ? pendingLocalState?.pendingRuntimeState ?? {} : undefined,
|
|
1689
|
-
isInstanceOfISnapshot(
|
|
1660
|
+
isInstanceOfISnapshot(baseSnapshot) ? baseSnapshot : undefined,
|
|
1690
1661
|
);
|
|
1691
1662
|
|
|
1692
1663
|
// replay saved ops
|
|
@@ -1814,7 +1785,7 @@ export class Container
|
|
|
1814
1785
|
const snapshotTreeWithBlobContents: ISnapshotTreeWithBlobContents =
|
|
1815
1786
|
combineSnapshotTreeAndSnapshotBlobs(baseSnapshot, snapshotBlobs);
|
|
1816
1787
|
this.storageAdapter.loadSnapshotFromSnapshotBlobs(snapshotBlobs);
|
|
1817
|
-
const attributes = await
|
|
1788
|
+
const attributes = await getDocumentAttributes(
|
|
1818
1789
|
this.storageAdapter,
|
|
1819
1790
|
snapshotTreeWithBlobContents,
|
|
1820
1791
|
);
|
|
@@ -1846,28 +1817,6 @@ export class Container
|
|
|
1846
1817
|
this.setLoaded();
|
|
1847
1818
|
}
|
|
1848
1819
|
|
|
1849
|
-
private async getDocumentAttributes(
|
|
1850
|
-
storage: IDocumentStorageService,
|
|
1851
|
-
tree: ISnapshotTree | undefined,
|
|
1852
|
-
): Promise<IDocumentAttributes> {
|
|
1853
|
-
if (tree === undefined) {
|
|
1854
|
-
return {
|
|
1855
|
-
minimumSequenceNumber: 0,
|
|
1856
|
-
sequenceNumber: 0,
|
|
1857
|
-
};
|
|
1858
|
-
}
|
|
1859
|
-
|
|
1860
|
-
// Backward compatibility: old docs would have ".attributes" instead of "attributes"
|
|
1861
|
-
const attributesHash =
|
|
1862
|
-
".protocol" in tree.trees
|
|
1863
|
-
? tree.trees[".protocol"].blobs.attributes
|
|
1864
|
-
: tree.blobs[".attributes"];
|
|
1865
|
-
|
|
1866
|
-
const attributes = await readAndParse<IDocumentAttributes>(storage, attributesHash);
|
|
1867
|
-
|
|
1868
|
-
return attributes;
|
|
1869
|
-
}
|
|
1870
|
-
|
|
1871
1820
|
private async initializeProtocolStateFromSnapshot(
|
|
1872
1821
|
attributes: IDocumentAttributes,
|
|
1873
1822
|
storage: IDocumentStorageService,
|
|
@@ -2341,7 +2290,8 @@ export class Container
|
|
|
2341
2290
|
this.emit("op", message);
|
|
2342
2291
|
}
|
|
2343
2292
|
|
|
2344
|
-
|
|
2293
|
+
// unknown should be removed once `@alpha` tag is removed from IContainerContext
|
|
2294
|
+
private submitSignal(content: unknown | ISignalEnvelope, targetClientId?: string) {
|
|
2345
2295
|
this._deltaManager.submitSignal(JSON.stringify(content), targetClientId);
|
|
2346
2296
|
}
|
|
2347
2297
|
|
|
@@ -2389,10 +2339,6 @@ export class Container
|
|
|
2389
2339
|
throw new Error(packageNotFactoryError);
|
|
2390
2340
|
}
|
|
2391
2341
|
|
|
2392
|
-
const getSpecifiedCodeDetails = () =>
|
|
2393
|
-
(this.protocolHandler.quorum.get("code") ??
|
|
2394
|
-
this.protocolHandler.quorum.get("code2")) as IFluidCodeDetails | undefined;
|
|
2395
|
-
|
|
2396
2342
|
const existing = snapshotTree !== undefined;
|
|
2397
2343
|
|
|
2398
2344
|
const context = new ContainerContext(
|
|
@@ -2420,7 +2366,6 @@ export class Container
|
|
|
2420
2366
|
() => this.clientId,
|
|
2421
2367
|
() => this.attachState,
|
|
2422
2368
|
() => this.connected,
|
|
2423
|
-
getSpecifiedCodeDetails,
|
|
2424
2369
|
this._deltaManager.clientDetails,
|
|
2425
2370
|
existing,
|
|
2426
2371
|
this.subLogger,
|
package/src/containerContext.ts
CHANGED
|
@@ -3,30 +3,32 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
7
6
|
import {
|
|
7
|
+
AttachState,
|
|
8
8
|
IAudience,
|
|
9
|
-
|
|
9
|
+
ICriticalContainerError,
|
|
10
10
|
IDeltaManager,
|
|
11
|
+
} from "@fluidframework/container-definitions";
|
|
12
|
+
import {
|
|
13
|
+
IBatchMessage,
|
|
14
|
+
IContainerContext,
|
|
11
15
|
ILoader,
|
|
12
|
-
ICriticalContainerError,
|
|
13
|
-
AttachState,
|
|
14
16
|
ILoaderOptions,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} from "@fluidframework/
|
|
18
|
-
import {
|
|
19
|
-
import { IDocumentStorageService, ISnapshot } from "@fluidframework/driver-definitions";
|
|
17
|
+
} from "@fluidframework/container-definitions/internal";
|
|
18
|
+
import { type FluidObject } from "@fluidframework/core-interfaces";
|
|
19
|
+
import { type ISignalEnvelope } from "@fluidframework/core-interfaces/internal";
|
|
20
|
+
import { IDocumentStorageService, ISnapshot } from "@fluidframework/driver-definitions/internal";
|
|
20
21
|
import {
|
|
21
22
|
IClientDetails,
|
|
22
23
|
IDocumentMessage,
|
|
23
24
|
IQuorumClients,
|
|
24
25
|
ISequencedDocumentMessage,
|
|
25
26
|
ISnapshotTree,
|
|
27
|
+
ISummaryContent,
|
|
26
28
|
IVersion,
|
|
27
29
|
MessageType,
|
|
28
|
-
ISummaryContent,
|
|
29
30
|
} from "@fluidframework/protocol-definitions";
|
|
31
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
34
|
* {@inheritDoc @fluidframework/container-definitions#IContainerContext}
|
|
@@ -85,7 +87,16 @@ export class ContainerContext implements IContainerContext {
|
|
|
85
87
|
batch: IBatchMessage[],
|
|
86
88
|
referenceSequenceNumber?: number,
|
|
87
89
|
) => number,
|
|
88
|
-
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* `unknown` should be removed once `@alpha` tag is removed from IContainerContext
|
|
93
|
+
* @see {@link https://dev.azure.com/fluidframework/internal/_workitems/edit/7462}
|
|
94
|
+
* Any changes to submitSignalFn `content` should be checked internally by temporarily changing IContainerContext and removing all `unknown`s
|
|
95
|
+
*/
|
|
96
|
+
public readonly submitSignalFn: (
|
|
97
|
+
content: unknown | ISignalEnvelope,
|
|
98
|
+
targetClientId?: string,
|
|
99
|
+
) => void,
|
|
89
100
|
public readonly disposeFn: (error?: ICriticalContainerError) => void,
|
|
90
101
|
public readonly closeFn: (error?: ICriticalContainerError) => void,
|
|
91
102
|
public readonly updateDirtyContainerState: (dirty: boolean) => void,
|
|
@@ -94,7 +105,6 @@ export class ContainerContext implements IContainerContext {
|
|
|
94
105
|
private readonly _getClientId: () => string | undefined,
|
|
95
106
|
private readonly _getAttachState: () => AttachState,
|
|
96
107
|
private readonly _getConnected: () => boolean,
|
|
97
|
-
public readonly getSpecifiedCodeDetails: () => IFluidCodeDetails | undefined,
|
|
98
108
|
public readonly clientDetails: IClientDetails,
|
|
99
109
|
public readonly existing: boolean,
|
|
100
110
|
public readonly taggedLogger: ITelemetryLoggerExt,
|
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { IDisposable } from "@fluidframework/core-interfaces";
|
|
7
|
-
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
8
6
|
import { bufferToString, stringToBuffer } from "@fluid-internal/client-utils";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { ISnapshotTreeWithBlobContents } from "@fluidframework/container-definitions/internal";
|
|
8
|
+
import { IDisposable } from "@fluidframework/core-interfaces";
|
|
9
|
+
import { assert } from "@fluidframework/core-utils/internal";
|
|
11
10
|
import {
|
|
12
11
|
FetchSource,
|
|
13
12
|
IDocumentService,
|
|
@@ -16,8 +15,8 @@ import {
|
|
|
16
15
|
ISnapshot,
|
|
17
16
|
ISnapshotFetchOptions,
|
|
18
17
|
ISummaryContext,
|
|
19
|
-
} from "@fluidframework/driver-definitions";
|
|
20
|
-
import { UsageError } from "@fluidframework/driver-utils";
|
|
18
|
+
} from "@fluidframework/driver-definitions/internal";
|
|
19
|
+
import { UsageError } from "@fluidframework/driver-utils/internal";
|
|
21
20
|
import {
|
|
22
21
|
ICreateBlobResponse,
|
|
23
22
|
ISnapshotTree,
|
|
@@ -25,6 +24,8 @@ import {
|
|
|
25
24
|
ISummaryTree,
|
|
26
25
|
IVersion,
|
|
27
26
|
} from "@fluidframework/protocol-definitions";
|
|
27
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
28
|
+
|
|
28
29
|
import { IDetachedBlobStorage } from "./loader.js";
|
|
29
30
|
import { ProtocolTreeStorageService } from "./protocolTreeDocumentStorageService.js";
|
|
30
31
|
import { RetriableDocumentStorageService } from "./retriableDocumentStorageService.js";
|
package/src/contracts.ts
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { IErrorBase, ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
7
6
|
import {
|
|
8
7
|
IConnectionDetails,
|
|
9
8
|
ICriticalContainerError,
|
|
10
9
|
IDeltaQueue,
|
|
11
|
-
IFluidCodeDetails,
|
|
12
|
-
isFluidPackage,
|
|
13
10
|
ReadOnlyInfo,
|
|
14
11
|
} from "@fluidframework/container-definitions";
|
|
12
|
+
import { IFluidCodeDetails, isFluidPackage } from "@fluidframework/container-definitions/internal";
|
|
13
|
+
import { IErrorBase, ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
14
|
+
import { IContainerPackageInfo } from "@fluidframework/driver-definitions/internal";
|
|
15
15
|
import {
|
|
16
16
|
ConnectionMode,
|
|
17
17
|
IClientConfiguration,
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
ISignalClient,
|
|
22
22
|
ISignalMessage,
|
|
23
23
|
} from "@fluidframework/protocol-definitions";
|
|
24
|
-
import { IContainerPackageInfo } from "@fluidframework/driver-definitions";
|
|
25
24
|
|
|
26
25
|
export enum ReconnectMode {
|
|
27
26
|
Never = "Never",
|
|
@@ -100,7 +99,7 @@ export interface IConnectionManager {
|
|
|
100
99
|
* Submits signal to relay service.
|
|
101
100
|
* Called only when active connection is present.
|
|
102
101
|
*/
|
|
103
|
-
submitSignal(content:
|
|
102
|
+
submitSignal: (content: string, targetClientId?: string) => void;
|
|
104
103
|
|
|
105
104
|
/**
|
|
106
105
|
* Submits messages to relay service.
|
package/src/debugLogger.ts
CHANGED
|
@@ -3,20 +3,19 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { performance } from "@fluid-internal/client-utils";
|
|
6
7
|
import {
|
|
7
8
|
ITelemetryBaseEvent,
|
|
8
9
|
ITelemetryBaseLogger,
|
|
9
10
|
ITelemetryBaseProperties,
|
|
10
11
|
} from "@fluidframework/core-interfaces";
|
|
11
|
-
import {
|
|
12
|
-
|
|
12
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
13
13
|
import {
|
|
14
|
-
ITelemetryLoggerExt,
|
|
15
14
|
ITelemetryLoggerPropertyBags,
|
|
16
15
|
createMultiSinkLogger,
|
|
17
16
|
eventNamespaceSeparator,
|
|
18
17
|
formatTick,
|
|
19
|
-
} from "@fluidframework/telemetry-utils";
|
|
18
|
+
} from "@fluidframework/telemetry-utils/internal";
|
|
20
19
|
|
|
21
20
|
// This import style is necessary to ensure the emitted JS code works in both CJS and ESM.
|
|
22
21
|
import debugPkg from "debug";
|
package/src/deltaManager.ts
CHANGED
|
@@ -3,46 +3,52 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
IThrottlingWarning,
|
|
9
|
-
IEventProvider,
|
|
10
|
-
ITelemetryBaseProperties,
|
|
11
|
-
type ITelemetryBaseEvent,
|
|
12
|
-
} from "@fluidframework/core-interfaces";
|
|
6
|
+
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
13
7
|
import {
|
|
14
8
|
ICriticalContainerError,
|
|
15
9
|
IDeltaManager,
|
|
16
10
|
IDeltaManagerEvents,
|
|
17
11
|
IDeltaQueue,
|
|
18
12
|
} from "@fluidframework/container-definitions";
|
|
19
|
-
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
20
|
-
import { assert } from "@fluidframework/core-utils";
|
|
21
13
|
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
UsageError,
|
|
30
|
-
type ITelemetryGenericEventExt,
|
|
31
|
-
type ITelemetryErrorEventExt,
|
|
32
|
-
} from "@fluidframework/telemetry-utils";
|
|
14
|
+
IEventProvider,
|
|
15
|
+
type ITelemetryBaseEvent,
|
|
16
|
+
ITelemetryBaseProperties,
|
|
17
|
+
} from "@fluidframework/core-interfaces";
|
|
18
|
+
import { IThrottlingWarning } from "@fluidframework/core-interfaces/internal";
|
|
19
|
+
import { assert } from "@fluidframework/core-utils/internal";
|
|
20
|
+
import { DriverErrorTypes } from "@fluidframework/driver-definitions";
|
|
33
21
|
import {
|
|
34
22
|
IDocumentDeltaStorageService,
|
|
35
23
|
IDocumentService,
|
|
36
|
-
|
|
37
|
-
} from "@fluidframework/driver-definitions";
|
|
24
|
+
} from "@fluidframework/driver-definitions/internal";
|
|
38
25
|
import {
|
|
26
|
+
MessageType2,
|
|
27
|
+
NonRetryableError,
|
|
28
|
+
isRuntimeMessage,
|
|
29
|
+
} from "@fluidframework/driver-utils/internal";
|
|
30
|
+
import {
|
|
31
|
+
ConnectionMode,
|
|
39
32
|
IDocumentMessage,
|
|
40
33
|
ISequencedDocumentMessage,
|
|
41
34
|
ISignalMessage,
|
|
42
35
|
MessageType,
|
|
43
|
-
ConnectionMode,
|
|
44
36
|
} from "@fluidframework/protocol-definitions";
|
|
45
|
-
import {
|
|
37
|
+
import {
|
|
38
|
+
type ITelemetryErrorEventExt,
|
|
39
|
+
type ITelemetryGenericEventExt,
|
|
40
|
+
ITelemetryLoggerExt,
|
|
41
|
+
} from "@fluidframework/telemetry-utils";
|
|
42
|
+
import {
|
|
43
|
+
DataCorruptionError,
|
|
44
|
+
DataProcessingError,
|
|
45
|
+
UsageError,
|
|
46
|
+
extractSafePropertiesFromMessage,
|
|
47
|
+
isFluidError,
|
|
48
|
+
normalizeError,
|
|
49
|
+
safeRaiseEvent,
|
|
50
|
+
} from "@fluidframework/telemetry-utils/internal";
|
|
51
|
+
import { v4 as uuid } from "uuid";
|
|
46
52
|
|
|
47
53
|
import {
|
|
48
54
|
IConnectionDetailsInternal,
|
|
@@ -325,7 +331,7 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
|
|
|
325
331
|
return message.clientSequenceNumber;
|
|
326
332
|
}
|
|
327
333
|
|
|
328
|
-
public submitSignal(content:
|
|
334
|
+
public submitSignal(content: string, targetClientId?: string) {
|
|
329
335
|
return this.connectionManager.submitSignal(content, targetClientId);
|
|
330
336
|
}
|
|
331
337
|
|
package/src/deltaQueue.ts
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { TypedEventEmitter, performance } from "@fluid-internal/client-utils";
|
|
6
7
|
import { IDeltaQueue, IDeltaQueueEvents } from "@fluidframework/container-definitions";
|
|
7
|
-
import { assert } from "@fluidframework/core-utils";
|
|
8
|
-
import { performance, TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
8
|
+
import { assert } from "@fluidframework/core-utils/internal";
|
|
9
9
|
import Deque from "double-ended-queue";
|
|
10
10
|
|
|
11
11
|
export interface IDeltaQueueWriter<T> {
|
package/src/error.ts
CHANGED
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { ContainerErrorTypes } from "@fluidframework/container-definitions/internal";
|
|
7
|
+
import { ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
8
|
+
import { IThrottlingWarning } from "@fluidframework/core-interfaces/internal";
|
|
9
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
8
10
|
import {
|
|
9
11
|
IFluidErrorBase,
|
|
10
|
-
ITelemetryLoggerExt,
|
|
11
12
|
LoggingError,
|
|
12
13
|
wrapErrorAndLog,
|
|
13
|
-
} from "@fluidframework/telemetry-utils";
|
|
14
|
+
} from "@fluidframework/telemetry-utils/internal";
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Warning emitted when requests to storage are being throttled.
|