@fluidframework/agent-scheduler 2.0.0-internal.7.1.0 → 2.0.0-internal.7.2.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.
- package/CHANGELOG.md +4 -0
- package/package.json +17 -18
- package/dist/agent-scheduler-alpha.d.ts +0 -132
- package/dist/agent-scheduler-beta.d.ts +0 -132
- package/dist/agent-scheduler-public.d.ts +0 -132
- package/dist/agent-scheduler.d.ts +0 -131
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/agent-scheduler",
|
|
3
|
-
"version": "2.0.0-internal.7.
|
|
3
|
+
"version": "2.0.0-internal.7.2.0",
|
|
4
4
|
"description": "Built in runtime object for distributing agents across instances of a container",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -15,28 +15,27 @@
|
|
|
15
15
|
"module": "lib/index.js",
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@fluid-internal/client-utils": ">=2.0.0-internal.7.
|
|
19
|
-
"@fluidframework/container-definitions": ">=2.0.0-internal.7.
|
|
20
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.
|
|
21
|
-
"@fluidframework/core-utils": ">=2.0.0-internal.7.
|
|
22
|
-
"@fluidframework/datastore": ">=2.0.0-internal.7.
|
|
23
|
-
"@fluidframework/datastore-definitions": ">=2.0.0-internal.7.
|
|
24
|
-
"@fluidframework/map": ">=2.0.0-internal.7.
|
|
25
|
-
"@fluidframework/register-collection": ">=2.0.0-internal.7.
|
|
26
|
-
"@fluidframework/runtime-definitions": ">=2.0.0-internal.7.
|
|
27
|
-
"@fluidframework/runtime-utils": ">=2.0.0-internal.7.
|
|
28
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-internal.7.
|
|
18
|
+
"@fluid-internal/client-utils": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
|
|
19
|
+
"@fluidframework/container-definitions": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
|
|
20
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
|
|
21
|
+
"@fluidframework/core-utils": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
|
|
22
|
+
"@fluidframework/datastore": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
|
|
23
|
+
"@fluidframework/datastore-definitions": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
|
|
24
|
+
"@fluidframework/map": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
|
|
25
|
+
"@fluidframework/register-collection": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
|
|
26
|
+
"@fluidframework/runtime-definitions": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
|
|
27
|
+
"@fluidframework/runtime-utils": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
|
|
28
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
|
|
29
29
|
"uuid": "^9.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@fluid-tools/build-cli": "^0.
|
|
33
|
-
"@fluidframework/agent-scheduler-previous": "npm:@fluidframework/agent-scheduler@2.0.0-internal.7.
|
|
34
|
-
"@fluidframework/build-common": "^2.0.
|
|
35
|
-
"@fluidframework/build-tools": "^0.
|
|
32
|
+
"@fluid-tools/build-cli": "^0.26.1",
|
|
33
|
+
"@fluidframework/agent-scheduler-previous": "npm:@fluidframework/agent-scheduler@2.0.0-internal.7.1.0",
|
|
34
|
+
"@fluidframework/build-common": "^2.0.3",
|
|
35
|
+
"@fluidframework/build-tools": "^0.26.1",
|
|
36
36
|
"@fluidframework/eslint-config-fluid": "^3.0.0",
|
|
37
37
|
"@microsoft/api-extractor": "^7.37.0",
|
|
38
38
|
"@types/node": "^16.18.38",
|
|
39
|
-
"copyfiles": "^2.4.1",
|
|
40
39
|
"eslint": "~8.50.0",
|
|
41
40
|
"prettier": "~3.0.3",
|
|
42
41
|
"rimraf": "^4.4.0",
|
|
@@ -62,7 +61,7 @@
|
|
|
62
61
|
"build:esnext": "tsc --project ./tsconfig.esnext.json",
|
|
63
62
|
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
64
63
|
"ci:build:docs": "api-extractor run",
|
|
65
|
-
"clean": "rimraf --glob
|
|
64
|
+
"clean": "rimraf --glob dist lib \"*.tsbuildinfo\" \"*.build.log\" _api-extractor-temp",
|
|
66
65
|
"dev": "npm run build:dev -- --watch",
|
|
67
66
|
"eslint": "eslint --format stylish src",
|
|
68
67
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { FluidDataStoreRuntime } from '@fluidframework/datastore';
|
|
2
|
-
import { IEvent } from '@fluidframework/core-interfaces';
|
|
3
|
-
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
4
|
-
import { IFluidDataStoreContext } from '@fluidframework/runtime-definitions';
|
|
5
|
-
import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
|
|
6
|
-
import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
7
|
-
import { NamedFluidDataStoreRegistryEntry } from '@fluidframework/runtime-definitions';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export declare class AgentSchedulerFactory implements IFluidDataStoreFactory {
|
|
13
|
-
static readonly type = "_scheduler";
|
|
14
|
-
readonly type = "_scheduler";
|
|
15
|
-
get IFluidDataStoreFactory(): this;
|
|
16
|
-
static get registryEntry(): NamedFluidDataStoreRegistryEntry;
|
|
17
|
-
static createChildInstance(parentContext: IFluidDataStoreContext): Promise<IAgentScheduler>;
|
|
18
|
-
instantiateDataStore(context: IFluidDataStoreContext, existing: boolean): Promise<FluidDataStoreRuntime>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
24
|
-
export declare const IAgentScheduler: keyof IProvideAgentScheduler;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Agent scheduler distributes a set of tasks/variables across connected clients.
|
|
28
|
-
*
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
export declare interface IAgentScheduler extends IProvideAgentScheduler, IEventProvider<IAgentSchedulerEvents>, IFluidLoadable {
|
|
32
|
-
/**
|
|
33
|
-
* Registers a set of new tasks to distribute amongst connected clients. Only use this if a client wants
|
|
34
|
-
* a new agent to run but does not have the capability to run the agent inside the host.
|
|
35
|
-
* Client can call pick() later if the capability changes.
|
|
36
|
-
*
|
|
37
|
-
* This method should only be called once per task. Duplicate calls will be rejected.
|
|
38
|
-
*/
|
|
39
|
-
register(...taskUrls: string[]): Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* Attempts to pick a set of tasks. A client will only run the task if it's chosen based on consensus.
|
|
42
|
-
* Resolves when the tasks are assigned to one of the connected clients.
|
|
43
|
-
*
|
|
44
|
-
* This method should only be called once per task. Duplicate calls will be rejected.
|
|
45
|
-
*
|
|
46
|
-
* @param worker - callback to run when task is picked up.
|
|
47
|
-
*/
|
|
48
|
-
pick(taskId: string, worker: () => Promise<void>): Promise<void>;
|
|
49
|
-
/**
|
|
50
|
-
* Releases a set of tasks for other clients to grab. Resolves when the tasks are released.
|
|
51
|
-
*
|
|
52
|
-
* Only previously picked tasks are allowed. Releasing non picked tasks will get a rejection.
|
|
53
|
-
* App can call pickedTasks() to get the picked list first.
|
|
54
|
-
*/
|
|
55
|
-
release(...taskUrls: string[]): Promise<void>;
|
|
56
|
-
/**
|
|
57
|
-
* Returns a list of all tasks running on this client
|
|
58
|
-
*/
|
|
59
|
-
pickedTasks(): string[];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Events emitted by {@link (IAgentScheduler:interface)}.
|
|
64
|
-
*
|
|
65
|
-
* @public
|
|
66
|
-
*/
|
|
67
|
-
export declare interface IAgentSchedulerEvents extends IEvent {
|
|
68
|
-
/**
|
|
69
|
-
* Event when ownership of task changes
|
|
70
|
-
* @param event - name of the event:
|
|
71
|
-
*
|
|
72
|
-
* - "picked" - the task has been assigned to this client, in response to pick() being called
|
|
73
|
-
* If client loses this task (due to disconnect), it will attempt to pick it again (on connection)
|
|
74
|
-
* automatically, unless release() is called
|
|
75
|
-
*
|
|
76
|
-
* - "released" - the task was successfully released back to the pool. Client will not attempt to
|
|
77
|
-
* re-acquire the task, unless pick() is called.
|
|
78
|
-
*
|
|
79
|
-
* - "lost" - task is lost due to disconnect or data store / container being attached.
|
|
80
|
-
* Task will be picked up again by some connected client (this client will try as well,
|
|
81
|
-
* unless release() is called)
|
|
82
|
-
*
|
|
83
|
-
* @param listener - callback notified when change happened for particular key
|
|
84
|
-
*/
|
|
85
|
-
(event: "picked" | "released" | "lost", listener: (taskId: string) => void): any;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* @public
|
|
90
|
-
*/
|
|
91
|
-
export declare interface IProvideAgentScheduler {
|
|
92
|
-
readonly IAgentScheduler: IAgentScheduler;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Events emitted by {@link TaskSubscription}.
|
|
97
|
-
*
|
|
98
|
-
* @public
|
|
99
|
-
*/
|
|
100
|
-
export declare interface ITaskSubscriptionEvents extends IEvent {
|
|
101
|
-
(event: "gotTask" | "lostTask", listener: () => void): any;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* TaskSubscription works with an AgentScheduler to make it easier to monitor a specific task ownership.
|
|
106
|
-
*
|
|
107
|
-
* @public
|
|
108
|
-
*/
|
|
109
|
-
export declare class TaskSubscription extends TypedEventEmitter<ITaskSubscriptionEvents> {
|
|
110
|
-
private readonly agentScheduler;
|
|
111
|
-
readonly taskId: string;
|
|
112
|
-
private subscribed;
|
|
113
|
-
/**
|
|
114
|
-
* @param agentScheduler - The AgentScheduler that will be subscribed against
|
|
115
|
-
* @param taskId - The string ID of the task to subscribe against
|
|
116
|
-
*/
|
|
117
|
-
constructor(agentScheduler: IAgentScheduler, taskId: string);
|
|
118
|
-
/**
|
|
119
|
-
* Check if currently holding ownership of the task.
|
|
120
|
-
* @returns true if currently the task owner, false otherwise.
|
|
121
|
-
*/
|
|
122
|
-
haveTask(): boolean;
|
|
123
|
-
/**
|
|
124
|
-
* Volunteer for the task. By default, the TaskSubscription will only watch the task and not volunteer.
|
|
125
|
-
* This is safe to call multiple times across multiple TaskSubscriptions.
|
|
126
|
-
*/
|
|
127
|
-
volunteer(): void;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/* Excluded from this release type: TypedEventEmitter */
|
|
131
|
-
|
|
132
|
-
export { }
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { FluidDataStoreRuntime } from '@fluidframework/datastore';
|
|
2
|
-
import { IEvent } from '@fluidframework/core-interfaces';
|
|
3
|
-
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
4
|
-
import { IFluidDataStoreContext } from '@fluidframework/runtime-definitions';
|
|
5
|
-
import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
|
|
6
|
-
import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
7
|
-
import { NamedFluidDataStoreRegistryEntry } from '@fluidframework/runtime-definitions';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export declare class AgentSchedulerFactory implements IFluidDataStoreFactory {
|
|
13
|
-
static readonly type = "_scheduler";
|
|
14
|
-
readonly type = "_scheduler";
|
|
15
|
-
get IFluidDataStoreFactory(): this;
|
|
16
|
-
static get registryEntry(): NamedFluidDataStoreRegistryEntry;
|
|
17
|
-
static createChildInstance(parentContext: IFluidDataStoreContext): Promise<IAgentScheduler>;
|
|
18
|
-
instantiateDataStore(context: IFluidDataStoreContext, existing: boolean): Promise<FluidDataStoreRuntime>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
24
|
-
export declare const IAgentScheduler: keyof IProvideAgentScheduler;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Agent scheduler distributes a set of tasks/variables across connected clients.
|
|
28
|
-
*
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
export declare interface IAgentScheduler extends IProvideAgentScheduler, IEventProvider<IAgentSchedulerEvents>, IFluidLoadable {
|
|
32
|
-
/**
|
|
33
|
-
* Registers a set of new tasks to distribute amongst connected clients. Only use this if a client wants
|
|
34
|
-
* a new agent to run but does not have the capability to run the agent inside the host.
|
|
35
|
-
* Client can call pick() later if the capability changes.
|
|
36
|
-
*
|
|
37
|
-
* This method should only be called once per task. Duplicate calls will be rejected.
|
|
38
|
-
*/
|
|
39
|
-
register(...taskUrls: string[]): Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* Attempts to pick a set of tasks. A client will only run the task if it's chosen based on consensus.
|
|
42
|
-
* Resolves when the tasks are assigned to one of the connected clients.
|
|
43
|
-
*
|
|
44
|
-
* This method should only be called once per task. Duplicate calls will be rejected.
|
|
45
|
-
*
|
|
46
|
-
* @param worker - callback to run when task is picked up.
|
|
47
|
-
*/
|
|
48
|
-
pick(taskId: string, worker: () => Promise<void>): Promise<void>;
|
|
49
|
-
/**
|
|
50
|
-
* Releases a set of tasks for other clients to grab. Resolves when the tasks are released.
|
|
51
|
-
*
|
|
52
|
-
* Only previously picked tasks are allowed. Releasing non picked tasks will get a rejection.
|
|
53
|
-
* App can call pickedTasks() to get the picked list first.
|
|
54
|
-
*/
|
|
55
|
-
release(...taskUrls: string[]): Promise<void>;
|
|
56
|
-
/**
|
|
57
|
-
* Returns a list of all tasks running on this client
|
|
58
|
-
*/
|
|
59
|
-
pickedTasks(): string[];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Events emitted by {@link (IAgentScheduler:interface)}.
|
|
64
|
-
*
|
|
65
|
-
* @public
|
|
66
|
-
*/
|
|
67
|
-
export declare interface IAgentSchedulerEvents extends IEvent {
|
|
68
|
-
/**
|
|
69
|
-
* Event when ownership of task changes
|
|
70
|
-
* @param event - name of the event:
|
|
71
|
-
*
|
|
72
|
-
* - "picked" - the task has been assigned to this client, in response to pick() being called
|
|
73
|
-
* If client loses this task (due to disconnect), it will attempt to pick it again (on connection)
|
|
74
|
-
* automatically, unless release() is called
|
|
75
|
-
*
|
|
76
|
-
* - "released" - the task was successfully released back to the pool. Client will not attempt to
|
|
77
|
-
* re-acquire the task, unless pick() is called.
|
|
78
|
-
*
|
|
79
|
-
* - "lost" - task is lost due to disconnect or data store / container being attached.
|
|
80
|
-
* Task will be picked up again by some connected client (this client will try as well,
|
|
81
|
-
* unless release() is called)
|
|
82
|
-
*
|
|
83
|
-
* @param listener - callback notified when change happened for particular key
|
|
84
|
-
*/
|
|
85
|
-
(event: "picked" | "released" | "lost", listener: (taskId: string) => void): any;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* @public
|
|
90
|
-
*/
|
|
91
|
-
export declare interface IProvideAgentScheduler {
|
|
92
|
-
readonly IAgentScheduler: IAgentScheduler;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Events emitted by {@link TaskSubscription}.
|
|
97
|
-
*
|
|
98
|
-
* @public
|
|
99
|
-
*/
|
|
100
|
-
export declare interface ITaskSubscriptionEvents extends IEvent {
|
|
101
|
-
(event: "gotTask" | "lostTask", listener: () => void): any;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* TaskSubscription works with an AgentScheduler to make it easier to monitor a specific task ownership.
|
|
106
|
-
*
|
|
107
|
-
* @public
|
|
108
|
-
*/
|
|
109
|
-
export declare class TaskSubscription extends TypedEventEmitter<ITaskSubscriptionEvents> {
|
|
110
|
-
private readonly agentScheduler;
|
|
111
|
-
readonly taskId: string;
|
|
112
|
-
private subscribed;
|
|
113
|
-
/**
|
|
114
|
-
* @param agentScheduler - The AgentScheduler that will be subscribed against
|
|
115
|
-
* @param taskId - The string ID of the task to subscribe against
|
|
116
|
-
*/
|
|
117
|
-
constructor(agentScheduler: IAgentScheduler, taskId: string);
|
|
118
|
-
/**
|
|
119
|
-
* Check if currently holding ownership of the task.
|
|
120
|
-
* @returns true if currently the task owner, false otherwise.
|
|
121
|
-
*/
|
|
122
|
-
haveTask(): boolean;
|
|
123
|
-
/**
|
|
124
|
-
* Volunteer for the task. By default, the TaskSubscription will only watch the task and not volunteer.
|
|
125
|
-
* This is safe to call multiple times across multiple TaskSubscriptions.
|
|
126
|
-
*/
|
|
127
|
-
volunteer(): void;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/* Excluded from this release type: TypedEventEmitter */
|
|
131
|
-
|
|
132
|
-
export { }
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { FluidDataStoreRuntime } from '@fluidframework/datastore';
|
|
2
|
-
import { IEvent } from '@fluidframework/core-interfaces';
|
|
3
|
-
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
4
|
-
import { IFluidDataStoreContext } from '@fluidframework/runtime-definitions';
|
|
5
|
-
import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
|
|
6
|
-
import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
7
|
-
import { NamedFluidDataStoreRegistryEntry } from '@fluidframework/runtime-definitions';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export declare class AgentSchedulerFactory implements IFluidDataStoreFactory {
|
|
13
|
-
static readonly type = "_scheduler";
|
|
14
|
-
readonly type = "_scheduler";
|
|
15
|
-
get IFluidDataStoreFactory(): this;
|
|
16
|
-
static get registryEntry(): NamedFluidDataStoreRegistryEntry;
|
|
17
|
-
static createChildInstance(parentContext: IFluidDataStoreContext): Promise<IAgentScheduler>;
|
|
18
|
-
instantiateDataStore(context: IFluidDataStoreContext, existing: boolean): Promise<FluidDataStoreRuntime>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
24
|
-
export declare const IAgentScheduler: keyof IProvideAgentScheduler;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Agent scheduler distributes a set of tasks/variables across connected clients.
|
|
28
|
-
*
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
export declare interface IAgentScheduler extends IProvideAgentScheduler, IEventProvider<IAgentSchedulerEvents>, IFluidLoadable {
|
|
32
|
-
/**
|
|
33
|
-
* Registers a set of new tasks to distribute amongst connected clients. Only use this if a client wants
|
|
34
|
-
* a new agent to run but does not have the capability to run the agent inside the host.
|
|
35
|
-
* Client can call pick() later if the capability changes.
|
|
36
|
-
*
|
|
37
|
-
* This method should only be called once per task. Duplicate calls will be rejected.
|
|
38
|
-
*/
|
|
39
|
-
register(...taskUrls: string[]): Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* Attempts to pick a set of tasks. A client will only run the task if it's chosen based on consensus.
|
|
42
|
-
* Resolves when the tasks are assigned to one of the connected clients.
|
|
43
|
-
*
|
|
44
|
-
* This method should only be called once per task. Duplicate calls will be rejected.
|
|
45
|
-
*
|
|
46
|
-
* @param worker - callback to run when task is picked up.
|
|
47
|
-
*/
|
|
48
|
-
pick(taskId: string, worker: () => Promise<void>): Promise<void>;
|
|
49
|
-
/**
|
|
50
|
-
* Releases a set of tasks for other clients to grab. Resolves when the tasks are released.
|
|
51
|
-
*
|
|
52
|
-
* Only previously picked tasks are allowed. Releasing non picked tasks will get a rejection.
|
|
53
|
-
* App can call pickedTasks() to get the picked list first.
|
|
54
|
-
*/
|
|
55
|
-
release(...taskUrls: string[]): Promise<void>;
|
|
56
|
-
/**
|
|
57
|
-
* Returns a list of all tasks running on this client
|
|
58
|
-
*/
|
|
59
|
-
pickedTasks(): string[];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Events emitted by {@link (IAgentScheduler:interface)}.
|
|
64
|
-
*
|
|
65
|
-
* @public
|
|
66
|
-
*/
|
|
67
|
-
export declare interface IAgentSchedulerEvents extends IEvent {
|
|
68
|
-
/**
|
|
69
|
-
* Event when ownership of task changes
|
|
70
|
-
* @param event - name of the event:
|
|
71
|
-
*
|
|
72
|
-
* - "picked" - the task has been assigned to this client, in response to pick() being called
|
|
73
|
-
* If client loses this task (due to disconnect), it will attempt to pick it again (on connection)
|
|
74
|
-
* automatically, unless release() is called
|
|
75
|
-
*
|
|
76
|
-
* - "released" - the task was successfully released back to the pool. Client will not attempt to
|
|
77
|
-
* re-acquire the task, unless pick() is called.
|
|
78
|
-
*
|
|
79
|
-
* - "lost" - task is lost due to disconnect or data store / container being attached.
|
|
80
|
-
* Task will be picked up again by some connected client (this client will try as well,
|
|
81
|
-
* unless release() is called)
|
|
82
|
-
*
|
|
83
|
-
* @param listener - callback notified when change happened for particular key
|
|
84
|
-
*/
|
|
85
|
-
(event: "picked" | "released" | "lost", listener: (taskId: string) => void): any;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* @public
|
|
90
|
-
*/
|
|
91
|
-
export declare interface IProvideAgentScheduler {
|
|
92
|
-
readonly IAgentScheduler: IAgentScheduler;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Events emitted by {@link TaskSubscription}.
|
|
97
|
-
*
|
|
98
|
-
* @public
|
|
99
|
-
*/
|
|
100
|
-
export declare interface ITaskSubscriptionEvents extends IEvent {
|
|
101
|
-
(event: "gotTask" | "lostTask", listener: () => void): any;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* TaskSubscription works with an AgentScheduler to make it easier to monitor a specific task ownership.
|
|
106
|
-
*
|
|
107
|
-
* @public
|
|
108
|
-
*/
|
|
109
|
-
export declare class TaskSubscription extends TypedEventEmitter<ITaskSubscriptionEvents> {
|
|
110
|
-
private readonly agentScheduler;
|
|
111
|
-
readonly taskId: string;
|
|
112
|
-
private subscribed;
|
|
113
|
-
/**
|
|
114
|
-
* @param agentScheduler - The AgentScheduler that will be subscribed against
|
|
115
|
-
* @param taskId - The string ID of the task to subscribe against
|
|
116
|
-
*/
|
|
117
|
-
constructor(agentScheduler: IAgentScheduler, taskId: string);
|
|
118
|
-
/**
|
|
119
|
-
* Check if currently holding ownership of the task.
|
|
120
|
-
* @returns true if currently the task owner, false otherwise.
|
|
121
|
-
*/
|
|
122
|
-
haveTask(): boolean;
|
|
123
|
-
/**
|
|
124
|
-
* Volunteer for the task. By default, the TaskSubscription will only watch the task and not volunteer.
|
|
125
|
-
* This is safe to call multiple times across multiple TaskSubscriptions.
|
|
126
|
-
*/
|
|
127
|
-
volunteer(): void;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/* Excluded from this release type: TypedEventEmitter */
|
|
131
|
-
|
|
132
|
-
export { }
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { FluidDataStoreRuntime } from '@fluidframework/datastore';
|
|
2
|
-
import { IEvent } from '@fluidframework/core-interfaces';
|
|
3
|
-
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
4
|
-
import { IFluidDataStoreContext } from '@fluidframework/runtime-definitions';
|
|
5
|
-
import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
|
|
6
|
-
import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
7
|
-
import { NamedFluidDataStoreRegistryEntry } from '@fluidframework/runtime-definitions';
|
|
8
|
-
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
export declare class AgentSchedulerFactory implements IFluidDataStoreFactory {
|
|
14
|
-
static readonly type = "_scheduler";
|
|
15
|
-
readonly type = "_scheduler";
|
|
16
|
-
get IFluidDataStoreFactory(): this;
|
|
17
|
-
static get registryEntry(): NamedFluidDataStoreRegistryEntry;
|
|
18
|
-
static createChildInstance(parentContext: IFluidDataStoreContext): Promise<IAgentScheduler>;
|
|
19
|
-
instantiateDataStore(context: IFluidDataStoreContext, existing: boolean): Promise<FluidDataStoreRuntime>;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @public
|
|
24
|
-
*/
|
|
25
|
-
export declare const IAgentScheduler: keyof IProvideAgentScheduler;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Agent scheduler distributes a set of tasks/variables across connected clients.
|
|
29
|
-
*
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
|
-
export declare interface IAgentScheduler extends IProvideAgentScheduler, IEventProvider<IAgentSchedulerEvents>, IFluidLoadable {
|
|
33
|
-
/**
|
|
34
|
-
* Registers a set of new tasks to distribute amongst connected clients. Only use this if a client wants
|
|
35
|
-
* a new agent to run but does not have the capability to run the agent inside the host.
|
|
36
|
-
* Client can call pick() later if the capability changes.
|
|
37
|
-
*
|
|
38
|
-
* This method should only be called once per task. Duplicate calls will be rejected.
|
|
39
|
-
*/
|
|
40
|
-
register(...taskUrls: string[]): Promise<void>;
|
|
41
|
-
/**
|
|
42
|
-
* Attempts to pick a set of tasks. A client will only run the task if it's chosen based on consensus.
|
|
43
|
-
* Resolves when the tasks are assigned to one of the connected clients.
|
|
44
|
-
*
|
|
45
|
-
* This method should only be called once per task. Duplicate calls will be rejected.
|
|
46
|
-
*
|
|
47
|
-
* @param worker - callback to run when task is picked up.
|
|
48
|
-
*/
|
|
49
|
-
pick(taskId: string, worker: () => Promise<void>): Promise<void>;
|
|
50
|
-
/**
|
|
51
|
-
* Releases a set of tasks for other clients to grab. Resolves when the tasks are released.
|
|
52
|
-
*
|
|
53
|
-
* Only previously picked tasks are allowed. Releasing non picked tasks will get a rejection.
|
|
54
|
-
* App can call pickedTasks() to get the picked list first.
|
|
55
|
-
*/
|
|
56
|
-
release(...taskUrls: string[]): Promise<void>;
|
|
57
|
-
/**
|
|
58
|
-
* Returns a list of all tasks running on this client
|
|
59
|
-
*/
|
|
60
|
-
pickedTasks(): string[];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Events emitted by {@link (IAgentScheduler:interface)}.
|
|
65
|
-
*
|
|
66
|
-
* @public
|
|
67
|
-
*/
|
|
68
|
-
export declare interface IAgentSchedulerEvents extends IEvent {
|
|
69
|
-
/**
|
|
70
|
-
* Event when ownership of task changes
|
|
71
|
-
* @param event - name of the event:
|
|
72
|
-
*
|
|
73
|
-
* - "picked" - the task has been assigned to this client, in response to pick() being called
|
|
74
|
-
* If client loses this task (due to disconnect), it will attempt to pick it again (on connection)
|
|
75
|
-
* automatically, unless release() is called
|
|
76
|
-
*
|
|
77
|
-
* - "released" - the task was successfully released back to the pool. Client will not attempt to
|
|
78
|
-
* re-acquire the task, unless pick() is called.
|
|
79
|
-
*
|
|
80
|
-
* - "lost" - task is lost due to disconnect or data store / container being attached.
|
|
81
|
-
* Task will be picked up again by some connected client (this client will try as well,
|
|
82
|
-
* unless release() is called)
|
|
83
|
-
*
|
|
84
|
-
* @param listener - callback notified when change happened for particular key
|
|
85
|
-
*/
|
|
86
|
-
(event: "picked" | "released" | "lost", listener: (taskId: string) => void): any;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* @public
|
|
91
|
-
*/
|
|
92
|
-
export declare interface IProvideAgentScheduler {
|
|
93
|
-
readonly IAgentScheduler: IAgentScheduler;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Events emitted by {@link TaskSubscription}.
|
|
98
|
-
*
|
|
99
|
-
* @public
|
|
100
|
-
*/
|
|
101
|
-
export declare interface ITaskSubscriptionEvents extends IEvent {
|
|
102
|
-
(event: "gotTask" | "lostTask", listener: () => void): any;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* TaskSubscription works with an AgentScheduler to make it easier to monitor a specific task ownership.
|
|
107
|
-
*
|
|
108
|
-
* @public
|
|
109
|
-
*/
|
|
110
|
-
export declare class TaskSubscription extends TypedEventEmitter<ITaskSubscriptionEvents> {
|
|
111
|
-
private readonly agentScheduler;
|
|
112
|
-
readonly taskId: string;
|
|
113
|
-
private subscribed;
|
|
114
|
-
/**
|
|
115
|
-
* @param agentScheduler - The AgentScheduler that will be subscribed against
|
|
116
|
-
* @param taskId - The string ID of the task to subscribe against
|
|
117
|
-
*/
|
|
118
|
-
constructor(agentScheduler: IAgentScheduler, taskId: string);
|
|
119
|
-
/**
|
|
120
|
-
* Check if currently holding ownership of the task.
|
|
121
|
-
* @returns true if currently the task owner, false otherwise.
|
|
122
|
-
*/
|
|
123
|
-
haveTask(): boolean;
|
|
124
|
-
/**
|
|
125
|
-
* Volunteer for the task. By default, the TaskSubscription will only watch the task and not volunteer.
|
|
126
|
-
* This is safe to call multiple times across multiple TaskSubscriptions.
|
|
127
|
-
*/
|
|
128
|
-
volunteer(): void;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export { }
|