-
Notifications
You must be signed in to change notification settings - Fork 134
/
Copy pathgcpb.proto
117 lines (97 loc) · 3.25 KB
/
gcpb.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
syntax = "proto3";
package gcpb;
import "gogoproto/gogo.proto";
import "rustproto.proto";
option (gogoproto.sizer_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (rustproto.lite_runtime_all) = true;
option java_package = "org.tikv.kvproto";
service GC {
rpc ListKeySpaces(ListKeySpacesRequest) returns (ListKeySpacesResponse) {}
rpc GetMinServiceSafePoint(GetMinServiceSafePointRequest) returns (GetMinServiceSafePointResponse) {}
rpc UpdateGCSafePoint(UpdateGCSafePointRequest) returns (UpdateGCSafePointResponse) {}
rpc UpdateServiceSafePoint(UpdateServiceSafePointRequest) returns (UpdateServiceSafePointResponse) {}
}
message RequestHeader {
// cluster_id is the ID of the cluster which be sent to.
uint64 cluster_id = 1;
// sender_id is the ID of the sender server, also member ID or etcd ID.
uint64 sender_id = 2;
}
message ResponseHeader {
// cluster_id is the ID of the cluster which sent the response.
uint64 cluster_id = 1;
Error error = 2;
}
enum ErrorType {
OK = 0;
UNKNOWN = 1;
NOT_BOOTSTRAPPED = 2;
// revision supplied does not match the current etcd revision
REVISION_MISMATCH = 3;
// if the proposed safe point is earlier than old safe point or gc safe point
SAFEPOINT_ROLLBACK = 4;
}
message Error {
ErrorType type = 1;
string message = 2;
}
message KeySpace {
bytes space_id = 1;
uint64 gc_safe_point = 2;
}
message ListKeySpacesRequest {
RequestHeader header = 1;
// set with_gc_safe_point to true to also receive gc safe point for each key space
bool with_gc_safe_point = 2;
}
message ListKeySpacesResponse {
ResponseHeader header = 1;
repeated KeySpace key_spaces = 2;
}
message GetMinServiceSafePointRequest {
RequestHeader header = 1;
bytes space_id = 2;
}
message GetMinServiceSafePointResponse {
ResponseHeader header = 1;
uint64 safe_point = 2;
// revision here is to safeguard the validity of the obtained min,
// preventing cases where new services register their safe points after min is obtained by gc worker
int64 revision = 3;
}
message UpdateGCSafePointRequest {
RequestHeader header = 1;
bytes space_id = 2;
uint64 safe_point = 3;
// here client need to provide the revision obtained from GetMinServiceSafePoint,
// so server can check if it's still valid
int64 revision = 4;
}
message UpdateGCSafePointResponse {
ResponseHeader header = 1;
// update will be successful if revision is valid and new safepoint > old safe point
// if failed, previously obtained min might be incorrect, should retry from GetMinServiceSafePoint
bool succeeded = 2;
uint64 new_safe_point = 3;
}
message UpdateServiceSafePointRequest {
RequestHeader header = 1;
bytes space_id = 2;
bytes service_id = 3;
// safe point will be set to expire on (PD Server time + TTL)
// pass in a ttl < 0 to remove target safe point
// pass in MAX_INT64 to set a safe point that never expire
int64 TTL = 4;
uint64 safe_point = 5;
}
message UpdateServiceSafePointResponse {
ResponseHeader header = 1;
// update will be successful if ttl < 0 (a removal request)
// or if new safe point >= old safe point and new safe point >= gc safe point
bool succeeded = 2;
uint64 gc_safe_point = 3;
uint64 old_safe_point = 4;
uint64 new_safe_point = 5;
}