Developing lightweight computation at the DSG edge

antidote.proto 4.79 KB
Newer Older
Mathias Weber's avatar
Mathias Weber committed
1
2
syntax = "proto2";
// Java package specifiers
Mathias Weber's avatar
Mathias Weber committed
3
option java_package = "com.basho.riak.protobuf";
Mathias Weber's avatar
Mathias Weber committed
4
5
6
7
8
9
10
11
12
13
14
15
16
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;
Mathias Weber's avatar
Mathias Weber committed
17
18
    FLAG_EW = 13;
    FLAG_DW = 14;
Mathias Weber's avatar
Mathias Weber committed
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
}


//------------------
// Counter

// Counter increment requenst
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;
}

Mathias Weber's avatar
Mathias Weber committed
108
109
110
111
112
113
114
115
116
117
118
119
//-------------------
// Flags

message ApbFlagUpdate {
    required bool value = 1;
}

message ApbGetFlagResp {
    required bool value = 1;
}


Mathias Weber's avatar
Mathias Weber committed
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

// 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
}

// 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;
Mathias Weber's avatar
Mathias Weber committed
166
    optional ApbFlagUpdate flagop = 7;
Mathias Weber's avatar
Mathias Weber committed
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
}

// 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;
Mathias Weber's avatar
Mathias Weber committed
217
    optional ApbGetFlagResp flag = 7;
Mathias Weber's avatar
Mathias Weber committed
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
}
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;
}