@fluidframework/datastore 2.71.0 → 2.73.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.73.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.73.0",
73
+ "@fluidframework/container-definitions": "~2.73.0",
74
+ "@fluidframework/core-interfaces": "~2.73.0",
75
+ "@fluidframework/core-utils": "~2.73.0",
76
+ "@fluidframework/datastore-definitions": "~2.73.0",
77
+ "@fluidframework/driver-definitions": "~2.73.0",
78
+ "@fluidframework/driver-utils": "~2.73.0",
79
+ "@fluidframework/id-compressor": "~2.73.0",
80
+ "@fluidframework/runtime-definitions": "~2.73.0",
81
+ "@fluidframework/runtime-utils": "~2.73.0",
82
+ "@fluidframework/telemetry-utils": "~2.73.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.73.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.73.0",
94
+ "@fluidframework/test-runtime-utils": "~2.73.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,86 @@ export class FluidDataStoreRuntime
1326
1331
  localOpMetadata: unknown,
1327
1332
  ): void {
1328
1333
  this.verifyNotClosed();
1334
+ assert(
1335
+ !this.localOpActivity,
1336
+ 0xca2 /* localOpActivity must be undefined when entering rollback */,
1337
+ );
1338
+ this.localOpActivity = "rollback";
1339
+ try {
1340
+ // The op being rolled back was not/will not be submitted, so decrement the count.
1341
+ --this.pendingOpCount.value;
1329
1342
 
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" */);
1343
+ switch (type) {
1344
+ case DataStoreMessageType.ChannelOp: {
1345
+ // For Operations, find the right channel and trigger resubmission on it.
1346
+ const envelope = content as IEnvelope;
1347
+ const channelContext = this.contexts.get(envelope.address);
1348
+ assert(!!channelContext, 0x2ed /* "There should be a channel context for the op" */);
1339
1349
 
1340
- channelContext.rollback(envelope.contents, localOpMetadata);
1341
- break;
1342
- }
1343
- default: {
1344
- throw new LoggingError(`Can't rollback ${type} message`);
1350
+ channelContext.rollback(envelope.contents, localOpMetadata);
1351
+ break;
1352
+ }
1353
+ default: {
1354
+ throw new LoggingError(`Can't rollback ${type} message`);
1355
+ }
1345
1356
  }
1357
+ } finally {
1358
+ this.localOpActivity = undefined;
1346
1359
  }
1347
1360
  }
1348
1361
 
1349
1362
  // TODO: use something other than `any` here
1350
1363
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
1351
1364
  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;
1365
+ assert(
1366
+ !this.localOpActivity,
1367
+ 0xca3 /* localOpActivity must be undefined when entering applyStashedOp */,
1368
+ );
1369
+ this.localOpActivity = "applyStashed";
1370
+ try {
1371
+ // The op being applied may have been submitted in a previous session, so we increment the count here.
1372
+ // Either the ack will arrive and be processed, or that previous session's connection will end, at which point the op will be resubmitted.
1373
+ ++this.pendingOpCount.value;
1355
1374
 
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;
1375
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1376
+ const type = content?.type as DataStoreMessageType;
1377
+ switch (type) {
1378
+ case DataStoreMessageType.Attach: {
1379
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1380
+ const attachMessage = content.content as IAttachMessage;
1362
1381
 
1363
- const flatBlobs = new Map<string, ArrayBufferLike>();
1364
- const snapshotTree = buildSnapshotTree(attachMessage.snapshot.entries, flatBlobs);
1382
+ const flatBlobs = new Map<string, ArrayBufferLike>();
1383
+ const snapshotTree = buildSnapshotTree(attachMessage.snapshot.entries, flatBlobs);
1365
1384
 
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);
1385
+ const channelContext = this.createRehydratedLocalChannelContext(
1386
+ attachMessage.id,
1387
+ snapshotTree,
1388
+ flatBlobs,
1389
+ );
1390
+ await channelContext.getChannel();
1391
+ this.contexts.set(attachMessage.id, channelContext);
1392
+ if (this.attachState === AttachState.Detached) {
1393
+ this.localChannelContextQueue.set(attachMessage.id, channelContext);
1394
+ } else {
1395
+ channelContext.makeVisible();
1396
+ this.pendingAttach.add(attachMessage.id);
1397
+ }
1398
+ return;
1399
+ }
1400
+ case DataStoreMessageType.ChannelOp: {
1401
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1402
+ const envelope = content.content as IEnvelope;
1403
+ const channelContext = this.contexts.get(envelope.address);
1404
+ assert(!!channelContext, 0x184 /* "There should be a channel context for the op" */);
1405
+ await channelContext.getChannel();
1406
+ return channelContext.applyStashedOp(envelope.contents);
1407
+ }
1408
+ default: {
1409
+ unreachableCase(type);
1378
1410
  }
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
1411
  }
1412
+ } finally {
1413
+ this.localOpActivity = undefined;
1392
1414
  }
1393
1415
  }
1394
1416
 
@@ -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.73.0";