-
Notifications
You must be signed in to change notification settings - Fork 0
/
proxy.proto
121 lines (96 loc) · 1.99 KB
/
proxy.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
syntax = "proto3";
option go_package = "github.com/Yanhao/bedrock-cli/clients/proxy";
package bedrock.proxy;
option cc_generic_services = true;
enum TxStatus {
START = 0;
FINISHED = 1;
}
enum TxLockType {
SHARED = 0;
EXCLUSIVE = 1;
}
message TxRecordLock {
TxLockType lock_type = 1;
bytes key = 2;
}
message TxRangeLock {
TxLockType lock_type = 1;
bytes start_key = 2;
bytes end_key = 3;
}
message TxRecord {
uint32 storage_id = 1;
uint64 tx_id = 2;
TxStatus status = 3;
uint64 heartbeat_ts = 4;
repeated TxRecordLock record_locks = 5;
repeated TxRangeLock range_locks = 6;
}
enum Error {
OK = 0;
NO_SUCH_KEY = 1;
INVLIAD_PARAMETERS = 2;
UNKNOWN = 255;
}
message KvGetRequest {
uint32 storage_id = 1;
bytes key = 2;
bool read_latest = 3;
}
message KvGetResponse {
bytes value = 1;
Error err = 255;
}
message KvSetRequest {
uint32 storage_id = 1;
bytes key = 2;
bytes value = 3;
}
message KvSetResponse {
Error err = 255;
}
message KvDeleteRequest {
uint32 storage_id = 1;
bytes key = 2;
}
message KvDeleteResponse {
Error err = 255;
}
message KvScanRequest {
uint32 storage_id = 1;
bytes prefix = 2;
uint32 limit = 3;
}
message KeyValue {
bytes key = 1;
bytes value = 2;
}
message KvScanResponse {
repeated KeyValue kvs = 1;
Error err = 255;
}
enum PredicateOp {
EQUAL = 0;
NOT_EQUAL = 1;
}
message Predicate {
bytes key = 1;
bytes value = 2;
PredicateOp op = 3;
}
message BatchRequest {
uint32 storage_id = 1;
repeated KeyValue kvs = 2;
repeated Predicate predicates = 3;
}
message BatchResponse {
Error err = 255;
}
service ProxyService {
rpc KvSet(KvSetRequest) returns (KvSetResponse);
rpc KvGet(KvGetRequest) returns (KvGetResponse);
rpc KvDelete(KvDeleteRequest) returns (KvDeleteResponse);
rpc KvScan(KvScanRequest) returns (stream KvScanResponse);
rpc Batch(BatchRequest) returns (BatchResponse);
}