-
Notifications
You must be signed in to change notification settings - Fork 2
/
antidote.proto
278 lines (223 loc) · 5.94 KB
/
antidote.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
syntax = "proto2";
// Java package specifiers
option java_package = "com.basho.riak.protobuf";
option java_outer_classname = "AntidotePB";
option go_package = "antidoteclient";
enum CRDT_type {
COUNTER = 3;
ORSET = 4;
LWWREG = 5;
MVREG = 6;
GMAP = 8;
RWSET = 10;
RRMAP = 11;
FATCOUNTER = 12;
FLAG_EW = 13;
FLAG_DW = 14;
BCOUNTER = 15;
}
// Riak Error response
message ApbErrorResp {
required bytes errmsg = 1;
required uint32 errcode = 2;
}
//------------------
// Counter
// Counter increment request
message ApbCounterUpdate {
// inc indicates the value to be incremented. To decrement, use a negative value. If no value is given, it will be considered as an increment by 1
optional sint64 inc = 1;
}
// Response operation
message ApbGetCounterResp {
required sint32 value = 1;
}
//------------------
// Set
// Set updates request
message ApbSetUpdate{
enum SetOpType // TODO merge adds/removes
{
ADD = 1;
REMOVE = 2;
}
required SetOpType optype = 1;
repeated bytes adds = 2;
repeated bytes rems = 3;
}
// Get set request
message ApbGetSetResp {
repeated bytes value = 1;
}
//------------------
// LWW-register
// Register update
message ApbRegUpdate {
required bytes value = 1;
}
// Response operation
message ApbGetRegResp {
required bytes value = 1;
}
//------------------
// MV-register
// use ApbRegUpdate for updates
// response:
message ApbGetMVRegResp {
repeated bytes values = 1;
}
//------------------
// Map
message ApbMapKey {
required bytes key = 1;
required CRDT_type type = 2;
}
message ApbMapUpdate {
repeated ApbMapNestedUpdate updates = 1;
repeated ApbMapKey removedKeys = 2;
}
message ApbMapNestedUpdate {
required ApbMapKey key = 1;
required ApbUpdateOperation update = 2;
}
message ApbGetMapResp {
repeated ApbMapEntry entries = 1;
}
message ApbMapEntry {
required ApbMapKey key = 1;
required ApbReadObjectResp value = 2;
}
//-------------------
// Flags
message ApbFlagUpdate {
required bool value = 1;
}
message ApbGetFlagResp {
required bool value = 1;
}
// General reset operation
message ApbCrdtReset {
}
// Response operation
message ApbOperationResp {
required bool success = 1;
optional uint32 errorcode = 2;
}
//--------------------------------------------------------------
// Properties parameters of a transaction
message ApbTxnProperties {
optional uint32 read_write = 1 ; //default = 0 = read_write, 1 = read_only, 2 = write_only
optional uint32 red_blue = 2 ; // default = 0 = blue, 1 = red
repeated bytes shared_locks = 3;
repeated bytes exclusive_locks = 4;
}
// Object (Key) representation
message ApbBoundObject {
required bytes key = 1;
required CRDT_type type = 2;
required bytes bucket = 3;
}
// Objects to be read
message ApbReadObjects {
repeated ApbBoundObject boundobjects = 1;
required bytes transaction_descriptor = 2;
}
// An Object to be updated with specified operation
message ApbUpdateOp {
required ApbBoundObject boundobject = 1;
required ApbUpdateOperation operation = 2;
}
message ApbUpdateOperation { // TODO use this above
optional ApbCounterUpdate counterop = 1;
optional ApbSetUpdate setop = 2;
optional ApbRegUpdate regop = 3;
optional ApbMapUpdate mapop = 5;
optional ApbCrdtReset resetop = 6;
optional ApbFlagUpdate flagop = 7;
}
// Objects to be updated
message ApbUpdateObjects {
repeated ApbUpdateOp updates = 1;
required bytes transaction_descriptor = 2;
}
// Start Transaction
message ApbStartTransaction {
optional bytes timestamp = 1;
optional ApbTxnProperties properties = 2;
}
// Abort Transaction
message ApbAbortTransaction {
required bytes transaction_descriptor = 1;
}
// Commit Transaction
message ApbCommitTransaction {
required bytes transaction_descriptor = 1;
}
message ApbStaticUpdateObjects{
required ApbStartTransaction transaction = 1;
repeated ApbUpdateOp updates = 2;
}
message ApbStaticReadObjects{
required ApbStartTransaction transaction = 1;
repeated ApbBoundObject objects = 2;
}
//Start transaction response
message ApbStartTransactionResp {
required bool success = 1;
optional bytes transaction_descriptor = 2;
optional uint32 errorcode = 3;
}
//Read Objects Response
message ApbReadObjectResp {
// one of the following:
optional ApbGetCounterResp counter = 1;
optional ApbGetSetResp set = 2;
optional ApbGetRegResp reg = 3;
optional ApbGetMVRegResp mvreg = 4;
optional ApbGetMapResp map = 6;
optional ApbGetFlagResp flag = 7;
}
message ApbReadObjectsResp {
required bool success = 1;
repeated ApbReadObjectResp objects = 2;
optional uint32 errorcode = 3;
}
// Commit Response
message ApbCommitResp {
required bool success = 1;
optional bytes commit_time = 2;
optional uint32 errorcode = 3;
}
message ApbStaticReadObjectsResp {
required ApbReadObjectsResp objects = 1;
required ApbCommitResp committime = 2;
}
//------------ Cluster Management API ---------
// Create a DC with multiple nodes
message ApbCreateDC {
// name of antidote nodes of the form 'antidote@hostname' or 'antidote@ip'
repeated string nodes = 1;
}
message ApbCreateDCResp {
required bool success = 1;
optional uint32 errorcode = 2;
}
// Get a connection descriptor of the DC to be given to other DCs.
message ApbGetConnectionDescriptor {
}
message ApbGetConnectionDescriptorResp {
required bool success = 1;
//structure of descriptor is internal to antidote.
optional bytes descriptor = 2;
optional uint32 errorcode = 3;
}
// Connect DC with each other to start replication.
// This message must be send to all DCs.
message ApbConnectToDCs {
// descriptors is a list of connection information of all DCs obtained from ApbGetConnectionDescriptorResp.descriptor
repeated bytes descriptors = 1;
}
message ApbConnectToDCsResp {
required bool success = 1;
optional uint32 errorcode = 2;
}