@fluidframework/task-manager 2.0.0-rc.4.0.6 → 2.0.0-rc.5.0.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/CHANGELOG.md +8 -0
- package/api-extractor/api-extractor-lint-bundle.json +5 -0
- package/api-extractor/api-extractor-lint-legacy.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-legacy.esm.json +5 -0
- package/api-extractor/api-extractor-lint-public.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-public.esm.json +5 -0
- package/api-extractor.json +1 -1
- package/api-report/task-manager.alpha.api.md +43 -0
- package/api-report/task-manager.beta.api.md +12 -0
- package/api-report/task-manager.public.api.md +12 -0
- package/biome.jsonc +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +3 -3
- 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 +5 -20
- package/dist/taskManager.d.ts.map +1 -1
- package/dist/taskManager.js +9 -28
- package/dist/taskManager.js.map +1 -1
- package/dist/taskManagerFactory.d.ts +12 -2
- package/dist/taskManagerFactory.d.ts.map +1 -1
- package/dist/taskManagerFactory.js +9 -3
- package/dist/taskManagerFactory.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/interfaces.d.ts +3 -3
- 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 +5 -20
- package/lib/taskManager.d.ts.map +1 -1
- package/lib/taskManager.js +3 -22
- package/lib/taskManager.js.map +1 -1
- package/lib/taskManagerFactory.d.ts +12 -2
- package/lib/taskManagerFactory.d.ts.map +1 -1
- package/lib/taskManagerFactory.js +9 -3
- package/lib/taskManagerFactory.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +34 -29
- package/src/index.ts +1 -1
- package/src/interfaces.ts +6 -3
- package/src/packageVersion.ts +1 -1
- package/src/taskManager.ts +17 -33
- package/src/taskManagerFactory.ts +19 -6
- package/tsconfig.json +1 -0
- package/tsdoc.json +4 -0
- package/api-report/task-manager.api.md +0 -68
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @fluidframework/task-manager
|
|
2
2
|
|
|
3
|
+
## 2.0.0-rc.5.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Update to TypeScript 5.4 ([#21214](https://github.com/microsoft/FluidFramework/pull/21214)) [0e6256c722](https://github.com/microsoft/FluidFramework/commit/0e6256c722d8bf024f4325bf02547daeeb18bfa6)
|
|
8
|
+
|
|
9
|
+
Update package implementations to use TypeScript 5.4.5.
|
|
10
|
+
|
|
3
11
|
## 2.0.0-rc.4.0.0
|
|
4
12
|
|
|
5
13
|
Dependency updates only.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
|
|
4
|
+
"mainEntryPointFilePath": "<projectFolder>/dist/legacy.d.ts"
|
|
5
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
|
|
4
|
+
"mainEntryPointFilePath": "<projectFolder>/lib/legacy.d.ts"
|
|
5
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
|
|
4
|
+
"mainEntryPointFilePath": "<projectFolder>/dist/public.d.ts"
|
|
5
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
|
|
4
|
+
"mainEntryPointFilePath": "<projectFolder>/lib/public.d.ts"
|
|
5
|
+
}
|
package/api-extractor.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "../../../common/build/build-common/api-extractor-base.esm.
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-base.esm.current.json"
|
|
4
4
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
## Alpha API Report File for "@fluidframework/task-manager"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import { ISharedObject } from '@fluidframework/shared-object-base/internal';
|
|
8
|
+
import { ISharedObjectEvents } from '@fluidframework/shared-object-base/internal';
|
|
9
|
+
import { ISharedObjectKind } from '@fluidframework/shared-object-base/internal';
|
|
10
|
+
import { SharedObjectKind } from '@fluidframework/shared-object-base/internal';
|
|
11
|
+
|
|
12
|
+
// @alpha
|
|
13
|
+
export interface ITaskManager extends ISharedObject<ITaskManagerEvents> {
|
|
14
|
+
abandon(taskId: string): void;
|
|
15
|
+
assigned(taskId: string): boolean;
|
|
16
|
+
canVolunteer(): boolean;
|
|
17
|
+
complete(taskId: string): void;
|
|
18
|
+
queued(taskId: string): boolean;
|
|
19
|
+
subscribed(taskId: string): boolean;
|
|
20
|
+
subscribeToTask(taskId: string): void;
|
|
21
|
+
volunteerForTask(taskId: string): Promise<boolean>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// @alpha
|
|
25
|
+
export interface ITaskManagerEvents extends ISharedObjectEvents {
|
|
26
|
+
// @eventProperty
|
|
27
|
+
(event: "assigned", listener: TaskEventListener): any;
|
|
28
|
+
// @eventProperty
|
|
29
|
+
(event: "completed", listener: TaskEventListener): any;
|
|
30
|
+
// @eventProperty
|
|
31
|
+
(event: "lost", listener: TaskEventListener): any;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// @alpha
|
|
35
|
+
export type TaskEventListener = (taskId: string) => void;
|
|
36
|
+
|
|
37
|
+
// @alpha
|
|
38
|
+
export const TaskManager: ISharedObjectKind<ITaskManager> & SharedObjectKind<ITaskManager>;
|
|
39
|
+
|
|
40
|
+
// @alpha
|
|
41
|
+
export type TaskManager = ITaskManager;
|
|
42
|
+
|
|
43
|
+
```
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
## Beta API Report File for "@fluidframework/task-manager"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import { ISharedObject } from '@fluidframework/shared-object-base/internal';
|
|
8
|
+
import { ISharedObjectEvents } from '@fluidframework/shared-object-base/internal';
|
|
9
|
+
import { ISharedObjectKind } from '@fluidframework/shared-object-base/internal';
|
|
10
|
+
import { SharedObjectKind } from '@fluidframework/shared-object-base/internal';
|
|
11
|
+
|
|
12
|
+
```
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
## Public API Report File for "@fluidframework/task-manager"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import { ISharedObject } from '@fluidframework/shared-object-base/internal';
|
|
8
|
+
import { ISharedObjectEvents } from '@fluidframework/shared-object-base/internal';
|
|
9
|
+
import { ISharedObjectKind } from '@fluidframework/shared-object-base/internal';
|
|
10
|
+
import { SharedObjectKind } from '@fluidframework/shared-object-base/internal';
|
|
11
|
+
|
|
12
|
+
```
|
package/biome.jsonc
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
* @packageDocumentation
|
|
10
10
|
*/
|
|
11
11
|
export { ITaskManager, ITaskManagerEvents, TaskEventListener } from "./interfaces.js";
|
|
12
|
-
export { TaskManager } from "./
|
|
12
|
+
export { TaskManager } from "./taskManagerFactory.js";
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.TaskManager = void 0;
|
|
8
|
-
var
|
|
9
|
-
Object.defineProperty(exports, "TaskManager", { enumerable: true, get: function () { return
|
|
8
|
+
var taskManagerFactory_js_1 = require("./taskManagerFactory.js");
|
|
9
|
+
Object.defineProperty(exports, "TaskManager", { enumerable: true, get: function () { return taskManagerFactory_js_1.TaskManager; } });
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAUH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAUH,iEAAsD;AAA7C,oHAAA,WAAW,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Contains a distributed data structure, {@link ITaskManager}, to track the queues of clients that want to\n * exclusively run tasks.\n *\n * @packageDocumentation\n */\n\nexport { ITaskManager, ITaskManagerEvents, TaskEventListener } from \"./interfaces.js\";\nexport { TaskManager } from \"./taskManagerFactory.js\";\n"]}
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -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 { ISharedObject, ISharedObjectEvents } from "@fluidframework/shared-object-base";
|
|
5
|
+
import { ISharedObject, ISharedObjectEvents } from "@fluidframework/shared-object-base/internal";
|
|
6
6
|
/**
|
|
7
7
|
* Describes the event listener format for {@link ITaskManagerEvents} events.
|
|
8
8
|
*
|
|
@@ -11,7 +11,7 @@ import { ISharedObject, ISharedObjectEvents } from "@fluidframework/shared-objec
|
|
|
11
11
|
*/
|
|
12
12
|
export type TaskEventListener = (taskId: string) => void;
|
|
13
13
|
/**
|
|
14
|
-
* Events emitted by {@link
|
|
14
|
+
* Events emitted by {@link ITaskManager}.
|
|
15
15
|
* @alpha
|
|
16
16
|
*/
|
|
17
17
|
export interface ITaskManagerEvents extends ISharedObjectEvents {
|
|
@@ -43,7 +43,7 @@ export interface ITaskManagerEvents extends ISharedObjectEvents {
|
|
|
43
43
|
*
|
|
44
44
|
* @example Creation
|
|
45
45
|
*
|
|
46
|
-
* To create a {@link
|
|
46
|
+
* To create a {@link ITaskManager}, call the static create method:
|
|
47
47
|
*
|
|
48
48
|
* ```typescript
|
|
49
49
|
* const taskManager = TaskManager.create(this.runtime, id);
|
package/dist/interfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,aAAa,EACb,mBAAmB,EACnB,MAAM,6CAA6C,CAAC;AAErD;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,kBAAmB,SAAQ,mBAAmB;IAC9D;;;;;;OAMG;IACH,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,iBAAiB,OAAE;IAEjD;;;;OAIG;IACH,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,iBAAiB,OAAE;IAElD;;;;;;OAMG;IACH,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,OAAE;CAC7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FG;AACH,MAAM,WAAW,YAAa,SAAQ,aAAa,CAAC,kBAAkB,CAAC;IACtE;;;;;OAKG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnD;;;;OAIG;IACH,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtC;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAElC;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAEhC;;;OAGG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAEpC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B;;OAEG;IACH,YAAY,IAAI,OAAO,CAAC;CACxB"}
|
package/dist/interfaces.js.map
CHANGED
|
@@ -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 {
|
|
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 {\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 * @alpha\n */\nexport type TaskEventListener = (taskId: string) => void;\n\n/**\n * Events emitted by {@link ITaskManager}.\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 * @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"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -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.0.0-rc.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-rc.5.0.1";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -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.0.0-rc.
|
|
11
|
+
exports.pkgVersion = "2.0.0-rc.5.0.1";
|
|
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,gBAAgB,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.0.0-rc.
|
|
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,gBAAgB,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.0.0-rc.5.0.1\";\n"]}
|
package/dist/taskManager.d.ts
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IChannelAttributes,
|
|
6
|
-
import { ISequencedDocumentMessage } from "@fluidframework/
|
|
7
|
-
import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
|
|
8
|
-
import { IFluidSerializer } from "@fluidframework/shared-object-base";
|
|
9
|
-
import { SharedObject } from "@fluidframework/shared-object-base/internal";
|
|
5
|
+
import { IChannelAttributes, IFluidDataStoreRuntime, IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
|
|
6
|
+
import { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
7
|
+
import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions/internal";
|
|
8
|
+
import { IFluidSerializer, SharedObject } from "@fluidframework/shared-object-base/internal";
|
|
10
9
|
import { ITaskManager, ITaskManagerEvents } from "./interfaces.js";
|
|
11
10
|
/**
|
|
12
11
|
* {@inheritDoc ITaskManager}
|
|
@@ -14,21 +13,7 @@ import { ITaskManager, ITaskManagerEvents } from "./interfaces.js";
|
|
|
14
13
|
* @sealed
|
|
15
14
|
* @alpha
|
|
16
15
|
*/
|
|
17
|
-
export declare class
|
|
18
|
-
/**
|
|
19
|
-
* Create a new TaskManager
|
|
20
|
-
*
|
|
21
|
-
* @param runtime - data store runtime the new task queue belongs to
|
|
22
|
-
* @param id - optional name of the task queue
|
|
23
|
-
* @returns newly create task queue (but not attached yet)
|
|
24
|
-
*/
|
|
25
|
-
static create(runtime: IFluidDataStoreRuntime, id?: string): TaskManager;
|
|
26
|
-
/**
|
|
27
|
-
* Get a factory for TaskManager to register with the data store.
|
|
28
|
-
*
|
|
29
|
-
* @returns a factory that creates and load TaskManager
|
|
30
|
-
*/
|
|
31
|
-
static getFactory(): IChannelFactory;
|
|
16
|
+
export declare class TaskManagerClass extends SharedObject<ITaskManagerEvents> implements ITaskManager {
|
|
32
17
|
/**
|
|
33
18
|
* Mapping of taskId to a queue of clientIds that are waiting on the task. Maintains the consensus state of the
|
|
34
19
|
* queue, even if we know we've submitted an op that should eventually modify the queue.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taskManager.d.ts","sourceRoot":"","sources":["../src/taskManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"taskManager.d.ts","sourceRoot":"","sources":["../src/taskManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAEN,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EACN,gBAAgB,EAChB,YAAY,EAEZ,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAqCnE;;;;;GAKG;AACH,qBAAa,gBACZ,SAAQ,YAAY,CAAC,kBAAkB,CACvC,YAAW,YAAY;IAEvB;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoC;IAG/D,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;IACH,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAsC;IAEvE;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA0B;IAE1D;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAoC;IAE1E;;OAEG;IACH,OAAO,KAAK,QAAQ,GAEnB;IAED;;OAEG;IACH,OAAO,KAAK,YAAY,GAEvB;IAED;;;;;;OAMG;gBACS,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,kBAAkB;IAqHvF,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,gBAAgB;IAoBxB;;OAEG;IACU,gBAAgB,CAAC,MAAM,EAAE,MAAM;IAwF5C;;OAEG;IACI,eAAe,CAAC,MAAM,EAAE,MAAM;IA6ErC;;OAEG;IACI,OAAO,CAAC,MAAM,EAAE,MAAM;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;;;;OAIG;IACH,SAAS,CAAC,aAAa,CAAC,UAAU,EAAE,gBAAgB,GAAG,qBAAqB;IAuB5E;;OAEG;cACa,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQxE,KAAK;IACL,SAAS,CAAC,mBAAmB;IAE7B;;OAEG;IACH,SAAS,CAAC,YAAY;IAItB;;OAEG;IACH,SAAS,CAAC,SAAS;IAKnB;;;OAGG;IACH,SAAS,CAAC,YAAY;IAEtB;;;;;;;OAOG;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;IAiB/B,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI;CAmB5C"}
|
package/dist/taskManager.js
CHANGED
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.TaskManagerClass = void 0;
|
|
8
8
|
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
9
9
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
10
|
-
const internal_2 = require("@fluidframework/driver-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const taskManagerFactory_js_1 = require("./taskManagerFactory.js");
|
|
10
|
+
const internal_2 = require("@fluidframework/driver-definitions/internal");
|
|
11
|
+
const internal_3 = require("@fluidframework/driver-utils/internal");
|
|
12
|
+
const internal_4 = require("@fluidframework/shared-object-base/internal");
|
|
14
13
|
const snapshotFileName = "header";
|
|
15
14
|
/**
|
|
16
15
|
* Placeholder clientId for detached scenarios.
|
|
@@ -22,25 +21,7 @@ const placeholderClientId = "placeholder";
|
|
|
22
21
|
* @sealed
|
|
23
22
|
* @alpha
|
|
24
23
|
*/
|
|
25
|
-
class
|
|
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_js_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_js_1.TaskManagerFactory();
|
|
43
|
-
}
|
|
24
|
+
class TaskManagerClass extends internal_4.SharedObject {
|
|
44
25
|
/**
|
|
45
26
|
* Returns the clientId. Will return a placeholder if the runtime is detached and not yet assigned a clientId.
|
|
46
27
|
*/
|
|
@@ -477,13 +458,13 @@ class TaskManager extends internal_3.SharedObject {
|
|
|
477
458
|
}
|
|
478
459
|
});
|
|
479
460
|
const content = [...filteredMap.entries()];
|
|
480
|
-
return (0,
|
|
461
|
+
return (0, internal_4.createSingleBlobSummary)(snapshotFileName, JSON.stringify(content));
|
|
481
462
|
}
|
|
482
463
|
/**
|
|
483
464
|
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
|
|
484
465
|
*/
|
|
485
466
|
async loadCore(storage) {
|
|
486
|
-
const content = await (0,
|
|
467
|
+
const content = await (0, internal_3.readAndParse)(storage, snapshotFileName);
|
|
487
468
|
content.forEach(([taskId, clientIdQueue]) => {
|
|
488
469
|
this.taskQueues.set(taskId, clientIdQueue);
|
|
489
470
|
});
|
|
@@ -518,7 +499,7 @@ class TaskManager extends internal_3.SharedObject {
|
|
|
518
499
|
* For messages from a remote client, this will be undefined.
|
|
519
500
|
*/
|
|
520
501
|
processCore(message, local, localOpMetadata) {
|
|
521
|
-
if (message.type ===
|
|
502
|
+
if (message.type === internal_2.MessageType.Operation) {
|
|
522
503
|
const op = message.contents;
|
|
523
504
|
const messageId = localOpMetadata;
|
|
524
505
|
switch (op.type) {
|
|
@@ -633,5 +614,5 @@ class TaskManager extends internal_3.SharedObject {
|
|
|
633
614
|
}
|
|
634
615
|
}
|
|
635
616
|
}
|
|
636
|
-
exports.
|
|
617
|
+
exports.TaskManagerClass = TaskManagerClass;
|
|
637
618
|
//# sourceMappingURL=taskManager.js.map
|