-
Notifications
You must be signed in to change notification settings - Fork 10
/
DataMessage.ts
55 lines (48 loc) · 992 Bytes
/
DataMessage.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
/**
* Message containing data intended for a certain peer.
*/
export interface DataMessage {
/**
* The current path of the message. Every node this message passes through
* appends to this path.
*/
readonly path: DataMessagePathEntry[];
/**
* The target node that this message is for.
*/
readonly target: ArrayBuffer;
/**
* Type of data being sent.
*/
readonly type: string;
/**
* Data of the message.
*/
readonly data: ArrayBuffer;
}
/**
* Path entry.
*/
export interface DataMessagePathEntry {
/**
* The identifier of the node that added this path entry.
*/
readonly node: ArrayBuffer;
/**
* An identifier used by the node to identify this message.
*/
readonly id: number;
}
/**
* Message sent backwards when the target node acknowledges having received
* the message.
*/
export interface DataAckMessage {
id: number;
}
/**
* Message sent backwards if a node rejects the message.
*/
export interface DataRejectMessage {
id: number;
}