-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterface.ts
88 lines (79 loc) · 1.96 KB
/
interface.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
import { EComponent } from "./enumeration.ts";
import { IMPayload } from "./messages.ts";
import { IRequestPayload, IResponsePayload } from "./operation.ts";
import { EMonOpType } from "./enumeration.ts";
import { DRemotePeerSet } from "./models/remotepeerset.model.ts";
import { DClientSet } from "./models/clientset.model.ts";
export interface IMessage<
T extends keyof MPayload = keyof IMPayload,
ReqPayload extends IRequestPayload = IRequestPayload,
ResPayload extends IResponsePayload = IResponsePayload,
MPayload extends IMPayload<ReqPayload, ResPayload> = IMPayload<
ReqPayload,
ResPayload
>,
> {
type: T;
source: string;
destination: EComponent | string;
payload: MPayload[T];
}
export interface IState<
ReqPayload extends IRequestPayload = IRequestPayload,
ResPayload extends IResponsePayload = IResponsePayload,
MPayload extends IMPayload<ReqPayload, ResPayload> = IMPayload<
ReqPayload,
ResPayload
>> {
ready: boolean;
net: {
requests: { [key: string]: string };
ready: boolean;
peers: DRemotePeerSet<ReqPayload, ResPayload, MPayload>,
clients: DClientSet<ReqPayload, ResPayload>
};
log: {
console: boolean;
debug: boolean;
exclude: (keyof MPayload)[];
last: number;
};
mon: {
requests: string[];
stats: { [key: string]: number };
watchers: {
[key: string]: {
interval: number,
expire: number
}
};
loggers: string[];
/**
* key: Message hash
* value: {
* token: Request token
* notify: Send ClientNotification
* }
*/
trace: {
[key: string]: {
notify: boolean,
token: string
}
}
};
testing: {
dummy: string // Use for e2e tests E2E::Mon::Set
}
}
export interface IMonOp<T = string | number | { [key: string]: unknown }> {
op: EMonOpType;
metric: {
key: string;
value?: T;
};
}
export interface IMonWatch {
key: string;
expire: number; // limit of notifies
}