-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.proto
More file actions
85 lines (72 loc) · 2.05 KB
/
schema.proto
File metadata and controls
85 lines (72 loc) · 2.05 KB
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
// Sent as part of the noise protocol.
message NoisePayload {
required bytes nonce = 1;
}
// type=0
message Open {
required bytes discoveryKey = 1;
optional bytes capability = 2;
}
// type=1, overall feed options. can be sent multiple times
message Options {
repeated string extensions = 1; // Should be sorted lexicographically
optional bool ack = 2; // Should all blocks be explicitly acknowledged?
}
// type=2, message indicating state changes etc.
// initial state for uploading/downloading is true
message Status {
optional bool uploading = 1;
optional bool downloading = 2;
}
// type=3, what do we have?
message Have {
required uint64 start = 1;
optional uint64 length = 2 [default = 1]; // defaults to 1
optional bytes bitfield = 3;
optional bool ack = 4; // when true, this Have message is an acknowledgement
}
// type=4, what did we lose?
message Unhave {
required uint64 start = 1;
optional uint64 length = 2 [default = 1]; // defaults to 1
}
// type=5, what do we want? remote should start sending have messages in this range
message Want {
required uint64 start = 1;
optional uint64 length = 2; // defaults to Infinity or feed.length (if not live)
}
// type=6, what don't we want anymore?
message Unwant {
required uint64 start = 1;
optional uint64 length = 2; // defaults to Infinity or feed.length (if not live)
}
// type=7, ask for data
message Request {
required uint64 index = 1;
optional uint64 bytes = 2;
optional bool hash = 3;
optional uint64 nodes = 4;
}
// type=8, cancel a request
message Cancel {
required uint64 index = 1;
optional uint64 bytes = 2;
optional bool hash = 3;
}
// type=9, get some data
message Data {
message Node {
required uint64 index = 1;
required bytes hash = 2;
required uint64 size = 3;
}
required uint64 index = 1;
optional bytes value = 2;
repeated Node nodes = 3;
optional bytes signature = 4;
}
// type=10, explicitly close a channel.
message Close {
optional bytes discoveryKey = 1; // only send this if you did not do an open
}
// type=15, extension message