@fluidframework/task-manager 2.0.0-internal.6.4.0 → 2.0.0-internal.7.1.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.
@@ -0,0 +1,346 @@
1
+ /**
2
+ * Contains a distributed data structure, {@link ITaskManager}, to track the queues of clients that want to
3
+ * exclusively run tasks.
4
+ *
5
+ * @packageDocumentation
6
+ */
7
+
8
+ import { IChannelAttributes } from '@fluidframework/datastore-definitions';
9
+ import { IChannelFactory } from '@fluidframework/datastore-definitions';
10
+ import { IChannelStorageService } from '@fluidframework/datastore-definitions';
11
+ import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
12
+ import { IFluidSerializer } from '@fluidframework/shared-object-base';
13
+ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
14
+ import { ISharedObject } from '@fluidframework/shared-object-base';
15
+ import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
16
+ import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
17
+ import { SharedObject } from '@fluidframework/shared-object-base';
18
+
19
+ /**
20
+ * A distributed data structure that tracks queues of clients that want to exclusively run a task.
21
+ *
22
+ * @example Creation
23
+ *
24
+ * To create a {@link TaskManager}, call the static create method:
25
+ *
26
+ * ```typescript
27
+ * const taskManager = TaskManager.create(this.runtime, id);
28
+ * ```
29
+ *
30
+ * @example Usage
31
+ *
32
+ * To volunteer for a task, use the {@link ITaskManager.volunteerForTask} method.
33
+ * This returns a Promise that will resolve once the client has acquired exclusive rights to run the task,
34
+ * or reject if the client is removed from the queue without acquiring the rights.
35
+ *
36
+ * ```typescript
37
+ * taskManager.volunteerForTask("NameOfTask")
38
+ * .then(() => { doTheTask(); })
39
+ * .catch((err) => { console.error(err); });
40
+ * ```
41
+ *
42
+ * Alternatively, you can indefinitely volunteer for a task with the synchronous {@link ITaskManager.subscribeToTask}
43
+ * method. This method does not return a value, therefore you need to rely on eventing to know when you have acquired
44
+ * the rights to run the task (see below).
45
+ *
46
+ * ```typescript
47
+ * taskManager.subscribeToTask("NameOfTask");
48
+ * ```
49
+ *
50
+ * To check if the local client is currently subscribed to a task, use the {@link ITaskManager.subscribed} method.
51
+ *
52
+ * ```typescript
53
+ * if (taskManager.subscribed("NameOfTask")) {
54
+ * console.log("This client is currently subscribed to the task.");
55
+ * }
56
+ * ```
57
+ *
58
+ * To release the rights to the task, use the {@link ITaskManager.abandon} method.
59
+ * The next client in the queue will then get the rights to run the task.
60
+ *
61
+ * ```typescript
62
+ * taskManager.abandon("NameOfTask");
63
+ * ```
64
+ *
65
+ * To inspect your state in the queue, you can use the {@link ITaskManager.queued} and {@link ITaskManager.assigned}
66
+ * methods.
67
+ *
68
+ * ```typescript
69
+ * if (taskManager.queued("NameOfTask")) {
70
+ * console.log("This client is somewhere in the queue, potentially even having the task assignment.");
71
+ * }
72
+ *
73
+ * if (taskManager.assigned("NameOfTask")) {
74
+ * console.log("This client currently has the rights to run the task");
75
+ * }
76
+ * ```
77
+ *
78
+ * To signal to other connected clients that a task is completed, use the {@link ITaskManager.complete} method.
79
+ * This will release all clients from the queue and emit the "completed" event.
80
+ *
81
+ * ```typescript
82
+ * taskManager.complete("NameOfTask");
83
+ * ```
84
+ *
85
+ * @example Eventing
86
+ *
87
+ * `ITaskManager` will emit events when a task is assigned to the client, when the task assignment is lost,
88
+ * and when a task was completed by another client.
89
+ *
90
+ * ```typescript
91
+ * taskManager.on("assigned", (taskId: string) => {
92
+ * console.log(`Client was assigned task: ${taskId}`);
93
+ * });
94
+ *
95
+ * taskManager.on("lost", (taskId: string) => {
96
+ * console.log(`Client released task: ${taskId}`);
97
+ * });
98
+ *
99
+ * taskManager.on("completed", (taskId: string) => {
100
+ * console.log(`Another client completed task: ${taskId}`);
101
+ * });
102
+ * ```
103
+ *
104
+ * These can be useful if the logic to volunteer for a task is separated from the logic to perform the task, such as
105
+ * when using {@link ITaskManager.subscribeToTask}.
106
+ *
107
+ * See {@link ITaskManagerEvents} for more details.
108
+ *
109
+ * @public
110
+ */
111
+ export declare interface ITaskManager extends ISharedObject<ITaskManagerEvents> {
112
+ /**
113
+ * Volunteer for the task. Returns a promise that resolves `true` if the task is assigned to the local client and
114
+ * `false` if the task was completed by another client. It rejects if the local client abandoned the task or
115
+ * disconnected while in queue.
116
+ * @param taskId - Identifier for the task
117
+ */
118
+ volunteerForTask(taskId: string): Promise<boolean>;
119
+ /**
120
+ * Continuously volunteer for the task. Watch the "assigned" event to determine if the task is assigned.
121
+ * The local client will automatically re-enter the queue if it disconnects.
122
+ * @param taskId - Identifier for the task
123
+ */
124
+ subscribeToTask(taskId: string): void;
125
+ /**
126
+ * Exit the queue, releasing the task if currently assigned.
127
+ * @param taskId - Identifier for the task
128
+ */
129
+ abandon(taskId: string): void;
130
+ /**
131
+ * Check whether this client is the current assignee for the task and there is no outstanding abandon op that
132
+ * would abandon the assignment.
133
+ * @param taskId - Identifier for the task
134
+ */
135
+ assigned(taskId: string): boolean;
136
+ /**
137
+ * Check whether this client is either the current assignee, in queue, or we expect they will be in queue after
138
+ * outstanding ops have been ack'd.
139
+ * @param taskId - Identifier for the task
140
+ */
141
+ queued(taskId: string): boolean;
142
+ /**
143
+ * Check whether this client is currently subscribed to the task.
144
+ * @param taskId - Identifier for the task
145
+ */
146
+ subscribed(taskId: string): boolean;
147
+ /**
148
+ * Marks a task as completed and releases all clients from its queue.
149
+ * @param taskId - Identifier for the task
150
+ */
151
+ complete(taskId: string): void;
152
+ /**
153
+ * Check whether this client can currently volunteer for a task.
154
+ */
155
+ canVolunteer(): boolean;
156
+ }
157
+
158
+ /**
159
+ * Events emitted by {@link TaskManager}.
160
+ *
161
+ * @public
162
+ */
163
+ export declare interface ITaskManagerEvents extends ISharedObjectEvents {
164
+ /**
165
+ * Fires when a task has been exclusively assigned to the client.
166
+ *
167
+ * @remarks Does not account for known pending ops, but instead only reflects the current state.
168
+ *
169
+ * @eventProperty
170
+ */
171
+ (event: "assigned", listener: TaskEventListener): any;
172
+ /**
173
+ * Fires when a task the client is queued for is completed.
174
+ *
175
+ * @eventProperty
176
+ */
177
+ (event: "completed", listener: TaskEventListener): any;
178
+ /**
179
+ * Fires when the task assignment is lost by the local client.
180
+ *
181
+ * @remarks This could be due to the client disconnecting or by manually calling {@link ITaskManager.abandon}.
182
+ *
183
+ * @eventProperty
184
+ */
185
+ (event: "lost", listener: TaskEventListener): any;
186
+ }
187
+
188
+ /**
189
+ * Describes the event listener format for {@link ITaskManagerEvents} events.
190
+ *
191
+ * @param taskId - The unique identifier of the related task.
192
+ *
193
+ * @public
194
+ */
195
+ export declare type TaskEventListener = (taskId: string) => void;
196
+
197
+ /**
198
+ * {@inheritDoc ITaskManager}
199
+ *
200
+ * @sealed
201
+ * @public
202
+ */
203
+ export declare class TaskManager extends SharedObject<ITaskManagerEvents> implements ITaskManager {
204
+ /**
205
+ * Create a new TaskManager
206
+ *
207
+ * @param runtime - data store runtime the new task queue belongs to
208
+ * @param id - optional name of the task queue
209
+ * @returns newly create task queue (but not attached yet)
210
+ */
211
+ static create(runtime: IFluidDataStoreRuntime, id?: string): TaskManager;
212
+ /**
213
+ * Get a factory for TaskManager to register with the data store.
214
+ *
215
+ * @returns a factory that creates and load TaskManager
216
+ */
217
+ static getFactory(): IChannelFactory;
218
+ /**
219
+ * Mapping of taskId to a queue of clientIds that are waiting on the task. Maintains the consensus state of the
220
+ * queue, even if we know we've submitted an op that should eventually modify the queue.
221
+ */
222
+ private readonly taskQueues;
223
+ private readonly opWatcher;
224
+ private readonly queueWatcher;
225
+ private readonly abandonWatcher;
226
+ private readonly connectionWatcher;
227
+ private readonly completedWatcher;
228
+ private messageId;
229
+ /**
230
+ * Tracks the most recent pending op for a given task
231
+ */
232
+ private readonly latestPendingOps;
233
+ /**
234
+ * Tracks tasks that are this client is currently subscribed to.
235
+ */
236
+ private readonly subscribedTasks;
237
+ /**
238
+ * Map to track tasks that have pending complete ops.
239
+ */
240
+ private readonly pendingCompletedTasks;
241
+ /**
242
+ * Returns the clientId. Will return a placeholder if the runtime is detached and not yet assigned a clientId.
243
+ */
244
+ private get clientId();
245
+ /**
246
+ * Returns a ReadOnlyInfo object to determine current read/write permissions.
247
+ */
248
+ private get readOnlyInfo();
249
+ /**
250
+ * Constructs a new task manager. If the object is non-local an id and service interfaces will
251
+ * be provided
252
+ *
253
+ * @param runtime - data store runtime the task queue belongs to
254
+ * @param id - optional name of the task queue
255
+ */
256
+ constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
257
+ private submitVolunteerOp;
258
+ private submitAbandonOp;
259
+ private submitCompleteOp;
260
+ /**
261
+ * {@inheritDoc ITaskManager.volunteerForTask}
262
+ */
263
+ volunteerForTask(taskId: string): Promise<boolean>;
264
+ /**
265
+ * {@inheritDoc ITaskManager.subscribeToTask}
266
+ */
267
+ subscribeToTask(taskId: string): void;
268
+ /**
269
+ * {@inheritDoc ITaskManager.abandon}
270
+ */
271
+ abandon(taskId: string): void;
272
+ /**
273
+ * {@inheritDoc ITaskManager.assigned}
274
+ */
275
+ assigned(taskId: string): boolean;
276
+ /**
277
+ * {@inheritDoc ITaskManager.queued}
278
+ */
279
+ queued(taskId: string): boolean;
280
+ /**
281
+ * {@inheritDoc ITaskManager.subscribed}
282
+ */
283
+ subscribed(taskId: string): boolean;
284
+ /**
285
+ * {@inheritDoc ITaskManager.complete}
286
+ */
287
+ complete(taskId: string): void;
288
+ /**
289
+ * {@inheritDoc ITaskManager.canVolunteer}
290
+ */
291
+ canVolunteer(): boolean;
292
+ /**
293
+ * Create a summary for the task manager
294
+ *
295
+ * @returns the summary of the current state of the task manager
296
+ * @internal
297
+ */
298
+ protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
299
+ /**
300
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
301
+ * @internal
302
+ */
303
+ protected loadCore(storage: IChannelStorageService): Promise<void>;
304
+ /**
305
+ * @internal
306
+ */
307
+ protected initializeLocalCore(): void;
308
+ /**
309
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}
310
+ * @internal
311
+ */
312
+ protected onDisconnect(): void;
313
+ /**
314
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onConnect}
315
+ * @internal
316
+ */
317
+ protected onConnect(): void;
318
+ /**
319
+ * Override resubmit core to avoid resubmission on reconnect. On disconnect we accept our removal from the
320
+ * queues, and leave it up to the user to decide whether they want to attempt to re-enter a queue on reconnect.
321
+ * @internal
322
+ */
323
+ protected reSubmitCore(): void;
324
+ /**
325
+ * Process a task manager operation
326
+ *
327
+ * @param message - the message to prepare
328
+ * @param local - whether the message was sent by the local client
329
+ * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
330
+ * For messages from a remote client, this will be undefined.
331
+ * @internal
332
+ */
333
+ protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
334
+ private addClientToQueue;
335
+ private removeClientFromQueue;
336
+ private removeClientFromAllQueues;
337
+ /**
338
+ * Will replace all instances of the placeholderClientId with the current clientId. This should only be called when
339
+ * transitioning from detached to attached and this.runtime.clientId is defined.
340
+ */
341
+ private replacePlaceholderInAllQueues;
342
+ private scrubClientsNotInQuorum;
343
+ applyStashedOp(): void;
344
+ }
345
+
346
+ export { }
@@ -11,6 +11,7 @@ import { ITaskManager, ITaskManagerEvents } from "./interfaces";
11
11
  * {@inheritDoc ITaskManager}
12
12
  *
13
13
  * @sealed
14
+ * @public
14
15
  */
15
16
  export declare class TaskManager extends SharedObject<ITaskManagerEvents> implements ITaskManager {
16
17
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"taskManager.d.ts","sourceRoot":"","sources":["../src/taskManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,yBAAyB,EAAe,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EACN,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAA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;IAwB7B;;OAEG;IACI,QAAQ,CAAC,MAAM,EAAE,MAAM;IAa9B;;OAEG;IACI,MAAM,CAAC,MAAM,EAAE,MAAM;IAgB5B;;OAEG;IACI,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAI1C;;OAEG;IACI,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAmBrC;;OAEG;IACI,YAAY,IAAI,OAAO;IAQ9B;;;;;OAKG;IACH,SAAS,CAAC,aAAa,CAAC,UAAU,EAAE,gBAAgB,GAAG,qBAAqB;IAuB5E;;;OAGG;cACa,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQxE;;OAEG;IACH,SAAS,CAAC,mBAAmB;IAE7B;;;OAGG;IACH,SAAS,CAAC,YAAY;IAItB;;;OAGG;IACH,SAAS,CAAC,SAAS;IAKnB;;;;OAIG;IACH,SAAS,CAAC,YAAY;IAEtB;;;;;;;;OAQG;IACH,SAAS,CAAC,WAAW,CACpB,OAAO,EAAE,yBAAyB,EAClC,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,OAAO;IAyBzB,OAAO,CAAC,gBAAgB;IA4BxB,OAAO,CAAC,qBAAqB;IAsB7B,OAAO,CAAC,yBAAyB;IAMjC;;;OAGG;IACH,OAAO,CAAC,6BAA6B;IAerC,OAAO,CAAC,uBAAuB;IAiBxB,cAAc;CAGrB"}
@@ -20,8 +20,39 @@ const placeholderClientId = "placeholder";
20
20
  * {@inheritDoc ITaskManager}
21
21
  *
22
22
  * @sealed
23
+ * @public
23
24
  */
24
25
  class TaskManager extends shared_object_base_1.SharedObject {
26
+ /**
27
+ * Create a new TaskManager
28
+ *
29
+ * @param runtime - data store runtime the new task queue belongs to
30
+ * @param id - optional name of the task queue
31
+ * @returns newly create task queue (but not attached yet)
32
+ */
33
+ static create(runtime, id) {
34
+ return runtime.createChannel(id, taskManagerFactory_1.TaskManagerFactory.Type);
35
+ }
36
+ /**
37
+ * Get a factory for TaskManager to register with the data store.
38
+ *
39
+ * @returns a factory that creates and load TaskManager
40
+ */
41
+ static getFactory() {
42
+ return new taskManagerFactory_1.TaskManagerFactory();
43
+ }
44
+ /**
45
+ * Returns the clientId. Will return a placeholder if the runtime is detached and not yet assigned a clientId.
46
+ */
47
+ get clientId() {
48
+ return this.isAttached() ? this.runtime.clientId : placeholderClientId;
49
+ }
50
+ /**
51
+ * Returns a ReadOnlyInfo object to determine current read/write permissions.
52
+ */
53
+ get readOnlyInfo() {
54
+ return this.runtime.deltaManager.readOnlyInfo;
55
+ }
25
56
  /**
26
57
  * Constructs a new task manager. If the object is non-local an id and service interfaces will
27
58
  * be provided
@@ -145,36 +176,6 @@ class TaskManager extends shared_object_base_1.SharedObject {
145
176
  this.latestPendingOps.clear();
146
177
  });
147
178
  }
148
- /**
149
- * Create a new TaskManager
150
- *
151
- * @param runtime - data store runtime the new task queue belongs to
152
- * @param id - optional name of the task queue
153
- * @returns newly create task queue (but not attached yet)
154
- */
155
- static create(runtime, id) {
156
- return runtime.createChannel(id, taskManagerFactory_1.TaskManagerFactory.Type);
157
- }
158
- /**
159
- * Get a factory for TaskManager to register with the data store.
160
- *
161
- * @returns a factory that creates and load TaskManager
162
- */
163
- static getFactory() {
164
- return new taskManagerFactory_1.TaskManagerFactory();
165
- }
166
- /**
167
- * Returns the clientId. Will return a placeholder if the runtime is detached and not yet assigned a clientId.
168
- */
169
- get clientId() {
170
- return this.isAttached() ? this.runtime.clientId : placeholderClientId;
171
- }
172
- /**
173
- * Returns a ReadOnlyInfo object to determine current read/write permissions.
174
- */
175
- get readOnlyInfo() {
176
- return this.runtime.deltaManager.readOnlyInfo;
177
- }
178
179
  submitVolunteerOp(taskId) {
179
180
  const op = {
180
181
  type: "volunteer",