@fluidframework/container-loader 2.13.0 → 2.21.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 +8 -0
- package/dist/connectionManager.js +7 -7
- package/dist/connectionManager.js.map +1 -1
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +18 -14
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +6 -1
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js +7 -0
- package/dist/containerContext.js.map +1 -1
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/debugLogger.js +1 -1
- package/dist/debugLogger.js.map +1 -1
- package/dist/deltaQueue.d.ts.map +1 -1
- package/dist/deltaQueue.js +2 -2
- package/dist/deltaQueue.js.map +1 -1
- package/dist/layerCompatState.d.ts +19 -0
- package/dist/layerCompatState.d.ts.map +1 -0
- package/dist/layerCompatState.js +64 -0
- package/dist/layerCompatState.js.map +1 -0
- package/dist/package.json +2 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/protocol/quorum.d.ts +0 -10
- package/dist/protocol/quorum.d.ts.map +1 -1
- package/dist/protocol/quorum.js +0 -14
- package/dist/protocol/quorum.js.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +3 -1
- package/dist/utils.js.map +1 -1
- package/lib/connectionManager.js +8 -8
- package/lib/connectionManager.js.map +1 -1
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +19 -15
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts +6 -1
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js +7 -0
- package/lib/containerContext.js.map +1 -1
- package/lib/containerStorageAdapter.js.map +1 -1
- package/lib/debugLogger.js +2 -2
- package/lib/debugLogger.js.map +1 -1
- package/lib/deltaQueue.d.ts.map +1 -1
- package/lib/deltaQueue.js +3 -3
- package/lib/deltaQueue.js.map +1 -1
- package/lib/layerCompatState.d.ts +19 -0
- package/lib/layerCompatState.d.ts.map +1 -0
- package/lib/layerCompatState.js +60 -0
- package/lib/layerCompatState.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/quorum.d.ts +0 -10
- package/lib/protocol/quorum.d.ts.map +1 -1
- package/lib/protocol/quorum.js +0 -14
- package/lib/protocol/quorum.js.map +1 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +3 -1
- package/lib/utils.js.map +1 -1
- package/package.json +14 -14
- package/src/connectionManager.ts +8 -8
- package/src/container.ts +28 -15
- package/src/containerContext.ts +14 -1
- package/src/containerStorageAdapter.ts +3 -3
- package/src/debugLogger.ts +2 -2
- package/src/deltaQueue.ts +3 -3
- package/src/layerCompatState.ts +75 -0
- package/src/packageVersion.ts +1 -1
- package/src/protocol/quorum.ts +0 -16
- package/src/utils.ts +4 -1
package/src/debugLogger.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { performanceNow } from "@fluid-internal/client-utils";
|
|
7
7
|
import {
|
|
8
8
|
ITelemetryBaseEvent,
|
|
9
9
|
ITelemetryBaseLogger,
|
|
@@ -88,7 +88,7 @@ export class DebugLogger implements ITelemetryBaseLogger {
|
|
|
88
88
|
newEvent.eventName = undefined;
|
|
89
89
|
|
|
90
90
|
let tick = "";
|
|
91
|
-
tick = `tick=${formatTick(
|
|
91
|
+
tick = `tick=${formatTick(performanceNow())}`;
|
|
92
92
|
|
|
93
93
|
// Extract stack to put it last, but also to avoid escaping '\n' in it by JSON.stringify below
|
|
94
94
|
const stack = newEvent.stack ?? "";
|
package/src/deltaQueue.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { TypedEventEmitter,
|
|
6
|
+
import { TypedEventEmitter, performanceNow } from "@fluid-internal/client-utils";
|
|
7
7
|
import {
|
|
8
8
|
IDeltaQueue,
|
|
9
9
|
IDeltaQueueEvents,
|
|
@@ -153,7 +153,7 @@ export class DeltaQueue<T>
|
|
|
153
153
|
count: number;
|
|
154
154
|
duration: number;
|
|
155
155
|
} {
|
|
156
|
-
const start =
|
|
156
|
+
const start = performanceNow();
|
|
157
157
|
let count = 0;
|
|
158
158
|
|
|
159
159
|
// For grouping to work we must process all local messages immediately and in the single turn.
|
|
@@ -169,7 +169,7 @@ export class DeltaQueue<T>
|
|
|
169
169
|
this.emit("op", next);
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
const duration =
|
|
172
|
+
const duration = performanceNow() - start;
|
|
173
173
|
if (this.q.length === 0) {
|
|
174
174
|
this.emit("idle", count, duration);
|
|
175
175
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
checkLayerCompatibility,
|
|
8
|
+
type ILayerCompatDetails,
|
|
9
|
+
type ILayerCompatSupportRequirements,
|
|
10
|
+
} from "@fluid-internal/client-utils";
|
|
11
|
+
import type { ICriticalContainerError } from "@fluidframework/container-definitions";
|
|
12
|
+
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
13
|
+
|
|
14
|
+
import { pkgVersion } from "./packageVersion.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Loader's compatibility details that is exposed to the Runtime layer.
|
|
18
|
+
*/
|
|
19
|
+
export const LoaderCompatDetails: ILayerCompatDetails = {
|
|
20
|
+
/**
|
|
21
|
+
* The package version of the Loader layer.
|
|
22
|
+
*/
|
|
23
|
+
pkgVersion,
|
|
24
|
+
/**
|
|
25
|
+
* The current generation of the Loader layer.
|
|
26
|
+
*/
|
|
27
|
+
generation: 1,
|
|
28
|
+
/**
|
|
29
|
+
* The features supported by the Loader layer across the Loader / Runtime boundary.
|
|
30
|
+
*/
|
|
31
|
+
supportedFeatures: new Set<string>(),
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The requirements that the Runtime layer must meet to be compatible with this Loader.
|
|
36
|
+
*/
|
|
37
|
+
export const RuntimeSupportRequirements: ILayerCompatSupportRequirements = {
|
|
38
|
+
/**
|
|
39
|
+
* Minimum generation that Runtime must be at to be compatible with Loader. Note that 0 is used here for
|
|
40
|
+
* Runtime layers before the introduction of the layer compatibility enforcement.
|
|
41
|
+
*/
|
|
42
|
+
minSupportedGeneration: 0,
|
|
43
|
+
/**
|
|
44
|
+
* The features that the Runtime must support to be compatible with Loader.
|
|
45
|
+
*/
|
|
46
|
+
requiredFeatures: [],
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Validates that the Runtime layer is compatible with the Loader.
|
|
51
|
+
*/
|
|
52
|
+
export function validateRuntimeCompatibility(
|
|
53
|
+
maybeRuntimeCompatDetails: ILayerCompatDetails | undefined,
|
|
54
|
+
disposeFn: (error?: ICriticalContainerError) => void,
|
|
55
|
+
): void {
|
|
56
|
+
const layerCheckResult = checkLayerCompatibility(
|
|
57
|
+
RuntimeSupportRequirements,
|
|
58
|
+
maybeRuntimeCompatDetails,
|
|
59
|
+
);
|
|
60
|
+
if (!layerCheckResult.isCompatible) {
|
|
61
|
+
const error = new UsageError("Loader is not compatible with Runtime", {
|
|
62
|
+
errorDetails: JSON.stringify({
|
|
63
|
+
loaderVersion: LoaderCompatDetails.pkgVersion,
|
|
64
|
+
runtimeVersion: maybeRuntimeCompatDetails?.pkgVersion,
|
|
65
|
+
loaderGeneration: LoaderCompatDetails.generation,
|
|
66
|
+
runtimeGeneration: maybeRuntimeCompatDetails?.generation,
|
|
67
|
+
minSupportedGeneration: RuntimeSupportRequirements.minSupportedGeneration,
|
|
68
|
+
isGenerationCompatible: layerCheckResult.isGenerationCompatible,
|
|
69
|
+
unsupportedFeatures: layerCheckResult.unsupportedFeatures,
|
|
70
|
+
}),
|
|
71
|
+
});
|
|
72
|
+
disposeFn(error);
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
}
|
package/src/packageVersion.ts
CHANGED
package/src/protocol/quorum.ts
CHANGED
|
@@ -221,14 +221,6 @@ export class QuorumProposals
|
|
|
221
221
|
return this.values.get(key)?.value;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
/**
|
|
225
|
-
* Returns additional data about the approved consensus value
|
|
226
|
-
* @deprecated Removed in recent protocol-definitions. Use get() instead.
|
|
227
|
-
*/
|
|
228
|
-
public getApprovalData(key: string): ICommittedProposal | undefined {
|
|
229
|
-
return this.values.get(key);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
224
|
/**
|
|
233
225
|
* Proposes a new value. Returns a promise that will either:
|
|
234
226
|
* - Resolve when the proposal is accepted
|
|
@@ -505,14 +497,6 @@ export class Quorum extends TypedEventEmitter<IQuorum["on"]> implements IQuorum
|
|
|
505
497
|
return this.quorumProposals.get(key);
|
|
506
498
|
}
|
|
507
499
|
|
|
508
|
-
/**
|
|
509
|
-
* Returns additional data about the approved consensus value
|
|
510
|
-
* @deprecated Removed in recent protocol-definitions. Use get() instead.
|
|
511
|
-
*/
|
|
512
|
-
public getApprovalData(key: string): ICommittedProposal | undefined {
|
|
513
|
-
return this.quorumProposals.getApprovalData(key);
|
|
514
|
-
}
|
|
515
|
-
|
|
516
500
|
/**
|
|
517
501
|
* Adds a new client to the quorum
|
|
518
502
|
*/
|
package/src/utils.ts
CHANGED
|
@@ -145,7 +145,10 @@ function convertSummaryToSnapshotAndBlobs(summary: ISummaryTree): SnapshotWithBl
|
|
|
145
145
|
unreferenced: summary.unreferenced,
|
|
146
146
|
groupId: summary.groupId,
|
|
147
147
|
};
|
|
148
|
-
|
|
148
|
+
const keys = Object.keys(summary.tree);
|
|
149
|
+
for (const key of keys) {
|
|
150
|
+
const summaryObject = summary.tree[key];
|
|
151
|
+
|
|
149
152
|
switch (summaryObject.type) {
|
|
150
153
|
case SummaryType.Tree: {
|
|
151
154
|
const innerSnapshot = convertSummaryToSnapshotAndBlobs(summaryObject);
|