@fluidframework/task-manager 2.53.1 → 2.61.0-355054

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 (43) hide show
  1. package/.mocharc.cjs +1 -2
  2. package/CHANGELOG.md +4 -0
  3. package/api-report/{task-manager.legacy.alpha.api.md → task-manager.legacy.beta.api.md} +6 -6
  4. package/dist/interfaces.d.ts +6 -11
  5. package/dist/interfaces.d.ts.map +1 -1
  6. package/dist/interfaces.js.map +1 -1
  7. package/dist/legacy.d.ts +2 -1
  8. package/dist/packageVersion.d.ts +1 -1
  9. package/dist/packageVersion.d.ts.map +1 -1
  10. package/dist/packageVersion.js +1 -1
  11. package/dist/packageVersion.js.map +1 -1
  12. package/dist/taskManager.d.ts +22 -9
  13. package/dist/taskManager.d.ts.map +1 -1
  14. package/dist/taskManager.js +267 -172
  15. package/dist/taskManager.js.map +1 -1
  16. package/dist/taskManagerFactory.d.ts +2 -4
  17. package/dist/taskManagerFactory.d.ts.map +1 -1
  18. package/dist/taskManagerFactory.js +1 -2
  19. package/dist/taskManagerFactory.js.map +1 -1
  20. package/internal.d.ts +1 -1
  21. package/legacy.d.ts +1 -1
  22. package/lib/interfaces.d.ts +6 -11
  23. package/lib/interfaces.d.ts.map +1 -1
  24. package/lib/interfaces.js.map +1 -1
  25. package/lib/legacy.d.ts +2 -1
  26. package/lib/packageVersion.d.ts +1 -1
  27. package/lib/packageVersion.d.ts.map +1 -1
  28. package/lib/packageVersion.js +1 -1
  29. package/lib/packageVersion.js.map +1 -1
  30. package/lib/taskManager.d.ts +22 -9
  31. package/lib/taskManager.d.ts.map +1 -1
  32. package/lib/taskManager.js +254 -159
  33. package/lib/taskManager.js.map +1 -1
  34. package/lib/taskManagerFactory.d.ts +2 -4
  35. package/lib/taskManagerFactory.d.ts.map +1 -1
  36. package/lib/taskManagerFactory.js +1 -2
  37. package/lib/taskManagerFactory.js.map +1 -1
  38. package/lib/tsdoc-metadata.json +1 -1
  39. package/package.json +39 -26
  40. package/src/interfaces.ts +6 -11
  41. package/src/packageVersion.ts +1 -1
  42. package/src/taskManager.ts +294 -180
  43. package/src/taskManagerFactory.ts +2 -4
package/.mocharc.cjs CHANGED
@@ -7,6 +7,5 @@
7
7
 
8
8
  const getFluidTestMochaConfig = require("@fluid-internal/mocha-test-setup/mocharc-common");
9
9
 
10
- const packageDir = __dirname;
11
- const config = getFluidTestMochaConfig(packageDir);
10
+ const config = getFluidTestMochaConfig(__dirname);
12
11
  module.exports = config;
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluidframework/task-manager
2
2
 
3
+ ## 2.60.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.53.0
4
8
 
5
9
  Dependency updates only.
@@ -1,10 +1,10 @@
1
- ## Alpha API Report File for "@fluidframework/task-manager"
1
+ ## Beta API Report File for "@fluidframework/task-manager"
2
2
 
3
3
  > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
4
 
5
5
  ```ts
6
6
 
7
- // @alpha @legacy
7
+ // @beta @legacy
8
8
  export interface ITaskManager extends ISharedObject<ITaskManagerEvents> {
9
9
  abandon(taskId: string): void;
10
10
  assigned(taskId: string): boolean;
@@ -16,7 +16,7 @@ export interface ITaskManager extends ISharedObject<ITaskManagerEvents> {
16
16
  volunteerForTask(taskId: string): Promise<boolean>;
17
17
  }
18
18
 
19
- // @alpha @legacy
19
+ // @beta @legacy
20
20
  export interface ITaskManagerEvents extends ISharedObjectEvents {
21
21
  // @eventProperty
22
22
  (event: "assigned", listener: TaskEventListener): any;
@@ -26,13 +26,13 @@ export interface ITaskManagerEvents extends ISharedObjectEvents {
26
26
  (event: "lost", listener: TaskEventListener): any;
27
27
  }
28
28
 
29
- // @alpha @legacy
29
+ // @beta @legacy
30
30
  export type TaskEventListener = (taskId: string) => void;
31
31
 
32
- // @alpha @legacy
32
+ // @beta @legacy
33
33
  export const TaskManager: ISharedObjectKind<ITaskManager> & SharedObjectKind<ITaskManager>;
34
34
 
35
- // @alpha @legacy
35
+ // @beta @legacy
36
36
  export type TaskManager = ITaskManager;
37
37
 
38
38
  ```
@@ -7,20 +7,18 @@ import type { ISharedObject, ISharedObjectEvents } from "@fluidframework/shared-
7
7
  * Describes the event listener format for {@link ITaskManagerEvents} events.
8
8
  *
9
9
  * @param taskId - The unique identifier of the related task.
10
- * @legacy
11
- * @alpha
10
+ * @legacy @beta
12
11
  */
13
12
  export type TaskEventListener = (taskId: string) => void;
14
13
  /**
15
14
  * Events emitted by {@link ITaskManager}.
16
- * @legacy
17
- * @alpha
15
+ * @legacy @beta
18
16
  */
19
17
  export interface ITaskManagerEvents extends ISharedObjectEvents {
20
18
  /**
21
19
  * Fires when a task has been exclusively assigned to the client.
22
20
  *
23
- * @remarks Does not account for known pending ops, but instead only reflects the current state.
21
+ * @remarks Does not account for known pending ops, but instead only reflects the current consensus state.
24
22
  *
25
23
  * @eventProperty
26
24
  */
@@ -129,8 +127,7 @@ export interface ITaskManagerEvents extends ISharedObjectEvents {
129
127
  * when using {@link ITaskManager.subscribeToTask}.
130
128
  *
131
129
  * See {@link ITaskManagerEvents} for more details.
132
- * @legacy
133
- * @alpha
130
+ * @legacy @beta
134
131
  */
135
132
  export interface ITaskManager extends ISharedObject<ITaskManagerEvents> {
136
133
  /**
@@ -152,14 +149,12 @@ export interface ITaskManager extends ISharedObject<ITaskManagerEvents> {
152
149
  */
153
150
  abandon(taskId: string): void;
154
151
  /**
155
- * Check whether this client is the current assignee for the task and there is no outstanding abandon op that
156
- * would abandon the assignment.
152
+ * Check whether this client is the current assignee for the task based on the consensus state.
157
153
  * @param taskId - Identifier for the task
158
154
  */
159
155
  assigned(taskId: string): boolean;
160
156
  /**
161
- * Check whether this client is either the current assignee, in queue, or we expect they will be in queue after
162
- * outstanding ops have been ack'd.
157
+ * Check whether this client is either the current assignee or in queue to become the assignee.
163
158
  * @param taskId - Identifier for the task
164
159
  */
165
160
  queued(taskId: string): boolean;
@@ -1 +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OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B;;OAEG;IACH,YAAY,IAAI,OAAO,CAAC;CACxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tISharedObject,\n\tISharedObjectEvents,\n} from \"@fluidframework/shared-object-base/internal\";\n\n/**\n * Describes the event listener format for {@link ITaskManagerEvents} events.\n *\n * @param taskId - The unique identifier of the related task.\n * @legacy\n * @alpha\n */\nexport type TaskEventListener = (taskId: string) => void;\n\n/**\n * Events emitted by {@link ITaskManager}.\n * @legacy\n * @alpha\n */\nexport interface ITaskManagerEvents extends ISharedObjectEvents {\n\t/**\n\t * Fires when a task has been exclusively assigned to the client.\n\t *\n\t * @remarks Does not account for known pending ops, but instead only reflects the current state.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"assigned\", listener: TaskEventListener);\n\n\t/**\n\t * Fires when a task the client is queued for is completed.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"completed\", listener: TaskEventListener);\n\n\t/**\n\t * Fires when the task assignment is lost by the local client.\n\t *\n\t * @remarks This could be due to the client disconnecting or by manually calling {@link ITaskManager.abandon}.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"lost\", listener: TaskEventListener);\n}\n\n/**\n * A distributed data structure that tracks queues of clients that want to exclusively run a task.\n *\n * @example Creation\n *\n * To create a {@link ITaskManager}, call the static create method:\n *\n * ```typescript\n * const taskManager = TaskManager.create(this.runtime, id);\n * ```\n *\n * @example Usage\n *\n * To volunteer for a task, use the {@link ITaskManager.volunteerForTask} method.\n * This returns a Promise that will resolve once the client has acquired exclusive rights to run the task,\n * or reject if the client is removed from the queue without acquiring the rights.\n *\n * ```typescript\n * taskManager.volunteerForTask(\"NameOfTask\")\n * .then(() => { doTheTask(); })\n * .catch((err) => { console.error(err); });\n * ```\n *\n * Alternatively, you can indefinitely volunteer for a task with the synchronous {@link ITaskManager.subscribeToTask}\n * method. This method does not return a value, therefore you need to rely on eventing to know when you have acquired\n * the rights to run the task (see below).\n *\n * ```typescript\n * taskManager.subscribeToTask(\"NameOfTask\");\n * ```\n *\n * To check if the local client is currently subscribed to a task, use the {@link ITaskManager.subscribed} method.\n *\n * ```typescript\n * if (taskManager.subscribed(\"NameOfTask\")) {\n * console.log(\"This client is currently subscribed to the task.\");\n * }\n * ```\n *\n * To release the rights to the task, use the {@link ITaskManager.abandon} method.\n * The next client in the queue will then get the rights to run the task.\n *\n * ```typescript\n * taskManager.abandon(\"NameOfTask\");\n * ```\n *\n * To inspect your state in the queue, you can use the {@link ITaskManager.queued} and {@link ITaskManager.assigned}\n * methods.\n *\n * ```typescript\n * if (taskManager.queued(\"NameOfTask\")) {\n * console.log(\"This client is somewhere in the queue, potentially even having the task assignment.\");\n * }\n *\n * if (taskManager.assigned(\"NameOfTask\")) {\n * console.log(\"This client currently has the rights to run the task\");\n * }\n * ```\n *\n * To signal to other connected clients that a task is completed, use the {@link ITaskManager.complete} method.\n * This will release all clients from the queue and emit the \"completed\" event.\n *\n * ```typescript\n * taskManager.complete(\"NameOfTask\");\n * ```\n *\n * @example Eventing\n *\n * `ITaskManager` will emit events when a task is assigned to the client, when the task assignment is lost,\n * and when a task was completed by another client.\n *\n * ```typescript\n * taskManager.on(\"assigned\", (taskId: string) => {\n * console.log(`Client was assigned task: ${taskId}`);\n * });\n *\n * taskManager.on(\"lost\", (taskId: string) => {\n * console.log(`Client released task: ${taskId}`);\n * });\n *\n * taskManager.on(\"completed\", (taskId: string) => {\n * console.log(`Another client completed task: ${taskId}`);\n * });\n * ```\n *\n * These can be useful if the logic to volunteer for a task is separated from the logic to perform the task, such as\n * when using {@link ITaskManager.subscribeToTask}.\n *\n * See {@link ITaskManagerEvents} for more details.\n * @legacy\n * @alpha\n */\nexport interface ITaskManager extends ISharedObject<ITaskManagerEvents> {\n\t/**\n\t * Volunteer for the task. Returns a promise that resolves `true` if the task is assigned to the local client and\n\t * `false` if the task was completed by another client. It rejects if the local client abandoned the task or\n\t * disconnected while in queue.\n\t * @param taskId - Identifier for the task\n\t */\n\tvolunteerForTask(taskId: string): Promise<boolean>;\n\n\t/**\n\t * Continuously volunteer for the task. Watch the \"assigned\" event to determine if the task is assigned.\n\t * The local client will automatically re-enter the queue if it disconnects.\n\t * @param taskId - Identifier for the task\n\t */\n\tsubscribeToTask(taskId: string): void;\n\n\t/**\n\t * Exit the queue, releasing the task if currently assigned.\n\t * @param taskId - Identifier for the task\n\t */\n\tabandon(taskId: string): void;\n\n\t/**\n\t * Check whether this client is the current assignee for the task and there is no outstanding abandon op that\n\t * would abandon the assignment.\n\t * @param taskId - Identifier for the task\n\t */\n\tassigned(taskId: string): boolean;\n\n\t/**\n\t * Check whether this client is either the current assignee, in queue, or we expect they will be in queue after\n\t * outstanding ops have been ack'd.\n\t * @param taskId - Identifier for the task\n\t */\n\tqueued(taskId: string): boolean;\n\n\t/**\n\t * Check whether this client is currently subscribed to the task.\n\t * @param taskId - Identifier for the task\n\t */\n\tsubscribed(taskId: string): boolean;\n\n\t/**\n\t * Marks a task as completed and releases all clients from its queue.\n\t * @param taskId - Identifier for the task\n\t */\n\tcomplete(taskId: string): void;\n\n\t/**\n\t * Check whether this client can currently volunteer for a task.\n\t */\n\tcanVolunteer(): boolean;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tISharedObject,\n\tISharedObjectEvents,\n} from \"@fluidframework/shared-object-base/internal\";\n\n/**\n * Describes the event listener format for {@link ITaskManagerEvents} events.\n *\n * @param taskId - The unique identifier of the related task.\n * @legacy @beta\n */\nexport type TaskEventListener = (taskId: string) => void;\n\n/**\n * Events emitted by {@link ITaskManager}.\n * @legacy @beta\n */\nexport interface ITaskManagerEvents extends ISharedObjectEvents {\n\t/**\n\t * Fires when a task has been exclusively assigned to the client.\n\t *\n\t * @remarks Does not account for known pending ops, but instead only reflects the current consensus state.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"assigned\", listener: TaskEventListener);\n\n\t/**\n\t * Fires when a task the client is queued for is completed.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"completed\", listener: TaskEventListener);\n\n\t/**\n\t * Fires when the task assignment is lost by the local client.\n\t *\n\t * @remarks This could be due to the client disconnecting or by manually calling {@link ITaskManager.abandon}.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"lost\", listener: TaskEventListener);\n}\n\n/**\n * A distributed data structure that tracks queues of clients that want to exclusively run a task.\n *\n * @example Creation\n *\n * To create a {@link ITaskManager}, call the static create method:\n *\n * ```typescript\n * const taskManager = TaskManager.create(this.runtime, id);\n * ```\n *\n * @example Usage\n *\n * To volunteer for a task, use the {@link ITaskManager.volunteerForTask} method.\n * This returns a Promise that will resolve once the client has acquired exclusive rights to run the task,\n * or reject if the client is removed from the queue without acquiring the rights.\n *\n * ```typescript\n * taskManager.volunteerForTask(\"NameOfTask\")\n * .then(() => { doTheTask(); })\n * .catch((err) => { console.error(err); });\n * ```\n *\n * Alternatively, you can indefinitely volunteer for a task with the synchronous {@link ITaskManager.subscribeToTask}\n * method. This method does not return a value, therefore you need to rely on eventing to know when you have acquired\n * the rights to run the task (see below).\n *\n * ```typescript\n * taskManager.subscribeToTask(\"NameOfTask\");\n * ```\n *\n * To check if the local client is currently subscribed to a task, use the {@link ITaskManager.subscribed} method.\n *\n * ```typescript\n * if (taskManager.subscribed(\"NameOfTask\")) {\n * console.log(\"This client is currently subscribed to the task.\");\n * }\n * ```\n *\n * To release the rights to the task, use the {@link ITaskManager.abandon} method.\n * The next client in the queue will then get the rights to run the task.\n *\n * ```typescript\n * taskManager.abandon(\"NameOfTask\");\n * ```\n *\n * To inspect your state in the queue, you can use the {@link ITaskManager.queued} and {@link ITaskManager.assigned}\n * methods.\n *\n * ```typescript\n * if (taskManager.queued(\"NameOfTask\")) {\n * console.log(\"This client is somewhere in the queue, potentially even having the task assignment.\");\n * }\n *\n * if (taskManager.assigned(\"NameOfTask\")) {\n * console.log(\"This client currently has the rights to run the task\");\n * }\n * ```\n *\n * To signal to other connected clients that a task is completed, use the {@link ITaskManager.complete} method.\n * This will release all clients from the queue and emit the \"completed\" event.\n *\n * ```typescript\n * taskManager.complete(\"NameOfTask\");\n * ```\n *\n * @example Eventing\n *\n * `ITaskManager` will emit events when a task is assigned to the client, when the task assignment is lost,\n * and when a task was completed by another client.\n *\n * ```typescript\n * taskManager.on(\"assigned\", (taskId: string) => {\n * console.log(`Client was assigned task: ${taskId}`);\n * });\n *\n * taskManager.on(\"lost\", (taskId: string) => {\n * console.log(`Client released task: ${taskId}`);\n * });\n *\n * taskManager.on(\"completed\", (taskId: string) => {\n * console.log(`Another client completed task: ${taskId}`);\n * });\n * ```\n *\n * These can be useful if the logic to volunteer for a task is separated from the logic to perform the task, such as\n * when using {@link ITaskManager.subscribeToTask}.\n *\n * See {@link ITaskManagerEvents} for more details.\n * @legacy @beta\n */\nexport interface ITaskManager extends ISharedObject<ITaskManagerEvents> {\n\t/**\n\t * Volunteer for the task. Returns a promise that resolves `true` if the task is assigned to the local client and\n\t * `false` if the task was completed by another client. It rejects if the local client abandoned the task or\n\t * disconnected while in queue.\n\t * @param taskId - Identifier for the task\n\t */\n\tvolunteerForTask(taskId: string): Promise<boolean>;\n\n\t/**\n\t * Continuously volunteer for the task. Watch the \"assigned\" event to determine if the task is assigned.\n\t * The local client will automatically re-enter the queue if it disconnects.\n\t * @param taskId - Identifier for the task\n\t */\n\tsubscribeToTask(taskId: string): void;\n\n\t/**\n\t * Exit the queue, releasing the task if currently assigned.\n\t * @param taskId - Identifier for the task\n\t */\n\tabandon(taskId: string): void;\n\n\t/**\n\t * Check whether this client is the current assignee for the task based on the consensus state.\n\t * @param taskId - Identifier for the task\n\t */\n\tassigned(taskId: string): boolean;\n\n\t/**\n\t * Check whether this client is either the current assignee or in queue to become the assignee.\n\t * @param taskId - Identifier for the task\n\t */\n\tqueued(taskId: string): boolean;\n\n\t/**\n\t * Check whether this client is currently subscribed to the task.\n\t * @param taskId - Identifier for the task\n\t */\n\tsubscribed(taskId: string): boolean;\n\n\t/**\n\t * Marks a task as completed and releases all clients from its queue.\n\t * @param taskId - Identifier for the task\n\t */\n\tcomplete(taskId: string): void;\n\n\t/**\n\t * Check whether this client can currently volunteer for a task.\n\t */\n\tcanVolunteer(): boolean;\n}\n"]}
package/dist/legacy.d.ts CHANGED
@@ -16,9 +16,10 @@
16
16
  */
17
17
 
18
18
  export {
19
- // @legacy APIs
19
+ // #region @legacyBeta APIs
20
20
  ITaskManager,
21
21
  ITaskManagerEvents,
22
22
  TaskEventListener,
23
23
  TaskManager
24
+ // #endregion
24
25
  } from "./index.js";
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/task-manager";
8
- export declare const pkgVersion = "2.53.1";
8
+ export declare const pkgVersion = "2.61.0-355054";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,iCAAiC,CAAC;AACtD,eAAO,MAAM,UAAU,WAAW,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,iCAAiC,CAAC;AACtD,eAAO,MAAM,UAAU,kBAAkB,CAAC"}
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/task-manager";
11
- exports.pkgVersion = "2.53.1";
11
+ exports.pkgVersion = "2.61.0-355054";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,8BAA8B,CAAC;AACzC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/task-manager\";\nexport const pkgVersion = \"2.53.1\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,8BAA8B,CAAC;AACzC,QAAA,UAAU,GAAG,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/task-manager\";\nexport const pkgVersion = \"2.61.0-355054\";\n"]}
@@ -12,8 +12,7 @@ import type { ITaskManager, ITaskManagerEvents } from "./interfaces.js";
12
12
  * {@inheritDoc ITaskManager}
13
13
  *
14
14
  * @sealed
15
- * @legacy
16
- * @alpha
15
+ * @legacy @beta
17
16
  */
18
17
  export declare class TaskManagerClass extends SharedObject<ITaskManagerEvents> implements ITaskManager {
19
18
  /**
@@ -26,7 +25,8 @@ export declare class TaskManagerClass extends SharedObject<ITaskManagerEvents> i
26
25
  private readonly abandonWatcher;
27
26
  private readonly connectionWatcher;
28
27
  private readonly completedWatcher;
29
- private messageId;
28
+ private readonly rollbackWatcher;
29
+ private nextPendingMessageId;
30
30
  /**
31
31
  * Tracks the most recent pending op for a given task
32
32
  */
@@ -35,10 +35,6 @@ export declare class TaskManagerClass extends SharedObject<ITaskManagerEvents> i
35
35
  * Tracks tasks that are this client is currently subscribed to.
36
36
  */
37
37
  private readonly subscribedTasks;
38
- /**
39
- * Map to track tasks that have pending complete ops.
40
- */
41
- private readonly pendingCompletedTasks;
42
38
  /**
43
39
  * Returns the clientId. Will return a placeholder if the runtime is detached and not yet assigned a clientId.
44
40
  */
@@ -113,8 +109,9 @@ export declare class TaskManagerClass extends SharedObject<ITaskManagerEvents> i
113
109
  /**
114
110
  * Override resubmit core to avoid resubmission on reconnect. On disconnect we accept our removal from the
115
111
  * queues, and leave it up to the user to decide whether they want to attempt to re-enter a queue on reconnect.
112
+ * However, we do need to update latestPendingOps to account for the ops we will no longer be processing.
116
113
  */
117
- protected reSubmitCore(): void;
114
+ protected reSubmitCore(content: unknown, localOpMetadata: number): void;
118
115
  /**
119
116
  * Process a task manager operation
120
117
  *
@@ -123,7 +120,7 @@ export declare class TaskManagerClass extends SharedObject<ITaskManagerEvents> i
123
120
  * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
124
121
  * For messages from a remote client, this will be undefined.
125
122
  */
126
- protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
123
+ protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: number | undefined): void;
127
124
  private addClientToQueue;
128
125
  private removeClientFromQueue;
129
126
  private removeClientFromAllQueues;
@@ -133,6 +130,22 @@ export declare class TaskManagerClass extends SharedObject<ITaskManagerEvents> i
133
130
  */
134
131
  private replacePlaceholderInAllQueues;
135
132
  private scrubClientsNotInQuorum;
133
+ /**
134
+ * Checks whether this client is currently assigned or in queue to become assigned, while also accounting
135
+ * for the latest pending ops.
136
+ */
137
+ private queuedOptimistically;
138
+ /**
139
+ * Returns true if the client is detached.
140
+ * This is distinct from !this.isAttached() because `isAttached()` also checks if `this._isBoundToContext`
141
+ * is true. We use `isDetached()` to determine if we should simulate auto-ack behavior for ops, which is
142
+ * mainly concerned with if we have been assigned a real clientId yet.
143
+ */
144
+ private isDetached;
136
145
  protected applyStashedOp(content: unknown): void;
146
+ /**
147
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}
148
+ */
149
+ protected rollback(content: unknown, localOpMetadata: unknown): void;
137
150
  }
138
151
  //# sourceMappingURL=taskManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"taskManager.d.ts","sourceRoot":"","sources":["../src/taskManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EACX,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAG7F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EACN,YAAY,EAEZ,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAqCxE;;;;;;GAMG;AACH,qBAAa,gBACZ,SAAQ,YAAY,CAAC,kBAAkB,CACvC,YAAW,YAAY;IAEvB;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA+B;IAG1D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoC;IAE9D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAoC;IAEjE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAoC;IAEnE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAoC;IAEtE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAoC;IAErE,OAAO,CAAC,SAAS,CAAc;IAC/B;;OAEG;I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