@fluidframework/datastore 2.41.0-338401 → 2.42.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 +1 -4
- package/CHANGELOG.md +8 -0
- package/dist/channelContext.d.ts +7 -5
- package/dist/channelContext.d.ts.map +1 -1
- package/dist/channelContext.js +3 -1
- package/dist/channelContext.js.map +1 -1
- package/dist/channelDeltaConnection.d.ts +5 -5
- package/dist/channelDeltaConnection.d.ts.map +1 -1
- package/dist/channelDeltaConnection.js +7 -6
- package/dist/channelDeltaConnection.js.map +1 -1
- package/dist/channelStorageService.js +2 -2
- package/dist/channelStorageService.js.map +1 -1
- package/dist/dataStoreRuntime.d.ts +20 -0
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/dataStoreRuntime.js +125 -48
- package/dist/dataStoreRuntime.js.map +1 -1
- package/dist/fluidHandle.d.ts.map +1 -1
- package/dist/fluidHandle.js +6 -2
- package/dist/fluidHandle.js.map +1 -1
- package/dist/localChannelContext.d.ts +8 -6
- package/dist/localChannelContext.d.ts.map +1 -1
- package/dist/localChannelContext.js +8 -6
- package/dist/localChannelContext.js.map +1 -1
- package/dist/localChannelStorageService.d.ts.map +1 -1
- package/dist/localChannelStorageService.js +6 -4
- package/dist/localChannelStorageService.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/remoteChannelContext.d.ts +7 -5
- package/dist/remoteChannelContext.d.ts.map +1 -1
- package/dist/remoteChannelContext.js +5 -4
- package/dist/remoteChannelContext.js.map +1 -1
- package/lib/channelContext.d.ts +7 -5
- package/lib/channelContext.d.ts.map +1 -1
- package/lib/channelContext.js +3 -1
- package/lib/channelContext.js.map +1 -1
- package/lib/channelDeltaConnection.d.ts +5 -5
- package/lib/channelDeltaConnection.d.ts.map +1 -1
- package/lib/channelDeltaConnection.js +7 -6
- package/lib/channelDeltaConnection.js.map +1 -1
- package/lib/channelStorageService.js +2 -2
- package/lib/channelStorageService.js.map +1 -1
- package/lib/dataStoreRuntime.d.ts +20 -0
- package/lib/dataStoreRuntime.d.ts.map +1 -1
- package/lib/dataStoreRuntime.js +125 -48
- package/lib/dataStoreRuntime.js.map +1 -1
- package/lib/fluidHandle.d.ts.map +1 -1
- package/lib/fluidHandle.js +6 -2
- package/lib/fluidHandle.js.map +1 -1
- package/lib/localChannelContext.d.ts +8 -6
- package/lib/localChannelContext.d.ts.map +1 -1
- package/lib/localChannelContext.js +8 -6
- package/lib/localChannelContext.js.map +1 -1
- package/lib/localChannelStorageService.d.ts.map +1 -1
- package/lib/localChannelStorageService.js +6 -4
- package/lib/localChannelStorageService.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/remoteChannelContext.d.ts +7 -5
- package/lib/remoteChannelContext.d.ts.map +1 -1
- package/lib/remoteChannelContext.js +5 -4
- package/lib/remoteChannelContext.js.map +1 -1
- package/package.json +16 -16
- package/src/channelContext.ts +7 -5
- package/src/channelDeltaConnection.ts +19 -19
- package/src/channelStorageService.ts +3 -3
- package/src/dataStoreRuntime.ts +174 -75
- package/src/fluidHandle.ts +7 -3
- package/src/localChannelContext.ts +18 -16
- package/src/localChannelStorageService.ts +6 -4
- package/src/packageVersion.ts +1 -1
- package/src/remoteChannelContext.ts +19 -19
package/dist/dataStoreRuntime.js
CHANGED
|
@@ -37,6 +37,21 @@ var DataStoreMessageType;
|
|
|
37
37
|
const defaultPolicies = {
|
|
38
38
|
readonlyInStagingMode: true,
|
|
39
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Set up the boxed pendingOpCount value.
|
|
42
|
+
*/
|
|
43
|
+
function initializePendingOpCount() {
|
|
44
|
+
let value = 0;
|
|
45
|
+
return {
|
|
46
|
+
get value() {
|
|
47
|
+
return value;
|
|
48
|
+
},
|
|
49
|
+
set value(newValue) {
|
|
50
|
+
(0, internal_1.assert)(newValue >= 0, 0xbbd /* pendingOpCount must be non-negative */);
|
|
51
|
+
value = newValue;
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
40
55
|
/**
|
|
41
56
|
* Base data store class
|
|
42
57
|
* @legacy
|
|
@@ -67,6 +82,8 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
67
82
|
get idCompressor() {
|
|
68
83
|
return this.dataStoreContext.idCompressor;
|
|
69
84
|
}
|
|
85
|
+
// TODO: the methods below should have more specific return typing, per the interfaces they are implementing.
|
|
86
|
+
// Doing so would be a breaking change.
|
|
70
87
|
get IFluidHandleContext() {
|
|
71
88
|
return this;
|
|
72
89
|
}
|
|
@@ -121,6 +138,11 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
121
138
|
* is currently marked as legacy alpha. So, using unknown here.
|
|
122
139
|
*/
|
|
123
140
|
this.ILayerCompatDetails = dataStoreLayerCompatState_js_1.dataStoreCompatDetailsForRuntime;
|
|
141
|
+
/**
|
|
142
|
+
* Count of pending ops that have been submitted but not yet ack'd.
|
|
143
|
+
* Used to compute {@link FluidDataStoreRuntime.isDirty}
|
|
144
|
+
*/
|
|
145
|
+
this.pendingOpCount = initializePendingOpCount();
|
|
124
146
|
(0, internal_1.assert)(!dataStoreContext.id.includes("/"), 0x30e /* Id cannot contain slashes. DataStoreContext should have validated this. */);
|
|
125
147
|
this.policies = { ...defaultPolicies, ...policies };
|
|
126
148
|
// Validate that the Runtime is compatible with this DataStore.
|
|
@@ -151,10 +173,10 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
151
173
|
const tree = dataStoreContext.baseSnapshot;
|
|
152
174
|
// Must always receive the data store type inside of the attributes
|
|
153
175
|
if (tree?.trees !== undefined) {
|
|
154
|
-
Object.entries(tree.trees)
|
|
176
|
+
for (const [path, subtree] of Object.entries(tree.trees)) {
|
|
155
177
|
// Issue #4414
|
|
156
178
|
if (path === "_search") {
|
|
157
|
-
|
|
179
|
+
continue;
|
|
158
180
|
}
|
|
159
181
|
let channelContext;
|
|
160
182
|
// If already exists on storage, then create a remote channel. However, if it is case of rehydrating a
|
|
@@ -166,11 +188,11 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
166
188
|
// data store, if the data store is loaded after the container is attached, then we missed making
|
|
167
189
|
// the channel visible. So do it now. Otherwise, add it to local channel context queue, so
|
|
168
190
|
// that it can be make it visible later with the data store.
|
|
169
|
-
if (dataStoreContext.attachState
|
|
170
|
-
|
|
191
|
+
if (dataStoreContext.attachState === container_definitions_1.AttachState.Detached) {
|
|
192
|
+
this.localChannelContextQueue.set(path, channelContext);
|
|
171
193
|
}
|
|
172
194
|
else {
|
|
173
|
-
|
|
195
|
+
channelContext.makeVisible();
|
|
174
196
|
}
|
|
175
197
|
}
|
|
176
198
|
else {
|
|
@@ -179,7 +201,7 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
179
201
|
}));
|
|
180
202
|
}
|
|
181
203
|
this.contexts.set(path, channelContext);
|
|
182
|
-
}
|
|
204
|
+
}
|
|
183
205
|
}
|
|
184
206
|
this.entryPoint = new fluidHandle_js_1.FluidObjectHandle(new internal_1.LazyPromise(async () => provideEntryPoint(this)), "", this.objectsRoutingContext);
|
|
185
207
|
this.attachListener();
|
|
@@ -210,17 +232,27 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
210
232
|
// By default, a data store can log maximum 10 local changes telemetry in summarizer.
|
|
211
233
|
this.localChangesTelemetryCount =
|
|
212
234
|
this.mc.config.getNumber("Fluid.Telemetry.LocalChangesTelemetryCount") ?? 10;
|
|
235
|
+
// Reference these properties to avoid unused private member errors.
|
|
236
|
+
// They're accessed via IFluidDataStoreRuntimeExperimental interface.
|
|
237
|
+
// eslint-disable-next-line no-void
|
|
238
|
+
void [this.inStagingMode, this.isDirty];
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Implementation of IFluidDataStoreRuntimeExperimental.inStagingMode
|
|
242
|
+
*/
|
|
243
|
+
// eslint-disable-next-line import/no-deprecated
|
|
244
|
+
get inStagingMode() {
|
|
245
|
+
return (
|
|
213
246
|
// eslint-disable-next-line import/no-deprecated
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
247
|
+
this.dataStoreContext.containerRuntime
|
|
248
|
+
?.inStagingMode);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Implementation of IFluidDataStoreRuntimeExperimental.isDirty
|
|
252
|
+
*/
|
|
253
|
+
// eslint-disable-next-line import/no-deprecated
|
|
254
|
+
get isDirty() {
|
|
255
|
+
return this.pendingOpCount.value > 0;
|
|
224
256
|
}
|
|
225
257
|
get deltaManager() {
|
|
226
258
|
return (0, internal_4.toDeltaManagerErased)(this.deltaManagerInternal);
|
|
@@ -321,11 +353,7 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
321
353
|
}
|
|
322
354
|
createChannel(idArg, type) {
|
|
323
355
|
let id;
|
|
324
|
-
if (idArg
|
|
325
|
-
id = idArg;
|
|
326
|
-
this.validateChannelId(id);
|
|
327
|
-
}
|
|
328
|
-
else {
|
|
356
|
+
if (idArg === undefined) {
|
|
329
357
|
/**
|
|
330
358
|
* Return uuid if short-ids are explicitly disabled via feature flags.
|
|
331
359
|
*/
|
|
@@ -339,19 +367,23 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
339
367
|
// - uuids
|
|
340
368
|
// In first two cases we will encode result as strings in more compact form, with leading underscore,
|
|
341
369
|
// to ensure no overlap with user-provided DDS names (see validateChannelId())
|
|
342
|
-
if (this.visibilityState
|
|
343
|
-
// container is detached, only one client observes content, no way to hit collisions with other clients.
|
|
344
|
-
id = (0, internal_4.encodeCompactIdToString)(2 * this.contexts.size, "_");
|
|
345
|
-
}
|
|
346
|
-
else {
|
|
370
|
+
if (this.visibilityState === internal_3.VisibilityState.GloballyVisible) {
|
|
347
371
|
// Due to back-compat, we could not depend yet on generateDocumentUniqueId() being there.
|
|
348
372
|
// We can remove the need to leverage uuid() as fall-back in couple releases.
|
|
349
373
|
const res = this.dataStoreContext.containerRuntime.generateDocumentUniqueId?.() ?? (0, uuid_1.v4)();
|
|
350
374
|
id = typeof res === "number" ? (0, internal_4.encodeCompactIdToString)(2 * res + 1, "_") : res;
|
|
351
375
|
}
|
|
376
|
+
else {
|
|
377
|
+
// container is detached, only one client observes content, no way to hit collisions with other clients.
|
|
378
|
+
id = (0, internal_4.encodeCompactIdToString)(2 * this.contexts.size, "_");
|
|
379
|
+
}
|
|
352
380
|
}
|
|
353
381
|
(0, internal_1.assert)(!id.includes("/"), 0x8fc /* slash */);
|
|
354
382
|
}
|
|
383
|
+
else {
|
|
384
|
+
id = idArg;
|
|
385
|
+
this.validateChannelId(id);
|
|
386
|
+
}
|
|
355
387
|
this.verifyNotClosed();
|
|
356
388
|
(0, internal_1.assert)(!this.contexts.has(id), 0x179 /* "createChannel() with existing ID" */);
|
|
357
389
|
(0, internal_1.assert)(type !== undefined, 0x209 /* "Factory Type should be defined" */);
|
|
@@ -415,9 +447,9 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
415
447
|
return;
|
|
416
448
|
}
|
|
417
449
|
this.visibilityState = internal_3.VisibilityState.LocallyVisible;
|
|
418
|
-
this.pendingHandlesToMakeVisible
|
|
450
|
+
for (const handle of this.pendingHandlesToMakeVisible) {
|
|
419
451
|
handle.attachGraph();
|
|
420
|
-
}
|
|
452
|
+
}
|
|
421
453
|
this.pendingHandlesToMakeVisible.clear();
|
|
422
454
|
this.dataStoreContext.makeLocallyVisible();
|
|
423
455
|
}
|
|
@@ -483,7 +515,7 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
483
515
|
*/
|
|
484
516
|
let currentAddress;
|
|
485
517
|
let currentMessagesContent = [];
|
|
486
|
-
const { messagesContent, local } = messageCollection;
|
|
518
|
+
const { messagesContent, local, envelope } = messageCollection;
|
|
487
519
|
const sendBunchedMessages = () => {
|
|
488
520
|
// Current address will be undefined for the first message in the list.
|
|
489
521
|
if (currentAddress === undefined) {
|
|
@@ -493,7 +525,7 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
493
525
|
const channelContext = this.contexts.get(currentAddress);
|
|
494
526
|
(0, internal_1.assert)(!!channelContext, 0xa6b /* Channel context not found */);
|
|
495
527
|
channelContext.processMessages({
|
|
496
|
-
envelope
|
|
528
|
+
envelope,
|
|
497
529
|
messagesContent: currentMessagesContent,
|
|
498
530
|
local,
|
|
499
531
|
});
|
|
@@ -548,15 +580,20 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
548
580
|
*/
|
|
549
581
|
processMessages(messageCollection) {
|
|
550
582
|
this.verifyNotClosed();
|
|
551
|
-
const { envelope, messagesContent } = messageCollection;
|
|
583
|
+
const { envelope, local, messagesContent } = messageCollection;
|
|
584
|
+
if (local) {
|
|
585
|
+
this.pendingOpCount.value -= messagesContent.length;
|
|
586
|
+
}
|
|
552
587
|
try {
|
|
553
588
|
switch (envelope.type) {
|
|
554
|
-
case DataStoreMessageType.ChannelOp:
|
|
589
|
+
case DataStoreMessageType.ChannelOp: {
|
|
555
590
|
this.processChannelMessages(messageCollection);
|
|
556
591
|
break;
|
|
557
|
-
|
|
592
|
+
}
|
|
593
|
+
case DataStoreMessageType.Attach: {
|
|
558
594
|
this.processAttachMessages(messageCollection);
|
|
559
595
|
break;
|
|
596
|
+
}
|
|
560
597
|
default:
|
|
561
598
|
}
|
|
562
599
|
}
|
|
@@ -758,7 +795,10 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
758
795
|
}
|
|
759
796
|
}
|
|
760
797
|
}
|
|
761
|
-
submitMessage(type,
|
|
798
|
+
submitMessage(type,
|
|
799
|
+
// TODO: use something other than `any` here (breaking change)
|
|
800
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
801
|
+
content, localOpMetadata) {
|
|
762
802
|
this.submit(type, content, localOpMetadata);
|
|
763
803
|
}
|
|
764
804
|
/**
|
|
@@ -769,7 +809,7 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
769
809
|
*/
|
|
770
810
|
submitSignal(type, content, targetClientId) {
|
|
771
811
|
this.verifyNotClosed();
|
|
772
|
-
|
|
812
|
+
this.dataStoreContext.submitSignal(type, content, targetClientId);
|
|
773
813
|
}
|
|
774
814
|
/**
|
|
775
815
|
* Will return when the data store is attached.
|
|
@@ -813,6 +853,7 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
813
853
|
submit(type, content, localOpMetadata = undefined) {
|
|
814
854
|
this.verifyNotClosed();
|
|
815
855
|
this.dataStoreContext.submitMessage(type, content, localOpMetadata);
|
|
856
|
+
++this.pendingOpCount.value;
|
|
816
857
|
}
|
|
817
858
|
/**
|
|
818
859
|
* For messages of type MessageType.Operation, finds the right channel and asks it to resubmit the message.
|
|
@@ -821,8 +862,14 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
821
862
|
* @param content - The content of the original message.
|
|
822
863
|
* @param localOpMetadata - The local metadata associated with the original message.
|
|
823
864
|
*/
|
|
824
|
-
reSubmit(type,
|
|
865
|
+
reSubmit(type,
|
|
866
|
+
// TODO: use something other than `any` here (breaking change)
|
|
867
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
868
|
+
content, localOpMetadata, squash) {
|
|
825
869
|
this.verifyNotClosed();
|
|
870
|
+
// The op being resubmitted was not / will not be submitted, so decrement the count.
|
|
871
|
+
// The calls below may result in one or more ops submitted again, which will increment the count (or not if nothing needs to be submitted anymore).
|
|
872
|
+
--this.pendingOpCount.value;
|
|
826
873
|
switch (type) {
|
|
827
874
|
case DataStoreMessageType.ChannelOp: {
|
|
828
875
|
// For Operations, find the right channel and trigger resubmission on it.
|
|
@@ -832,12 +879,14 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
832
879
|
channelContext.reSubmit(envelope.contents, localOpMetadata, squash);
|
|
833
880
|
break;
|
|
834
881
|
}
|
|
835
|
-
case DataStoreMessageType.Attach:
|
|
882
|
+
case DataStoreMessageType.Attach: {
|
|
836
883
|
// For Attach messages, just submit them again.
|
|
837
884
|
this.submit(type, content, localOpMetadata);
|
|
838
885
|
break;
|
|
839
|
-
|
|
886
|
+
}
|
|
887
|
+
default: {
|
|
840
888
|
(0, internal_1.unreachableCase)(type);
|
|
889
|
+
}
|
|
841
890
|
}
|
|
842
891
|
}
|
|
843
892
|
/**
|
|
@@ -845,8 +894,13 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
845
894
|
* @param content - The content of the original message.
|
|
846
895
|
* @param localOpMetadata - The local metadata associated with the original message.
|
|
847
896
|
*/
|
|
848
|
-
rollback(type,
|
|
897
|
+
rollback(type,
|
|
898
|
+
// TODO: use something other than `any` here (breaking change)
|
|
899
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
900
|
+
content, localOpMetadata) {
|
|
849
901
|
this.verifyNotClosed();
|
|
902
|
+
// The op being rolled back was not/will not be submitted, so decrement the count.
|
|
903
|
+
--this.pendingOpCount.value;
|
|
850
904
|
switch (type) {
|
|
851
905
|
case DataStoreMessageType.ChannelOp: {
|
|
852
906
|
// For Operations, find the right channel and trigger resubmission on it.
|
|
@@ -856,14 +910,22 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
856
910
|
channelContext.rollback(envelope.contents, localOpMetadata);
|
|
857
911
|
break;
|
|
858
912
|
}
|
|
859
|
-
default:
|
|
913
|
+
default: {
|
|
860
914
|
throw new internal_5.LoggingError(`Can't rollback ${type} message`);
|
|
915
|
+
}
|
|
861
916
|
}
|
|
862
917
|
}
|
|
918
|
+
// TODO: use something other than `any` here
|
|
919
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
863
920
|
async applyStashedOp(content) {
|
|
921
|
+
// The op being applied may have been submitted in a previous session, so we increment the count here.
|
|
922
|
+
// Either the ack will arrive and be processed, or that previous session's connection will end, at which point the op will be resubmitted.
|
|
923
|
+
++this.pendingOpCount.value;
|
|
924
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
864
925
|
const type = content?.type;
|
|
865
926
|
switch (type) {
|
|
866
927
|
case DataStoreMessageType.Attach: {
|
|
928
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
867
929
|
const attachMessage = content.content;
|
|
868
930
|
const flatBlobs = new Map();
|
|
869
931
|
const snapshotTree = (0, internal_2.buildSnapshotTree)(attachMessage.snapshot.entries, flatBlobs);
|
|
@@ -880,16 +942,25 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
880
942
|
return;
|
|
881
943
|
}
|
|
882
944
|
case DataStoreMessageType.ChannelOp: {
|
|
945
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
883
946
|
const envelope = content.content;
|
|
884
947
|
const channelContext = this.contexts.get(envelope.address);
|
|
885
948
|
(0, internal_1.assert)(!!channelContext, 0x184 /* "There should be a channel context for the op" */);
|
|
886
949
|
await channelContext.getChannel();
|
|
887
950
|
return channelContext.applyStashedOp(envelope.contents);
|
|
888
951
|
}
|
|
889
|
-
default:
|
|
952
|
+
default: {
|
|
890
953
|
(0, internal_1.unreachableCase)(type);
|
|
954
|
+
}
|
|
891
955
|
}
|
|
892
956
|
}
|
|
957
|
+
/**
|
|
958
|
+
* Indicates the given channel is dirty from Summarizer's point of view,
|
|
959
|
+
* i.e. it has local changes that need to be included in the summary.
|
|
960
|
+
*
|
|
961
|
+
* @remarks - If a channel's changes are rolled back or rebased away, we won't
|
|
962
|
+
* clear the dirty flag set here.
|
|
963
|
+
*/
|
|
893
964
|
setChannelDirty(address) {
|
|
894
965
|
this.verifyNotClosed();
|
|
895
966
|
this.dataStoreContext.setChannelDirty(address);
|
|
@@ -898,11 +969,13 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
898
969
|
this.setMaxListeners(Number.MAX_SAFE_INTEGER);
|
|
899
970
|
// back-compat, to be removed in the future.
|
|
900
971
|
// Added in "2.0.0-rc.2.0.0" timeframe.
|
|
972
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-explicit-any
|
|
901
973
|
this.dataStoreContext.once?.("attaching", () => {
|
|
902
974
|
this.setAttachState(container_definitions_1.AttachState.Attaching);
|
|
903
975
|
});
|
|
904
976
|
// back-compat, to be removed in the future.
|
|
905
977
|
// Added in "2.0.0-rc.2.0.0" timeframe.
|
|
978
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-explicit-any
|
|
906
979
|
this.dataStoreContext.once?.("attached", () => {
|
|
907
980
|
this.setAttachState(container_definitions_1.AttachState.Attached);
|
|
908
981
|
});
|
|
@@ -938,7 +1011,7 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
938
1011
|
}
|
|
939
1012
|
setAttachState(attachState) {
|
|
940
1013
|
switch (attachState) {
|
|
941
|
-
case container_definitions_1.AttachState.Attaching:
|
|
1014
|
+
case container_definitions_1.AttachState.Attaching: {
|
|
942
1015
|
/**
|
|
943
1016
|
* back-compat 0.59.1000 - Ideally, attachGraph() should have already been called making the data store
|
|
944
1017
|
* locally visible. However, before visibility state was added, this may not have been the case and data
|
|
@@ -953,21 +1026,24 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
953
1026
|
(0, internal_1.assert)(this.visibilityState === internal_3.VisibilityState.LocallyVisible, 0x2d1 /* "Data store should be locally visible before it can become globally visible." */);
|
|
954
1027
|
// Mark the data store globally visible and make its child channels visible as well.
|
|
955
1028
|
this.visibilityState = internal_3.VisibilityState.GloballyVisible;
|
|
956
|
-
this.localChannelContextQueue
|
|
1029
|
+
for (const [, channel] of this.localChannelContextQueue) {
|
|
957
1030
|
channel.makeVisible();
|
|
958
|
-
}
|
|
1031
|
+
}
|
|
959
1032
|
this.localChannelContextQueue.clear();
|
|
960
1033
|
// This promise resolution will be moved to attached event once we fix the scheduler.
|
|
961
1034
|
this.deferredAttached.resolve();
|
|
962
1035
|
this.emit("attaching");
|
|
963
1036
|
break;
|
|
964
|
-
|
|
1037
|
+
}
|
|
1038
|
+
case container_definitions_1.AttachState.Attached: {
|
|
965
1039
|
(0, internal_1.assert)(this.visibilityState === internal_3.VisibilityState.GloballyVisible, 0x2d2 /* "Data store should be globally visible when its attached." */);
|
|
966
1040
|
this._attachState = container_definitions_1.AttachState.Attached;
|
|
967
1041
|
this.emit("attached");
|
|
968
1042
|
break;
|
|
969
|
-
|
|
1043
|
+
}
|
|
1044
|
+
default: {
|
|
970
1045
|
(0, internal_1.unreachableCase)(attachState, "unreached");
|
|
1046
|
+
}
|
|
971
1047
|
}
|
|
972
1048
|
}
|
|
973
1049
|
}
|
|
@@ -1020,6 +1096,7 @@ const mixinSummaryHandler = (handler, Base = FluidDataStoreRuntime) => class Run
|
|
|
1020
1096
|
summary.summary.tree[firstName] = blob;
|
|
1021
1097
|
}
|
|
1022
1098
|
async summarize(...args) {
|
|
1099
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
1023
1100
|
const summary = await super.summarize(...args);
|
|
1024
1101
|
try {
|
|
1025
1102
|
const content = await handler(this);
|
|
@@ -1027,9 +1104,9 @@ const mixinSummaryHandler = (handler, Base = FluidDataStoreRuntime) => class Run
|
|
|
1027
1104
|
this.addBlob(summary, content.path, content.content);
|
|
1028
1105
|
}
|
|
1029
1106
|
}
|
|
1030
|
-
catch (
|
|
1107
|
+
catch (error) {
|
|
1031
1108
|
// Any error coming from app-provided handler should be marked as DataProcessingError
|
|
1032
|
-
throw internal_5.DataProcessingError.wrapIfUnrecognized(
|
|
1109
|
+
throw internal_5.DataProcessingError.wrapIfUnrecognized(error, "mixinSummaryHandler");
|
|
1033
1110
|
}
|
|
1034
1111
|
return summary;
|
|
1035
1112
|
}
|