-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.proto
353 lines (266 loc) · 6.44 KB
/
server.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
syntax = "proto3";
import "google/protobuf/any.proto";
package gos;
service TransactionService {
// Starts a new transaction
rpc StartTransaction(StartTransactionRequest) returns (TxnId) {}
// Get the state of an object on a txn time
rpc GetOidState(GetOidTxn) returns (State) {}
// WRITE
rpc Store(stream StoreObject) returns (stream StoreResponse) {}
// DELETE
// Delete a state, index and relations of an object on a txn time and all subobjects (in vacuumm thread)
rpc DeleteOid(DeleteOidTxn) returns (DeleteResponse) {}
// COMMIT
rpc Commit(TxnId) returns (CommitStatus) {}
rpc Abort(TxnId) returns (AbortStatus) {}
// Introspection
rpc GetPageOfKeys(PageOidsRequest) returns (OidsResponse) {}
rpc Keys(KeysRequest) returns (OidsResponse) {}
rpc GetChild(GetChildRequest) returns (StatesResponse) {}
rpc GetChilden(GetChildenRequest) returns (StatesResponse) {}
rpc HasKey(GetChildRequest) returns (FoundResponse) {}
rpc LenChildren(LenChildenRequest) returns (LengthResponse) {}
// Stream all subobjects
rpc Items(GetOidTxn) returns (stream State) {}
rpc GetAnnotation(AnnotationRequest) returns (State) {}
rpc GetAnnotationKeys(GetOidTxn) returns (OidsResponse) {}
// Blobs
rpc WriteBlobChunk(WriteChunkRequest) returns (FoundResponse) {}
rpc ReadBlobChunk(ReadChunkRequest) returns (Blob) {}
rpc ReadBlobChunks(ReadChunksRequest) returns (stream Blob) {}
rpc DelBlobChunks(DelBlobRequest) returns (stream Blob) {}
// Stats
rpc GetTotalNumberOfObjects(TxnId) returns (LengthResponse) {}
rpc GetTotalNumberOfResources(TxnId) returns (LengthResponse) {}
rpc GetTotalResourcesOfType(TxnResourceRequest) returns (LengthResponse) {}
// Batch
rpc GetPageStateOidOfType(TxnResourcePageRequest) returns (stream State) {}
rpc GetPageStateOfType(TxnResourcePageRequest) returns (stream State) {}
// Search
rpc SearchState(SearchRequest) returns (stream State) {}
// // Introspect
// rpc GetActiveTransactions() returns (Transactions) {}
}
message StartTransactionRequest {
bool write = 1;
string user = 2;
repeated string roles = 3;
string path = 4;
}
message TxnId {
uint64 tid = 1;
uint32 part = 2;
}
message GetOidTxn {
uint64 tid = 1;
string oid = 2;
bool update = 3;
}
message DeleteOidTxn {
uint64 tid = 1;
string oid = 2;
}
message DeleteResponse {
bool result = 1;
}
message GetIdTxn {
uint64 tid = 1;
string oid = 2;
bool update = 3;
}
message OidTxnRelation {
uint64 tid = 1;
string oid = 2;
string relation = 3;
}
message State {
bytes state = 1;
string of = 2;
string parent_id = 3;
string id = 4;
string type = 5;
string otid = 6;
}
message StoreObject {
uint64 tid = 1;
uint32 part = 2;
string uid = 3;
repeated string path = 4;
bytes state = 5;
Metadata metadata = 6;
RelationState relations = 7;
FTSState fts = 8;
SecurityState security = 9;
string of = 10;
string parent_id = 11;
string id = 12;
string type = 13;
string otid = 14;
}
message Int {
int64 value = 1;
}
message String {
string value = 1;
}
message Metadata {
map<string, google.protobuf.Any> fields = 1;
bool merge = 2;
}
message FTSState {
map<string, google.protobuf.Any> fields = 1;
bool merge = 2;
}
message RelationStoreOid {
repeated string name = 1;
}
message Relation {
string destination = 1;
bool dual = 2;
map<string, google.protobuf.Any> properties = 3;
}
message RelationState {
repeated Relation state = 3;
bool merge = 4;
}
message SecurityState {
repeated string allow_user = 1;
repeated string allow_role = 2;
repeated string deny_user = 3;
repeated string deny_role = 4;
repeated string single_user = 5;
repeated string single_role = 6;
bool merge = 7;
}
message StoreResponse {
bool ok = 1;
int32 time = 2;
Conflict conflict = 3;
string uid = 4;
}
message TxnSet {
uint64 tid = 1;
repeated string zoid = 2;
}
message CommitStatus {
bool ok = 1;
repeated Conflict conflics = 2;
}
message AbortStatus {}
// should be on the backend?
message Conflict {
string zoid = 1;
State real_state = 2;
State proposed_state = 3;
}
// Introspection
message PageOidsRequest {
uint64 tid = 1;
string parent_zoid = 2;
int32 page = 3;
int64 page_size = 4;
}
message OidsResponse {
uint64 tid = 1;
repeated string zoid = 2;
}
message KeysRequest {
uint64 tid = 1;
string parent_zoid = 2;
}
message GetChildRequest {
uint64 tid = 1;
string parent_zoid = 2;
string id = 3;
}
message GetChildenRequest {
uint64 tid = 1;
string parent_zoid = 2;
repeated string id = 3;
}
message StatesResponse {
repeated State state = 1;
}
message FoundResponse {
bool found = 1;
}
message LengthResponse {
uint64 length = 1;
}
message LenChildenRequest {
uint64 tid = 1;
string parent = 2;
}
message AnnotationRequest {
uint64 tid = 1;
string zoid = 2;
string id = 3;
}
// Blobs
message WriteChunkRequest {
uint64 tid = 1;
string bid = 2;
string zoid = 3;
uint32 chunk_index = 4;
bytes data = 5;
}
message Blob {
uint32 chunk_index = 1;
bytes data = 2;
}
message ReadChunkRequest {
uint64 tid = 1;
string bid = 2;
uint32 chunk_index = 3;
}
message ReadChunksRequest {
uint64 tid = 1;
string bid = 2;
}
message DelBlobRequest {
uint64 tid = 1;
string bid = 2;
}
// Batch
message TxnResourcePageRequest {
uint64 tid = 1;
string type = 2;
int32 page = 3;
int64 page_size = 4;
}
message TxnResourceRequest {
uint64 tid = 1;
string type = 2;
}
// Search
message SearchRequest {
uint64 tid = 1;
uint32 part = 2;
string type = 3;
repeated string path = 4;
int32 page = 5;
int64 page_size = 6;
// Relation
map<string, google.protobuf.Any> relation = 7;
// Index
message SearchOperation {
enum Operations {
IN = 0;
NOT = 1;
GTE = 2;
LTE = 3;
EQ = 4;
}
SearchOperation op = 1;
google.protobuf.Any value = 2;
}
map<string, SearchOperation> index = 8;
map<string, SearchOperation> fts = 9;
// Security
SearchSecurity security = 12;
}
message SearchSecurity {
string user = 1;
repeated string role = 2;
}