@fluidframework/container-runtime 2.20.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/.eslintrc.cjs +36 -6
- package/CHANGELOG.md +38 -0
- package/api-report/container-runtime.legacy.alpha.api.md +31 -31
- package/dist/batchTracker.d.ts +1 -2
- package/dist/batchTracker.d.ts.map +1 -1
- package/dist/batchTracker.js +1 -1
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager/blobManager.d.ts.map +1 -1
- package/dist/blobManager/blobManager.js +14 -11
- package/dist/blobManager/blobManager.js.map +1 -1
- package/dist/blobManager/blobManagerSnapSum.d.ts +1 -0
- package/dist/blobManager/blobManagerSnapSum.d.ts.map +1 -1
- package/dist/blobManager/blobManagerSnapSum.js +7 -5
- package/dist/blobManager/blobManagerSnapSum.js.map +1 -1
- package/dist/channelCollection.d.ts.map +1 -1
- package/dist/channelCollection.js +63 -41
- package/dist/channelCollection.js.map +1 -1
- package/dist/connectionTelemetry.d.ts +2 -2
- package/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js +4 -4
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/containerRuntime.d.ts +14 -30
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +264 -194
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.js +6 -3
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +16 -11
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.d.ts.map +1 -1
- package/dist/dataStoreContexts.js +1 -0
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/deltaScheduler.d.ts.map +1 -1
- package/dist/deltaScheduler.js +5 -5
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +36 -14
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.d.ts.map +1 -1
- package/dist/gc/gcConfigs.js +2 -0
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +8 -0
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js +1 -0
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcHelpers.d.ts.map +1 -1
- package/dist/gc/gcHelpers.js +8 -5
- package/dist/gc/gcHelpers.js.map +1 -1
- package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -1
- package/dist/gc/gcSummaryStateTracker.js +2 -1
- package/dist/gc/gcSummaryStateTracker.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +29 -15
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/inboundBatchAggregator.js +3 -3
- package/dist/inboundBatchAggregator.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/messageTypes.d.ts.map +1 -1
- package/dist/messageTypes.js.map +1 -1
- package/dist/opLifecycle/duplicateBatchDetector.js +2 -2
- package/dist/opLifecycle/duplicateBatchDetector.js.map +1 -1
- package/dist/opLifecycle/opCompressor.d.ts +3 -2
- package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opCompressor.js +13 -19
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts +3 -0
- package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opDecompressor.js +4 -1
- package/dist/opLifecycle/opDecompressor.js.map +1 -1
- package/dist/opLifecycle/opGroupingManager.d.ts +1 -1
- package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
- package/dist/opLifecycle/opGroupingManager.js +5 -3
- package/dist/opLifecycle/opGroupingManager.js.map +1 -1
- package/dist/opLifecycle/opSplitter.d.ts +13 -10
- package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
- package/dist/opLifecycle/opSplitter.js +14 -11
- package/dist/opLifecycle/opSplitter.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +3 -3
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +11 -15
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.js +3 -1
- package/dist/opLifecycle/remoteMessageProcessor.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/pendingStateManager.d.ts +3 -4
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +11 -10
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/summary/documentSchema.d.ts +7 -0
- package/dist/summary/documentSchema.d.ts.map +1 -1
- package/dist/summary/documentSchema.js +6 -4
- package/dist/summary/documentSchema.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts +1 -0
- package/dist/summary/orderedClientElection.d.ts.map +1 -1
- package/dist/summary/orderedClientElection.js +13 -11
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.d.ts +1 -0
- package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.js +7 -2
- package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/summary/runningSummarizer.d.ts +2 -2
- package/dist/summary/runningSummarizer.d.ts.map +1 -1
- package/dist/summary/runningSummarizer.js +38 -17
- package/dist/summary/runningSummarizer.js.map +1 -1
- package/dist/summary/summarizer.d.ts +1 -0
- package/dist/summary/summarizer.d.ts.map +1 -1
- package/dist/summary/summarizer.js +18 -9
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerClientElection.d.ts.map +1 -1
- package/dist/summary/summarizerClientElection.js +1 -0
- package/dist/summary/summarizerClientElection.js.map +1 -1
- package/dist/summary/summarizerHeuristics.js +1 -1
- package/dist/summary/summarizerHeuristics.js.map +1 -1
- package/dist/summary/summarizerNode/index.d.ts.map +1 -1
- package/dist/summary/summarizerNode/index.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.js +30 -31
- package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js +3 -3
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +7 -0
- package/dist/summary/summarizerTypes.d.ts.map +1 -1
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts +3 -4
- package/dist/summary/summaryCollection.d.ts.map +1 -1
- package/dist/summary/summaryCollection.js +9 -6
- package/dist/summary/summaryCollection.js.map +1 -1
- package/dist/summary/summaryFormat.d.ts +4 -1
- package/dist/summary/summaryFormat.d.ts.map +1 -1
- package/dist/summary/summaryFormat.js +3 -2
- package/dist/summary/summaryFormat.js.map +1 -1
- package/dist/summary/summaryGenerator.d.ts.map +1 -1
- package/dist/summary/summaryGenerator.js +19 -8
- package/dist/summary/summaryGenerator.js.map +1 -1
- package/dist/summary/summaryManager.d.ts.map +1 -1
- package/dist/summary/summaryManager.js +12 -9
- package/dist/summary/summaryManager.js.map +1 -1
- package/lib/batchTracker.d.ts +1 -2
- package/lib/batchTracker.d.ts.map +1 -1
- package/lib/batchTracker.js +2 -2
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager/blobManager.d.ts.map +1 -1
- package/lib/blobManager/blobManager.js +14 -11
- package/lib/blobManager/blobManager.js.map +1 -1
- package/lib/blobManager/blobManagerSnapSum.d.ts +1 -0
- package/lib/blobManager/blobManagerSnapSum.d.ts.map +1 -1
- package/lib/blobManager/blobManagerSnapSum.js +7 -5
- package/lib/blobManager/blobManagerSnapSum.js.map +1 -1
- package/lib/channelCollection.d.ts.map +1 -1
- package/lib/channelCollection.js +66 -42
- package/lib/channelCollection.js.map +1 -1
- package/lib/connectionTelemetry.d.ts +2 -2
- package/lib/connectionTelemetry.d.ts.map +1 -1
- package/lib/connectionTelemetry.js +5 -5
- package/lib/connectionTelemetry.js.map +1 -1
- package/lib/containerRuntime.d.ts +14 -30
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +271 -196
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.js +6 -3
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +16 -11
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreContexts.d.ts.map +1 -1
- package/lib/dataStoreContexts.js +1 -0
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/deltaScheduler.d.ts.map +1 -1
- package/lib/deltaScheduler.js +6 -6
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +39 -15
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcConfigs.d.ts.map +1 -1
- package/lib/gc/gcConfigs.js +2 -0
- package/lib/gc/gcConfigs.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +8 -0
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js +1 -0
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcHelpers.d.ts.map +1 -1
- package/lib/gc/gcHelpers.js +8 -5
- package/lib/gc/gcHelpers.js.map +1 -1
- package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -1
- package/lib/gc/gcSummaryStateTracker.js +2 -1
- package/lib/gc/gcSummaryStateTracker.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +32 -16
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/inboundBatchAggregator.js +4 -4
- package/lib/inboundBatchAggregator.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/messageTypes.d.ts.map +1 -1
- package/lib/messageTypes.js.map +1 -1
- package/lib/opLifecycle/duplicateBatchDetector.js +2 -2
- package/lib/opLifecycle/duplicateBatchDetector.js.map +1 -1
- package/lib/opLifecycle/opCompressor.d.ts +3 -2
- package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opCompressor.js +13 -19
- package/lib/opLifecycle/opCompressor.js.map +1 -1
- package/lib/opLifecycle/opDecompressor.d.ts +3 -0
- package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opDecompressor.js +4 -1
- package/lib/opLifecycle/opDecompressor.js.map +1 -1
- package/lib/opLifecycle/opGroupingManager.d.ts +1 -1
- package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
- package/lib/opLifecycle/opGroupingManager.js +5 -3
- package/lib/opLifecycle/opGroupingManager.js.map +1 -1
- package/lib/opLifecycle/opSplitter.d.ts +13 -10
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
- package/lib/opLifecycle/opSplitter.js +14 -11
- package/lib/opLifecycle/opSplitter.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts +3 -3
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +11 -15
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.js +3 -1
- package/lib/opLifecycle/remoteMessageProcessor.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/pendingStateManager.d.ts +3 -4
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +12 -11
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/summary/documentSchema.d.ts +7 -0
- package/lib/summary/documentSchema.d.ts.map +1 -1
- package/lib/summary/documentSchema.js +6 -4
- package/lib/summary/documentSchema.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts +1 -0
- package/lib/summary/orderedClientElection.d.ts.map +1 -1
- package/lib/summary/orderedClientElection.js +13 -11
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/runWhileConnectedCoordinator.d.ts +1 -0
- package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
- package/lib/summary/runWhileConnectedCoordinator.js +7 -2
- package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/lib/summary/runningSummarizer.d.ts +2 -2
- package/lib/summary/runningSummarizer.d.ts.map +1 -1
- package/lib/summary/runningSummarizer.js +38 -17
- package/lib/summary/runningSummarizer.js.map +1 -1
- package/lib/summary/summarizer.d.ts +1 -0
- package/lib/summary/summarizer.d.ts.map +1 -1
- package/lib/summary/summarizer.js +18 -9
- package/lib/summary/summarizer.js.map +1 -1
- package/lib/summary/summarizerClientElection.d.ts.map +1 -1
- package/lib/summary/summarizerClientElection.js +1 -0
- package/lib/summary/summarizerClientElection.js.map +1 -1
- package/lib/summary/summarizerHeuristics.js +1 -1
- package/lib/summary/summarizerHeuristics.js.map +1 -1
- package/lib/summary/summarizerNode/index.d.ts.map +1 -1
- package/lib/summary/summarizerNode/index.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.js +30 -31
- package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js +3 -3
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/lib/summary/summarizerTypes.d.ts +7 -0
- package/lib/summary/summarizerTypes.d.ts.map +1 -1
- package/lib/summary/summarizerTypes.js.map +1 -1
- package/lib/summary/summaryCollection.d.ts +3 -4
- package/lib/summary/summaryCollection.d.ts.map +1 -1
- package/lib/summary/summaryCollection.js +9 -6
- package/lib/summary/summaryCollection.js.map +1 -1
- package/lib/summary/summaryFormat.d.ts +4 -1
- package/lib/summary/summaryFormat.d.ts.map +1 -1
- package/lib/summary/summaryFormat.js +2 -2
- package/lib/summary/summaryFormat.js.map +1 -1
- package/lib/summary/summaryGenerator.d.ts.map +1 -1
- package/lib/summary/summaryGenerator.js +19 -8
- package/lib/summary/summaryGenerator.js.map +1 -1
- package/lib/summary/summaryManager.d.ts.map +1 -1
- package/lib/summary/summaryManager.js +12 -9
- package/lib/summary/summaryManager.js.map +1 -1
- package/package.json +21 -43
- package/src/batchTracker.ts +3 -3
- package/src/blobManager/blobManager.ts +16 -14
- package/src/blobManager/blobManagerSnapSum.ts +8 -8
- package/src/channelCollection.ts +63 -44
- package/src/connectionTelemetry.ts +12 -6
- package/src/containerRuntime.ts +306 -235
- package/src/dataStore.ts +6 -3
- package/src/dataStoreContext.ts +16 -16
- package/src/dataStoreContexts.ts +1 -0
- package/src/deltaScheduler.ts +6 -6
- package/src/gc/garbageCollection.ts +47 -20
- package/src/gc/gcConfigs.ts +9 -1
- package/src/gc/gcDefinitions.ts +12 -0
- package/src/gc/gcHelpers.ts +9 -4
- package/src/gc/gcSummaryStateTracker.ts +3 -1
- package/src/gc/gcTelemetry.ts +26 -11
- package/src/inboundBatchAggregator.ts +4 -4
- package/src/layerCompatState.ts +75 -0
- package/src/messageTypes.ts +2 -0
- package/src/opLifecycle/README.md +43 -34
- package/src/opLifecycle/duplicateBatchDetector.ts +2 -2
- package/src/opLifecycle/opCompressor.ts +16 -23
- package/src/opLifecycle/opDecompressor.ts +4 -1
- package/src/opLifecycle/opGroupingManager.ts +5 -4
- package/src/opLifecycle/opSplitter.ts +14 -11
- package/src/opLifecycle/outbox.ts +13 -20
- package/src/opLifecycle/remoteMessageProcessor.ts +3 -1
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +15 -10
- package/src/summary/documentSchema.ts +11 -4
- package/src/summary/orderedClientElection.ts +14 -11
- package/src/summary/runWhileConnectedCoordinator.ts +6 -0
- package/src/summary/runningSummarizer.ts +43 -19
- package/src/summary/summarizer.ts +24 -11
- package/src/summary/summarizerClientElection.ts +2 -0
- package/src/summary/summarizerHeuristics.ts +1 -1
- package/src/summary/summarizerNode/index.ts +1 -0
- package/src/summary/summarizerNode/summarizerNode.ts +32 -31
- package/src/summary/summarizerNode/summarizerNodeWithGc.ts +4 -4
- package/src/summary/summarizerTypes.ts +7 -0
- package/src/summary/summaryCollection.ts +19 -8
- package/src/summary/summaryFormat.ts +10 -5
- package/src/summary/summaryGenerator.ts +25 -10
- package/src/summary/summaryManager.ts +14 -12
- package/container-runtime.test-files.tar +0 -0
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { IDisposable } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { IDisposable, type ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
7
7
|
import { assert, Lazy } from "@fluidframework/core-utils/internal";
|
|
8
8
|
import {
|
|
9
9
|
ITelemetryLoggerExt,
|
|
10
10
|
DataProcessingError,
|
|
11
11
|
LoggingError,
|
|
12
12
|
extractSafePropertiesFromMessage,
|
|
13
|
+
createChildLogger,
|
|
13
14
|
} from "@fluidframework/telemetry-utils/internal";
|
|
14
15
|
import Deque from "double-ended-queue";
|
|
15
16
|
import { v4 as uuid } from "uuid";
|
|
@@ -194,6 +195,7 @@ export class PendingStateManager implements IDisposable {
|
|
|
194
195
|
*/
|
|
195
196
|
private savedOps: IPendingMessage[] = [];
|
|
196
197
|
|
|
198
|
+
// eslint-disable-next-line unicorn/consistent-function-scoping -- Property is defined once; no need to extract inner lambda
|
|
197
199
|
private readonly disposeOnce = new Lazy<void>(() => {
|
|
198
200
|
this.initialMessages.clear();
|
|
199
201
|
this.pendingMessages.clear();
|
|
@@ -244,27 +246,30 @@ export class PendingStateManager implements IDisposable {
|
|
|
244
246
|
);
|
|
245
247
|
return message.sequenceNumber > (snapshotSequenceNumber ?? 0);
|
|
246
248
|
});
|
|
247
|
-
this.pendingMessages.toArray()
|
|
249
|
+
for (const message of this.pendingMessages.toArray()) {
|
|
248
250
|
if (
|
|
249
251
|
snapshotSequenceNumber !== undefined &&
|
|
250
252
|
message.referenceSequenceNumber < snapshotSequenceNumber
|
|
251
253
|
) {
|
|
252
254
|
throw new LoggingError("trying to stash ops older than our latest snapshot");
|
|
253
255
|
}
|
|
254
|
-
}
|
|
256
|
+
}
|
|
255
257
|
return {
|
|
256
258
|
pendingStates: [
|
|
257
259
|
...newSavedOps,
|
|
258
|
-
...this.pendingMessages.toArray().map(withoutLocalOpMetadata),
|
|
260
|
+
...this.pendingMessages.toArray().map((message) => withoutLocalOpMetadata(message)),
|
|
259
261
|
],
|
|
260
262
|
};
|
|
261
263
|
}
|
|
262
264
|
|
|
265
|
+
private readonly logger: ITelemetryLoggerExt;
|
|
266
|
+
|
|
263
267
|
constructor(
|
|
264
268
|
private readonly stateHandler: IRuntimeStateHandler,
|
|
265
269
|
stashedLocalState: IPendingLocalState | undefined,
|
|
266
|
-
|
|
270
|
+
logger: ITelemetryBaseLogger,
|
|
267
271
|
) {
|
|
272
|
+
this.logger = createChildLogger({ logger });
|
|
268
273
|
if (stashedLocalState?.pendingStates) {
|
|
269
274
|
this.initialMessages.push(...stashedLocalState.pendingStates);
|
|
270
275
|
}
|
|
@@ -352,15 +357,15 @@ export class PendingStateManager implements IDisposable {
|
|
|
352
357
|
}
|
|
353
358
|
// applyStashedOp will cause the DDS to behave as if it has sent the op but not actually send it
|
|
354
359
|
const localOpMetadata = await this.stateHandler.applyStashedOp(nextMessage.content);
|
|
355
|
-
if (
|
|
356
|
-
if (localOpMetadata !== undefined) {
|
|
357
|
-
throw new Error("Local Op Metadata must be undefined when not attached");
|
|
358
|
-
}
|
|
359
|
-
} else {
|
|
360
|
+
if (this.stateHandler.isAttached()) {
|
|
360
361
|
nextMessage.localOpMetadata = localOpMetadata;
|
|
361
362
|
// then we push onto pendingMessages which will cause PendingStateManager to resubmit when we connect
|
|
362
363
|
patchbatchInfo(nextMessage); // Back compat
|
|
363
364
|
this.pendingMessages.push(nextMessage);
|
|
365
|
+
} else {
|
|
366
|
+
if (localOpMetadata !== undefined) {
|
|
367
|
+
throw new Error("Local Op Metadata must be undefined when not attached");
|
|
368
|
+
}
|
|
364
369
|
}
|
|
365
370
|
} catch (error) {
|
|
366
371
|
throw DataProcessingError.wrapIfUnrecognized(error, "applyStashedOp", nextMessage);
|
|
@@ -15,6 +15,7 @@ import { pkgVersion } from "../packageVersion.js";
|
|
|
15
15
|
* we want them to continue to collaborate alongside clients who support that capability, but such capability is shipping dark for now.
|
|
16
16
|
* @legacy
|
|
17
17
|
* @alpha
|
|
18
|
+
* @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
|
|
18
19
|
*/
|
|
19
20
|
export type DocumentSchemaValueType = string | string[] | true | number | undefined;
|
|
20
21
|
|
|
@@ -59,6 +60,7 @@ export type IdCompressorMode = "on" | "delayed" | undefined;
|
|
|
59
60
|
*
|
|
60
61
|
* @legacy
|
|
61
62
|
* @alpha
|
|
63
|
+
* @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
|
|
62
64
|
*/
|
|
63
65
|
export interface IDocumentSchema {
|
|
64
66
|
// version that describes how data is stored in this structure.
|
|
@@ -80,6 +82,7 @@ export interface IDocumentSchema {
|
|
|
80
82
|
* @see ContainerRuntimeDocumentSchemaMessage
|
|
81
83
|
* @legacy
|
|
82
84
|
* @alpha
|
|
85
|
+
* @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
|
|
83
86
|
*/
|
|
84
87
|
export type IDocumentSchemaChangeMessage = IDocumentSchema;
|
|
85
88
|
|
|
@@ -91,6 +94,7 @@ export type IDocumentSchemaChangeMessage = IDocumentSchema;
|
|
|
91
94
|
*
|
|
92
95
|
* @legacy
|
|
93
96
|
* @alpha
|
|
97
|
+
* @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
|
|
94
98
|
*/
|
|
95
99
|
export interface IDocumentSchemaFeatures {
|
|
96
100
|
// Tells if client uses legacy behavior of changing schema.
|
|
@@ -121,6 +125,7 @@ export interface IDocumentSchemaFeatures {
|
|
|
121
125
|
* Ex: Changing the 'document schema acceptance' mechanism from convert-and-swap to one requiring consensus does require changing this version.
|
|
122
126
|
* @legacy
|
|
123
127
|
* @alpha
|
|
128
|
+
* @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
|
|
124
129
|
*/
|
|
125
130
|
export const currentDocumentVersionSchema = 1;
|
|
126
131
|
|
|
@@ -128,6 +133,7 @@ export const currentDocumentVersionSchema = 1;
|
|
|
128
133
|
* Current document schema.
|
|
129
134
|
* @legacy
|
|
130
135
|
* @alpha
|
|
136
|
+
* @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
|
|
131
137
|
*/
|
|
132
138
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
|
133
139
|
export type IDocumentSchemaCurrent = {
|
|
@@ -437,6 +443,7 @@ function arrayToProp(arr: string[]): string[] | undefined {
|
|
|
437
443
|
*
|
|
438
444
|
* @legacy
|
|
439
445
|
* @alpha
|
|
446
|
+
* @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
|
|
440
447
|
* @sealed
|
|
441
448
|
*/
|
|
442
449
|
export class DocumentsSchemaController {
|
|
@@ -496,9 +503,8 @@ export class DocumentsSchemaController {
|
|
|
496
503
|
// Schema coming from document metadata (snapshot we loaded from), or if no document exists
|
|
497
504
|
// (this is a new document) then this is the same as desiredSchema (same as session schema in such case).
|
|
498
505
|
// Latter is importnat sure that's what will go into summary.
|
|
499
|
-
this.documentSchema =
|
|
500
|
-
?
|
|
501
|
-
: ((documentMetadataSchema as IDocumentSchemaCurrent) ??
|
|
506
|
+
this.documentSchema = existing
|
|
507
|
+
? ((documentMetadataSchema as IDocumentSchemaCurrent) ??
|
|
502
508
|
({
|
|
503
509
|
version: currentDocumentVersionSchema,
|
|
504
510
|
// see comment in summarizeDocumentSchema() on why it has to stay zero
|
|
@@ -508,7 +514,8 @@ export class DocumentsSchemaController {
|
|
|
508
514
|
runtime: {
|
|
509
515
|
explicitSchemaControl: boolToProp(!existing && features.explicitSchemaControl),
|
|
510
516
|
},
|
|
511
|
-
} satisfies IDocumentSchemaCurrent))
|
|
517
|
+
} satisfies IDocumentSchemaCurrent))
|
|
518
|
+
: this.desiredSchema;
|
|
512
519
|
|
|
513
520
|
checkRuntimeCompatibility(this.documentSchema, "document");
|
|
514
521
|
this.validateSeqNumber(this.documentSchema.refSeq, snapshotSequenceNumber, "summary");
|
|
@@ -273,6 +273,7 @@ export interface IOrderedClientElectionEvents extends IEvent {
|
|
|
273
273
|
* Serialized state of IOrderedClientElection.
|
|
274
274
|
* @legacy
|
|
275
275
|
* @alpha
|
|
276
|
+
* @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
|
|
276
277
|
*/
|
|
277
278
|
export interface ISerializedElection {
|
|
278
279
|
/**
|
|
@@ -603,8 +604,15 @@ export class OrderedClientElection
|
|
|
603
604
|
this._eligibleCount--;
|
|
604
605
|
if (this._electedClient === client) {
|
|
605
606
|
// Removing the _electedClient. There are 2 possible cases:
|
|
606
|
-
if (this._electedParent
|
|
607
|
-
// 1. The _electedClient is
|
|
607
|
+
if (this._electedParent === client) {
|
|
608
|
+
// 1. The _electedClient is an interactive client that has left the quorum.
|
|
609
|
+
// Automatically shift to next oldest client.
|
|
610
|
+
const nextClient =
|
|
611
|
+
this.findFirstEligibleParent(this._electedParent?.youngerClient) ??
|
|
612
|
+
this.findFirstEligibleParent(this.orderedClientCollection.oldestClient);
|
|
613
|
+
this.tryElectingClient(nextClient, sequenceNumber, "RemoveClient");
|
|
614
|
+
} else {
|
|
615
|
+
// 2. The _electedClient is a summarizer that we've been allowing to finish its work.
|
|
608
616
|
// Let the _electedParent become the _electedClient so that it can start its own summarizer.
|
|
609
617
|
if (this._electedClient.client.details.type !== summarizerClientType) {
|
|
610
618
|
throw new UsageError("Elected client should be a summarizer client 1");
|
|
@@ -614,13 +622,6 @@ export class OrderedClientElection
|
|
|
614
622
|
sequenceNumber,
|
|
615
623
|
"RemoveSummarizerClient",
|
|
616
624
|
);
|
|
617
|
-
} else {
|
|
618
|
-
// 2. The _electedClient is an interactive client that has left the quorum.
|
|
619
|
-
// Automatically shift to next oldest client.
|
|
620
|
-
const nextClient =
|
|
621
|
-
this.findFirstEligibleParent(this._electedParent?.youngerClient) ??
|
|
622
|
-
this.findFirstEligibleParent(this.orderedClientCollection.oldestClient);
|
|
623
|
-
this.tryElectingClient(nextClient, sequenceNumber, "RemoveClient");
|
|
624
625
|
}
|
|
625
626
|
} else if (this._electedParent === client) {
|
|
626
627
|
// Removing the _electedParent (but not _electedClient).
|
|
@@ -638,7 +639,9 @@ export class OrderedClientElection
|
|
|
638
639
|
}
|
|
639
640
|
|
|
640
641
|
public getAllEligibleClients(): ITrackedClient[] {
|
|
641
|
-
return this.orderedClientCollection
|
|
642
|
+
return this.orderedClientCollection
|
|
643
|
+
.getAllClients()
|
|
644
|
+
.filter((client) => this.isEligibleFn(client));
|
|
642
645
|
}
|
|
643
646
|
|
|
644
647
|
/**
|
|
@@ -687,7 +690,7 @@ export class OrderedClientElection
|
|
|
687
690
|
sequenceNumber,
|
|
688
691
|
electedClientId: this.electedClient?.clientId,
|
|
689
692
|
electedParentId: this.electedParent?.clientId,
|
|
690
|
-
isEligible: client
|
|
693
|
+
isEligible: client === undefined ? false : this.isEligibleFn(client),
|
|
691
694
|
isSummarizerClient: client?.client.details.type === summarizerClientType,
|
|
692
695
|
reason,
|
|
693
696
|
});
|
|
@@ -6,13 +6,16 @@
|
|
|
6
6
|
import type { SummarizerStopReason } from "@fluidframework/container-runtime-definitions/internal";
|
|
7
7
|
import { assert, Deferred } from "@fluidframework/core-utils/internal";
|
|
8
8
|
|
|
9
|
+
// eslint-disable-next-line import/no-deprecated
|
|
9
10
|
import { IConnectableRuntime, ISummaryCancellationToken } from "./summarizerTypes.js";
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Similar to AbortController, but using promise instead of events
|
|
13
14
|
* @legacy
|
|
14
15
|
* @alpha
|
|
16
|
+
* @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
|
|
15
17
|
*/
|
|
18
|
+
// eslint-disable-next-line import/no-deprecated
|
|
16
19
|
export interface ICancellableSummarizerController extends ISummaryCancellationToken {
|
|
17
20
|
stop(reason: SummarizerStopReason): void;
|
|
18
21
|
}
|
|
@@ -22,6 +25,7 @@ export interface ICancellableSummarizerController extends ISummaryCancellationTo
|
|
|
22
25
|
* This object implements ISummaryCancellationToken interface but cancellation is never leveraged.
|
|
23
26
|
* @internal
|
|
24
27
|
*/
|
|
28
|
+
// eslint-disable-next-line import/no-deprecated
|
|
25
29
|
export const neverCancelledSummaryToken: ISummaryCancellationToken = {
|
|
26
30
|
cancelled: false,
|
|
27
31
|
waitCancelled: new Promise(() => {}),
|
|
@@ -64,6 +68,7 @@ export class RunWhileConnectedCoordinator implements ICancellableSummarizerContr
|
|
|
64
68
|
}
|
|
65
69
|
|
|
66
70
|
public static async create(
|
|
71
|
+
// eslint-disable-next-line import/no-deprecated
|
|
67
72
|
runtime: IConnectableRuntime,
|
|
68
73
|
active: () => boolean,
|
|
69
74
|
): Promise<RunWhileConnectedCoordinator> {
|
|
@@ -73,6 +78,7 @@ export class RunWhileConnectedCoordinator implements ICancellableSummarizerContr
|
|
|
73
78
|
}
|
|
74
79
|
|
|
75
80
|
protected constructor(
|
|
81
|
+
// eslint-disable-next-line import/no-deprecated
|
|
76
82
|
private readonly runtime: IConnectableRuntime,
|
|
77
83
|
private readonly active: () => boolean,
|
|
78
84
|
) {}
|
|
@@ -34,7 +34,9 @@ import {
|
|
|
34
34
|
EnqueueSummarizeResult,
|
|
35
35
|
IEnqueueSummarizeOptions,
|
|
36
36
|
IOnDemandSummarizeOptions,
|
|
37
|
+
// eslint-disable-next-line import/no-deprecated
|
|
37
38
|
IRefreshSummaryAckOptions,
|
|
39
|
+
// eslint-disable-next-line import/no-deprecated
|
|
38
40
|
ISubmitSummaryOptions,
|
|
39
41
|
ISummarizeHeuristicData,
|
|
40
42
|
ISummarizeHeuristicRunner,
|
|
@@ -42,7 +44,9 @@ import {
|
|
|
42
44
|
ISummarizeResults,
|
|
43
45
|
ISummarizeRunnerTelemetry,
|
|
44
46
|
ISummarizeTelemetryProperties,
|
|
47
|
+
// eslint-disable-next-line import/no-deprecated
|
|
45
48
|
ISummarizerRuntime,
|
|
49
|
+
// eslint-disable-next-line import/no-deprecated
|
|
46
50
|
ISummaryCancellationToken,
|
|
47
51
|
SubmitSummaryResult,
|
|
48
52
|
type IRetriableFailureError,
|
|
@@ -88,12 +92,16 @@ export class RunningSummarizer
|
|
|
88
92
|
logger: ITelemetryBaseLogger,
|
|
89
93
|
summaryWatcher: IClientSummaryWatcher,
|
|
90
94
|
configuration: ISummaryConfiguration,
|
|
95
|
+
// eslint-disable-next-line import/no-deprecated
|
|
91
96
|
submitSummaryCallback: (options: ISubmitSummaryOptions) => Promise<SubmitSummaryResult>,
|
|
97
|
+
// eslint-disable-next-line import/no-deprecated
|
|
92
98
|
refreshLatestSummaryAckCallback: (options: IRefreshSummaryAckOptions) => Promise<void>,
|
|
93
99
|
heuristicData: ISummarizeHeuristicData,
|
|
94
100
|
summaryCollection: SummaryCollection,
|
|
101
|
+
// eslint-disable-next-line import/no-deprecated
|
|
95
102
|
cancellationToken: ISummaryCancellationToken,
|
|
96
103
|
stopSummarizerCallback: (reason: SummarizerStopReason) => void,
|
|
104
|
+
// eslint-disable-next-line import/no-deprecated
|
|
97
105
|
runtime: ISummarizerRuntime,
|
|
98
106
|
): Promise<RunningSummarizer> {
|
|
99
107
|
const summarizer = new RunningSummarizer(
|
|
@@ -188,7 +196,10 @@ export class RunningSummarizer
|
|
|
188
196
|
private totalSuccessfulAttempts = 0;
|
|
189
197
|
private initialized = false;
|
|
190
198
|
|
|
191
|
-
private readonly runtimeListener
|
|
199
|
+
private readonly runtimeListener: (
|
|
200
|
+
op: ISequencedDocumentMessage,
|
|
201
|
+
runtimeMessage?: boolean,
|
|
202
|
+
) => void;
|
|
192
203
|
|
|
193
204
|
/**
|
|
194
205
|
* The maximum number of summary attempts to do when submit summary fails.
|
|
@@ -207,15 +218,19 @@ export class RunningSummarizer
|
|
|
207
218
|
private readonly summaryWatcher: IClientSummaryWatcher,
|
|
208
219
|
private readonly configuration: ISummaryConfiguration,
|
|
209
220
|
private readonly submitSummaryCallback: (
|
|
221
|
+
// eslint-disable-next-line import/no-deprecated
|
|
210
222
|
options: ISubmitSummaryOptions,
|
|
211
223
|
) => Promise<SubmitSummaryResult>,
|
|
212
224
|
private readonly refreshLatestSummaryAckCallback: (
|
|
225
|
+
// eslint-disable-next-line import/no-deprecated
|
|
213
226
|
options: IRefreshSummaryAckOptions,
|
|
214
227
|
) => Promise<void>,
|
|
215
228
|
private readonly heuristicData: ISummarizeHeuristicData,
|
|
216
229
|
private readonly summaryCollection: SummaryCollection,
|
|
230
|
+
// eslint-disable-next-line import/no-deprecated
|
|
217
231
|
private readonly cancellationToken: ISummaryCancellationToken,
|
|
218
232
|
private readonly stopSummarizerCallback: (reason: SummarizerStopReason) => void,
|
|
233
|
+
// eslint-disable-next-line import/no-deprecated
|
|
219
234
|
private readonly runtime: ISummarizerRuntime,
|
|
220
235
|
) {
|
|
221
236
|
super();
|
|
@@ -293,6 +308,7 @@ export class RunningSummarizer
|
|
|
293
308
|
() => {
|
|
294
309
|
this.totalSuccessfulAttempts++;
|
|
295
310
|
},
|
|
311
|
+
// eslint-disable-next-line import/no-deprecated
|
|
296
312
|
async (options: IRefreshSummaryAckOptions) => {
|
|
297
313
|
if (immediatelyRefreshLatestSummaryAck) {
|
|
298
314
|
await this.refreshLatestSummaryAckAndHandleError(options);
|
|
@@ -341,6 +357,7 @@ export class RunningSummarizer
|
|
|
341
357
|
await this.lockedSummaryAction(
|
|
342
358
|
() => {},
|
|
343
359
|
async () => {
|
|
360
|
+
// eslint-disable-next-line import/no-deprecated
|
|
344
361
|
const options: IRefreshSummaryAckOptions = {
|
|
345
362
|
proposalHandle: summaryOpHandle,
|
|
346
363
|
ackHandle: summaryAckHandle,
|
|
@@ -354,6 +371,7 @@ export class RunningSummarizer
|
|
|
354
371
|
}
|
|
355
372
|
|
|
356
373
|
private readonly refreshLatestSummaryAckAndHandleError = async (
|
|
374
|
+
// eslint-disable-next-line import/no-deprecated
|
|
357
375
|
options: IRefreshSummaryAckOptions,
|
|
358
376
|
): Promise<void> => {
|
|
359
377
|
return this.refreshLatestSummaryAckCallback(options).catch(async (error) => {
|
|
@@ -475,10 +493,12 @@ export class RunningSummarizer
|
|
|
475
493
|
switch (op.type) {
|
|
476
494
|
case MessageType.Summarize:
|
|
477
495
|
case MessageType.SummaryAck:
|
|
478
|
-
case MessageType.SummaryNack:
|
|
496
|
+
case MessageType.SummaryNack: {
|
|
479
497
|
return false;
|
|
480
|
-
|
|
498
|
+
}
|
|
499
|
+
default: {
|
|
481
500
|
return runtimeMessage || this.nonRuntimeOpCanTriggerSummary();
|
|
501
|
+
}
|
|
482
502
|
}
|
|
483
503
|
}
|
|
484
504
|
|
|
@@ -503,16 +523,18 @@ export class RunningSummarizer
|
|
|
503
523
|
this.disposeEnqueuedSummary();
|
|
504
524
|
|
|
505
525
|
// This will try to run lastSummary if needed.
|
|
506
|
-
if (
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
526
|
+
if (
|
|
527
|
+
allowLastSummary &&
|
|
528
|
+
this.heuristicRunner?.shouldRunLastSummary() &&
|
|
529
|
+
this.summarizingLock === undefined
|
|
530
|
+
) {
|
|
531
|
+
this.trySummarizeOnce(
|
|
532
|
+
// summarizeProps
|
|
533
|
+
{ summarizeReason: "lastSummary" },
|
|
534
|
+
{},
|
|
535
|
+
undefined,
|
|
536
|
+
true /* isLastSummary */,
|
|
537
|
+
);
|
|
516
538
|
}
|
|
517
539
|
|
|
518
540
|
// Note that trySummarizeOnce() call above returns right away, without waiting.
|
|
@@ -625,6 +647,7 @@ export class RunningSummarizer
|
|
|
625
647
|
logger: this.mc.logger,
|
|
626
648
|
properties: { all: summarizeProps },
|
|
627
649
|
});
|
|
650
|
+
// eslint-disable-next-line import/no-deprecated
|
|
628
651
|
const summaryOptions: ISubmitSummaryOptions = {
|
|
629
652
|
...options,
|
|
630
653
|
summaryLogger,
|
|
@@ -741,6 +764,7 @@ export class RunningSummarizer
|
|
|
741
764
|
logger: this.mc.logger,
|
|
742
765
|
properties: { all: summarizeProps },
|
|
743
766
|
});
|
|
767
|
+
// eslint-disable-next-line import/no-deprecated
|
|
744
768
|
const summaryOptions: ISubmitSummaryOptions = {
|
|
745
769
|
...summarizeOptions,
|
|
746
770
|
summaryLogger,
|
|
@@ -792,9 +816,9 @@ export class RunningSummarizer
|
|
|
792
816
|
// If submit summary failed, use maxAttemptsForSubmitFailures. Else use the defaultMaxAttempts.
|
|
793
817
|
// Note: Check "summarySubmitted" result first because if it fails, ack nack would fail as well.
|
|
794
818
|
const submitSummaryResult = await results.summarySubmitted;
|
|
795
|
-
maxAttempts =
|
|
796
|
-
?
|
|
797
|
-
:
|
|
819
|
+
maxAttempts = submitSummaryResult.success
|
|
820
|
+
? defaultMaxAttempts
|
|
821
|
+
: this.maxAttemptsForSubmitFailures;
|
|
798
822
|
|
|
799
823
|
// Emit "summarize" event for this failed attempt.
|
|
800
824
|
status = "failure";
|
|
@@ -912,7 +936,7 @@ export class RunningSummarizer
|
|
|
912
936
|
}
|
|
913
937
|
|
|
914
938
|
/**
|
|
915
|
-
*
|
|
939
|
+
*{@inheritdoc (ISummarizer:interface).summarizeOnDemand}
|
|
916
940
|
*/
|
|
917
941
|
public summarizeOnDemand(
|
|
918
942
|
options: IOnDemandSummarizeOptions,
|
|
@@ -935,7 +959,7 @@ export class RunningSummarizer
|
|
|
935
959
|
const { reason, ...summarizeOptions } = options;
|
|
936
960
|
if (options.retryOnFailure === true) {
|
|
937
961
|
this.summarizeOnDemandWithRetries(`onDemand;${reason}`, resultsBuilder).catch(
|
|
938
|
-
(error) => {
|
|
962
|
+
(error: IRetriableFailureError) => {
|
|
939
963
|
resultsBuilder.fail("summarize failed", error);
|
|
940
964
|
},
|
|
941
965
|
);
|
|
@@ -950,7 +974,7 @@ export class RunningSummarizer
|
|
|
950
974
|
}
|
|
951
975
|
|
|
952
976
|
/**
|
|
953
|
-
*
|
|
977
|
+
*{@inheritdoc (ISummarizer:interface).enqueueSummarize}
|
|
954
978
|
*/
|
|
955
979
|
public enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult {
|
|
956
980
|
const { reason, afterSequenceNumber = 0, override = false, ...summarizeOptions } = options;
|
|
@@ -21,20 +21,25 @@ import {
|
|
|
21
21
|
|
|
22
22
|
import { ISummaryConfiguration } from "../containerRuntime.js";
|
|
23
23
|
|
|
24
|
+
// eslint-disable-next-line import/no-deprecated
|
|
24
25
|
import { ICancellableSummarizerController } from "./runWhileConnectedCoordinator.js";
|
|
25
26
|
import { RunningSummarizer } from "./runningSummarizer.js";
|
|
26
27
|
import { SummarizeHeuristicData } from "./summarizerHeuristics.js";
|
|
27
28
|
import {
|
|
28
29
|
EnqueueSummarizeResult,
|
|
30
|
+
// eslint-disable-next-line import/no-deprecated
|
|
29
31
|
IConnectableRuntime,
|
|
30
32
|
IEnqueueSummarizeOptions,
|
|
31
33
|
IOnDemandSummarizeOptions,
|
|
32
34
|
ISummarizeHeuristicData,
|
|
33
35
|
ISummarizeResults,
|
|
34
36
|
ISummarizer,
|
|
37
|
+
// eslint-disable-next-line import/no-deprecated
|
|
35
38
|
ISummarizerInternalsProvider,
|
|
39
|
+
// eslint-disable-next-line import/no-deprecated
|
|
36
40
|
ISummarizerRuntime,
|
|
37
41
|
ISummarizingWarning,
|
|
42
|
+
type IRetriableFailureError,
|
|
38
43
|
} from "./summarizerTypes.js";
|
|
39
44
|
import { SummaryCollection } from "./summaryCollection.js";
|
|
40
45
|
import { SummarizeResultBuilder } from "./summaryGenerator.js";
|
|
@@ -77,6 +82,7 @@ export const createSummarizingWarning = (
|
|
|
77
82
|
* It is created only by summarizing container (i.e. one with clientType === "summarizer")
|
|
78
83
|
* @legacy
|
|
79
84
|
* @alpha
|
|
85
|
+
* @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
|
|
80
86
|
*/
|
|
81
87
|
export class Summarizer extends TypedEventEmitter<ISummarizerEvents> implements ISummarizer {
|
|
82
88
|
public get ISummarizer(): this {
|
|
@@ -95,17 +101,21 @@ export class Summarizer extends TypedEventEmitter<ISummarizerEvents> implements
|
|
|
95
101
|
* Reference to runtime that created this object.
|
|
96
102
|
* i.e. runtime with clientType === "summarizer"
|
|
97
103
|
*/
|
|
104
|
+
// eslint-disable-next-line import/no-deprecated
|
|
98
105
|
private readonly runtime: ISummarizerRuntime,
|
|
99
106
|
private readonly configurationGetter: () => ISummaryConfiguration,
|
|
100
107
|
/**
|
|
101
108
|
* Represents an object that can generate summary.
|
|
102
109
|
* In practical terms, it's same runtime (this.runtime) with clientType === "summarizer".
|
|
103
110
|
*/
|
|
111
|
+
// eslint-disable-next-line import/no-deprecated
|
|
104
112
|
private readonly internalsProvider: ISummarizerInternalsProvider,
|
|
105
113
|
handleContext: IFluidHandleContext,
|
|
106
114
|
public readonly summaryCollection: SummaryCollection,
|
|
107
115
|
private readonly runCoordinatorCreateFn: (
|
|
116
|
+
// eslint-disable-next-line import/no-deprecated
|
|
108
117
|
runtime: IConnectableRuntime,
|
|
118
|
+
// eslint-disable-next-line import/no-deprecated
|
|
109
119
|
) => Promise<ICancellableSummarizerController>,
|
|
110
120
|
) {
|
|
111
121
|
super();
|
|
@@ -155,12 +165,14 @@ export class Summarizer extends TypedEventEmitter<ISummarizerEvents> implements
|
|
|
155
165
|
}
|
|
156
166
|
|
|
157
167
|
private async runCore(onBehalfOf: string): Promise<SummarizerStopReason> {
|
|
168
|
+
// eslint-disable-next-line import/no-deprecated
|
|
158
169
|
const runCoordinator: ICancellableSummarizerController = await this.runCoordinatorCreateFn(
|
|
159
170
|
this.runtime,
|
|
160
171
|
);
|
|
161
172
|
|
|
162
173
|
// Wait for either external signal to cancel, or loss of connectivity.
|
|
163
174
|
const stopP = Promise.race([runCoordinator.waitCancelled, this.stopDeferred.promise]);
|
|
175
|
+
// eslint-disable-next-line no-void
|
|
164
176
|
void stopP.then((reason) => {
|
|
165
177
|
this.logger.sendTelemetryEvent({
|
|
166
178
|
eventName: "StoppingSummarizer",
|
|
@@ -239,6 +251,7 @@ export class Summarizer extends TypedEventEmitter<ISummarizerEvents> implements
|
|
|
239
251
|
*/
|
|
240
252
|
private async start(
|
|
241
253
|
onBehalfOf: string,
|
|
254
|
+
// eslint-disable-next-line import/no-deprecated
|
|
242
255
|
runCoordinator: ICancellableSummarizerController,
|
|
243
256
|
): Promise<RunningSummarizer> {
|
|
244
257
|
if (this.runningSummarizer) {
|
|
@@ -358,12 +371,12 @@ export class Summarizer extends TypedEventEmitter<ISummarizerEvents> implements
|
|
|
358
371
|
runCoordinator.stop(stopReason);
|
|
359
372
|
this.close();
|
|
360
373
|
})
|
|
361
|
-
.catch((
|
|
362
|
-
builder.fail("Failed to start summarizer",
|
|
374
|
+
.catch((error: IRetriableFailureError) => {
|
|
375
|
+
builder.fail("Failed to start summarizer", error);
|
|
363
376
|
});
|
|
364
377
|
})
|
|
365
|
-
.catch((
|
|
366
|
-
builder.fail("Failed to create cancellation token",
|
|
378
|
+
.catch((error: IRetriableFailureError) => {
|
|
379
|
+
builder.fail("Failed to create cancellation token", error);
|
|
367
380
|
});
|
|
368
381
|
|
|
369
382
|
return builder.build();
|
|
@@ -390,21 +403,21 @@ export class Summarizer extends TypedEventEmitter<ISummarizerEvents> implements
|
|
|
390
403
|
private readonly forwardedEvents = new Map<string, () => void>();
|
|
391
404
|
|
|
392
405
|
private setupForwardedEvents(): void {
|
|
393
|
-
["summarize", "summarizeAllAttemptsFailed"]
|
|
394
|
-
const listener = (...args:
|
|
406
|
+
for (const event of ["summarize", "summarizeAllAttemptsFailed"]) {
|
|
407
|
+
const listener = (...args: unknown[]): void => {
|
|
395
408
|
this.emit(event, ...args);
|
|
396
409
|
};
|
|
397
410
|
// TODO: better typing here
|
|
398
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
411
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
399
412
|
this.runningSummarizer?.on(event as any, listener);
|
|
400
413
|
this.forwardedEvents.set(event, listener);
|
|
401
|
-
}
|
|
414
|
+
}
|
|
402
415
|
}
|
|
403
416
|
|
|
404
417
|
private cleanupForwardedEvents(): void {
|
|
405
|
-
this.forwardedEvents.
|
|
406
|
-
this.runningSummarizer?.off(event, listener)
|
|
407
|
-
|
|
418
|
+
for (const [event, listener] of this.forwardedEvents.entries()) {
|
|
419
|
+
this.runningSummarizer?.off(event, listener);
|
|
420
|
+
}
|
|
408
421
|
this.forwardedEvents.clear();
|
|
409
422
|
}
|
|
410
423
|
}
|
|
@@ -11,6 +11,7 @@ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
IOrderedClientElection,
|
|
14
|
+
// eslint-disable-next-line import/no-deprecated
|
|
14
15
|
ISerializedElection,
|
|
15
16
|
ITrackedClient,
|
|
16
17
|
} from "./orderedClientElection.js";
|
|
@@ -119,6 +120,7 @@ export class SummarizerClientElection
|
|
|
119
120
|
});
|
|
120
121
|
}
|
|
121
122
|
|
|
123
|
+
// eslint-disable-next-line import/no-deprecated
|
|
122
124
|
public serialize(): ISerializedElection {
|
|
123
125
|
const { electedClientId, electedParentId, electionSequenceNumber } =
|
|
124
126
|
this.clientElection.serialize();
|
|
@@ -134,7 +134,7 @@ export class SummarizeHeuristicRunner implements ISummarizeHeuristicRunner {
|
|
|
134
134
|
this.configuration.runtimeOpWeight,
|
|
135
135
|
this.configuration.nonRuntimeOpWeight,
|
|
136
136
|
);
|
|
137
|
-
const pToMaxOps = (weightedNumOfOps * 1
|
|
137
|
+
const pToMaxOps = (weightedNumOfOps * 1) / this.configuration.maxOps;
|
|
138
138
|
|
|
139
139
|
if (pToMaxOps >= 1) {
|
|
140
140
|
return minIdleTime;
|