-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabi.proto
115 lines (101 loc) · 2.67 KB
/
abi.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
syntax = "proto3";
package abi;
// 来自客户端的命令请求
message CommandRequest {
oneof request_data {
// Get a key from a table, return with a value
Hget hget = 1;
// Get all key-value pairs from the table
Hgetall hgetall = 2;
// Get multiple keys, and return their values
Hmget hmget = 3;
// Store a key-value pair in a table.
// If the table does not exist, then it will be created.
Hset hset = 4;
// Store multiple key-value pairs in a table.
// If the table does not exist, then it will be created.
Hmset hmset = 5;
// Delete a key from a table,
// and return the pervious key.
Hdel hdel = 6;
// Delete multiple keys from a table,
// and return the pervious keys.
Hmdel hmdel = 7;
// Check if the key exists in the table.
Hexists hexists = 8;
// Check if multiple keys exist in the table.
Hmexists hmexists = 9;
}
}
// 服务器的响应
message CommandResponse {
// 状态码:复用 HTTP 2xx/4xx/5xx 状态码
uint32 status = 1;
// 如果不是 2xx, message 里包含详细的信息
string message = 2;
// 成功返回的 values
repeated Value values = 3;
// 成功返回的 kv pairs
repeated Kvpair pairs = 4;
}
// 从 table 中获取一个 key,返回 value
message Hget {
// The table to cope with
string table = 1;
// The key to cope with
string key = 2;
}
// 从 table 中获取所有的 Kvpair
message Hgetall { string table = 1; }
// 从 table 中获取一组 key,返回它们的 value
message Hmget {
string table = 1;
repeated string keys = 2;
}
// 返回的值
message Value {
oneof value {
string string = 1;
bytes binary = 2;
int64 integer = 3;
double float = 4;
bool bool = 5;
}
}
// 返回的 Kvpair
message Kvpair {
string key = 1;
Value value = 2;
}
// 往 table 里存一个 kvpair,
// 如果 table 不存在就创建这个 table
message Hset {
string table = 1;
Kvpair pair = 2;
}
// 往 table 中存一组 kvpair,
// 如果 table 不存在就创建这个 table
message Hmset {
string table = 1;
repeated Kvpair pairs = 2;
}
// 从 table 中删除一个 key,返回它之前的值
message Hdel {
string table = 1;
string key = 2;
}
// 从 table 中删除一组 key,返回它们之前的值
message Hmdel {
string table = 1;
repeated string keys = 2;
}
// 查看 key 是否存在
message Hexists {
string table = 1;
string key = 2;
}
// 查看一组 key 是否存在
message Hmexists {
string table = 1;
repeated string keys = 2;
}