@fluidframework/container-runtime 2.4.0-299374 → 2.4.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 +12 -0
- package/container-runtime.test-files.tar +0 -0
- package/dist/blobManager/blobManager.d.ts.map +1 -1
- package/dist/blobManager/blobManager.js +10 -4
- package/dist/blobManager/blobManager.js.map +1 -1
- package/dist/containerRuntime.d.ts +6 -0
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +44 -69
- package/dist/containerRuntime.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +1 -1
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +2 -6
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/opLifecycle/batchManager.d.ts +2 -0
- package/dist/opLifecycle/batchManager.d.ts.map +1 -1
- package/dist/opLifecycle/batchManager.js.map +1 -1
- package/dist/opLifecycle/index.d.ts +1 -1
- package/dist/opLifecycle/index.d.ts.map +1 -1
- package/dist/opLifecycle/index.js +2 -1
- package/dist/opLifecycle/index.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +6 -0
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +25 -11
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts +4 -4
- package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.js +6 -18
- package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/pendingStateManager.d.ts +8 -2
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +14 -7
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts.map +1 -1
- package/dist/summary/summaryCollection.js +3 -4
- package/dist/summary/summaryCollection.js.map +1 -1
- package/lib/blobManager/blobManager.d.ts.map +1 -1
- package/lib/blobManager/blobManager.js +10 -4
- package/lib/blobManager/blobManager.js.map +1 -1
- package/lib/containerRuntime.d.ts +6 -0
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +42 -68
- package/lib/containerRuntime.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts +1 -1
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +3 -7
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/opLifecycle/batchManager.d.ts +2 -0
- package/lib/opLifecycle/batchManager.d.ts.map +1 -1
- package/lib/opLifecycle/batchManager.js.map +1 -1
- package/lib/opLifecycle/index.d.ts +1 -1
- package/lib/opLifecycle/index.d.ts.map +1 -1
- package/lib/opLifecycle/index.js +1 -1
- package/lib/opLifecycle/index.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts +6 -0
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +23 -10
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts +4 -4
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.js +6 -18
- package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/pendingStateManager.d.ts +8 -2
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +14 -7
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/summary/summaryCollection.d.ts.map +1 -1
- package/lib/summary/summaryCollection.js +3 -4
- package/lib/summary/summaryCollection.js.map +1 -1
- package/package.json +20 -18
- package/src/blobManager/blobManager.ts +10 -4
- package/src/containerRuntime.ts +67 -85
- package/src/gc/garbageCollection.ts +5 -12
- package/src/opLifecycle/batchManager.ts +3 -0
- package/src/opLifecycle/index.ts +1 -1
- package/src/opLifecycle/outbox.ts +32 -10
- package/src/opLifecycle/remoteMessageProcessor.ts +8 -22
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +26 -8
- package/src/summary/summaryCollection.ts +3 -4
package/dist/containerRuntime.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.ContainerRuntime = exports.loadContainerRuntime = exports.makeLegacySendBatchFn = exports.getDeviceSpec = exports.agentSchedulerId = exports.isUnpackedRuntimeMessage = exports.defaultPendingOpsRetryDelayMs = exports.defaultPendingOpsWaitTimeoutMs = exports.disabledCompressionConfig = exports.CompressionAlgorithms = exports.defaultRuntimeHeaderData = exports.InactiveResponseHeaderKey = exports.TombstoneResponseHeaderKey = exports.DeletedResponseHeaderKey = exports.DefaultSummaryConfiguration = void 0;
|
|
7
|
+
exports.ContainerRuntime = exports.loadContainerRuntime = exports.getSingleUseLegacyLogCallback = exports.makeLegacySendBatchFn = exports.getDeviceSpec = exports.agentSchedulerId = exports.isUnpackedRuntimeMessage = exports.defaultPendingOpsRetryDelayMs = exports.defaultPendingOpsWaitTimeoutMs = exports.disabledCompressionConfig = exports.CompressionAlgorithms = exports.defaultRuntimeHeaderData = exports.InactiveResponseHeaderKey = exports.TombstoneResponseHeaderKey = exports.DeletedResponseHeaderKey = exports.DefaultSummaryConfiguration = void 0;
|
|
8
8
|
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
9
9
|
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
10
10
|
const internal_1 = require("@fluidframework/container-definitions/internal");
|
|
@@ -33,16 +33,23 @@ const scheduleManager_js_1 = require("./scheduleManager.js");
|
|
|
33
33
|
const index_js_4 = require("./summary/index.js");
|
|
34
34
|
const throttler_js_1 = require("./throttler.js");
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Creates an error object to be thrown / passed to Container's close fn in case of an unknown message type.
|
|
37
37
|
* The parameters are typed to support compile-time enforcement of handling all known types/behaviors
|
|
38
38
|
*
|
|
39
|
-
* @param
|
|
39
|
+
* @param unknownContainerRuntimeMessageType - Typed as something unexpected, to ensure all known types have been
|
|
40
40
|
* handled before calling this function (e.g. in a switch statement).
|
|
41
|
-
*
|
|
41
|
+
*
|
|
42
|
+
* @param codePath - The code path where the unexpected message type was encountered.
|
|
43
|
+
*
|
|
44
|
+
* @param sequencedMessage - The sequenced message that contained the unexpected message type.
|
|
45
|
+
*
|
|
42
46
|
*/
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
function getUnknownMessageTypeError(unknownContainerRuntimeMessageType, codePath, sequencedMessage) {
|
|
48
|
+
return internal_7.DataProcessingError.create("Runtime message of unknown type", codePath, sequencedMessage, {
|
|
49
|
+
messageDetails: {
|
|
50
|
+
type: unknownContainerRuntimeMessageType,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
46
53
|
}
|
|
47
54
|
/**
|
|
48
55
|
* @legacy
|
|
@@ -236,9 +243,10 @@ let getSingleUseLegacyLogCallback = (logger, type) => {
|
|
|
236
243
|
details: { codePath, type },
|
|
237
244
|
});
|
|
238
245
|
// Now that we've logged, prevent future logging (globally).
|
|
239
|
-
getSingleUseLegacyLogCallback = () => () => { };
|
|
246
|
+
exports.getSingleUseLegacyLogCallback = () => () => { };
|
|
240
247
|
};
|
|
241
248
|
};
|
|
249
|
+
exports.getSingleUseLegacyLogCallback = getSingleUseLegacyLogCallback;
|
|
242
250
|
/**
|
|
243
251
|
* This is meant to be used by a {@link @fluidframework/container-definitions#IRuntimeFactory} to instantiate a container runtime.
|
|
244
252
|
* @param params - An object which specifies all required and optional params necessary to instantiate a runtime.
|
|
@@ -1394,22 +1402,9 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
1394
1402
|
// GC op is only sent in summarizer which should never have stashed ops.
|
|
1395
1403
|
throw new internal_7.LoggingError("GC op not expected to be stashed in summarizer");
|
|
1396
1404
|
default: {
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
const compatBehavior = opContents.compatDetails?.behavior;
|
|
1401
|
-
if (!compatBehaviorAllowsMessageType(opContents.type, compatBehavior)) {
|
|
1402
|
-
const error = internal_7.DataProcessingError.create("Stashed runtime message of unexpected type", "applyStashedOp", undefined /* sequencedMessage */, {
|
|
1403
|
-
messageDetails: JSON.stringify({
|
|
1404
|
-
type: opContents.type,
|
|
1405
|
-
compatBehavior,
|
|
1406
|
-
}),
|
|
1407
|
-
});
|
|
1408
|
-
this.closeFn(error);
|
|
1409
|
-
throw error;
|
|
1410
|
-
}
|
|
1411
|
-
// Note: Even if its compat behavior allows it, we don't know how to apply this stashed op.
|
|
1412
|
-
// All we can do is ignore it (similar to on process).
|
|
1405
|
+
const error = getUnknownMessageTypeError(opContents.type, "applyStashedOp" /* codePath */);
|
|
1406
|
+
this.closeFn(error);
|
|
1407
|
+
throw error;
|
|
1413
1408
|
}
|
|
1414
1409
|
}
|
|
1415
1410
|
}
|
|
@@ -1529,9 +1524,12 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
1529
1524
|
// or something different, like a system message.
|
|
1530
1525
|
const hasModernRuntimeMessageEnvelope = messageCopy.type === internal_3.MessageType.Operation;
|
|
1531
1526
|
const savedOp = messageCopy.metadata?.savedOp;
|
|
1532
|
-
const logLegacyCase = getSingleUseLegacyLogCallback(this.logger, messageCopy.type);
|
|
1533
|
-
|
|
1534
|
-
(
|
|
1527
|
+
const logLegacyCase = (0, exports.getSingleUseLegacyLogCallback)(this.logger, messageCopy.type);
|
|
1528
|
+
let runtimeBatch = hasModernRuntimeMessageEnvelope || isUnpackedRuntimeMessage(messageCopy);
|
|
1529
|
+
if (runtimeBatch) {
|
|
1530
|
+
// We expect runtime messages to have JSON contents - deserialize it in place.
|
|
1531
|
+
(0, index_js_3.ensureContentsDeserialized)(messageCopy);
|
|
1532
|
+
}
|
|
1535
1533
|
if (hasModernRuntimeMessageEnvelope) {
|
|
1536
1534
|
// If the message has the modern message envelope, then process it here.
|
|
1537
1535
|
// Here we unpack the message (decompress, unchunk, and/or ungroup) into a batch of messages with ContainerMessageType
|
|
@@ -1560,7 +1558,6 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
1560
1558
|
throw error;
|
|
1561
1559
|
}
|
|
1562
1560
|
}
|
|
1563
|
-
let runtimeBatch = true;
|
|
1564
1561
|
// Reach out to PendingStateManager, either to zip localOpMetadata into the *local* message list,
|
|
1565
1562
|
// or to check to ensure the *remote* messages don't match the batchId of a pending local batch.
|
|
1566
1563
|
// This latter case would indicate that the container has forked - two copies are trying to persist the same local changes.
|
|
@@ -1599,8 +1596,17 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
1599
1596
|
this.processInboundMessages(messagesWithPendingState, locationInBatch, local, savedOp, runtimeBatch);
|
|
1600
1597
|
}
|
|
1601
1598
|
else {
|
|
1599
|
+
if (!runtimeBatch) {
|
|
1600
|
+
// The DeltaManager used to do this, but doesn't anymore as of Loader v2.4
|
|
1601
|
+
// Anyone listening to our "op" event would expect the contents to be parsed per this same logic
|
|
1602
|
+
if (typeof messageCopy.contents === "string" &&
|
|
1603
|
+
messageCopy.contents !== "" &&
|
|
1604
|
+
messageCopy.type !== internal_3.MessageType.ClientLeave) {
|
|
1605
|
+
messageCopy.contents = JSON.parse(messageCopy.contents);
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1602
1608
|
this.processInboundMessages([{ message: messageCopy, localOpMetadata: undefined }], { batchStart: true, batchEnd: true }, // Single message
|
|
1603
|
-
local, savedOp,
|
|
1609
|
+
local, savedOp, runtimeBatch);
|
|
1604
1610
|
}
|
|
1605
1611
|
if (local) {
|
|
1606
1612
|
// If we have processed a local op, this means that the container is
|
|
@@ -1729,23 +1735,9 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
1729
1735
|
this.documentsSchemaController.processDocumentSchemaOp(message.contents, local, message.sequenceNumber);
|
|
1730
1736
|
break;
|
|
1731
1737
|
default: {
|
|
1732
|
-
const
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
// Former assert 0x3ce
|
|
1736
|
-
"Runtime message of unknown type", "OpProcessing", message, {
|
|
1737
|
-
local,
|
|
1738
|
-
messageDetails: JSON.stringify({
|
|
1739
|
-
type: message.type,
|
|
1740
|
-
contentType: typeof message.contents,
|
|
1741
|
-
compatBehavior,
|
|
1742
|
-
batch: message.metadata?.batch,
|
|
1743
|
-
compression: message.compression,
|
|
1744
|
-
}),
|
|
1745
|
-
});
|
|
1746
|
-
this.closeFn(error);
|
|
1747
|
-
throw error;
|
|
1748
|
-
}
|
|
1738
|
+
const error = getUnknownMessageTypeError(message.type, "validateAndProcessRuntimeMessage" /* codePath */, message);
|
|
1739
|
+
this.closeFn(error);
|
|
1740
|
+
throw error;
|
|
1749
1741
|
}
|
|
1750
1742
|
}
|
|
1751
1743
|
this.emit("op", message, true /* runtimeMessage */);
|
|
@@ -2661,7 +2653,7 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
2661
2653
|
contents: idRange,
|
|
2662
2654
|
};
|
|
2663
2655
|
const idAllocationBatchMessage = {
|
|
2664
|
-
contents:
|
|
2656
|
+
contents: (0, index_js_3.serializeOpContents)(idAllocationMessage),
|
|
2665
2657
|
referenceSequenceNumber: this.deltaManager.lastSequenceNumber,
|
|
2666
2658
|
};
|
|
2667
2659
|
this.outbox.submitIdAllocation(idAllocationBatchMessage);
|
|
@@ -2704,12 +2696,12 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
2704
2696
|
contents: schemaChangeMessage,
|
|
2705
2697
|
};
|
|
2706
2698
|
this.outbox.submit({
|
|
2707
|
-
contents:
|
|
2699
|
+
contents: (0, index_js_3.serializeOpContents)(msg),
|
|
2708
2700
|
referenceSequenceNumber: this.deltaManager.lastSequenceNumber,
|
|
2709
2701
|
});
|
|
2710
2702
|
}
|
|
2711
2703
|
const message = {
|
|
2712
|
-
contents:
|
|
2704
|
+
contents: (0, index_js_3.serializeOpContents)(containerRuntimeMessage),
|
|
2713
2705
|
metadata,
|
|
2714
2706
|
localOpMetadata,
|
|
2715
2707
|
referenceSequenceNumber: this.deltaManager.lastSequenceNumber,
|
|
@@ -2853,26 +2845,9 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
2853
2845
|
// send any ops, as some other client already changed schema.
|
|
2854
2846
|
break;
|
|
2855
2847
|
default: {
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
if (compatBehaviorAllowsMessageType(message.type, compatBehavior)) {
|
|
2860
|
-
// We do not ultimately resubmit it, to be consistent with this version of the code.
|
|
2861
|
-
this.logger.sendTelemetryEvent({
|
|
2862
|
-
eventName: "resubmitUnrecognizedMessageTypeAllowed",
|
|
2863
|
-
messageDetails: { type: message.type, compatBehavior },
|
|
2864
|
-
});
|
|
2865
|
-
}
|
|
2866
|
-
else {
|
|
2867
|
-
const error = internal_7.DataProcessingError.create("Resubmitting runtime message of unexpected type", "reSubmitCore", undefined /* sequencedMessage */, {
|
|
2868
|
-
messageDetails: JSON.stringify({
|
|
2869
|
-
type: message.type,
|
|
2870
|
-
compatBehavior,
|
|
2871
|
-
}),
|
|
2872
|
-
});
|
|
2873
|
-
this.closeFn(error);
|
|
2874
|
-
throw error;
|
|
2875
|
-
}
|
|
2848
|
+
const error = getUnknownMessageTypeError(message.type, "reSubmitCore" /* codePath */);
|
|
2849
|
+
this.closeFn(error);
|
|
2850
|
+
throw error;
|
|
2876
2851
|
}
|
|
2877
2852
|
}
|
|
2878
2853
|
}
|