-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathindex.d.ts
109 lines (65 loc) · 2.33 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
* Copyright (c) 2016-2018 Untu, Inc.
* This code is licensed under Eclipse Public License - v 1.0.
* The full license text can be found in LICENSE.txt file and
* on the Eclipse official site (https://www.eclipse.org/legal/epl-v10.html).
*/
import {EventEmitter} from 'events';
export interface Logger {
isDebug(): boolean;
debug(...messages: any[]): void;
info(...messages: any[]): void;
warn(...messages: any[]): void;
error(...messages: any[]): void;
}
export interface ParentActorRef {
getId(): string;
send(topic: string, ...message: any[]): Promise<void>;
sendAndReceive(topic: string, ...message: any[]): Promise<any>;
}
export interface SystemBus extends EventEmitter {
}
export interface ActorRef extends EventEmitter {
getId(): string;
getName(): string;
getLog(): Logger;
getSystem(): ActorSystem;
getMode(): string;
getState(): string;
getCustomParameters(): any;
changeConfiguration(config: object): Promise<void>;
changeGlobalConfiguration(config: object): Promise<void>;
send(topic: string, ...message: any[]): Promise<void>;
sendAndReceive(topic: string, ...message: any[]): Promise<any>;
broadcast(topic: string, ...message: any[]): Promise<void>;
broadcastAndReceive(topic: string, ...message: any[]): Promise<any[]>;
forwardToParent(...topics: Array<string|RegExp>): void;
forwardToChild(child: ActorRef, ...topics: Array<string|RegExp>): void;
metrics(): Promise<any>;
destroy(): Promise<void>;
getBus(): SystemBus;
tree(): Promise<Object>;
}
export interface Actor extends ActorRef {
getParent(): ParentActorRef;
createChild(behaviour: ActorDefinition|Object, options?: Object): Promise<ActorRef>;
createChildren(modulePath: string, options?: Object): Promise<ActorRef[]>;
}
export interface ActorDefinition {
initialize(selfActor: Actor): Promise<void>|void;
destroy(): Promise<void>|void;
}
export interface ResourceDefinition<T> {
initialize(system: ActorSystem): Promise<void>|void;
destroy(): Promise<void>|void;
getResource(): T;
}
export interface ActorSystem {
rootActor(): Promise<Actor>;
destroy(): Promise<void>;
getBus(): SystemBus;
listen(port?: number, host?: string): Promise<void>;
getLog(): any;
}
export function createSystem(options: Object): ActorSystem;
export function inherits(subClass: any, superClass: any): void;