-
Notifications
You must be signed in to change notification settings - Fork 3
/
node.proto
93 lines (70 loc) · 2.14 KB
/
node.proto
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
syntax = "proto3";
option go_package = "github.com/adammck/ranger/pkg/proto";
import "ranje.proto";
package ranger;
service Node {
rpc Prepare (PrepareRequest) returns (PrepareResponse) {}
rpc Activate (ServeRequest) returns (ServeResponse) {}
rpc Deactivate (DeactivateRequest) returns (DeactivateResponse) {}
rpc Drop (DropRequest) returns (DropResponse) {}
// Controller wants to know the state of the node, including its ranges.
// Proxy shouldn't call this; use Ranges instead.
rpc Info (InfoRequest) returns (InfoResponse) {}
// Proxy wants to know what it can forward to this node.
// Controller shouldn't call this; use Info instead.
rpc Ranges (RangesRequest) returns (stream RangesResponse) {}
}
message Parent {
RangeMeta range = 1;
// Range IDs in here may not appear in the PrepareRequest, because at some point
// the history is pruned.
repeated uint64 parent = 2;
// TODO: This should probably be two fields, host and port? Or node ident?
repeated Placement placements = 3;
}
message PrepareRequest {
RangeMeta range = 1;
// The range(s) which this range was created from, and the nodes where they
// can currently be found. This is empty is the range is brand new. Nodes may
// use this info to restore the current state of the range when accepting it.
// TODO: Need nested parents here?
repeated Parent parents = 3;
}
message PrepareResponse {
// TODO: Return just the state instead, like ServeResponse.
RangeInfo range_info = 1;
}
message ServeRequest {
uint64 range = 1;
bool force = 2;
}
message ServeResponse {
RangeNodeState state = 1;
}
message DeactivateRequest {
uint64 range = 1;
}
message DeactivateResponse {
RangeNodeState state = 1;
}
message DropRequest {
uint64 range = 1;
bool force = 2;
}
message DropResponse {
RangeNodeState state = 1;
}
message InfoRequest {
}
message InfoResponse {
repeated RangeInfo ranges = 1;
// The nod wants the controller to remove all ranges from it. Probably because
// it wants to shut down gracefully.
bool wantDrain = 2;
}
message RangesRequest {
}
message RangesResponse {
RangeMeta meta = 1;
RangeNodeState state = 2;
}