@fluidframework/container-runtime 2.92.0 → 2.100.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +1 -1
  3. package/container-runtime.test-files.tar +0 -0
  4. package/dist/containerRuntime.d.ts +16 -4
  5. package/dist/containerRuntime.d.ts.map +1 -1
  6. package/dist/containerRuntime.js +80 -60
  7. package/dist/containerRuntime.js.map +1 -1
  8. package/dist/dataStore.d.ts +1 -1
  9. package/dist/dataStore.d.ts.map +1 -1
  10. package/dist/dataStore.js +6 -7
  11. package/dist/dataStore.js.map +1 -1
  12. package/dist/opLifecycle/batchManager.d.ts +3 -9
  13. package/dist/opLifecycle/batchManager.d.ts.map +1 -1
  14. package/dist/opLifecycle/batchManager.js +3 -2
  15. package/dist/opLifecycle/batchManager.js.map +1 -1
  16. package/dist/opLifecycle/outbox.d.ts +8 -5
  17. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  18. package/dist/opLifecycle/outbox.js +40 -57
  19. package/dist/opLifecycle/outbox.js.map +1 -1
  20. package/dist/packageVersion.d.ts +1 -1
  21. package/dist/packageVersion.d.ts.map +1 -1
  22. package/dist/packageVersion.js +1 -1
  23. package/dist/packageVersion.js.map +1 -1
  24. package/dist/pendingStateManager.d.ts +1 -6
  25. package/dist/pendingStateManager.d.ts.map +1 -1
  26. package/dist/pendingStateManager.js +6 -16
  27. package/dist/pendingStateManager.js.map +1 -1
  28. package/dist/runtimeLayerCompatState.d.ts +2 -2
  29. package/eslint.config.mts +1 -1
  30. package/lib/containerRuntime.d.ts +16 -4
  31. package/lib/containerRuntime.d.ts.map +1 -1
  32. package/lib/containerRuntime.js +82 -62
  33. package/lib/containerRuntime.js.map +1 -1
  34. package/lib/dataStore.d.ts +1 -1
  35. package/lib/dataStore.d.ts.map +1 -1
  36. package/lib/dataStore.js +1 -2
  37. package/lib/dataStore.js.map +1 -1
  38. package/lib/opLifecycle/batchManager.d.ts +3 -9
  39. package/lib/opLifecycle/batchManager.d.ts.map +1 -1
  40. package/lib/opLifecycle/batchManager.js +3 -2
  41. package/lib/opLifecycle/batchManager.js.map +1 -1
  42. package/lib/opLifecycle/outbox.d.ts +8 -5
  43. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  44. package/lib/opLifecycle/outbox.js +41 -58
  45. package/lib/opLifecycle/outbox.js.map +1 -1
  46. package/lib/packageVersion.d.ts +1 -1
  47. package/lib/packageVersion.d.ts.map +1 -1
  48. package/lib/packageVersion.js +1 -1
  49. package/lib/packageVersion.js.map +1 -1
  50. package/lib/pendingStateManager.d.ts +1 -6
  51. package/lib/pendingStateManager.d.ts.map +1 -1
  52. package/lib/pendingStateManager.js +6 -16
  53. package/lib/pendingStateManager.js.map +1 -1
  54. package/lib/runtimeLayerCompatState.d.ts +2 -2
  55. package/lib/tsdoc-metadata.json +1 -1
  56. package/package.json +26 -31
  57. package/src/containerRuntime.ts +91 -76
  58. package/src/dataStore.ts +5 -6
  59. package/src/opLifecycle/batchManager.ts +4 -12
  60. package/src/opLifecycle/outbox.ts +51 -69
  61. package/src/packageVersion.ts +1 -1
  62. package/src/pendingStateManager.ts +5 -23
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type IDataStore, type IFluidDataStoreChannel } from "@fluidframework/runtime-definitions/internal";
5
+ import type { IDataStore, IFluidDataStoreChannel } from "@fluidframework/runtime-definitions/internal";
6
6
  import { type ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
7
7
  import type { ChannelCollection } from "./channelCollection.js";
8
8
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"dataStore.d.ts","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAEN,KAAK,UAAU,EACf,KAAK,sBAAsB,EAE3B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACN,KAAK,mBAAmB,EAGxB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGhE;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,+BACP,OAAO,yDAOnC,CAAC;AAEF,eAAO,MAAM,kBAAkB,0BACP,sBAAsB,cACjC,MAAM,qBACC,iBAAiB,UAC5B,mBAAmB,KACzB,UAAyF,CAAC"}
1
+ {"version":3,"file":"dataStore.d.ts","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAEX,UAAU,EACV,sBAAsB,EACtB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACN,KAAK,mBAAmB,EAGxB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGhE;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,+BACP,OAAO,yDAOnC,CAAC;AAEF,eAAO,MAAM,kBAAkB,0BACP,sBAAsB,cACjC,MAAM,qBACC,iBAAiB,UAC5B,mBAAmB,KACzB,UAAyF,CAAC"}
package/lib/dataStore.js CHANGED
@@ -4,7 +4,6 @@
4
4
  */
5
5
  import { AttachState } from "@fluidframework/container-definitions";
6
6
  import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
7
- import { asLegacyAlpha, } from "@fluidframework/runtime-definitions/internal";
8
7
  import { TelemetryDataTag, UsageError, } from "@fluidframework/telemetry-utils/internal";
9
8
  import { ContainerMessageType } from "./messageTypes.js";
10
9
  /**
@@ -33,7 +32,7 @@ class DataStore {
33
32
  if (alias.includes("/")) {
34
33
  throw new UsageError(`The alias cannot contain slashes: '${alias}'`);
35
34
  }
36
- if (asLegacyAlpha(this.parentContext.containerRuntime).inStagingMode === true) {
35
+ if (this.parentContext.containerRuntime.inStagingMode === true) {
37
36
  throw new UsageError("Cannot set aliases while in staging mode");
38
37
  }
39
38
  switch (this.aliasState) {
@@ -1 +1 @@
1
- {"version":3,"file":"dataStore.js","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAGpE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAIN,aAAa,GACb,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAEN,gBAAgB,EAChB,UAAU,GACV,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAmBzD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACtC,0BAAmC,EACoB,EAAE;IACzD,OAAO,CACN,OAAQ,0BAA8D,EAAE,UAAU;QACjF,QAAQ;QACT,OAAQ,0BAA8D,EAAE,KAAK,KAAK,QAAQ,CAC1F,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CACjC,qBAA6C,EAC7C,UAAkB,EAClB,iBAAoC,EACpC,MAA2B,EACd,EAAE,CAAC,IAAI,SAAS,CAAC,qBAAqB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAC;AAE7F,IAAK,UAIJ;AAJD,WAAK,UAAU;IACd,iCAAmB,CAAA;IACnB,mCAAqB,CAAA;IACrB,2BAAa,CAAA;AACd,CAAC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I,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACzC,oBAAoB,GAAG,GAAG,EAAE,CAC3B,MAAM,CACL,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAC/E,CAAC;YAEH,IAAI,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;gBAClD,oBAAoB,EAAE,CAAC;gBACvB,OAAO;YACR,CAAC;YAED,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;YACxE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;YACf,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport type { FluidObject } from \"@fluidframework/core-interfaces\";\nimport type { IFluidHandleInternal } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype AliasResult,\n\ttype IDataStore,\n\ttype IFluidDataStoreChannel,\n\tasLegacyAlpha,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tTelemetryDataTag,\n\tUsageError,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { ChannelCollection } from \"./channelCollection.js\";\nimport { ContainerMessageType } from \"./messageTypes.js\";\n\n/**\n * Interface for an op to be used for assigning an\n * alias to a datastore\n * @internal\n * @privateRemarks exported per ContainerRuntime export for testing purposes\n */\nexport interface IDataStoreAliasMessage {\n\t/**\n\t * The internal id of the datastore\n\t */\n\treadonly internalId: string;\n\t/**\n\t * The alias name to be assigned to the datastore\n\t */\n\treadonly alias: string;\n}\n\n/**\n * Type guard that returns true if the given alias message is actually an instance of\n * a class which implements {@link IDataStoreAliasMessage}\n * @param maybeDataStoreAliasMessage - message object to be validated\n * @returns True if the {@link IDataStoreAliasMessage} is fully implemented, false otherwise\n */\nexport const isDataStoreAliasMessage = (\n\tmaybeDataStoreAliasMessage: unknown,\n): maybeDataStoreAliasMessage is IDataStoreAliasMessage => {\n\treturn (\n\t\ttypeof (maybeDataStoreAliasMessage as Partial<IDataStoreAliasMessage>)?.internalId ===\n\t\t\t\"string\" &&\n\t\ttypeof (maybeDataStoreAliasMessage as Partial<IDataStoreAliasMessage>)?.alias === \"string\"\n\t);\n};\n\nexport const channelToDataStore = (\n\tfluidDataStoreChannel: IFluidDataStoreChannel,\n\tinternalId: string,\n\tchannelCollection: ChannelCollection,\n\tlogger: ITelemetryLoggerExt,\n): IDataStore => new DataStore(fluidDataStoreChannel, internalId, channelCollection, logger);\n\nenum AliasState {\n\tAliased = \"Aliased\",\n\tAliasing = \"Aliasing\",\n\tNone = \"None\",\n}\n\nclass DataStore implements IDataStore {\n\tprivate aliasState: AliasState = AliasState.None;\n\tprivate alias: string | undefined;\n\tprivate readonly pendingAliases: Map<string, Promise<AliasResult>>;\n\tprivate aliasResult: Promise<AliasResult> | undefined;\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.trySetAlias}\n\t */\n\tasync trySetAlias(alias: string): Promise<AliasResult> {\n\t\tif (alias.includes(\"/\")) {\n\t\t\tthrow new UsageError(`The alias cannot contain slashes: '${alias}'`);\n\t\t}\n\t\tif (asLegacyAlpha(this.parentContext.containerRuntime).inStagingMode === true) {\n\t\t\tthrow new UsageError(\"Cannot set aliases while in staging mode\");\n\t\t}\n\n\t\tswitch (this.aliasState) {\n\t\t\t// If we're already aliasing, check if it's for the same value and return\n\t\t\t// the stored promise, otherwise return 'AlreadyAliased'\n\t\t\tcase AliasState.Aliasing: {\n\t\t\t\tassert(\n\t\t\t\t\tthis.aliasResult !== undefined,\n\t\t\t\t\t0x316 /* There should be a cached promise of in-progress aliasing */,\n\t\t\t\t);\n\t\t\t\tawait this.aliasResult;\n\t\t\t\treturn this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\t\t\t}\n\n\t\t\t// If this datastore is already aliased, return true only if this\n\t\t\t// is a repeated call for the same alias\n\t\t\tcase AliasState.Aliased: {\n\t\t\t\treturn this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\t\t\t}\n\n\t\t\tcase AliasState.None: {\n\t\t\t\tconst existingAlias = this.pendingAliases.get(alias);\n\t\t\t\tif (existingAlias !== undefined) {\n\t\t\t\t\t// There is already another datastore which will be aliased\n\t\t\t\t\t// to the same name\n\t\t\t\t\treturn \"Conflict\";\n\t\t\t\t}\n\n\t\t\t\t// There is no current or past alias operation for this datastore,\n\t\t\t\t// or for this alias, so it is safe to continue execution\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(this.aliasState);\n\t\t\t}\n\t\t}\n\n\t\tthis.aliasState = AliasState.Aliasing;\n\t\tthis.aliasResult = this.trySetAliasInternal(alias);\n\t\tthis.pendingAliases.set(alias, this.aliasResult);\n\t\treturn this.aliasResult;\n\t}\n\n\tasync trySetAliasInternal(alias: string): Promise<AliasResult> {\n\t\tconst message: IDataStoreAliasMessage = {\n\t\t\tinternalId: this.internalId,\n\t\t\talias,\n\t\t};\n\t\tthis.fluidDataStoreChannel.makeVisibleAndAttachGraph();\n\n\t\tif (this.parentContext.attachState === AttachState.Detached) {\n\t\t\tconst localResult = this.channelCollection.processAliasMessageCore(\n\t\t\t\tthis.internalId,\n\t\t\t\talias,\n\t\t\t);\n\t\t\t// Explicitly lock-out future attempts of aliasing,\n\t\t\t// regardless of result\n\t\t\tthis.aliasState = AliasState.Aliased;\n\t\t\treturn localResult ? \"Success\" : \"Conflict\";\n\t\t}\n\n\t\tconst aliased = await this.ackBasedPromise<boolean>((resolve) => {\n\t\t\tthis.parentContext.submitMessage(\n\t\t\t\t{ type: ContainerMessageType.Alias, contents: message },\n\t\t\t\tresolve,\n\t\t\t);\n\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"AliasingException\",\n\t\t\t\t\t\talias: {\n\t\t\t\t\t\t\tvalue: alias,\n\t\t\t\t\t\t\ttag: TelemetryDataTag.UserData,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinternalId: {\n\t\t\t\t\t\t\tvalue: this.internalId,\n\t\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\n\t\t\t\treturn false;\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tthis.pendingAliases.delete(alias);\n\t\t\t});\n\n\t\tif (!aliased) {\n\t\t\tthis.aliasState = AliasState.None;\n\t\t\tthis.aliasResult = undefined;\n\t\t\treturn \"Conflict\";\n\t\t}\n\n\t\tthis.alias = alias;\n\t\tthis.aliasState = AliasState.Aliased;\n\t\treturn \"Success\";\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.entryPoint}\n\t */\n\tget entryPoint(): IFluidHandleInternal<FluidObject> {\n\t\treturn this.fluidDataStoreChannel.entryPoint;\n\t}\n\n\tconstructor(\n\t\tprivate readonly fluidDataStoreChannel: IFluidDataStoreChannel,\n\t\tprivate readonly internalId: string,\n\t\tprivate readonly channelCollection: ChannelCollection,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly parentContext = channelCollection.parentContext,\n\t) {\n\t\tthis.pendingAliases = channelCollection.pendingAliases;\n\t}\n\n\tprivate async ackBasedPromise<T>(\n\t\texecutor: (\n\t\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\t\treject: (reason?: unknown) => void,\n\t\t) => void,\n\t): Promise<T> {\n\t\tlet rejectBecauseDispose: () => void;\n\t\treturn new Promise<T>((resolve, reject) => {\n\t\t\trejectBecauseDispose = () =>\n\t\t\t\treject(\n\t\t\t\t\tnew Error(\"ContainerRuntime disposed while this ack-based Promise was pending\"),\n\t\t\t\t);\n\n\t\t\tif (this.parentContext.containerRuntime.disposed) {\n\t\t\t\trejectBecauseDispose();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.parentContext.containerRuntime.on(\"dispose\", rejectBecauseDispose);\n\t\t\texecutor(resolve, reject);\n\t\t}).finally(() => {\n\t\t\tthis.parentContext.containerRuntime.off(\"dispose\", rejectBecauseDispose);\n\t\t});\n\t}\n}\n"]}
1
+ {"version":3,"file":"dataStore.js","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAGpE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAM9E,OAAO,EAEN,gBAAgB,EAChB,UAAU,GACV,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAmBzD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACtC,0BAAmC,EACoB,EAAE;IACzD,OAAO,CACN,OAAQ,0BAA8D,EAAE,UAAU;QACjF,QAAQ;QACT,OAAQ,0BAA8D,EAAE,KAAK,KAAK,QAAQ,CAC1F,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CACjC,qBAA6C,EAC7C,UAAkB,EAClB,iBAAoC,EACpC,MAA2B,EACd,EAAE,CAAC,IAAI,SAAS,CAAC,qBAAqB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAC;AAE7F,IAAK,UAIJ;AAJD,WAAK,UAAU;IACd,iCAAmB,CAAA;IACnB,mCAAqB,CAAA;IAC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AO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACzC,oBAAoB,GAAG,GAAG,EAAE,CAC3B,MAAM,CACL,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAC/E,CAAC;YAEH,IAAI,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;gBAClD,oBAAoB,EAAE,CAAC;gBACvB,OAAO;YACR,CAAC;YAED,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;YACxE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;YACf,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport type { FluidObject } from \"@fluidframework/core-interfaces\";\nimport type { IFluidHandleInternal } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tAliasResult,\n\tIDataStore,\n\tIFluidDataStoreChannel,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tTelemetryDataTag,\n\tUsageError,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { ChannelCollection } from \"./channelCollection.js\";\nimport { ContainerMessageType } from \"./messageTypes.js\";\n\n/**\n * Interface for an op to be used for assigning an\n * alias to a datastore\n * @internal\n * @privateRemarks exported per ContainerRuntime export for testing purposes\n */\nexport interface IDataStoreAliasMessage {\n\t/**\n\t * The internal id of the datastore\n\t */\n\treadonly internalId: string;\n\t/**\n\t * The alias name to be assigned to the datastore\n\t */\n\treadonly alias: string;\n}\n\n/**\n * Type guard that returns true if the given alias message is actually an instance of\n * a class which implements {@link IDataStoreAliasMessage}\n * @param maybeDataStoreAliasMessage - message object to be validated\n * @returns True if the {@link IDataStoreAliasMessage} is fully implemented, false otherwise\n */\nexport const isDataStoreAliasMessage = (\n\tmaybeDataStoreAliasMessage: unknown,\n): maybeDataStoreAliasMessage is IDataStoreAliasMessage => {\n\treturn (\n\t\ttypeof (maybeDataStoreAliasMessage as Partial<IDataStoreAliasMessage>)?.internalId ===\n\t\t\t\"string\" &&\n\t\ttypeof (maybeDataStoreAliasMessage as Partial<IDataStoreAliasMessage>)?.alias === \"string\"\n\t);\n};\n\nexport const channelToDataStore = (\n\tfluidDataStoreChannel: IFluidDataStoreChannel,\n\tinternalId: string,\n\tchannelCollection: ChannelCollection,\n\tlogger: ITelemetryLoggerExt,\n): IDataStore => new DataStore(fluidDataStoreChannel, internalId, channelCollection, logger);\n\nenum AliasState {\n\tAliased = \"Aliased\",\n\tAliasing = \"Aliasing\",\n\tNone = \"None\",\n}\n\nclass DataStore implements IDataStore {\n\tprivate aliasState: AliasState = AliasState.None;\n\tprivate alias: string | undefined;\n\tprivate readonly pendingAliases: Map<string, Promise<AliasResult>>;\n\tprivate aliasResult: Promise<AliasResult> | undefined;\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.trySetAlias}\n\t */\n\tasync trySetAlias(alias: string): Promise<AliasResult> {\n\t\tif (alias.includes(\"/\")) {\n\t\t\tthrow new UsageError(`The alias cannot contain slashes: '${alias}'`);\n\t\t}\n\t\tif (this.parentContext.containerRuntime.inStagingMode === true) {\n\t\t\tthrow new UsageError(\"Cannot set aliases while in staging mode\");\n\t\t}\n\n\t\tswitch (this.aliasState) {\n\t\t\t// If we're already aliasing, check if it's for the same value and return\n\t\t\t// the stored promise, otherwise return 'AlreadyAliased'\n\t\t\tcase AliasState.Aliasing: {\n\t\t\t\tassert(\n\t\t\t\t\tthis.aliasResult !== undefined,\n\t\t\t\t\t0x316 /* There should be a cached promise of in-progress aliasing */,\n\t\t\t\t);\n\t\t\t\tawait this.aliasResult;\n\t\t\t\treturn this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\t\t\t}\n\n\t\t\t// If this datastore is already aliased, return true only if this\n\t\t\t// is a repeated call for the same alias\n\t\t\tcase AliasState.Aliased: {\n\t\t\t\treturn this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\t\t\t}\n\n\t\t\tcase AliasState.None: {\n\t\t\t\tconst existingAlias = this.pendingAliases.get(alias);\n\t\t\t\tif (existingAlias !== undefined) {\n\t\t\t\t\t// There is already another datastore which will be aliased\n\t\t\t\t\t// to the same name\n\t\t\t\t\treturn \"Conflict\";\n\t\t\t\t}\n\n\t\t\t\t// There is no current or past alias operation for this datastore,\n\t\t\t\t// or for this alias, so it is safe to continue execution\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(this.aliasState);\n\t\t\t}\n\t\t}\n\n\t\tthis.aliasState = AliasState.Aliasing;\n\t\tthis.aliasResult = this.trySetAliasInternal(alias);\n\t\tthis.pendingAliases.set(alias, this.aliasResult);\n\t\treturn this.aliasResult;\n\t}\n\n\tasync trySetAliasInternal(alias: string): Promise<AliasResult> {\n\t\tconst message: IDataStoreAliasMessage = {\n\t\t\tinternalId: this.internalId,\n\t\t\talias,\n\t\t};\n\t\tthis.fluidDataStoreChannel.makeVisibleAndAttachGraph();\n\n\t\tif (this.parentContext.attachState === AttachState.Detached) {\n\t\t\tconst localResult = this.channelCollection.processAliasMessageCore(\n\t\t\t\tthis.internalId,\n\t\t\t\talias,\n\t\t\t);\n\t\t\t// Explicitly lock-out future attempts of aliasing,\n\t\t\t// regardless of result\n\t\t\tthis.aliasState = AliasState.Aliased;\n\t\t\treturn localResult ? \"Success\" : \"Conflict\";\n\t\t}\n\n\t\tconst aliased = await this.ackBasedPromise<boolean>((resolve) => {\n\t\t\tthis.parentContext.submitMessage(\n\t\t\t\t{ type: ContainerMessageType.Alias, contents: message },\n\t\t\t\tresolve,\n\t\t\t);\n\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"AliasingException\",\n\t\t\t\t\t\talias: {\n\t\t\t\t\t\t\tvalue: alias,\n\t\t\t\t\t\t\ttag: TelemetryDataTag.UserData,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinternalId: {\n\t\t\t\t\t\t\tvalue: this.internalId,\n\t\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\n\t\t\t\treturn false;\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tthis.pendingAliases.delete(alias);\n\t\t\t});\n\n\t\tif (!aliased) {\n\t\t\tthis.aliasState = AliasState.None;\n\t\t\tthis.aliasResult = undefined;\n\t\t\treturn \"Conflict\";\n\t\t}\n\n\t\tthis.alias = alias;\n\t\tthis.aliasState = AliasState.Aliased;\n\t\treturn \"Success\";\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.entryPoint}\n\t */\n\tget entryPoint(): IFluidHandleInternal<FluidObject> {\n\t\treturn this.fluidDataStoreChannel.entryPoint;\n\t}\n\n\tconstructor(\n\t\tprivate readonly fluidDataStoreChannel: IFluidDataStoreChannel,\n\t\tprivate readonly internalId: string,\n\t\tprivate readonly channelCollection: ChannelCollection,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly parentContext = channelCollection.parentContext,\n\t) {\n\t\tthis.pendingAliases = channelCollection.pendingAliases;\n\t}\n\n\tprivate async ackBasedPromise<T>(\n\t\texecutor: (\n\t\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\t\treject: (reason?: unknown) => void,\n\t\t) => void,\n\t): Promise<T> {\n\t\tlet rejectBecauseDispose: () => void;\n\t\treturn new Promise<T>((resolve, reject) => {\n\t\t\trejectBecauseDispose = () =>\n\t\t\t\treject(\n\t\t\t\t\tnew Error(\"ContainerRuntime disposed while this ack-based Promise was pending\"),\n\t\t\t\t);\n\n\t\t\tif (this.parentContext.containerRuntime.disposed) {\n\t\t\t\trejectBecauseDispose();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.parentContext.containerRuntime.on(\"dispose\", rejectBecauseDispose);\n\t\t\texecutor(resolve, reject);\n\t\t}).finally(() => {\n\t\t\tthis.parentContext.containerRuntime.off(\"dispose\", rejectBecauseDispose);\n\t\t});\n\t}\n}\n"]}
@@ -7,15 +7,8 @@ import type { IPendingMessage } from "../pendingStateManager.js";
7
7
  import type { LocalBatchMessage, IBatchCheckpoint, LocalBatch } from "./definitions.js";
8
8
  import type { BatchStartInfo } from "./remoteMessageProcessor.js";
9
9
  export interface IBatchManagerOptions {
10
+ readonly disableGroupedBatching: boolean;
10
11
  readonly compressionOptions?: ICompressionRuntimeOptions;
11
- /**
12
- * If true, the outbox is allowed to rebase the batch during flushing.
13
- */
14
- readonly canRebase: boolean;
15
- /**
16
- * If true, don't compare batchID of incoming batches to this. e.g. ID Allocation Batch IDs should be ignored
17
- */
18
- readonly ignoreBatchId?: boolean;
19
12
  }
20
13
  export interface BatchSequenceNumbers {
21
14
  referenceSequenceNumber?: number;
@@ -56,8 +49,9 @@ export declare class BatchManager {
56
49
  get empty(): boolean;
57
50
  /**
58
51
  * Gets the pending batch and clears state for the next batch.
52
+ * The caller is responsible for calling {@link addBatchMetadata} after any modifications (e.g. prepending messages).
59
53
  */
60
- popBatch(batchId?: BatchId): LocalBatch;
54
+ popBatch(): LocalBatch;
61
55
  /**
62
56
  * Capture the pending state at this point
63
57
  */
@@ -1 +1 @@
1
- {"version":3,"file":"batchManager.d.ts","sourceRoot":"","sources":["../../src/opLifecycle/batchManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,KAAK,EAAE,0BAA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,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,eAAe,CAAS;IAEhC,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED,IAAW,eAAe,IAAI,oBAAoB,CAKjD;IAED,OAAO,KAAK,uBAAuB,GAKlC;IAED;;;OAGG;IACH,OAAO,CAAC,oBAAoB,CAAqB;gBAErB,OAAO,EAAE,oBAAoB;IAElD,IAAI,CACV,OAAO,EAAE,iBAAiB,EAC1B,SAAS,EAAE,OAAO,EAClB,2BAA2B,CAAC,EAAE,MAAM,GAClC,IAAI;IAUP,IAAW,KAAK,IAAI,OAAO,CAE1B;IAED;;;OAGG;IACI,QAAQ,IAAI,UAAU;IAgB7B;;OAEG;IACI,UAAU,IAAI,gBAAgB;IAwBrC;;OAEG;IACI,mBAAmB,IAAI,OAAO;CAGrC;AAED,eAAO,MAAM,gBAAgB,UAAW,UAAU,YAAY,OAAO,KAAG,UA4BvE,CAAC;AAEF,eAAO,MAAM,oBAAoB,YACvB,oBAAoB,gBACf,oBAAoB,KAChC,OASF,CAAC"}
@@ -64,8 +64,9 @@ export class BatchManager {
64
64
  }
65
65
  /**
66
66
  * Gets the pending batch and clears state for the next batch.
67
+ * The caller is responsible for calling {@link addBatchMetadata} after any modifications (e.g. prepending messages).
67
68
  */
68
- popBatch(batchId) {
69
+ popBatch() {
69
70
  assert(this.pendingBatch[0] !== undefined, 0xb8a /* expected non-empty batch */);
70
71
  const batch = {
71
72
  messages: this.pendingBatch,
@@ -76,7 +77,7 @@ export class BatchManager {
76
77
  this.pendingBatch = [];
77
78
  this.clientSequenceNumber = undefined;
78
79
  this.hasReentrantOps = false;
79
- return addBatchMetadata(batch, batchId);
80
+ return batch;
80
81
  }
81
82
  /**
82
83
  * Capture the pending state at this point
@@ -1 +1 @@
1
- {"version":3,"file":"batchManager.js","sourceRoot":"","sources":["../../src/opLifecycle/batchManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,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oft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tLoggingError,\n\ttagData,\n\tTelemetryDataTag,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { ICompressionRuntimeOptions } from \"../compressionDefinitions.js\";\nimport { isContainerMessageDirtyable } from \"../containerRuntime.js\";\nimport { asBatchMetadata, type IBatchMetadata } from \"../metadata.js\";\nimport type { IPendingMessage } from \"../pendingStateManager.js\";\n\nimport type { LocalBatchMessage, IBatchCheckpoint, LocalBatch } from \"./definitions.js\";\nimport { serializeOp } from \"./opSerialization.js\";\nimport type { BatchStartInfo } from \"./remoteMessageProcessor.js\";\n\nexport interface IBatchManagerOptions {\n\treadonly compressionOptions?: ICompressionRuntimeOptions;\n\n\t/**\n\t * If true, the outbox is allowed to rebase the batch during flushing.\n\t */\n\treadonly canRebase: boolean;\n\n\t/**\n\t * If true, don't compare batchID of incoming batches to this. e.g. ID Allocation Batch IDs should be ignored\n\t */\n\treadonly ignoreBatchId?: boolean;\n}\n\nexport interface BatchSequenceNumbers {\n\treferenceSequenceNumber?: number;\n\tclientSequenceNumber?: number;\n}\n\n/**\n * Type alias for the batchId stored in batch metadata\n */\nexport type BatchId = string;\n\n/**\n * Compose original client ID and client sequence number into BatchId to stamp on the message during reconnect\n */\nexport function generateBatchId(originalClientId: string, batchStartCsn: number): BatchId {\n\treturn `${originalClientId}_[${batchStartCsn}]`;\n}\n\n/**\n * Get the effective batch ID for the input argument.\n * Supports either an IPendingMessage or BatchStartInfo.\n * If the batch ID is explicitly present, return it.\n * Otherwise, generate a new batch ID using the client ID and batch start CSN.\n */\nexport function getEffectiveBatchId(\n\tpendingMessageOrBatchStartInfo: IPendingMessage | BatchStartInfo,\n): string {\n\tif (\"localOpMetadata\" in pendingMessageOrBatchStartInfo) {\n\t\tconst pendingMessage: IPendingMessage = pendingMessageOrBatchStartInfo;\n\t\treturn (\n\t\t\tasBatchMetadata(pendingMessage.opMetadata)?.batchId ??\n\t\t\tgenerateBatchId(\n\t\t\t\tpendingMessage.batchInfo.clientId,\n\t\t\t\tpendingMessage.batchInfo.batchStartCsn,\n\t\t\t)\n\t\t);\n\t}\n\n\tconst batchStart: BatchStartInfo = pendingMessageOrBatchStartInfo;\n\treturn batchStart.batchId ?? generateBatchId(batchStart.clientId, batchStart.batchStartCsn);\n}\n\n/**\n * Helper class that manages partial batch & rollback.\n */\nexport class BatchManager {\n\tprivate pendingBatch: LocalBatchMessage[] = [];\n\tprivate hasReentrantOps = false;\n\n\tpublic get length(): number {\n\t\treturn this.pendingBatch.length;\n\t}\n\n\tpublic get sequenceNumbers(): BatchSequenceNumbers {\n\t\treturn {\n\t\t\treferenceSequenceNumber: this.referenceSequenceNumber,\n\t\t\tclientSequenceNumber: this.clientSequenceNumber,\n\t\t};\n\t}\n\n\tprivate get referenceSequenceNumber(): number | undefined {\n\t\treturn this.pendingBatch.length === 0\n\t\t\t? undefined\n\t\t\t: // NOTE: In case of reentrant ops, there could be multiple reference sequence numbers, but we will rebase before submitting.\n\t\t\t\tthis.pendingBatch[this.pendingBatch.length - 1].referenceSequenceNumber;\n\t}\n\n\t/**\n\t * The last-processed CSN when this batch started.\n\t * This is used to ensure that while the batch is open, no incoming ops are processed.\n\t */\n\tprivate clientSequenceNumber: number | undefined;\n\n\tconstructor(public readonly options: IBatchManagerOptions) {}\n\n\tpublic push(\n\t\tmessage: LocalBatchMessage,\n\t\treentrant: boolean,\n\t\tcurrentClientSequenceNumber?: number,\n\t): void {\n\t\tthis.hasReentrantOps = this.hasReentrantOps || reentrant;\n\n\t\tif (this.pendingBatch.length === 0) {\n\t\t\tthis.clientSequenceNumber = currentClientSequenceNumber;\n\t\t}\n\n\t\tthis.pendingBatch.push(message);\n\t}\n\n\tpublic get empty(): boolean {\n\t\treturn this.pendingBatch.length === 0;\n\t}\n\n\t/**\n\t * Gets the pending batch and clears state for the next batch.\n\t */\n\tpublic popBatch(batchId?: BatchId): LocalBatch {\n\t\tassert(this.pendingBatch[0] !== undefined, 0xb8a /* expected non-empty batch */);\n\t\tconst batch: LocalBatch = {\n\t\t\tmessages: this.pendingBatch,\n\t\t\treferenceSequenceNumber: this.referenceSequenceNumber,\n\t\t\thasReentrantOps: this.hasReentrantOps,\n\t\t\tstaged: this.pendingBatch[0].staged,\n\t\t};\n\n\t\tthis.pendingBatch = [];\n\t\tthis.clientSequenceNumber = undefined;\n\t\tthis.hasReentrantOps = false;\n\n\t\treturn addBatchMetadata(batch, batchId);\n\t}\n\n\t/**\n\t * Capture the pending state at this point\n\t */\n\tpublic checkpoint(): IBatchCheckpoint {\n\t\tconst startSequenceNumber = this.clientSequenceNumber;\n\t\tconst startPoint = this.pendingBatch.length;\n\t\treturn {\n\t\t\trollback: (process: (message: LocalBatchMessage) => void) => {\n\t\t\t\tthis.clientSequenceNumber = startSequenceNumber;\n\t\t\t\tconst rollbackOpsLifo = this.pendingBatch.splice(startPoint).reverse();\n\t\t\t\tfor (const message of rollbackOpsLifo) {\n\t\t\t\t\tprocess(message);\n\t\t\t\t}\n\t\t\t\tconst count = this.pendingBatch.length - startPoint;\n\t\t\t\tif (count !== 0) {\n\t\t\t\t\tthrow new LoggingError(\"Ops generated during rollback\", {\n\t\t\t\t\t\tcount,\n\t\t\t\t\t\t...tagData(TelemetryDataTag.UserData, {\n\t\t\t\t\t\t\tops: serializeOp(this.pendingBatch.slice(startPoint).map((b) => b.runtimeOp))\n\t\t\t\t\t\t\t\t.content,\n\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * Does this batch current contain user changes (\"dirtyable\" ops)?\n\t */\n\tpublic containsUserChanges(): boolean {\n\t\treturn this.pendingBatch.some((message) => isContainerMessageDirtyable(message.runtimeOp));\n\t}\n}\n\nexport const addBatchMetadata = (batch: LocalBatch, batchId?: BatchId): LocalBatch => {\n\tconst batchEnd = batch.messages.length - 1;\n\n\tconst firstMsg = batch.messages[0];\n\tconst lastMsg = batch.messages[batchEnd];\n\tassert(\n\t\tfirstMsg !== undefined && lastMsg !== undefined,\n\t\t0x9d1 /* expected non-empty batch */,\n\t);\n\n\tconst firstMetadata: Partial<IBatchMetadata> = firstMsg.metadata ?? {};\n\tconst lastMetadata: Partial<IBatchMetadata> = lastMsg.metadata ?? {};\n\n\t// Multi-message batches: mark the first and last messages with the \"batch\" flag indicating batch start/end\n\tif (batch.messages.length > 1) {\n\t\tfirstMetadata.batch = true;\n\t\tlastMetadata.batch = false;\n\t\tfirstMsg.metadata = firstMetadata;\n\t\tlastMsg.metadata = lastMetadata;\n\t}\n\n\t// If batchId is provided (e.g. in case of resubmit): stamp it on the first message\n\tif (batchId !== undefined) {\n\t\tfirstMetadata.batchId = batchId;\n\t\tfirstMsg.metadata = firstMetadata;\n\t}\n\n\treturn batch;\n};\n\nexport const sequenceNumbersMatch = (\n\tseqNums: BatchSequenceNumbers,\n\totherSeqNums: BatchSequenceNumbers,\n): boolean => {\n\treturn (\n\t\t(seqNums.referenceSequenceNumber === undefined ||\n\t\t\totherSeqNums.referenceSequenceNumber === undefined ||\n\t\t\tseqNums.referenceSequenceNumber === otherSeqNums.referenceSequenceNumber) &&\n\t\t(seqNums.clientSequenceNumber === undefined ||\n\t\t\totherSeqNums.clientSequenceNumber === undefined ||\n\t\t\tseqNums.clientSequenceNumber === otherSeqNums.clientSequenceNumber)\n\t);\n};\n"]}
1
+ {"version":3,"file":"batchManager.js","sourceRoot":"","sources":["../../src/opLifecycle/batchManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EACN,YAAY,EACZ,OAAO,EACP,gBAAgB,GAChB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,eAAe,EAAuB,MAAM,gBAAgB,CAAC;AAItE,OAAO,EAAE,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AI,EAAE,CAAC;IACvE,MAAM,YAAY,GAA4B,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;IAErE,2GAA2G;IAC3G,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,aAAa,CAAC,KAAK,GAAG,IAAI,CAAC;QAC3B,YAAY,CAAC,KAAK,GAAG,KAAK,CAAC;QAC3B,QAAQ,CAAC,QAAQ,GAAG,aAAa,CAAC;QAClC,OAAO,CAAC,QAAQ,GAAG,YAAY,CAAC;IACjC,CAAC;IAED,mFAAmF;IACnF,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC3B,aAAa,CAAC,OAAO,GAAG,OAAO,CAAC;QAChC,QAAQ,CAAC,QAAQ,GAAG,aAAa,CAAC;IACnC,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CACnC,OAA6B,EAC7B,YAAkC,EACxB,EAAE;IACZ,OAAO,CACN,CAAC,OAAO,CAAC,uBAAuB,KAAK,SAAS;QAC7C,YAAY,CAAC,uBAAuB,KAAK,SAAS;QAClD,OAAO,CAAC,uBAAuB,KAAK,YAAY,CAAC,uBAAuB,CAAC;QAC1E,CAAC,OAAO,CAAC,oBAAoB,KAAK,SAAS;YAC1C,YAAY,CAAC,oBAAoB,KAAK,SAAS;YAC/C,OAAO,CAAC,oBAAoB,KAAK,YAAY,CAAC,oBAAoB,CAAC,CACpE,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tLoggingError,\n\ttagData,\n\tTelemetryDataTag,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { ICompressionRuntimeOptions } from \"../compressionDefinitions.js\";\nimport { isContainerMessageDirtyable } from \"../containerRuntime.js\";\nimport { asBatchMetadata, type IBatchMetadata } from \"../metadata.js\";\nimport type { IPendingMessage } from \"../pendingStateManager.js\";\n\nimport type { LocalBatchMessage, IBatchCheckpoint, LocalBatch } from \"./definitions.js\";\nimport { serializeOp } from \"./opSerialization.js\";\nimport type { BatchStartInfo } from \"./remoteMessageProcessor.js\";\n\nexport interface IBatchManagerOptions {\n\treadonly disableGroupedBatching: boolean;\n\treadonly compressionOptions?: ICompressionRuntimeOptions;\n}\n\nexport interface BatchSequenceNumbers {\n\treferenceSequenceNumber?: number;\n\tclientSequenceNumber?: number;\n}\n\n/**\n * Type alias for the batchId stored in batch metadata\n */\nexport type BatchId = string;\n\n/**\n * Compose original client ID and client sequence number into BatchId to stamp on the message during reconnect\n */\nexport function generateBatchId(originalClientId: string, batchStartCsn: number): BatchId {\n\treturn `${originalClientId}_[${batchStartCsn}]`;\n}\n\n/**\n * Get the effective batch ID for the input argument.\n * Supports either an IPendingMessage or BatchStartInfo.\n * If the batch ID is explicitly present, return it.\n * Otherwise, generate a new batch ID using the client ID and batch start CSN.\n */\nexport function getEffectiveBatchId(\n\tpendingMessageOrBatchStartInfo: IPendingMessage | BatchStartInfo,\n): string {\n\tif (\"localOpMetadata\" in pendingMessageOrBatchStartInfo) {\n\t\tconst pendingMessage: IPendingMessage = pendingMessageOrBatchStartInfo;\n\t\treturn (\n\t\t\tasBatchMetadata(pendingMessage.opMetadata)?.batchId ??\n\t\t\tgenerateBatchId(\n\t\t\t\tpendingMessage.batchInfo.clientId,\n\t\t\t\tpendingMessage.batchInfo.batchStartCsn,\n\t\t\t)\n\t\t);\n\t}\n\n\tconst batchStart: BatchStartInfo = pendingMessageOrBatchStartInfo;\n\treturn batchStart.batchId ?? generateBatchId(batchStart.clientId, batchStart.batchStartCsn);\n}\n\n/**\n * Helper class that manages partial batch & rollback.\n */\nexport class BatchManager {\n\tprivate pendingBatch: LocalBatchMessage[] = [];\n\tprivate hasReentrantOps = false;\n\n\tpublic get length(): number {\n\t\treturn this.pendingBatch.length;\n\t}\n\n\tpublic get sequenceNumbers(): BatchSequenceNumbers {\n\t\treturn {\n\t\t\treferenceSequenceNumber: this.referenceSequenceNumber,\n\t\t\tclientSequenceNumber: this.clientSequenceNumber,\n\t\t};\n\t}\n\n\tprivate get referenceSequenceNumber(): number | undefined {\n\t\treturn this.pendingBatch.length === 0\n\t\t\t? undefined\n\t\t\t: // NOTE: In case of reentrant ops, there could be multiple reference sequence numbers, but we will rebase before submitting.\n\t\t\t\tthis.pendingBatch[this.pendingBatch.length - 1].referenceSequenceNumber;\n\t}\n\n\t/**\n\t * The last-processed CSN when this batch started.\n\t * This is used to ensure that while the batch is open, no incoming ops are processed.\n\t */\n\tprivate clientSequenceNumber: number | undefined;\n\n\tconstructor(public readonly options: IBatchManagerOptions) {}\n\n\tpublic push(\n\t\tmessage: LocalBatchMessage,\n\t\treentrant: boolean,\n\t\tcurrentClientSequenceNumber?: number,\n\t): void {\n\t\tthis.hasReentrantOps = this.hasReentrantOps || reentrant;\n\n\t\tif (this.pendingBatch.length === 0) {\n\t\t\tthis.clientSequenceNumber = currentClientSequenceNumber;\n\t\t}\n\n\t\tthis.pendingBatch.push(message);\n\t}\n\n\tpublic get empty(): boolean {\n\t\treturn this.pendingBatch.length === 0;\n\t}\n\n\t/**\n\t * Gets the pending batch and clears state for the next batch.\n\t * The caller is responsible for calling {@link addBatchMetadata} after any modifications (e.g. prepending messages).\n\t */\n\tpublic popBatch(): LocalBatch {\n\t\tassert(this.pendingBatch[0] !== undefined, 0xb8a /* expected non-empty batch */);\n\t\tconst batch: LocalBatch = {\n\t\t\tmessages: this.pendingBatch,\n\t\t\treferenceSequenceNumber: this.referenceSequenceNumber,\n\t\t\thasReentrantOps: this.hasReentrantOps,\n\t\t\tstaged: this.pendingBatch[0].staged,\n\t\t};\n\n\t\tthis.pendingBatch = [];\n\t\tthis.clientSequenceNumber = undefined;\n\t\tthis.hasReentrantOps = false;\n\n\t\treturn batch;\n\t}\n\n\t/**\n\t * Capture the pending state at this point\n\t */\n\tpublic checkpoint(): IBatchCheckpoint {\n\t\tconst startSequenceNumber = this.clientSequenceNumber;\n\t\tconst startPoint = this.pendingBatch.length;\n\t\treturn {\n\t\t\trollback: (process: (message: LocalBatchMessage) => void) => {\n\t\t\t\tthis.clientSequenceNumber = startSequenceNumber;\n\t\t\t\tconst rollbackOpsLifo = this.pendingBatch.splice(startPoint).reverse();\n\t\t\t\tfor (const message of rollbackOpsLifo) {\n\t\t\t\t\tprocess(message);\n\t\t\t\t}\n\t\t\t\tconst count = this.pendingBatch.length - startPoint;\n\t\t\t\tif (count !== 0) {\n\t\t\t\t\tthrow new LoggingError(\"Ops generated during rollback\", {\n\t\t\t\t\t\tcount,\n\t\t\t\t\t\t...tagData(TelemetryDataTag.UserData, {\n\t\t\t\t\t\t\tops: serializeOp(this.pendingBatch.slice(startPoint).map((b) => b.runtimeOp))\n\t\t\t\t\t\t\t\t.content,\n\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * Does this batch current contain user changes (\"dirtyable\" ops)?\n\t */\n\tpublic containsUserChanges(): boolean {\n\t\treturn this.pendingBatch.some((message) => isContainerMessageDirtyable(message.runtimeOp));\n\t}\n}\n\nexport const addBatchMetadata = (batch: LocalBatch, batchId?: BatchId): LocalBatch => {\n\tconst batchEnd = batch.messages.length - 1;\n\n\tconst firstMsg = batch.messages[0];\n\tconst lastMsg = batch.messages[batchEnd];\n\tassert(\n\t\tfirstMsg !== undefined && lastMsg !== undefined,\n\t\t0x9d1 /* expected non-empty batch */,\n\t);\n\n\tconst firstMetadata: Partial<IBatchMetadata> = firstMsg.metadata ?? {};\n\tconst lastMetadata: Partial<IBatchMetadata> = lastMsg.metadata ?? {};\n\n\t// Multi-message batches: mark the first and last messages with the \"batch\" flag indicating batch start/end\n\tif (batch.messages.length > 1) {\n\t\tfirstMetadata.batch = true;\n\t\tlastMetadata.batch = false;\n\t\tfirstMsg.metadata = firstMetadata;\n\t\tlastMsg.metadata = lastMetadata;\n\t}\n\n\t// If batchId is provided (e.g. in case of resubmit): stamp it on the first message\n\tif (batchId !== undefined) {\n\t\tfirstMetadata.batchId = batchId;\n\t\tfirstMsg.metadata = firstMetadata;\n\t}\n\n\treturn batch;\n};\n\nexport const sequenceNumbersMatch = (\n\tseqNums: BatchSequenceNumbers,\n\totherSeqNums: BatchSequenceNumbers,\n): boolean => {\n\treturn (\n\t\t(seqNums.referenceSequenceNumber === undefined ||\n\t\t\totherSeqNums.referenceSequenceNumber === undefined ||\n\t\t\tseqNums.referenceSequenceNumber === otherSeqNums.referenceSequenceNumber) &&\n\t\t(seqNums.clientSequenceNumber === undefined ||\n\t\t\totherSeqNums.clientSequenceNumber === undefined ||\n\t\t\tseqNums.clientSequenceNumber === otherSeqNums.clientSequenceNumber)\n\t);\n};\n"]}
@@ -31,6 +31,13 @@ export interface IOutboxParameters {
31
31
  readonly getCurrentSequenceNumbers: () => BatchSequenceNumbers;
32
32
  readonly reSubmit: (message: PendingMessageResubmitData, squash: boolean) => void;
33
33
  readonly opReentrancy: () => boolean;
34
+ /**
35
+ * JIT callback to generate an ID allocation op at flush time.
36
+ * Called after rebase (if any), so the returned message has the correct refSeq.
37
+ *
38
+ * @returns A LocalBatchMessage for the ID allocation op, or undefined if no IDs need allocating.
39
+ */
40
+ readonly generateIdAllocationOp: () => LocalBatchMessage | undefined;
34
41
  }
35
42
  /**
36
43
  * Info needed to correctly resubmit a batch
@@ -91,7 +98,6 @@ export declare class Outbox {
91
98
  private readonly logger;
92
99
  private readonly mainBatch;
93
100
  private readonly blobAttachBatch;
94
- private readonly idAllocationBatch;
95
101
  private batchRebasesToReport;
96
102
  private rebasing;
97
103
  /**
@@ -106,7 +112,6 @@ export declare class Outbox {
106
112
  get messageCount(): number;
107
113
  get mainBatchMessageCount(): number;
108
114
  get blobAttachBatchMessageCount(): number;
109
- get idAllocationBatchMessageCount(): number;
110
115
  get isEmpty(): boolean;
111
116
  containsUserChanges(): boolean;
112
117
  /**
@@ -120,10 +125,9 @@ export declare class Outbox {
120
125
  * last message processed by the ContainerRuntime. In the absence of op reentrancy, this
121
126
  * pair will remain stable during a single JS turn during which the batch is being built up.
122
127
  */
123
- private maybeFlushPartialBatch;
128
+ private outboxSequenceNumberCoherencyCheck;
124
129
  submit(message: LocalBatchMessage): void;
125
130
  submitBlobAttach(message: LocalBatchMessage): void;
126
- submitIdAllocation(message: LocalBatchMessage): void;
127
131
  private addMessageToBatchManager;
128
132
  /**
129
133
  * Flush all the batches to the ordering service.
@@ -171,7 +175,6 @@ export declare class Outbox {
171
175
  */
172
176
  getBatchCheckpoints(): {
173
177
  mainBatch: IBatchCheckpoint;
174
- idAllocationBatch: IBatchCheckpoint;
175
178
  blobAttachBatch: IBatchCheckpoint;
176
179
  };
177
180
  }
@@ -1 +1 @@
1
- {"version":3,"file":"outbox.d.ts","sourceRoot":"","sources":["../../src/opLifecycle/outbox.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,KAAK,EACX,oBAAoB,EAEpB,MAAM,iCAAiC,CAAC;AAUzC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,KAAK,EACX,0BAA0B,EAC1B,mBAAmB,EACnB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAEN,KAAK,oBAAoB,EAGzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACX,iBAAiB,EACjB,gBAAgB,EAGhB,UAAU,EACV,aAAa,EACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAA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idframework/core-utils/internal";
6
6
  import { DataProcessingError, UsageError, createChildLogger, } from "@fluidframework/telemetry-utils/internal";
7
- import { BatchManager, sequenceNumbersMatch, } from "./batchManager.js";
7
+ import { BatchManager, sequenceNumbersMatch, addBatchMetadata, } from "./batchManager.js";
8
8
  import { serializeOp } from "./opSerialization.js";
9
9
  /**
10
10
  * Temporarily increase the stack limit while executing the provided action.
@@ -105,15 +105,11 @@ export class Outbox {
105
105
  this.maxMismatchedOpsToReport = 3;
106
106
  this.mismatchedOpsReported = 0;
107
107
  this.logger = createChildLogger({ logger: params.logger, namespace: "Outbox" });
108
- this.mainBatch = new BatchManager({ canRebase: true });
109
- this.blobAttachBatch = new BatchManager({ canRebase: true });
110
- this.idAllocationBatch = new BatchManager({
111
- canRebase: false,
112
- ignoreBatchId: true,
113
- });
108
+ this.mainBatch = new BatchManager({ disableGroupedBatching: false });
109
+ this.blobAttachBatch = new BatchManager({ disableGroupedBatching: true });
114
110
  }
115
111
  get messageCount() {
116
- return this.mainBatch.length + this.blobAttachBatch.length + this.idAllocationBatch.length;
112
+ return this.mainBatch.length + this.blobAttachBatch.length;
117
113
  }
118
114
  get mainBatchMessageCount() {
119
115
  return this.mainBatch.length;
@@ -121,16 +117,11 @@ export class Outbox {
121
117
  get blobAttachBatchMessageCount() {
122
118
  return this.blobAttachBatch.length;
123
119
  }
124
- get idAllocationBatchMessageCount() {
125
- return this.idAllocationBatch.length;
126
- }
127
120
  get isEmpty() {
128
121
  return this.messageCount === 0;
129
122
  }
130
123
  containsUserChanges() {
131
- return (this.mainBatch.containsUserChanges() || this.blobAttachBatch.containsUserChanges()
132
- // ID Allocation ops are not user changes
133
- );
124
+ return this.mainBatch.containsUserChanges() || this.blobAttachBatch.containsUserChanges();
134
125
  }
135
126
  /**
136
127
  * Detect whether batching has been interrupted by an incoming message being processed. In this case,
@@ -143,16 +134,13 @@ export class Outbox {
143
134
  * last message processed by the ContainerRuntime. In the absence of op reentrancy, this
144
135
  * pair will remain stable during a single JS turn during which the batch is being built up.
145
136
  */
146
- maybeFlushPartialBatch() {
137
+ outboxSequenceNumberCoherencyCheck() {
147
138
  const mainBatchSeqNums = this.mainBatch.sequenceNumbers;
148
139
  const blobAttachSeqNums = this.blobAttachBatch.sequenceNumbers;
149
- const idAllocSeqNums = this.idAllocationBatch.sequenceNumbers;
150
- assert(sequenceNumbersMatch(mainBatchSeqNums, blobAttachSeqNums) &&
151
- sequenceNumbersMatch(mainBatchSeqNums, idAllocSeqNums), 0x58d /* Reference sequence numbers from both batches must be in sync */);
140
+ assert(sequenceNumbersMatch(mainBatchSeqNums, blobAttachSeqNums), 0x58d /* Reference sequence numbers from both batches must be in sync */);
152
141
  const currentSequenceNumbers = this.params.getCurrentSequenceNumbers();
153
142
  if (sequenceNumbersMatch(mainBatchSeqNums, currentSequenceNumbers) &&
154
- sequenceNumbersMatch(blobAttachSeqNums, currentSequenceNumbers) &&
155
- sequenceNumbersMatch(idAllocSeqNums, currentSequenceNumbers)) {
143
+ sequenceNumbersMatch(blobAttachSeqNums, currentSequenceNumbers)) {
156
144
  // The reference sequence numbers are stable, there is nothing to do
157
145
  return;
158
146
  }
@@ -184,17 +172,13 @@ export class Outbox {
184
172
  throw errorWrapper.value;
185
173
  }
186
174
  submit(message) {
187
- this.maybeFlushPartialBatch();
175
+ this.outboxSequenceNumberCoherencyCheck();
188
176
  this.addMessageToBatchManager(this.mainBatch, message);
189
177
  }
190
178
  submitBlobAttach(message) {
191
- this.maybeFlushPartialBatch();
179
+ this.outboxSequenceNumberCoherencyCheck();
192
180
  this.addMessageToBatchManager(this.blobAttachBatch, message);
193
181
  }
194
- submitIdAllocation(message) {
195
- this.maybeFlushPartialBatch();
196
- this.addMessageToBatchManager(this.idAllocationBatch, message);
197
- }
198
182
  addMessageToBatchManager(batchManager, message) {
199
183
  batchManager.push(message, this.isContextReentrant(), this.params.getCurrentSequenceNumbers().clientSequenceNumber);
200
184
  }
@@ -207,17 +191,18 @@ export class Outbox {
207
191
  */
208
192
  flush(resubmitInfo) {
209
193
  // We have nothing to flush if all batchManagers are empty, and we we're not needing to resubmit an empty batch placeholder
210
- if (this.idAllocationBatch.empty &&
211
- this.blobAttachBatch.empty &&
194
+ if (this.blobAttachBatch.empty &&
212
195
  this.mainBatch.empty &&
213
196
  resubmitInfo?.batchId === undefined) {
197
+ // Note that it's possible that there are unfinalized ranges in the ID Compressor,
198
+ // but there's no urgency to flush those if they're not referenced in any messages.
214
199
  return;
215
200
  }
216
201
  assert(!this.isContextReentrant(), 0xb7b /* Flushing must not happen while incoming changes are being processed */);
217
202
  this.flushAll(resubmitInfo);
218
203
  }
219
204
  flushAll(resubmitInfo) {
220
- const allBatchesEmpty = this.idAllocationBatch.empty && this.blobAttachBatch.empty && this.mainBatch.empty;
205
+ const allBatchesEmpty = this.blobAttachBatch.empty && this.mainBatch.empty;
221
206
  if (allBatchesEmpty) {
222
207
  // If we're resubmitting with a batchId and all batches are empty, we need to flush an empty batch.
223
208
  // Note that we currently resubmit one batch at a time, so on resubmit, 1 of the 2 batches will *always* be empty.
@@ -229,22 +214,8 @@ export class Outbox {
229
214
  }
230
215
  return;
231
216
  }
232
- // Don't use resubmittingBatchId for idAllocationBatch.
233
- // ID Allocation messages are not directly resubmitted so don't pass the resubmitInfo
234
- this.flushInternal({
235
- batchManager: this.idAllocationBatch,
236
- // Note: For now, we will never stage ID Allocation messages.
237
- // They won't contain personal info and no harm in extra allocations in case of discarding the staged changes
238
- });
239
- this.flushInternal({
240
- batchManager: this.blobAttachBatch,
241
- disableGroupedBatching: true,
242
- resubmitInfo,
243
- });
244
- this.flushInternal({
245
- batchManager: this.mainBatch,
246
- resubmitInfo,
247
- });
217
+ this.flushInternal(this.blobAttachBatch, resubmitInfo);
218
+ this.flushInternal(this.mainBatch, resubmitInfo);
248
219
  }
249
220
  flushEmptyBatch(resubmittingBatchId, resubmittingStagedBatch) {
250
221
  const referenceSequenceNumber = this.params.getCurrentSequenceNumbers().referenceSequenceNumber;
@@ -258,20 +229,20 @@ export class Outbox {
258
229
  this.params.pendingStateManager.onFlushEmptyBatch(placeholderMessage, clientSequenceNumber, resubmittingStagedBatch);
259
230
  return;
260
231
  }
261
- flushInternal(params) {
262
- const { batchManager, disableGroupedBatching = false, resubmitInfo } = params;
232
+ flushInternal(batchManager, resubmitInfo) {
263
233
  if (batchManager.empty) {
264
234
  return;
265
235
  }
266
- const rawBatch = batchManager.popBatch(resubmitInfo?.batchId);
236
+ let rawBatch = batchManager.popBatch();
267
237
  // On resubmit we use the original batch's staged state, so these should match as well.
268
238
  const staged = rawBatch.staged === true;
269
239
  assert(resubmitInfo === undefined || resubmitInfo.staged === staged, 0xba3 /* Mismatch in staged state tracking */);
270
- const groupingEnabled = !disableGroupedBatching && this.params.groupingManager.groupedBatchingEnabled();
271
- if (batchManager.options.canRebase &&
272
- rawBatch.hasReentrantOps === true &&
273
- groupingEnabled) {
240
+ const groupingEnabled = !batchManager.options.disableGroupedBatching &&
241
+ this.params.groupingManager.groupedBatchingEnabled();
242
+ if (rawBatch.hasReentrantOps === true) {
243
+ assert(resubmitInfo === undefined, 0xcf2 /* Re-submitting a batch with reentrant ops is not supported */);
274
244
  assert(!this.rebasing, 0x6fa /* A rebased batch should never have reentrant ops */);
245
+ // Rebase the current batch (resubmit the ops one-by-one) and then reinvoke flushInternal.
275
246
  // If a batch contains reentrant ops (ops created as a result from processing another op)
276
247
  // it needs to be rebased so that we can ensure consistent reference sequence numbers
277
248
  // and eventual consistency at the DDS level.
@@ -281,16 +252,30 @@ export class Outbox {
281
252
  this.rebase(rawBatch, batchManager);
282
253
  return;
283
254
  }
284
- let clientSequenceNumber;
285
255
  // Did we disconnect? (i.e. is shouldSend false?)
286
256
  // If so, do nothing, as pending state manager will resubmit it correctly on reconnect.
287
257
  // Because flush() is a task that executes async (on clean stack), we can get here in disconnected state.
288
- if (this.params.shouldSend() && !staged) {
258
+ const shouldSendNow = this.params.shouldSend() && !staged;
259
+ let clientSequenceNumber;
260
+ if (shouldSendNow) {
261
+ // Generate ID Allocation op just-in-time, after rebase (if any), and before addBatchMetadata,
262
+ // so that the prepended idAllocMsg is correctly marked as the first op in the batch.
263
+ // This ensures the refSeq is correct (matching the rest of the batch) and that
264
+ // ID ranges aren't lost during rebase (since reSubmit drops IdAllocation ops).
265
+ // Only generate for non-staged batches — ID alloc ops are always non-staged.
266
+ const idAllocMsg = this.params.generateIdAllocationOp();
267
+ if (idAllocMsg !== undefined) {
268
+ rawBatch = { ...rawBatch, messages: [idAllocMsg, ...rawBatch.messages] };
269
+ }
270
+ addBatchMetadata(rawBatch, resubmitInfo?.batchId);
289
271
  const virtualizedBatch = this.virtualizeBatch(rawBatch, groupingEnabled);
290
272
  clientSequenceNumber = this.sendBatch(virtualizedBatch);
291
273
  assert(clientSequenceNumber === undefined || clientSequenceNumber >= 0, 0x9d2 /* unexpected negative clientSequenceNumber (empty batch should yield undefined) */);
292
274
  }
293
- this.params.pendingStateManager.onFlushBatch(rawBatch.messages, clientSequenceNumber, staged, batchManager.options.ignoreBatchId);
275
+ else {
276
+ addBatchMetadata(rawBatch, resubmitInfo?.batchId);
277
+ }
278
+ this.params.pendingStateManager.onFlushBatch(rawBatch.messages, clientSequenceNumber, staged);
294
279
  }
295
280
  /**
296
281
  * Rebases a batch. All the ops in the batch are resubmitted to the runtime and
@@ -300,7 +285,6 @@ export class Outbox {
300
285
  */
301
286
  rebase(rawBatch, batchManager) {
302
287
  assert(!this.rebasing, 0x6fb /* Reentrancy */);
303
- assert(batchManager.options.canRebase, 0x9a7 /* BatchManager does not support rebase */);
304
288
  this.rebasing = true;
305
289
  const squash = false;
306
290
  for (const message of rawBatch.messages) {
@@ -318,7 +302,7 @@ export class Outbox {
318
302
  }, new UsageError("BatchRebase"));
319
303
  this.batchRebasesToReport--;
320
304
  }
321
- this.flushInternal({ batchManager });
305
+ this.flushInternal(batchManager);
322
306
  this.rebasing = false;
323
307
  }
324
308
  isContextReentrant() {
@@ -431,7 +415,6 @@ export class Outbox {
431
415
  const mainBatch = this.mainBatch.checkpoint();
432
416
  return {
433
417
  mainBatch,
434
- idAllocationBatch: this.idAllocationBatch.checkpoint(),
435
418
  blobAttachBatch: this.blobAttachBatch.checkpoint(),
436
419
  };
437
420
  }