-
Notifications
You must be signed in to change notification settings - Fork 3
/
bob.proto
96 lines (79 loc) · 2.21 KB
/
bob.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
syntax = "proto3";
package bob_storage;
// API
service BobApi {
rpc Put (PutRequest) returns (OpStatus) {}
rpc Get (GetRequest) returns (Blob) {}
rpc Ping (Null) returns (Null) {}
rpc Exist (ExistRequest) returns (ExistResponse) {}
rpc Delete (DeleteRequest) returns (OpStatus) {}
}
message Null {};
// Put operation parameters
message PutRequest {
BlobKey key = 1; // Blob's key
Blob data = 2; // Data
PutOptions options = 3; // options
}
// Get operation parameters
message GetRequest {
BlobKey key = 1; // Blob's key
GetOptions options = 2; // options
}
// Exist operation parameters
message ExistRequest {
repeated BlobKey keys = 1; // Keys to check
GetOptions options = 2; // Options, same as in get request
}
// Delete operation parameters
message DeleteRequest {
BlobKey key = 1; // Blob's key
BlobMeta meta = 2; // Metadata
DeleteOptions options = 3; // Options
}
// Blob id
message BlobKey {
bytes key = 1; //Inner id representation
}
// Data blob
message Blob {
bytes data = 1; // Data
BlobMeta meta = 2; // Metadata
}
// Blob metadata
message BlobMeta {
uint64 timestamp = 1; // timestamp for data version
}
// Operation status
message OpStatus {
BobError error = 1; // If all good - null
}
message ExistResponse {
repeated bool exist = 1;
}
// Put operation options
message PutOptions {
repeated string remote_nodes = 1;
bool force_node = 2; // Force operation to be served by node to which it comes
bool overwrite = 3; // Overwrite data in case of id existens
}
enum GetSource {
ALL = 0;
NORMAL = 1;
ALIEN = 2;
}
// Get operation options
message GetOptions {
bool force_node = 1; // Force operation to be served by node to which it comes
GetSource source = 2; // Set source for data reading
}
message BobError {
int32 code = 1; // Error code in case of error
string desc = 2; // Error desription
}
// Delete operation options
message DeleteOptions {
repeated string force_alien_nodes = 1; // List of nodes in aliens to perform force operation (skip presence check)
bool force_node = 2; // Force operation to be served by node to which it comes
bool is_alien = 3; // Shows if the request is for aliens
}