@fluidframework/container-runtime 2.4.0 → 2.5.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 +18 -0
- package/api-report/container-runtime.legacy.alpha.api.md +3 -1
- package/container-runtime.test-files.tar +0 -0
- package/dist/blobManager/blobManager.d.ts +3 -3
- package/dist/blobManager/blobManager.d.ts.map +1 -1
- package/dist/blobManager/blobManager.js +1 -1
- package/dist/blobManager/blobManager.js.map +1 -1
- package/dist/channelCollection.d.ts +20 -5
- package/dist/channelCollection.d.ts.map +1 -1
- package/dist/channelCollection.js +183 -119
- package/dist/channelCollection.js.map +1 -1
- package/dist/containerRuntime.d.ts +12 -4
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +155 -66
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStoreContext.d.ts +15 -3
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +48 -19
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +5 -6
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +23 -22
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +2 -2
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +3 -0
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +9 -0
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts +1 -0
- package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.js +2 -0
- package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/dist/opProperties.js +1 -1
- package/dist/opProperties.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/summary/documentSchema.d.ts +11 -0
- package/dist/summary/documentSchema.d.ts.map +1 -1
- package/dist/summary/documentSchema.js +45 -30
- package/dist/summary/documentSchema.js.map +1 -1
- package/lib/blobManager/blobManager.d.ts +3 -3
- package/lib/blobManager/blobManager.d.ts.map +1 -1
- package/lib/blobManager/blobManager.js +1 -1
- package/lib/blobManager/blobManager.js.map +1 -1
- package/lib/channelCollection.d.ts +20 -5
- package/lib/channelCollection.d.ts.map +1 -1
- package/lib/channelCollection.js +183 -119
- package/lib/channelCollection.js.map +1 -1
- package/lib/containerRuntime.d.ts +12 -4
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +155 -66
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStoreContext.d.ts +15 -3
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +48 -19
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts +5 -6
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +23 -22
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +2 -2
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts +3 -0
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +9 -0
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts +1 -0
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.js +2 -0
- package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/lib/opProperties.js +1 -1
- package/lib/opProperties.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/summary/documentSchema.d.ts +11 -0
- package/lib/summary/documentSchema.d.ts.map +1 -1
- package/lib/summary/documentSchema.js +45 -30
- package/lib/summary/documentSchema.js.map +1 -1
- package/package.json +24 -24
- package/src/blobManager/blobManager.ts +2 -2
- package/src/channelCollection.ts +227 -160
- package/src/containerRuntime.ts +197 -80
- package/src/dataStoreContext.ts +66 -23
- package/src/gc/garbageCollection.ts +32 -32
- package/src/gc/gcDefinitions.ts +3 -3
- package/src/opLifecycle/outbox.ts +12 -0
- package/src/opLifecycle/remoteMessageProcessor.ts +3 -0
- package/src/opProperties.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/summary/documentSchema.ts +58 -39
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelCollection.d.ts","sourceRoot":"","sources":["../src/channelCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EACN,WAAW,EACX,WAAW,EACX,QAAQ,EACR,SAAS,EACT,oBAAoB,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAGrF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAC7E,OAAO,EACN,aAAa,EACb,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AAMrD,OAAO,EACN,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,WAAW,EAGX,SAAS,EACT,sBAAsB,EACtB,sBAAsB,EACtB,8BAA8B,EAC9B,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"channelCollection.d.ts","sourceRoot":"","sources":["../src/channelCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EACN,WAAW,EACX,WAAW,EACX,QA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AShC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAGlC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAVtB,SAAgB,IAAI,8BAA8B;IAE3C,uBAAuB,EAAE,uBAAuB,CAAC;gBAGvD,eAAe,EAAE,kCAAkC,EAElC,iBAAiB,EAAE,CACnC,OAAO,EAAE,sBAAsB,KAC3B,OAAO,CAAC,WAAW,CAAC,EACR,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,qBAAqB,CAAC,OAAO,iBAAiB,CAAC,KAAK,CAAC;IAKvF,IAAW,sBAAsB,SAEhC;IAEY,oBAAoB,CAChC,OAAO,EAAE,sBAAsB,EAC/B,SAAS,EAAE,OAAO,GAChB,OAAO,CAAC,sBAAsB,CAAC;CAalC"}
|
package/lib/channelCollection.js
CHANGED
|
@@ -251,87 +251,93 @@ export class ChannelCollection {
|
|
|
251
251
|
makeVisibleAndAttachGraph() {
|
|
252
252
|
this.parentContext.makeLocallyVisible();
|
|
253
253
|
}
|
|
254
|
-
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
//
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
// Allows longitudinal tracking of various state (e.g. foundGCData), and some sampled details
|
|
264
|
-
if (this.shouldSendAttachLog) {
|
|
265
|
-
this.shouldSendAttachLog = false;
|
|
266
|
-
this.mc.logger.sendTelemetryEvent({
|
|
267
|
-
eventName: "dataStoreAttachMessage_sampled",
|
|
268
|
-
...tagCodeArtifacts({ id: attachMessage.id, pkg: attachMessage.type }),
|
|
269
|
-
details: {
|
|
270
|
-
local,
|
|
271
|
-
snapshot: !!attachMessage.snapshot,
|
|
272
|
-
foundGCData,
|
|
273
|
-
},
|
|
274
|
-
...extractSafePropertiesFromMessage(message),
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
// The local object has already been attached
|
|
278
|
-
if (local) {
|
|
279
|
-
assert(this.pendingAttach.has(attachMessage.id), 0x15e /* "Local object does not have matching attach message id" */);
|
|
280
|
-
this.contexts.get(attachMessage.id)?.setAttachState(AttachState.Attached);
|
|
281
|
-
this.pendingAttach.delete(attachMessage.id);
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
// If a non-local operation then go and create the object, otherwise mark it as officially attached.
|
|
285
|
-
if (this.alreadyProcessed(attachMessage.id)) {
|
|
286
|
-
// TODO: dataStoreId may require a different tag from PackageData #7488
|
|
287
|
-
const error = new DataCorruptionError(
|
|
288
|
-
// pre-0.58 error message: duplicateDataStoreCreatedWithExistingId
|
|
289
|
-
"Duplicate DataStore created with existing id", {
|
|
290
|
-
...extractSafePropertiesFromMessage(message),
|
|
291
|
-
...tagCodeArtifacts({ dataStoreId: attachMessage.id }),
|
|
254
|
+
processAttachMessages(messageCollection) {
|
|
255
|
+
const { envelope, messagesContent, local } = messageCollection;
|
|
256
|
+
for (const { contents } of messagesContent) {
|
|
257
|
+
const attachMessage = contents;
|
|
258
|
+
// We need to process the GC Data for both local and remote attach messages
|
|
259
|
+
const foundGCData = processAttachMessageGCData(attachMessage.snapshot, (nodeId, toPath) => {
|
|
260
|
+
// nodeId is the relative path under the node being attached. Always starts with "/", but no trailing "/" after an id
|
|
261
|
+
const fromPath = `/${attachMessage.id}${nodeId === "/" ? "" : nodeId}`;
|
|
262
|
+
this.parentContext.addedGCOutboundRoute(fromPath, toPath, envelope.timestamp);
|
|
292
263
|
});
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
264
|
+
// Only log once per container to avoid noise/cost.
|
|
265
|
+
// Allows longitudinal tracking of various state (e.g. foundGCData), and some sampled details
|
|
266
|
+
if (this.shouldSendAttachLog) {
|
|
267
|
+
this.shouldSendAttachLog = false;
|
|
268
|
+
this.mc.logger.sendTelemetryEvent({
|
|
269
|
+
eventName: "dataStoreAttachMessage_sampled",
|
|
270
|
+
...tagCodeArtifacts({ id: attachMessage.id, pkg: attachMessage.type }),
|
|
271
|
+
details: {
|
|
272
|
+
local,
|
|
273
|
+
snapshot: !!attachMessage.snapshot,
|
|
274
|
+
foundGCData,
|
|
275
|
+
},
|
|
276
|
+
...extractSafePropertiesFromMessage(envelope),
|
|
277
|
+
});
|
|
301
278
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
279
|
+
// The local object has already been attached
|
|
280
|
+
if (local) {
|
|
281
|
+
assert(this.pendingAttach.has(attachMessage.id), 0x15e /* "Local object does not have matching attach message id" */);
|
|
282
|
+
this.contexts.get(attachMessage.id)?.setAttachState(AttachState.Attached);
|
|
283
|
+
this.pendingAttach.delete(attachMessage.id);
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
// If a non-local operation then go and create the object, otherwise mark it as officially attached.
|
|
287
|
+
if (this.alreadyProcessed(attachMessage.id)) {
|
|
288
|
+
// TODO: dataStoreId may require a different tag from PackageData #7488
|
|
289
|
+
const error = new DataCorruptionError(
|
|
290
|
+
// pre-0.58 error message: duplicateDataStoreCreatedWithExistingId
|
|
291
|
+
"Duplicate DataStore created with existing id", {
|
|
292
|
+
...extractSafePropertiesFromMessage(envelope),
|
|
293
|
+
...tagCodeArtifacts({ dataStoreId: attachMessage.id }),
|
|
294
|
+
});
|
|
295
|
+
throw error;
|
|
296
|
+
}
|
|
297
|
+
const flatAttachBlobs = new Map();
|
|
298
|
+
let snapshot;
|
|
299
|
+
if (attachMessage.snapshot) {
|
|
300
|
+
snapshot = buildSnapshotTree(attachMessage.snapshot.entries, flatAttachBlobs);
|
|
301
|
+
if (isInstanceOfISnapshot(this.baseSnapshot)) {
|
|
302
|
+
snapshot = { ...this.baseSnapshot, snapshotTree: snapshot };
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
// Include the type of attach message which is the pkg of the store to be
|
|
306
|
+
// used by RemoteFluidDataStoreContext in case it is not in the snapshot.
|
|
307
|
+
const pkg = [attachMessage.type];
|
|
308
|
+
const remoteFluidDataStoreContext = new RemoteFluidDataStoreContext({
|
|
309
|
+
id: attachMessage.id,
|
|
310
|
+
snapshot,
|
|
311
|
+
parentContext: this.wrapContextForInnerChannel(attachMessage.id),
|
|
312
|
+
storage: new StorageServiceWithAttachBlobs(this.parentContext.storage, flatAttachBlobs),
|
|
313
|
+
scope: this.parentContext.scope,
|
|
314
|
+
loadingGroupId: attachMessage.snapshot?.groupId,
|
|
315
|
+
createSummarizerNodeFn: this.parentContext.getCreateChildSummarizerNodeFn(attachMessage.id, {
|
|
316
|
+
type: CreateSummarizerNodeSource.FromAttach,
|
|
317
|
+
sequenceNumber: envelope.sequenceNumber,
|
|
318
|
+
snapshot: attachMessage.snapshot ?? {
|
|
319
|
+
entries: [createAttributesBlob(pkg, true /* isRootDataStore */)],
|
|
320
|
+
},
|
|
321
|
+
}),
|
|
322
|
+
pkg,
|
|
329
323
|
});
|
|
324
|
+
this.contexts.addBoundOrRemoted(remoteFluidDataStoreContext);
|
|
330
325
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
326
|
+
}
|
|
327
|
+
processAliasMessages(messageCollection) {
|
|
328
|
+
const { envelope, messagesContent, local } = messageCollection;
|
|
329
|
+
for (const { contents, localOpMetadata } of messagesContent) {
|
|
330
|
+
const aliasMessage = contents;
|
|
331
|
+
if (!isDataStoreAliasMessage(aliasMessage)) {
|
|
332
|
+
throw new DataCorruptionError("malformedDataStoreAliasMessage", {
|
|
333
|
+
...extractSafePropertiesFromMessage(envelope),
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
const resolve = localOpMetadata;
|
|
337
|
+
const aliasResult = this.processAliasMessageCore(aliasMessage.internalId, aliasMessage.alias, envelope.timestamp);
|
|
338
|
+
if (local) {
|
|
339
|
+
resolve(aliasResult);
|
|
340
|
+
}
|
|
335
341
|
}
|
|
336
342
|
}
|
|
337
343
|
processAliasMessageCore(internalId, alias, messageTimestampMs) {
|
|
@@ -578,58 +584,116 @@ export class ChannelCollection {
|
|
|
578
584
|
this.pendingAttach.set(message.id, message);
|
|
579
585
|
}
|
|
580
586
|
}
|
|
581
|
-
|
|
582
|
-
|
|
587
|
+
/**
|
|
588
|
+
* Process messages for this channel collection. The messages here are contiguous messages in a batch.
|
|
589
|
+
* @param messageCollection - The collection of messages to process.
|
|
590
|
+
*/
|
|
591
|
+
processMessages(messageCollection) {
|
|
592
|
+
switch (messageCollection.envelope.type) {
|
|
593
|
+
case ContainerMessageType.FluidDataStoreOp:
|
|
594
|
+
this.processChannelMessages(messageCollection);
|
|
595
|
+
break;
|
|
583
596
|
case ContainerMessageType.Attach:
|
|
584
|
-
this.
|
|
585
|
-
|
|
597
|
+
this.processAttachMessages(messageCollection);
|
|
598
|
+
break;
|
|
586
599
|
case ContainerMessageType.Alias:
|
|
587
|
-
this.
|
|
588
|
-
return;
|
|
589
|
-
case ContainerMessageType.FluidDataStoreOp: {
|
|
590
|
-
const envelope = message.contents;
|
|
591
|
-
const innerContents = envelope.contents;
|
|
592
|
-
const transformed = {
|
|
593
|
-
...message,
|
|
594
|
-
type: innerContents.type,
|
|
595
|
-
contents: innerContents.content,
|
|
596
|
-
};
|
|
597
|
-
this.processChannelOp(envelope.address, transformed, local, localMessageMetadata);
|
|
598
|
-
// Notify GC of any outbound references that were added by this op.
|
|
599
|
-
detectOutboundReferences(envelope.address, transformed.contents, (fromPath, toPath) => this.parentContext.addedGCOutboundRoute(fromPath, toPath, message.timestamp));
|
|
600
|
+
this.processAliasMessages(messageCollection);
|
|
600
601
|
break;
|
|
601
|
-
}
|
|
602
602
|
default:
|
|
603
603
|
assert(false, 0x8e9 /* unreached */);
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
606
|
+
/**
|
|
607
|
+
* This is still here for back-compat purposes because channel collection implements
|
|
608
|
+
* IFluidDataStoreChannel. Once it is removed from the interface, this method can be removed.
|
|
609
|
+
* Container runtime calls `processMessages` instead.
|
|
610
|
+
*/
|
|
611
|
+
process(message, local, localOpMetadata) {
|
|
612
|
+
this.processMessages({
|
|
613
|
+
envelope: message,
|
|
614
|
+
messagesContent: [
|
|
615
|
+
{
|
|
616
|
+
contents: message.contents,
|
|
617
|
+
localOpMetadata,
|
|
618
|
+
clientSequenceNumber: message.clientSequenceNumber,
|
|
619
|
+
},
|
|
620
|
+
],
|
|
621
|
+
local,
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Process channel messages. The messages here are contiguous channel type messages in a batch. Bunch
|
|
626
|
+
* of contiguous messages for a data store should be sent to it together.
|
|
627
|
+
* @param messageCollection - The collection of messages to process.
|
|
628
|
+
*/
|
|
629
|
+
processChannelMessages(messageCollection) {
|
|
630
|
+
const { messagesContent, local } = messageCollection;
|
|
631
|
+
let currentMessageState;
|
|
632
|
+
let currentMessagesContent = [];
|
|
633
|
+
// Helper that sends the current bunch of messages to the data store. It validates that the data stores exists.
|
|
634
|
+
const sendBunchedMessages = () => {
|
|
635
|
+
// Current message state will be undefined for the first message in the list.
|
|
636
|
+
if (currentMessageState === undefined) {
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
const currentContext = this.contexts.get(currentMessageState.address);
|
|
640
|
+
assert(!!currentContext, 0xa66 /* Context not found */);
|
|
641
|
+
currentContext.processMessages({
|
|
642
|
+
envelope: { ...messageCollection.envelope, type: currentMessageState.type },
|
|
643
|
+
messagesContent: currentMessagesContent,
|
|
616
644
|
local,
|
|
617
|
-
messageDetails: JSON.stringify({
|
|
618
|
-
type: message.type,
|
|
619
|
-
contentType: typeof message.contents,
|
|
620
|
-
}),
|
|
621
|
-
...tagCodeArtifacts({ address }),
|
|
622
645
|
});
|
|
646
|
+
currentMessagesContent = [];
|
|
647
|
+
};
|
|
648
|
+
/**
|
|
649
|
+
* Bunch contiguous messages for the same data store and send them together.
|
|
650
|
+
* This is an optimization mainly for DDSes, where it can process a bunch of ops together. DDSes
|
|
651
|
+
* like merge tree or shared tree can process ops more efficiently when they are bunched together.
|
|
652
|
+
*/
|
|
653
|
+
for (const { contents, ...restOfMessagesContent } of messagesContent) {
|
|
654
|
+
const contentsEnvelope = contents;
|
|
655
|
+
const address = contentsEnvelope.address;
|
|
656
|
+
const context = this.contexts.get(address);
|
|
657
|
+
// If the data store has been deleted, log an error and ignore this message. This helps prevent document
|
|
658
|
+
// corruption in case a deleted data store accidentally submitted an op.
|
|
659
|
+
if (this.checkAndLogIfDeleted(address, context, "Changed", "processFluidDataStoreOp")) {
|
|
660
|
+
continue;
|
|
661
|
+
}
|
|
662
|
+
if (context === undefined) {
|
|
663
|
+
// Former assert 0x162
|
|
664
|
+
throw DataProcessingError.create("No context for op", "processFluidDataStoreOp", messageCollection.envelope, {
|
|
665
|
+
local,
|
|
666
|
+
messageDetails: JSON.stringify({
|
|
667
|
+
type: messageCollection.envelope.type,
|
|
668
|
+
contentType: typeof contents,
|
|
669
|
+
}),
|
|
670
|
+
...tagCodeArtifacts({ address }),
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
const { type: contextType, content: contextContents } = contentsEnvelope.contents;
|
|
674
|
+
// If the address or type of the message changes while processing the message, send the current bunch.
|
|
675
|
+
if (currentMessageState?.address !== address ||
|
|
676
|
+
currentMessageState?.type !== contextType) {
|
|
677
|
+
sendBunchedMessages();
|
|
678
|
+
}
|
|
679
|
+
currentMessagesContent.push({
|
|
680
|
+
contents: contextContents,
|
|
681
|
+
...restOfMessagesContent,
|
|
682
|
+
});
|
|
683
|
+
currentMessageState = { address, type: contextType };
|
|
684
|
+
// Notify that a GC node for the data store changed. This is used to detect if a deleted data store is
|
|
685
|
+
// being used.
|
|
686
|
+
this.gcNodeUpdated({
|
|
687
|
+
node: { type: "DataStore", path: `/${address}` },
|
|
688
|
+
reason: "Changed",
|
|
689
|
+
timestampMs: messageCollection.envelope.timestamp,
|
|
690
|
+
packagePath: context.isLoaded ? context.packagePath : undefined,
|
|
691
|
+
});
|
|
692
|
+
detectOutboundReferences(address, contextContents, (fromPath, toPath) => this.parentContext.addedGCOutboundRoute(fromPath, toPath, messageCollection.envelope.timestamp));
|
|
623
693
|
}
|
|
624
|
-
|
|
625
|
-
//
|
|
626
|
-
|
|
627
|
-
this.gcNodeUpdated({
|
|
628
|
-
node: { type: "DataStore", path: `/${address}` },
|
|
629
|
-
reason: "Changed",
|
|
630
|
-
timestampMs: message.timestamp,
|
|
631
|
-
packagePath: context.isLoaded ? context.packagePath : undefined,
|
|
632
|
-
});
|
|
694
|
+
// Process the last bunch of messages, if any. Note that there may not be any messages in case all of them are
|
|
695
|
+
// ignored because the data store is deleted.
|
|
696
|
+
sendBunchedMessages();
|
|
633
697
|
}
|
|
634
698
|
async getDataStore(id, requestHeaderData, originalRequest) {
|
|
635
699
|
const headerData = { ...defaultRuntimeHeaderData, ...requestHeaderData };
|