-
Notifications
You must be signed in to change notification settings - Fork 984
/
raft_cmdpb.proto
151 lines (124 loc) · 3.05 KB
/
raft_cmdpb.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
syntax = "proto3";
package raft_cmdpb;
import "metapb.proto";
import "errorpb.proto";
import "eraftpb.proto";
message GetRequest {
string cf = 1;
bytes key = 2;
}
message GetResponse {
bytes value = 1;
}
message PutRequest {
string cf = 1;
bytes key = 2;
bytes value = 3;
}
message PutResponse {}
message DeleteRequest {
string cf = 1;
bytes key = 2;
}
message DeleteResponse {}
message SnapRequest {}
message SnapResponse {
metapb.Region region = 1;
}
enum CmdType {
Invalid = 0;
Get = 1;
Put = 3;
Delete = 4;
Snap = 5;
}
message Request {
CmdType cmd_type = 1;
GetRequest get = 2;
PutRequest put = 4;
DeleteRequest delete = 5;
SnapRequest snap = 6;
}
message Response {
CmdType cmd_type = 1;
GetResponse get = 2;
PutResponse put = 4;
DeleteResponse delete = 5;
SnapResponse snap = 6;
}
message ChangePeerRequest {
// This can be only called in internal Raftstore now.
eraftpb.ConfChangeType change_type = 1;
metapb.Peer peer = 2;
}
message ChangePeerResponse {
metapb.Region region = 1;
}
message SplitRequest {
// This can be only called in internal Raftstore now.
// The split_key has to exist in the splitting region.
bytes split_key = 1;
// We split the region into two. The first uses the origin
// parent region id, and the second uses the new_region_id.
// We must guarantee that the new_region_id is global unique.
uint64 new_region_id = 2;
// The peer ids for the new split region.
repeated uint64 new_peer_ids = 3;
}
message SplitResponse {
// SplitResponse contains the region where specific keys have split into.
repeated metapb.Region regions = 1;
}
message CompactLogRequest {
uint64 compact_index = 1;
uint64 compact_term = 2;
}
message CompactLogResponse {}
message TransferLeaderRequest {
metapb.Peer peer = 1;
}
message TransferLeaderResponse {}
enum AdminCmdType {
InvalidAdmin = 0;
ChangePeer = 1;
CompactLog = 3;
TransferLeader = 4;
Split = 10;
}
message AdminRequest {
AdminCmdType cmd_type = 1;
ChangePeerRequest change_peer = 2;
CompactLogRequest compact_log = 4;
TransferLeaderRequest transfer_leader = 5;
SplitRequest split = 10;
}
message AdminResponse {
AdminCmdType cmd_type = 1;
ChangePeerResponse change_peer = 2;
CompactLogResponse compact_log = 4;
TransferLeaderResponse transfer_leader = 5;
SplitResponse split = 10;
}
message RaftRequestHeader {
uint64 region_id = 1;
metapb.Peer peer = 2;
metapb.RegionEpoch region_epoch = 4;
uint64 term = 5;
}
message RaftResponseHeader {
errorpb.Error error = 1;
bytes uuid = 2;
uint64 current_term = 3;
}
message RaftCmdRequest {
RaftRequestHeader header = 1;
// We can't enclose normal requests and administrator request
// at same time.
repeated Request requests = 2;
AdminRequest admin_request = 3;
}
message RaftCmdResponse {
RaftResponseHeader header = 1;
repeated Response responses = 2;
AdminResponse admin_response = 3;
}