@fluidframework/task-manager 2.0.0-internal.3.0.5 → 2.0.0-internal.3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +21 -18
- package/.mocharc.js +2 -2
- package/api-extractor.json +2 -2
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/taskManager.d.ts +0 -2
- package/dist/taskManager.d.ts.map +1 -1
- package/dist/taskManager.js +11 -12
- package/dist/taskManager.js.map +1 -1
- package/dist/taskManagerFactory.d.ts.map +1 -1
- package/dist/taskManagerFactory.js.map +1 -1
- package/lib/interfaces.d.ts.map +1 -1
- package/lib/interfaces.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/taskManager.d.ts +0 -2
- package/lib/taskManager.d.ts.map +1 -1
- package/lib/taskManager.js +12 -13
- package/lib/taskManager.js.map +1 -1
- package/lib/taskManagerFactory.d.ts.map +1 -1
- package/lib/taskManagerFactory.js.map +1 -1
- package/package.json +108 -107
- package/prettier.config.cjs +1 -1
- package/src/interfaces.ts +49 -49
- package/src/packageVersion.ts +1 -1
- package/src/taskManager.ts +735 -701
- package/src/taskManagerFactory.ts +34 -33
- package/tsconfig.esnext.json +5 -5
- package/tsconfig.json +8 -12
package/src/interfaces.ts
CHANGED
|
@@ -9,66 +9,66 @@ import { ISharedObject, ISharedObjectEvents } from "@fluidframework/shared-objec
|
|
|
9
9
|
* Events emitted by {@link TaskManager}.
|
|
10
10
|
*/
|
|
11
11
|
export interface ITaskManagerEvents extends ISharedObjectEvents {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Notifies when the local client has reached the front of the queue, left the queue, or a task was completed.
|
|
14
|
+
* Does not account for known pending ops, but instead only reflects the current state.
|
|
15
|
+
*/
|
|
16
|
+
(event: "assigned" | "completed" | "lost", listener: (taskId: string) => void);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Task manager interface
|
|
21
21
|
*/
|
|
22
22
|
export interface ITaskManager extends ISharedObject<ITaskManagerEvents> {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Volunteer for the task. Returns a promise that resolves `true` if the task is assigned to the local client and
|
|
25
|
+
* `false` if the task was completed by another client. It rejects if the local client abandoned the task or
|
|
26
|
+
* disconnected while in queue.
|
|
27
|
+
* @param taskId - Identifier for the task
|
|
28
|
+
*/
|
|
29
|
+
volunteerForTask(taskId: string): Promise<boolean>;
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Continuously volunteer for the task. Watch the "assigned" event to determine if the task is assigned.
|
|
33
|
+
* The local client will automatically re-enter the queue if it disconnects.
|
|
34
|
+
* @param taskId - Identifier for the task
|
|
35
|
+
*/
|
|
36
|
+
subscribeToTask(taskId: string): void;
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Exit the queue, releasing the task if currently assigned.
|
|
40
|
+
* @param taskId - Identifier for the task
|
|
41
|
+
*/
|
|
42
|
+
abandon(taskId: string): void;
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Check whether this client is the current assignee for the task and there is no outstanding abandon op that
|
|
46
|
+
* would abandon the assignment.
|
|
47
|
+
* @param taskId - Identifier for the task
|
|
48
|
+
*/
|
|
49
|
+
assigned(taskId: string): boolean;
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Check whether this client is either the current assignee, in queue, or we expect they will be in queue after
|
|
53
|
+
* outstanding ops have been ack'd.
|
|
54
|
+
* @param taskId - Identifier for the task
|
|
55
|
+
*/
|
|
56
|
+
queued(taskId: string): boolean;
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Check whether this client is currently subscribed to the task.
|
|
60
|
+
* @param taskId - Identifier for the task
|
|
61
|
+
*/
|
|
62
|
+
subscribed(taskId: string): boolean;
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Marks a task as completed and releases all clients from its queue.
|
|
66
|
+
* @param taskId - Identifier for the task
|
|
67
|
+
*/
|
|
68
|
+
complete(taskId: string): void;
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Check whether this client can currently volunteer for a task.
|
|
72
|
+
*/
|
|
73
|
+
canVolunteer(): boolean;
|
|
74
74
|
}
|
package/src/packageVersion.ts
CHANGED