@fluidframework/agent-scheduler 2.0.0-dev.7.4.0.215930 → 2.0.0-dev.7.4.0.216897
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/api-extractor-lint.json +13 -0
- package/api-report/agent-scheduler.api.md +7 -7
- package/dist/agent-scheduler-alpha.d.ts +18 -121
- package/dist/agent-scheduler-beta.d.ts +18 -121
- package/dist/agent-scheduler-public.d.ts +18 -121
- package/dist/agent-scheduler-untrimmed.d.ts +7 -11
- package/dist/agent.cjs +1 -1
- package/dist/agent.cjs.map +1 -1
- package/dist/agent.d.ts +4 -6
- package/dist/agent.d.ts.map +1 -1
- package/dist/scheduler.cjs +1 -1
- package/dist/scheduler.cjs.map +1 -1
- package/dist/scheduler.d.ts +1 -1
- package/dist/taskSubscription.cjs +1 -2
- package/dist/taskSubscription.cjs.map +1 -1
- package/dist/taskSubscription.d.ts +2 -4
- package/dist/taskSubscription.d.ts.map +1 -1
- package/lib/agent-scheduler-alpha.d.ts +18 -121
- package/lib/agent-scheduler-beta.d.ts +18 -121
- package/lib/agent-scheduler-public.d.ts +18 -121
- package/lib/agent-scheduler-untrimmed.d.ts +7 -11
- package/lib/agent.d.ts +4 -6
- package/lib/agent.d.ts.map +1 -1
- package/lib/agent.mjs +1 -1
- package/lib/agent.mjs.map +1 -1
- package/lib/scheduler.d.ts +1 -1
- package/lib/scheduler.mjs +1 -1
- package/lib/scheduler.mjs.map +1 -1
- package/lib/taskSubscription.d.ts +2 -4
- package/lib/taskSubscription.d.ts.map +1 -1
- package/lib/taskSubscription.mjs +1 -2
- package/lib/taskSubscription.mjs.map +1 -1
- package/package.json +14 -13
- package/src/agent.ts +4 -6
- package/src/scheduler.ts +1 -1
- package/src/taskSubscription.ts +2 -4
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-lint.json",
|
|
4
|
+
"messages": {
|
|
5
|
+
"extractorMessageReporting": {
|
|
6
|
+
// TODO: remove once base config has this enabled as an error
|
|
7
|
+
"ae-incompatible-release-tags": {
|
|
8
|
+
"logLevel": "error",
|
|
9
|
+
"addToApiReportFile": false
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -13,7 +13,7 @@ import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
|
13
13
|
import { NamedFluidDataStoreRegistryEntry } from '@fluidframework/runtime-definitions';
|
|
14
14
|
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
15
15
|
|
|
16
|
-
// @
|
|
16
|
+
// @internal (undocumented)
|
|
17
17
|
export class AgentSchedulerFactory implements IFluidDataStoreFactory {
|
|
18
18
|
// (undocumented)
|
|
19
19
|
static createChildInstance(parentContext: IFluidDataStoreContext): Promise<IAgentScheduler>;
|
|
@@ -29,10 +29,10 @@ export class AgentSchedulerFactory implements IFluidDataStoreFactory {
|
|
|
29
29
|
readonly type = "_scheduler";
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
// @
|
|
32
|
+
// @internal (undocumented)
|
|
33
33
|
export const IAgentScheduler: keyof IProvideAgentScheduler;
|
|
34
34
|
|
|
35
|
-
// @
|
|
35
|
+
// @internal
|
|
36
36
|
export interface IAgentScheduler extends IProvideAgentScheduler, IEventProvider<IAgentSchedulerEvents>, IFluidLoadable {
|
|
37
37
|
pick(taskId: string, worker: () => Promise<void>): Promise<void>;
|
|
38
38
|
pickedTasks(): string[];
|
|
@@ -40,24 +40,24 @@ export interface IAgentScheduler extends IProvideAgentScheduler, IEventProvider<
|
|
|
40
40
|
release(...taskUrls: string[]): Promise<void>;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
// @
|
|
43
|
+
// @internal
|
|
44
44
|
export interface IAgentSchedulerEvents extends IEvent {
|
|
45
45
|
(event: "picked" | "released" | "lost", listener: (taskId: string) => void): any;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
// @
|
|
48
|
+
// @internal (undocumented)
|
|
49
49
|
export interface IProvideAgentScheduler {
|
|
50
50
|
// (undocumented)
|
|
51
51
|
readonly IAgentScheduler: IAgentScheduler;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
// @
|
|
54
|
+
// @internal
|
|
55
55
|
export interface ITaskSubscriptionEvents extends IEvent {
|
|
56
56
|
// (undocumented)
|
|
57
57
|
(event: "gotTask" | "lostTask", listener: () => void): any;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
// @
|
|
60
|
+
// @internal
|
|
61
61
|
export class TaskSubscription extends TypedEventEmitter<ITaskSubscriptionEvents> {
|
|
62
62
|
constructor(agentScheduler: IAgentScheduler, taskId: string);
|
|
63
63
|
haveTask(): boolean;
|
|
@@ -1,131 +1,28 @@
|
|
|
1
|
-
|
|
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';
|
|
1
|
+
/* Excluded from this release type: AgentSchedulerFactory */
|
|
8
2
|
|
|
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
|
-
}
|
|
3
|
+
/* Excluded from this release type: FluidDataStoreRuntime */
|
|
20
4
|
|
|
21
|
-
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
24
|
-
export declare const IAgentScheduler: keyof IProvideAgentScheduler;
|
|
5
|
+
/* Excluded from this release type: IAgentScheduler */
|
|
25
6
|
|
|
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
|
-
}
|
|
7
|
+
/* Excluded from this release type: IAgentSchedulerEvents */
|
|
61
8
|
|
|
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
|
-
}
|
|
9
|
+
/* Excluded from this release type: IEvent */
|
|
87
10
|
|
|
88
|
-
|
|
89
|
-
* @public
|
|
90
|
-
*/
|
|
91
|
-
export declare interface IProvideAgentScheduler {
|
|
92
|
-
readonly IAgentScheduler: IAgentScheduler;
|
|
93
|
-
}
|
|
11
|
+
/* Excluded from this release type: IEventProvider */
|
|
94
12
|
|
|
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
|
-
}
|
|
13
|
+
/* Excluded from this release type: IFluidDataStoreContext */
|
|
103
14
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
*/
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
}
|
|
15
|
+
/* Excluded from this release type: IFluidDataStoreFactory */
|
|
16
|
+
|
|
17
|
+
/* Excluded from this release type: IFluidLoadable */
|
|
18
|
+
|
|
19
|
+
/* Excluded from this release type: IProvideAgentScheduler */
|
|
20
|
+
|
|
21
|
+
/* Excluded from this release type: ITaskSubscriptionEvents */
|
|
22
|
+
|
|
23
|
+
/* Excluded from this release type: NamedFluidDataStoreRegistryEntry */
|
|
24
|
+
|
|
25
|
+
/* Excluded from this release type: TaskSubscription */
|
|
129
26
|
|
|
130
27
|
/* Excluded from this release type: TypedEventEmitter */
|
|
131
28
|
|
|
@@ -1,131 +1,28 @@
|
|
|
1
|
-
|
|
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';
|
|
1
|
+
/* Excluded from this release type: AgentSchedulerFactory */
|
|
8
2
|
|
|
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
|
-
}
|
|
3
|
+
/* Excluded from this release type: FluidDataStoreRuntime */
|
|
20
4
|
|
|
21
|
-
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
24
|
-
export declare const IAgentScheduler: keyof IProvideAgentScheduler;
|
|
5
|
+
/* Excluded from this release type: IAgentScheduler */
|
|
25
6
|
|
|
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
|
-
}
|
|
7
|
+
/* Excluded from this release type: IAgentSchedulerEvents */
|
|
61
8
|
|
|
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
|
-
}
|
|
9
|
+
/* Excluded from this release type: IEvent */
|
|
87
10
|
|
|
88
|
-
|
|
89
|
-
* @public
|
|
90
|
-
*/
|
|
91
|
-
export declare interface IProvideAgentScheduler {
|
|
92
|
-
readonly IAgentScheduler: IAgentScheduler;
|
|
93
|
-
}
|
|
11
|
+
/* Excluded from this release type: IEventProvider */
|
|
94
12
|
|
|
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
|
-
}
|
|
13
|
+
/* Excluded from this release type: IFluidDataStoreContext */
|
|
103
14
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
*/
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
}
|
|
15
|
+
/* Excluded from this release type: IFluidDataStoreFactory */
|
|
16
|
+
|
|
17
|
+
/* Excluded from this release type: IFluidLoadable */
|
|
18
|
+
|
|
19
|
+
/* Excluded from this release type: IProvideAgentScheduler */
|
|
20
|
+
|
|
21
|
+
/* Excluded from this release type: ITaskSubscriptionEvents */
|
|
22
|
+
|
|
23
|
+
/* Excluded from this release type: NamedFluidDataStoreRegistryEntry */
|
|
24
|
+
|
|
25
|
+
/* Excluded from this release type: TaskSubscription */
|
|
129
26
|
|
|
130
27
|
/* Excluded from this release type: TypedEventEmitter */
|
|
131
28
|
|
|
@@ -1,131 +1,28 @@
|
|
|
1
|
-
|
|
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';
|
|
1
|
+
/* Excluded from this release type: AgentSchedulerFactory */
|
|
8
2
|
|
|
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
|
-
}
|
|
3
|
+
/* Excluded from this release type: FluidDataStoreRuntime */
|
|
20
4
|
|
|
21
|
-
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
24
|
-
export declare const IAgentScheduler: keyof IProvideAgentScheduler;
|
|
5
|
+
/* Excluded from this release type: IAgentScheduler */
|
|
25
6
|
|
|
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
|
-
}
|
|
7
|
+
/* Excluded from this release type: IAgentSchedulerEvents */
|
|
61
8
|
|
|
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
|
-
}
|
|
9
|
+
/* Excluded from this release type: IEvent */
|
|
87
10
|
|
|
88
|
-
|
|
89
|
-
* @public
|
|
90
|
-
*/
|
|
91
|
-
export declare interface IProvideAgentScheduler {
|
|
92
|
-
readonly IAgentScheduler: IAgentScheduler;
|
|
93
|
-
}
|
|
11
|
+
/* Excluded from this release type: IEventProvider */
|
|
94
12
|
|
|
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
|
-
}
|
|
13
|
+
/* Excluded from this release type: IFluidDataStoreContext */
|
|
103
14
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
*/
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
}
|
|
15
|
+
/* Excluded from this release type: IFluidDataStoreFactory */
|
|
16
|
+
|
|
17
|
+
/* Excluded from this release type: IFluidLoadable */
|
|
18
|
+
|
|
19
|
+
/* Excluded from this release type: IProvideAgentScheduler */
|
|
20
|
+
|
|
21
|
+
/* Excluded from this release type: ITaskSubscriptionEvents */
|
|
22
|
+
|
|
23
|
+
/* Excluded from this release type: NamedFluidDataStoreRegistryEntry */
|
|
24
|
+
|
|
25
|
+
/* Excluded from this release type: TaskSubscription */
|
|
129
26
|
|
|
130
27
|
/* Excluded from this release type: TypedEventEmitter */
|
|
131
28
|
|
|
@@ -8,7 +8,7 @@ import { NamedFluidDataStoreRegistryEntry } from '@fluidframework/runtime-defini
|
|
|
8
8
|
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @
|
|
11
|
+
* @internal
|
|
12
12
|
*/
|
|
13
13
|
export declare class AgentSchedulerFactory implements IFluidDataStoreFactory {
|
|
14
14
|
static readonly type = "_scheduler";
|
|
@@ -20,14 +20,13 @@ export declare class AgentSchedulerFactory implements IFluidDataStoreFactory {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* @
|
|
23
|
+
* @internal
|
|
24
24
|
*/
|
|
25
25
|
export declare const IAgentScheduler: keyof IProvideAgentScheduler;
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Agent scheduler distributes a set of tasks/variables across connected clients.
|
|
29
|
-
*
|
|
30
|
-
* @public
|
|
29
|
+
* @internal
|
|
31
30
|
*/
|
|
32
31
|
export declare interface IAgentScheduler extends IProvideAgentScheduler, IEventProvider<IAgentSchedulerEvents>, IFluidLoadable {
|
|
33
32
|
/**
|
|
@@ -62,8 +61,7 @@ export declare interface IAgentScheduler extends IProvideAgentScheduler, IEventP
|
|
|
62
61
|
|
|
63
62
|
/**
|
|
64
63
|
* Events emitted by {@link (IAgentScheduler:interface)}.
|
|
65
|
-
*
|
|
66
|
-
* @public
|
|
64
|
+
* @internal
|
|
67
65
|
*/
|
|
68
66
|
export declare interface IAgentSchedulerEvents extends IEvent {
|
|
69
67
|
/**
|
|
@@ -87,7 +85,7 @@ export declare interface IAgentSchedulerEvents extends IEvent {
|
|
|
87
85
|
}
|
|
88
86
|
|
|
89
87
|
/**
|
|
90
|
-
* @
|
|
88
|
+
* @internal
|
|
91
89
|
*/
|
|
92
90
|
export declare interface IProvideAgentScheduler {
|
|
93
91
|
readonly IAgentScheduler: IAgentScheduler;
|
|
@@ -95,8 +93,7 @@ export declare interface IProvideAgentScheduler {
|
|
|
95
93
|
|
|
96
94
|
/**
|
|
97
95
|
* Events emitted by {@link TaskSubscription}.
|
|
98
|
-
*
|
|
99
|
-
* @public
|
|
96
|
+
* @internal
|
|
100
97
|
*/
|
|
101
98
|
export declare interface ITaskSubscriptionEvents extends IEvent {
|
|
102
99
|
(event: "gotTask" | "lostTask", listener: () => void): any;
|
|
@@ -104,8 +101,7 @@ export declare interface ITaskSubscriptionEvents extends IEvent {
|
|
|
104
101
|
|
|
105
102
|
/**
|
|
106
103
|
* TaskSubscription works with an AgentScheduler to make it easier to monitor a specific task ownership.
|
|
107
|
-
*
|
|
108
|
-
* @public
|
|
104
|
+
* @internal
|
|
109
105
|
*/
|
|
110
106
|
export declare class TaskSubscription extends TypedEventEmitter<ITaskSubscriptionEvents> {
|
|
111
107
|
private readonly agentScheduler;
|
package/dist/agent.cjs
CHANGED
package/dist/agent.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.cjs","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;GAEG;AACU,QAAA,eAAe,GAAiC,iBAAiB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IEvent, IEventProvider, IFluidLoadable } from \"@fluidframework/core-interfaces\";\n\n/**\n * @
|
|
1
|
+
{"version":3,"file":"agent.cjs","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;GAEG;AACU,QAAA,eAAe,GAAiC,iBAAiB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IEvent, IEventProvider, IFluidLoadable } from \"@fluidframework/core-interfaces\";\n\n/**\n * @internal\n */\nexport const IAgentScheduler: keyof IProvideAgentScheduler = \"IAgentScheduler\";\n\n/**\n * @internal\n */\nexport interface IProvideAgentScheduler {\n\treadonly IAgentScheduler: IAgentScheduler;\n}\n\n/**\n * Events emitted by {@link (IAgentScheduler:interface)}.\n * @internal\n */\nexport interface IAgentSchedulerEvents extends IEvent {\n\t/**\n\t * Event when ownership of task changes\n\t * @param event - name of the event:\n\t *\n\t * - \"picked\" - the task has been assigned to this client, in response to pick() being called\n\t * If client loses this task (due to disconnect), it will attempt to pick it again (on connection)\n\t * automatically, unless release() is called\n\t *\n\t * - \"released\" - the task was successfully released back to the pool. Client will not attempt to\n\t * re-acquire the task, unless pick() is called.\n\t *\n\t * - \"lost\" - task is lost due to disconnect or data store / container being attached.\n\t * Task will be picked up again by some connected client (this client will try as well,\n\t * unless release() is called)\n\t *\n\t * @param listener - callback notified when change happened for particular key\n\t */\n\t(event: \"picked\" | \"released\" | \"lost\", listener: (taskId: string) => void);\n}\n\n/**\n * Agent scheduler distributes a set of tasks/variables across connected clients.\n * @internal\n */\nexport interface IAgentScheduler\n\textends IProvideAgentScheduler,\n\t\tIEventProvider<IAgentSchedulerEvents>,\n\t\tIFluidLoadable {\n\t/**\n\t * Registers a set of new tasks to distribute amongst connected clients. Only use this if a client wants\n\t * a new agent to run but does not have the capability to run the agent inside the host.\n\t * Client can call pick() later if the capability changes.\n\t *\n\t * This method should only be called once per task. Duplicate calls will be rejected.\n\t */\n\tregister(...taskUrls: string[]): Promise<void>;\n\n\t/**\n\t * Attempts to pick a set of tasks. A client will only run the task if it's chosen based on consensus.\n\t * Resolves when the tasks are assigned to one of the connected clients.\n\t *\n\t * This method should only be called once per task. Duplicate calls will be rejected.\n\t *\n\t * @param worker - callback to run when task is picked up.\n\t */\n\tpick(taskId: string, worker: () => Promise<void>): Promise<void>;\n\n\t/**\n\t * Releases a set of tasks for other clients to grab. Resolves when the tasks are released.\n\t *\n\t * Only previously picked tasks are allowed. Releasing non picked tasks will get a rejection.\n\t * App can call pickedTasks() to get the picked list first.\n\t */\n\trelease(...taskUrls: string[]): Promise<void>;\n\n\t/**\n\t * Returns a list of all tasks running on this client\n\t */\n\tpickedTasks(): string[];\n}\n"]}
|
package/dist/agent.d.ts
CHANGED
|
@@ -4,19 +4,18 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { IEvent, IEventProvider, IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
6
6
|
/**
|
|
7
|
-
* @
|
|
7
|
+
* @internal
|
|
8
8
|
*/
|
|
9
9
|
export declare const IAgentScheduler: keyof IProvideAgentScheduler;
|
|
10
10
|
/**
|
|
11
|
-
* @
|
|
11
|
+
* @internal
|
|
12
12
|
*/
|
|
13
13
|
export interface IProvideAgentScheduler {
|
|
14
14
|
readonly IAgentScheduler: IAgentScheduler;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Events emitted by {@link (IAgentScheduler:interface)}.
|
|
18
|
-
*
|
|
19
|
-
* @public
|
|
18
|
+
* @internal
|
|
20
19
|
*/
|
|
21
20
|
export interface IAgentSchedulerEvents extends IEvent {
|
|
22
21
|
/**
|
|
@@ -40,8 +39,7 @@ export interface IAgentSchedulerEvents extends IEvent {
|
|
|
40
39
|
}
|
|
41
40
|
/**
|
|
42
41
|
* Agent scheduler distributes a set of tasks/variables across connected clients.
|
|
43
|
-
*
|
|
44
|
-
* @public
|
|
42
|
+
* @internal
|
|
45
43
|
*/
|
|
46
44
|
export interface IAgentScheduler extends IProvideAgentScheduler, IEventProvider<IAgentSchedulerEvents>, IFluidLoadable {
|
|
47
45
|
/**
|
package/dist/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEzF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,sBAA0C,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;CAC1C;AAED
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEzF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,sBAA0C,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;CAC1C;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAsB,SAAQ,MAAM;IACpD;;;;;;;;;;;;;;;;OAgBG;IACH,CAAC,KAAK,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,OAAE;CAC5E;AAED;;;GAGG;AACH,MAAM,WAAW,eAChB,SAAQ,sBAAsB,EAC7B,cAAc,CAAC,qBAAqB,CAAC,EACrC,cAAc;IACf;;;;;;OAMG;IACH,QAAQ,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/C;;;;;;;OAOG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjE;;;;;OAKG;IACH,OAAO,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9C;;OAEG;IACH,WAAW,IAAI,MAAM,EAAE,CAAC;CACxB"}
|