-
Notifications
You must be signed in to change notification settings - Fork 3
/
dlock.proto
49 lines (42 loc) · 939 Bytes
/
dlock.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
syntax = "proto3";
package dlock;
enum RequestType {
Invalid = 0;
Ping = 1;
Lock = 2;
Unlock = 3;
}
enum ResponseStatus {
// Error codes:
// 1-99: protocol level errors
// 100-119: [lock] input validation errors
// 120-139: [lock] response errors for valid input
Ok = 0;
General = 1; // generic error, read message for details
Version = 2; // incompatible request version
InvalidType = 3; // unknown request type
// Lock 100-199
TooManyKeys = 100;
AcquireTimeout = 120;
}
message Request {
uint32 version = 1;
uint64 id = 2;
string access_token = 3;
RequestType type = 4;
// Ping is empty
RequestLock lock = 51;
}
message Response {
uint32 version = 1;
uint64 request_id = 2;
ResponseStatus status = 3;
string error_text = 4;
repeated string keys = 5;
int64 server_unix_time = 6; // Unix timestamp
}
message RequestLock {
uint64 wait_micro = 1;
uint64 release_micro = 2;
repeated string keys = 3;
}