@fluidframework/agent-scheduler 2.0.0-rc.2.0.2 → 2.0.0-rc.3.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.
@@ -1,127 +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
- * @alpha
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
- * @alpha
24
- */
25
- export declare const IAgentScheduler: keyof IProvideAgentScheduler;
26
-
27
- /**
28
- * Agent scheduler distributes a set of tasks/variables across connected clients.
29
- * @alpha
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
- * @alpha
65
- */
66
- export declare interface IAgentSchedulerEvents extends IEvent {
67
- /**
68
- * Event when ownership of task changes
69
- * @param event - name of the event:
70
- *
71
- * - "picked" - the task has been assigned to this client, in response to pick() being called
72
- * If client loses this task (due to disconnect), it will attempt to pick it again (on connection)
73
- * automatically, unless release() is called
74
- *
75
- * - "released" - the task was successfully released back to the pool. Client will not attempt to
76
- * re-acquire the task, unless pick() is called.
77
- *
78
- * - "lost" - task is lost due to disconnect or data store / container being attached.
79
- * Task will be picked up again by some connected client (this client will try as well,
80
- * unless release() is called)
81
- *
82
- * @param listener - callback notified when change happened for particular key
83
- */
84
- (event: "picked" | "released" | "lost", listener: (taskId: string) => void): any;
85
- }
86
-
87
- /**
88
- * @alpha
89
- */
90
- export declare interface IProvideAgentScheduler {
91
- readonly IAgentScheduler: IAgentScheduler;
92
- }
93
-
94
- /**
95
- * Events emitted by {@link TaskSubscription}.
96
- * @alpha
97
- */
98
- export declare interface ITaskSubscriptionEvents extends IEvent {
99
- (event: "gotTask" | "lostTask", listener: () => void): any;
100
- }
101
-
102
- /**
103
- * TaskSubscription works with an AgentScheduler to make it easier to monitor a specific task ownership.
104
- * @alpha
105
- */
106
- export declare class TaskSubscription extends TypedEventEmitter<ITaskSubscriptionEvents> {
107
- private readonly agentScheduler;
108
- readonly taskId: string;
109
- private subscribed;
110
- /**
111
- * @param agentScheduler - The AgentScheduler that will be subscribed against
112
- * @param taskId - The string ID of the task to subscribe against
113
- */
114
- constructor(agentScheduler: IAgentScheduler, taskId: string);
115
- /**
116
- * Check if currently holding ownership of the task.
117
- * @returns true if currently the task owner, false otherwise.
118
- */
119
- haveTask(): boolean;
120
- /**
121
- * Volunteer for the task. By default, the TaskSubscription will only watch the task and not volunteer.
122
- * This is safe to call multiple times across multiple TaskSubscriptions.
123
- */
124
- volunteer(): void;
125
- }
126
-
127
- export { }
@@ -1,127 +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
- * @alpha
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
- * @alpha
24
- */
25
- export declare const IAgentScheduler: keyof IProvideAgentScheduler;
26
-
27
- /**
28
- * Agent scheduler distributes a set of tasks/variables across connected clients.
29
- * @alpha
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
- * @alpha
65
- */
66
- export declare interface IAgentSchedulerEvents extends IEvent {
67
- /**
68
- * Event when ownership of task changes
69
- * @param event - name of the event:
70
- *
71
- * - "picked" - the task has been assigned to this client, in response to pick() being called
72
- * If client loses this task (due to disconnect), it will attempt to pick it again (on connection)
73
- * automatically, unless release() is called
74
- *
75
- * - "released" - the task was successfully released back to the pool. Client will not attempt to
76
- * re-acquire the task, unless pick() is called.
77
- *
78
- * - "lost" - task is lost due to disconnect or data store / container being attached.
79
- * Task will be picked up again by some connected client (this client will try as well,
80
- * unless release() is called)
81
- *
82
- * @param listener - callback notified when change happened for particular key
83
- */
84
- (event: "picked" | "released" | "lost", listener: (taskId: string) => void): any;
85
- }
86
-
87
- /**
88
- * @alpha
89
- */
90
- export declare interface IProvideAgentScheduler {
91
- readonly IAgentScheduler: IAgentScheduler;
92
- }
93
-
94
- /**
95
- * Events emitted by {@link TaskSubscription}.
96
- * @alpha
97
- */
98
- export declare interface ITaskSubscriptionEvents extends IEvent {
99
- (event: "gotTask" | "lostTask", listener: () => void): any;
100
- }
101
-
102
- /**
103
- * TaskSubscription works with an AgentScheduler to make it easier to monitor a specific task ownership.
104
- * @alpha
105
- */
106
- export declare class TaskSubscription extends TypedEventEmitter<ITaskSubscriptionEvents> {
107
- private readonly agentScheduler;
108
- readonly taskId: string;
109
- private subscribed;
110
- /**
111
- * @param agentScheduler - The AgentScheduler that will be subscribed against
112
- * @param taskId - The string ID of the task to subscribe against
113
- */
114
- constructor(agentScheduler: IAgentScheduler, taskId: string);
115
- /**
116
- * Check if currently holding ownership of the task.
117
- * @returns true if currently the task owner, false otherwise.
118
- */
119
- haveTask(): boolean;
120
- /**
121
- * Volunteer for the task. By default, the TaskSubscription will only watch the task and not volunteer.
122
- * This is safe to call multiple times across multiple TaskSubscriptions.
123
- */
124
- volunteer(): void;
125
- }
126
-
127
- export { }
@@ -1,30 +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
- /* Excluded from this release type: AgentSchedulerFactory */
11
-
12
- /* Excluded from this release type: FluidDataStoreRuntime */
13
-
14
- /* Excluded from this release type: IAgentScheduler */
15
-
16
- /* Excluded from this release type: IAgentSchedulerEvents */
17
-
18
- /* Excluded from this release type: IFluidDataStoreContext */
19
-
20
- /* Excluded from this release type: IFluidDataStoreFactory */
21
-
22
- /* Excluded from this release type: IProvideAgentScheduler */
23
-
24
- /* Excluded from this release type: ITaskSubscriptionEvents */
25
-
26
- /* Excluded from this release type: NamedFluidDataStoreRegistryEntry */
27
-
28
- /* Excluded from this release type: TaskSubscription */
29
-
30
- export { }
@@ -1,30 +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
- /* Excluded from this release type: AgentSchedulerFactory */
11
-
12
- /* Excluded from this release type: FluidDataStoreRuntime */
13
-
14
- /* Excluded from this release type: IAgentScheduler */
15
-
16
- /* Excluded from this release type: IAgentSchedulerEvents */
17
-
18
- /* Excluded from this release type: IFluidDataStoreContext */
19
-
20
- /* Excluded from this release type: IFluidDataStoreFactory */
21
-
22
- /* Excluded from this release type: IProvideAgentScheduler */
23
-
24
- /* Excluded from this release type: ITaskSubscriptionEvents */
25
-
26
- /* Excluded from this release type: NamedFluidDataStoreRegistryEntry */
27
-
28
- /* Excluded from this release type: TaskSubscription */
29
-
30
- export { }
@@ -1,127 +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
- * @alpha
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
- * @alpha
24
- */
25
- export declare const IAgentScheduler: keyof IProvideAgentScheduler;
26
-
27
- /**
28
- * Agent scheduler distributes a set of tasks/variables across connected clients.
29
- * @alpha
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
- * @alpha
65
- */
66
- export declare interface IAgentSchedulerEvents extends IEvent {
67
- /**
68
- * Event when ownership of task changes
69
- * @param event - name of the event:
70
- *
71
- * - "picked" - the task has been assigned to this client, in response to pick() being called
72
- * If client loses this task (due to disconnect), it will attempt to pick it again (on connection)
73
- * automatically, unless release() is called
74
- *
75
- * - "released" - the task was successfully released back to the pool. Client will not attempt to
76
- * re-acquire the task, unless pick() is called.
77
- *
78
- * - "lost" - task is lost due to disconnect or data store / container being attached.
79
- * Task will be picked up again by some connected client (this client will try as well,
80
- * unless release() is called)
81
- *
82
- * @param listener - callback notified when change happened for particular key
83
- */
84
- (event: "picked" | "released" | "lost", listener: (taskId: string) => void): any;
85
- }
86
-
87
- /**
88
- * @alpha
89
- */
90
- export declare interface IProvideAgentScheduler {
91
- readonly IAgentScheduler: IAgentScheduler;
92
- }
93
-
94
- /**
95
- * Events emitted by {@link TaskSubscription}.
96
- * @alpha
97
- */
98
- export declare interface ITaskSubscriptionEvents extends IEvent {
99
- (event: "gotTask" | "lostTask", listener: () => void): any;
100
- }
101
-
102
- /**
103
- * TaskSubscription works with an AgentScheduler to make it easier to monitor a specific task ownership.
104
- * @alpha
105
- */
106
- export declare class TaskSubscription extends TypedEventEmitter<ITaskSubscriptionEvents> {
107
- private readonly agentScheduler;
108
- readonly taskId: string;
109
- private subscribed;
110
- /**
111
- * @param agentScheduler - The AgentScheduler that will be subscribed against
112
- * @param taskId - The string ID of the task to subscribe against
113
- */
114
- constructor(agentScheduler: IAgentScheduler, taskId: string);
115
- /**
116
- * Check if currently holding ownership of the task.
117
- * @returns true if currently the task owner, false otherwise.
118
- */
119
- haveTask(): boolean;
120
- /**
121
- * Volunteer for the task. By default, the TaskSubscription will only watch the task and not volunteer.
122
- * This is safe to call multiple times across multiple TaskSubscriptions.
123
- */
124
- volunteer(): void;
125
- }
126
-
127
- export { }
File without changes