@fluidframework/datastore 2.71.0 → 2.72.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/datastore",
3
- "version": "2.71.0",
3
+ "version": "2.72.0",
4
4
  "description": "Fluid data store implementation",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -69,29 +69,29 @@
69
69
  "temp-directory": "nyc/.nyc_output"
70
70
  },
71
71
  "dependencies": {
72
- "@fluid-internal/client-utils": "~2.71.0",
73
- "@fluidframework/container-definitions": "~2.71.0",
74
- "@fluidframework/core-interfaces": "~2.71.0",
75
- "@fluidframework/core-utils": "~2.71.0",
76
- "@fluidframework/datastore-definitions": "~2.71.0",
77
- "@fluidframework/driver-definitions": "~2.71.0",
78
- "@fluidframework/driver-utils": "~2.71.0",
79
- "@fluidframework/id-compressor": "~2.71.0",
80
- "@fluidframework/runtime-definitions": "~2.71.0",
81
- "@fluidframework/runtime-utils": "~2.71.0",
82
- "@fluidframework/telemetry-utils": "~2.71.0",
72
+ "@fluid-internal/client-utils": "~2.72.0",
73
+ "@fluidframework/container-definitions": "~2.72.0",
74
+ "@fluidframework/core-interfaces": "~2.72.0",
75
+ "@fluidframework/core-utils": "~2.72.0",
76
+ "@fluidframework/datastore-definitions": "~2.72.0",
77
+ "@fluidframework/driver-definitions": "~2.72.0",
78
+ "@fluidframework/driver-utils": "~2.72.0",
79
+ "@fluidframework/id-compressor": "~2.72.0",
80
+ "@fluidframework/runtime-definitions": "~2.72.0",
81
+ "@fluidframework/runtime-utils": "~2.72.0",
82
+ "@fluidframework/telemetry-utils": "~2.72.0",
83
83
  "uuid": "^11.1.0"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@arethetypeswrong/cli": "^0.17.1",
87
87
  "@biomejs/biome": "~1.9.3",
88
- "@fluid-internal/mocha-test-setup": "~2.71.0",
89
- "@fluid-tools/build-cli": "^0.58.3",
88
+ "@fluid-internal/mocha-test-setup": "~2.72.0",
89
+ "@fluid-tools/build-cli": "^0.60.0",
90
90
  "@fluidframework/build-common": "^2.0.3",
91
- "@fluidframework/build-tools": "^0.58.3",
92
- "@fluidframework/datastore-previous": "npm:@fluidframework/datastore@2.70.0",
93
- "@fluidframework/eslint-config-fluid": "^7.0.0",
94
- "@fluidframework/test-runtime-utils": "~2.71.0",
91
+ "@fluidframework/build-tools": "^0.60.0",
92
+ "@fluidframework/datastore-previous": "npm:@fluidframework/datastore@2.71.0",
93
+ "@fluidframework/eslint-config-fluid": "~2.72.0",
94
+ "@fluidframework/test-runtime-utils": "~2.72.0",
95
95
  "@microsoft/api-extractor": "7.52.11",
96
96
  "@types/lodash": "^4.14.118",
97
97
  "@types/mocha": "^10.0.10",
@@ -109,7 +109,11 @@
109
109
  "typescript": "~5.4.5"
110
110
  },
111
111
  "typeValidation": {
112
- "broken": {},
112
+ "broken": {
113
+ "Class_FluidDataStoreRuntime": {
114
+ "forwardCompat": false
115
+ }
116
+ },
113
117
  "entrypoint": "legacy"
114
118
  },
115
119
  "scripts": {
@@ -26,7 +26,7 @@ export const dataStoreCoreCompatDetails = {
26
26
  /**
27
27
  * The current generation of the Runtime layer.
28
28
  */
29
- generation: 1,
29
+ generation: 2,
30
30
  };
31
31
 
32
32
  /**
@@ -244,6 +244,11 @@ export class FluidDataStoreRuntime
244
244
  return this;
245
245
  }
246
246
 
247
+ private localOpActivity: "applyStashed" | "rollback" | undefined = undefined;
248
+ public get activeLocalOperationActivity(): "applyStashed" | "rollback" | undefined {
249
+ return this.localOpActivity;
250
+ }
251
+
247
252
  private _disposed = false;
248
253
  public get disposed(): boolean {
249
254
  return this._disposed;
@@ -1326,69 +1331,83 @@ export class FluidDataStoreRuntime
1326
1331
  localOpMetadata: unknown,
1327
1332
  ): void {
1328
1333
  this.verifyNotClosed();
1334
+ assert(!this.localOpActivity, "localOpActivity must be undefined when entering rollback");
1335
+ this.localOpActivity = "rollback";
1336
+ try {
1337
+ // The op being rolled back was not/will not be submitted, so decrement the count.
1338
+ --this.pendingOpCount.value;
1329
1339
 
1330
- // The op being rolled back was not/will not be submitted, so decrement the count.
1331
- --this.pendingOpCount.value;
1332
-
1333
- switch (type) {
1334
- case DataStoreMessageType.ChannelOp: {
1335
- // For Operations, find the right channel and trigger resubmission on it.
1336
- const envelope = content as IEnvelope;
1337
- const channelContext = this.contexts.get(envelope.address);
1338
- assert(!!channelContext, 0x2ed /* "There should be a channel context for the op" */);
1340
+ switch (type) {
1341
+ case DataStoreMessageType.ChannelOp: {
1342
+ // For Operations, find the right channel and trigger resubmission on it.
1343
+ const envelope = content as IEnvelope;
1344
+ const channelContext = this.contexts.get(envelope.address);
1345
+ assert(!!channelContext, 0x2ed /* "There should be a channel context for the op" */);
1339
1346
 
1340
- channelContext.rollback(envelope.contents, localOpMetadata);
1341
- break;
1342
- }
1343
- default: {
1344
- throw new LoggingError(`Can't rollback ${type} message`);
1347
+ channelContext.rollback(envelope.contents, localOpMetadata);
1348
+ break;
1349
+ }
1350
+ default: {
1351
+ throw new LoggingError(`Can't rollback ${type} message`);
1352
+ }
1345
1353
  }
1354
+ } finally {
1355
+ this.localOpActivity = undefined;
1346
1356
  }
1347
1357
  }
1348
1358
 
1349
1359
  // TODO: use something other than `any` here
1350
1360
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
1351
1361
  public async applyStashedOp(content: any): Promise<unknown> {
1352
- // The op being applied may have been submitted in a previous session, so we increment the count here.
1353
- // Either the ack will arrive and be processed, or that previous session's connection will end, at which point the op will be resubmitted.
1354
- ++this.pendingOpCount.value;
1362
+ assert(
1363
+ !this.localOpActivity,
1364
+ "localOpActivity must be undefined when entering applyStashedOp",
1365
+ );
1366
+ this.localOpActivity = "applyStashed";
1367
+ try {
1368
+ // The op being applied may have been submitted in a previous session, so we increment the count here.
1369
+ // Either the ack will arrive and be processed, or that previous session's connection will end, at which point the op will be resubmitted.
1370
+ ++this.pendingOpCount.value;
1355
1371
 
1356
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1357
- const type = content?.type as DataStoreMessageType;
1358
- switch (type) {
1359
- case DataStoreMessageType.Attach: {
1360
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1361
- const attachMessage = content.content as IAttachMessage;
1372
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1373
+ const type = content?.type as DataStoreMessageType;
1374
+ switch (type) {
1375
+ case DataStoreMessageType.Attach: {
1376
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1377
+ const attachMessage = content.content as IAttachMessage;
1362
1378
 
1363
- const flatBlobs = new Map<string, ArrayBufferLike>();
1364
- const snapshotTree = buildSnapshotTree(attachMessage.snapshot.entries, flatBlobs);
1379
+ const flatBlobs = new Map<string, ArrayBufferLike>();
1380
+ const snapshotTree = buildSnapshotTree(attachMessage.snapshot.entries, flatBlobs);
1365
1381
 
1366
- const channelContext = this.createRehydratedLocalChannelContext(
1367
- attachMessage.id,
1368
- snapshotTree,
1369
- flatBlobs,
1370
- );
1371
- await channelContext.getChannel();
1372
- this.contexts.set(attachMessage.id, channelContext);
1373
- if (this.attachState === AttachState.Detached) {
1374
- this.localChannelContextQueue.set(attachMessage.id, channelContext);
1375
- } else {
1376
- channelContext.makeVisible();
1377
- this.pendingAttach.add(attachMessage.id);
1382
+ const channelContext = this.createRehydratedLocalChannelContext(
1383
+ attachMessage.id,
1384
+ snapshotTree,
1385
+ flatBlobs,
1386
+ );
1387
+ await channelContext.getChannel();
1388
+ this.contexts.set(attachMessage.id, channelContext);
1389
+ if (this.attachState === AttachState.Detached) {
1390
+ this.localChannelContextQueue.set(attachMessage.id, channelContext);
1391
+ } else {
1392
+ channelContext.makeVisible();
1393
+ this.pendingAttach.add(attachMessage.id);
1394
+ }
1395
+ return;
1396
+ }
1397
+ case DataStoreMessageType.ChannelOp: {
1398
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1399
+ const envelope = content.content as IEnvelope;
1400
+ const channelContext = this.contexts.get(envelope.address);
1401
+ assert(!!channelContext, 0x184 /* "There should be a channel context for the op" */);
1402
+ await channelContext.getChannel();
1403
+ return channelContext.applyStashedOp(envelope.contents);
1404
+ }
1405
+ default: {
1406
+ unreachableCase(type);
1378
1407
  }
1379
- return;
1380
- }
1381
- case DataStoreMessageType.ChannelOp: {
1382
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1383
- const envelope = content.content as IEnvelope;
1384
- const channelContext = this.contexts.get(envelope.address);
1385
- assert(!!channelContext, 0x184 /* "There should be a channel context for the op" */);
1386
- await channelContext.getChannel();
1387
- return channelContext.applyStashedOp(envelope.contents);
1388
- }
1389
- default: {
1390
- unreachableCase(type);
1391
1408
  }
1409
+ } finally {
1410
+ this.localOpActivity = undefined;
1392
1411
  }
1393
1412
  }
1394
1413
 
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/datastore";
9
- export const pkgVersion = "2.71.0";
9
+ export const pkgVersion = "2.72.0";