@fluidframework/container-loader 2.0.0-rc.2.0.2 → 2.0.0-rc.3.0.0
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 +33 -0
- package/api-report/container-loader.api.md +13 -13
- package/dist/attachment.d.ts +6 -9
- package/dist/attachment.d.ts.map +1 -1
- package/dist/attachment.js +5 -5
- 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 +4 -4
- 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 +48 -43
- 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.d.ts +9 -46
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +105 -116
- 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 +11 -7
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +53 -50
- 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/legacy.d.ts +29 -0
- 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/public.d.ts +14 -0
- package/dist/quorum.d.ts +1 -1
- package/dist/quorum.d.ts.map +1 -1
- package/dist/quorum.js +4 -0
- 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 +86 -16
- package/dist/serializedStateManager.d.ts.map +1 -1
- package/dist/serializedStateManager.js +182 -82
- package/dist/serializedStateManager.js.map +1 -1
- package/dist/utils.d.ts +24 -9
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +82 -25
- package/dist/utils.js.map +1 -1
- package/internal.d.ts +11 -0
- package/legacy.d.ts +11 -0
- 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 +11 -6
- 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.d.ts +9 -46
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +37 -48
- 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 +11 -7
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +13 -10
- 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/legacy.d.ts +29 -0
- 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/public.d.ts +14 -0
- package/lib/quorum.d.ts +1 -1
- package/lib/quorum.d.ts.map +1 -1
- package/lib/quorum.js +4 -0
- 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 +86 -16
- package/lib/serializedStateManager.d.ts.map +1 -1
- package/lib/serializedStateManager.js +174 -77
- package/lib/serializedStateManager.js.map +1 -1
- package/lib/utils.d.ts +24 -9
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +69 -15
- package/lib/utils.js.map +1 -1
- package/package.json +37 -58
- package/src/attachment.ts +10 -8
- package/src/audience.ts +3 -2
- package/src/catchUpMonitor.ts +2 -2
- package/src/connectionManager.ts +27 -20
- package/src/connectionStateHandler.ts +7 -7
- package/src/container.ts +90 -143
- 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 +40 -30
- 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 +2 -1
- package/src/retriableDocumentStorageService.ts +6 -5
- package/src/serializedStateManager.ts +299 -111
- package/src/utils.ts +103 -24
- package/api-extractor-cjs.json +0 -8
- package/dist/container-loader-alpha.d.ts +0 -275
- package/dist/container-loader-beta.d.ts +0 -101
- package/dist/container-loader-public.d.ts +0 -101
- package/dist/container-loader-untrimmed.d.ts +0 -331
- package/lib/container-loader-alpha.d.ts +0 -275
- package/lib/container-loader-beta.d.ts +0 -101
- package/lib/container-loader-public.d.ts +0 -101
- package/lib/container-loader-untrimmed.d.ts +0 -331
- 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/{dist → lib}/tsdoc-metadata.json +0 -0
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
|
};
|
|
@@ -1314,8 +1281,8 @@ export class Container
|
|
|
1314
1281
|
throw normalizeErrorAndClose(error);
|
|
1315
1282
|
});
|
|
1316
1283
|
}
|
|
1317
|
-
|
|
1318
|
-
this.serializedStateManager.
|
|
1284
|
+
const snapshotWithBlobs = await attachP;
|
|
1285
|
+
this.serializedStateManager.setInitialSnapshot(snapshotWithBlobs);
|
|
1319
1286
|
if (!this.closed) {
|
|
1320
1287
|
this.handleDeltaConnectionArg(
|
|
1321
1288
|
{
|
|
@@ -1578,23 +1545,25 @@ 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
|
|
1593
|
-
const
|
|
1594
|
-
pendingLocalState?.savedOps[pendingLocalState.savedOps.length - 1]?.sequenceNumber
|
|
1595
|
-
|
|
1596
|
-
sequenceNumber !== undefined ? { ...attributes, sequenceNumber } : attributes;
|
|
1597
|
-
|
|
1564
|
+
const lastProcessedSequenceNumber =
|
|
1565
|
+
pendingLocalState?.savedOps[pendingLocalState.savedOps.length - 1]?.sequenceNumber ??
|
|
1566
|
+
attributes.sequenceNumber;
|
|
1598
1567
|
let opsBeforeReturnP: Promise<void> | undefined;
|
|
1599
1568
|
|
|
1600
1569
|
if (loadMode.pauseAfterLoad === true) {
|
|
@@ -1607,7 +1576,7 @@ export class Container
|
|
|
1607
1576
|
// Note: It is possible that we think the latest snapshot is newer than the specified sequence number
|
|
1608
1577
|
// due to saved ops that may be replayed after the snapshot.
|
|
1609
1578
|
// https://dev.azure.com/fluidframework/internal/_workitems/edit/5055
|
|
1610
|
-
if (
|
|
1579
|
+
if (lastProcessedSequenceNumber > loadToSequenceNumber) {
|
|
1611
1580
|
throw new Error(
|
|
1612
1581
|
"Cannot satisfy request to pause the container at the specified sequence number. Most recent snapshot is newer than the specified sequence number.",
|
|
1613
1582
|
);
|
|
@@ -1655,16 +1624,18 @@ export class Container
|
|
|
1655
1624
|
// Start prefetch, but not set opsBeforeReturnP - boot is not blocked by it!
|
|
1656
1625
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
1657
1626
|
this.attachDeltaManagerOpHandler(
|
|
1658
|
-
|
|
1627
|
+
attributes,
|
|
1659
1628
|
loadMode.deltaConnection !== "none" ? "all" : "none",
|
|
1629
|
+
lastProcessedSequenceNumber,
|
|
1660
1630
|
);
|
|
1661
1631
|
break;
|
|
1662
1632
|
case "sequenceNumber":
|
|
1663
1633
|
case "cached":
|
|
1664
1634
|
case "all":
|
|
1665
1635
|
opsBeforeReturnP = this.attachDeltaManagerOpHandler(
|
|
1666
|
-
|
|
1636
|
+
attributes,
|
|
1667
1637
|
loadMode.opsBeforeReturn,
|
|
1638
|
+
lastProcessedSequenceNumber,
|
|
1668
1639
|
);
|
|
1669
1640
|
break;
|
|
1670
1641
|
default:
|
|
@@ -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,
|
|
@@ -2107,6 +2056,7 @@ export class Container
|
|
|
2107
2056
|
private async attachDeltaManagerOpHandler(
|
|
2108
2057
|
attributes: IDocumentAttributes,
|
|
2109
2058
|
prefetchType?: "sequenceNumber" | "cached" | "all" | "none",
|
|
2059
|
+
lastProcessedSequenceNumber?: number,
|
|
2110
2060
|
) {
|
|
2111
2061
|
return this._deltaManager.attachOpHandler(
|
|
2112
2062
|
attributes.minimumSequenceNumber,
|
|
@@ -2118,6 +2068,7 @@ export class Container
|
|
|
2118
2068
|
},
|
|
2119
2069
|
},
|
|
2120
2070
|
prefetchType,
|
|
2071
|
+
lastProcessedSequenceNumber,
|
|
2121
2072
|
);
|
|
2122
2073
|
}
|
|
2123
2074
|
|
|
@@ -2341,7 +2292,8 @@ export class Container
|
|
|
2341
2292
|
this.emit("op", message);
|
|
2342
2293
|
}
|
|
2343
2294
|
|
|
2344
|
-
|
|
2295
|
+
// unknown should be removed once `@alpha` tag is removed from IContainerContext
|
|
2296
|
+
private submitSignal(content: unknown | ISignalEnvelope, targetClientId?: string) {
|
|
2345
2297
|
this._deltaManager.submitSignal(JSON.stringify(content), targetClientId);
|
|
2346
2298
|
}
|
|
2347
2299
|
|
|
@@ -2389,10 +2341,6 @@ export class Container
|
|
|
2389
2341
|
throw new Error(packageNotFactoryError);
|
|
2390
2342
|
}
|
|
2391
2343
|
|
|
2392
|
-
const getSpecifiedCodeDetails = () =>
|
|
2393
|
-
(this.protocolHandler.quorum.get("code") ??
|
|
2394
|
-
this.protocolHandler.quorum.get("code2")) as IFluidCodeDetails | undefined;
|
|
2395
|
-
|
|
2396
2344
|
const existing = snapshotTree !== undefined;
|
|
2397
2345
|
|
|
2398
2346
|
const context = new ContainerContext(
|
|
@@ -2420,7 +2368,6 @@ export class Container
|
|
|
2420
2368
|
() => this.clientId,
|
|
2421
2369
|
() => this.attachState,
|
|
2422
2370
|
() => this.connected,
|
|
2423
|
-
getSpecifiedCodeDetails,
|
|
2424
2371
|
this._deltaManager.clientDetails,
|
|
2425
2372
|
existing,
|
|
2426
2373
|
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";
|