forked from vesoft-inc/nebula
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meta.thrift
480 lines (394 loc) · 10.6 KB
/
meta.thrift
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
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
/* Copyright (c) 2018 vesoft inc. All rights reserved.
*
* This source code is licensed under Apache 2.0 License,
* attached with Common Clause Condition 1.0, found in the LICENSES directory.
*/
namespace cpp nebula.meta
namespace java com.vesoft.nebula.meta
namespace go nebula.meta
include "common.thrift"
enum ErrorCode {
SUCCEEDED = 0,
// RPC Failure
E_DISCONNECTED = -1,
E_FAIL_TO_CONNECT = -2,
E_RPC_FAILURE = -3,
E_LEADER_CHANGED = -11,
// Operation Failure
E_NO_HOSTS = -21,
E_EXISTED = -22,
E_NOT_FOUND = -23,
E_INVALID_HOST = -24,
E_UNSUPPORTED = -25,
E_NOT_DROP = -26,
E_BALANCER_RUNNING = -27,
E_CONFLICT = -28,
// KV Failure
E_STORE_FAILURE = -31,
E_STORE_SEGMENT_ILLEGAL = -32,
E_INVALID_PASSWORD = -41,
E_INPROPER_ROLE = -42,
E_UNKNOWN = -99,
} (cpp.enum_strict)
enum AlterSchemaOp {
ADD = 0x01,
CHANGE = 0x02,
DROP = 0x03,
UNKNOWN = 0x04,
} (cpp.enum_strict)
/**
** GOD is A global senior administrator.like root of Linux systems.
** ADMIN is an administrator for a given Graph Space.
** USER is a normal user for a given Graph Space. A User can access (read and write) the data in the Graph Space.
** GUEST is a read-only role for a given Graph Space. A Guest cannot modify the data in the Graph Space.
** Refer to header file src/graph/PermissionManager.h for details.
**/
enum RoleType {
GOD = 0x01,
ADMIN = 0x02,
USER = 0x03,
GUEST = 0x04,
} (cpp.enum_strict)
union ID {
1: common.GraphSpaceID space_id,
2: common.TagID tag_id,
3: common.EdgeType edge_type,
4: common.UserID user_id,
}
struct IdName {
1: ID id,
2: string name,
}
struct Pair {
1: string key,
2: string value,
}
struct SpaceProperties {
1: string space_name,
2: i32 partition_num,
3: i32 replica_factor,
}
struct SpaceItem {
1: common.GraphSpaceID space_id,
2: SpaceProperties properties,
}
struct TagItem {
1: common.TagID tag_id,
2: string tag_name,
3: common.SchemaVer version,
4: common.Schema schema,
}
struct AlterSchemaItem {
1: AlterSchemaOp op,
2: common.Schema schema,
}
struct EdgeItem {
1: common.EdgeType edge_type,
2: string edge_name,
3: common.SchemaVer version,
4: common.Schema schema,
}
enum HostStatus {
ONLINE = 0x00,
OFFLINE = 0x01,
UNKNOWN = 0x02,
} (cpp.enum_strict)
struct HostItem {
1: common.HostAddr hostAddr,
2: HostStatus status,
}
struct UserItem {
1: string account;
// Disable user if lock status is true.
2: bool is_lock,
// The number of queries an account can issue per hour
3: i32 max_queries_per_hour,
// The number of updates an account can issue per hour
4: i32 max_updates_per_hour,
// The number of times an account can connect to the server per hour
5: i32 max_connections_per_hour,
// The number of simultaneous connections to the server by an account
6: i32 max_user_connections,
}
struct RoleItem {
1: common.UserID user_id,
2: common.GraphSpaceID space_id,
3: RoleType role_type,
}
struct ExecResp {
1: ErrorCode code,
// For custom kv operations, it is useless.
2: ID id,
// Valid if ret equals E_LEADER_CHANGED.
3: common.HostAddr leader,
}
// Graph space related operations.
struct CreateSpaceReq {
1: SpaceProperties properties,
}
struct DropSpaceReq {
1: string space_name
}
struct ListSpacesReq {
}
struct ListSpacesResp {
1: ErrorCode code,
// Valid if ret equals E_LEADER_CHANGED.
2: common.HostAddr leader,
3: list<IdName> spaces,
}
struct GetSpaceReq {
1: string space_name,
}
struct GetSpaceResp {
1: ErrorCode code,
2: common.HostAddr leader,
3: SpaceItem item,
}
// Tags related operations
struct CreateTagReq {
1: common.GraphSpaceID space_id,
2: string tag_name,
3: common.Schema schema,
}
struct AlterTagReq {
1: common.GraphSpaceID space_id,
2: string tag_name,
3: list<AlterSchemaItem> tag_items,
4: common.SchemaProp schema_prop,
}
struct DropTagReq {
1: common.GraphSpaceID space_id,
2: string tag_name,
}
struct ListTagsReq {
1: common.GraphSpaceID space_id,
}
struct ListTagsResp {
1: ErrorCode code,
// Valid if ret equals E_LEADER_CHANGED.
2: common.HostAddr leader,
3: list<TagItem> tags,
}
struct GetTagReq {
1: common.GraphSpaceID space_id,
2: string tag_name,
3: common.SchemaVer version,
}
struct GetTagResp {
1: ErrorCode code,
2: common.HostAddr leader,
3: common.Schema schema,
}
// Edge related operations.
struct CreateEdgeReq {
1: common.GraphSpaceID space_id,
2: string edge_name,
3: common.Schema schema,
}
struct AlterEdgeReq {
1: common.GraphSpaceID space_id,
2: string edge_name,
3: list<AlterSchemaItem> edge_items,
4: common.SchemaProp schema_prop,
}
struct GetEdgeReq {
1: common.GraphSpaceID space_id,
2: string edge_name,
3: common.SchemaVer version,
}
struct GetEdgeResp {
1: ErrorCode code,
2: common.HostAddr leader,
3: common.Schema schema,
}
struct DropEdgeReq {
1: common.GraphSpaceID space_id,
2: string edge_name,
}
struct ListEdgesReq {
1: common.GraphSpaceID space_id,
}
struct ListEdgesResp {
1: ErrorCode code,
// Valid if ret equals E_LEADER_CHANGED.
2: common.HostAddr leader,
3: list<EdgeItem> edges,
}
// Host related operations.
struct AddHostsReq {
1: list<common.HostAddr> hosts;
}
struct ListHostsReq {
}
struct ListHostsResp {
1: ErrorCode code,
// Valid if ret equals E_LEADER_CHANGED.
2: common.HostAddr leader,
3: list<HostItem> hosts,
}
struct RemoveHostsReq {
1: list<common.HostAddr> hosts;
}
// Parts related operations.
struct GetPartsAllocReq {
1: common.GraphSpaceID space_id,
}
struct GetPartsAllocResp {
1: ErrorCode code,
// Valid if ret equals E_LEADER_CHANGED.
2: common.HostAddr leader,
3: map<common.PartitionID, list<common.HostAddr>>(cpp.template = "std::unordered_map") parts,
}
struct MultiPutReq {
// segment is used to avoid conflict with system data.
// it should be comprised of numbers and letters.
1: string segment,
2: list<Pair> pairs,
}
struct GetReq {
1: string segment,
2: string key,
}
struct GetResp {
1: ErrorCode code,
2: common.HostAddr leader,
3: string value,
}
struct MultiGetReq {
1: string segment,
2: list<string> keys,
}
struct MultiGetResp {
1: ErrorCode code,
2: common.HostAddr leader,
3: list<string> values,
}
struct RemoveReq {
1: string segment,
2: string key,
}
struct RemoveRangeReq {
1: string segment,
2: string start,
3: string end,
}
struct ScanReq {
1: string segment,
2: string start,
3: string end,
}
struct ScanResp {
1: ErrorCode code,
2: common.HostAddr leader,
3: list<string> values,
}
struct HBResp {
1: ErrorCode code,
2: common.HostAddr leader,
}
struct HBReq {
1: common.HostAddr host,
}
struct CreateUserReq {
1: UserItem user,
2: string encoded_pwd,
3: bool missing_ok,
}
struct DropUserReq {
1: string account,
2: bool missing_ok,
}
struct AlterUserReq {
1: UserItem user_item,
}
struct GrantRoleReq {
1: RoleItem role_item,
}
struct RevokeRoleReq {
1: RoleItem role_item,
}
struct GetUserReq {
1: string account,
}
struct GetUserResp {
1: ErrorCode code,
// Valid if ret equals E_LEADER_CHANGED.
2: common.HostAddr leader,
3: UserItem user_item,
}
struct ListUsersReq {
}
struct ListUsersResp {
1: ErrorCode code,
// Valid if ret equals E_LEADER_CHANGED.
2: common.HostAddr leader,
3: map<common.UserID, UserItem>(cpp.template = "std::unordered_map") users,
}
struct ListRolesReq {
1: common.GraphSpaceID space_id,
}
struct ListRolesResp {
1: ErrorCode code,
// Valid if ret equals E_LEADER_CHANGED.
2: common.HostAddr leader,
3: list<RoleItem> roles,
}
struct ChangePasswordReq {
1: string account,
2: string new_encoded_pwd,
3: string old_encoded_pwd,
}
struct CheckPasswordReq {
1: string account,
2: string encoded_pwd,
}
struct BalanceReq {
1: optional common.GraphSpaceID space_id,
// Specify the balance id to check the status of the related balance plan
2: optional i64 id,
}
struct BalanceResp {
1: ErrorCode code,
2: i64 id,
// Valid if code equals E_LEADER_CHANGED.
3: common.HostAddr leader,
}
service MetaService {
ExecResp createSpace(1: CreateSpaceReq req);
ExecResp dropSpace(1: DropSpaceReq req);
GetSpaceResp getSpace(1: GetSpaceReq req);
ListSpacesResp listSpaces(1: ListSpacesReq req);
ExecResp createTag(1: CreateTagReq req);
ExecResp alterTag(1: AlterTagReq req);
ExecResp dropTag(1: DropTagReq req);
GetTagResp getTag(1: GetTagReq req);
ListTagsResp listTags(1: ListTagsReq req);
ExecResp createEdge(1: CreateEdgeReq req);
ExecResp alterEdge(1: AlterEdgeReq req);
ExecResp dropEdge(1: DropEdgeReq req);
GetEdgeResp getEdge(1: GetEdgeReq req);
ListEdgesResp listEdges(1: ListEdgesReq req);
ExecResp addHosts(1: AddHostsReq req);
ExecResp removeHosts(1: RemoveHostsReq req);
ListHostsResp listHosts(1: ListHostsReq req);
GetPartsAllocResp getPartsAlloc(1: GetPartsAllocReq req);
ExecResp multiPut(1: MultiPutReq req);
GetResp get(1: GetReq req);
MultiGetResp multiGet(1: MultiGetReq req);
ExecResp remove(1: RemoveReq req);
ExecResp removeRange(1: RemoveRangeReq req);
ScanResp scan(1: ScanReq req);
ExecResp createUser(1: CreateUserReq req);
ExecResp dropUser(1: DropUserReq req);
ExecResp alterUser(1: AlterUserReq req);
ExecResp grantRole(1: GrantRoleReq req);
ExecResp revokeRole(1: RevokeRoleReq req);
GetUserResp getUser(1: GetUserReq req);
ListUsersResp listUsers(1: ListUsersReq req);
ListRolesResp listRoles(1: ListRolesReq req);
ExecResp changePassword(1: ChangePasswordReq req);
ExecResp checkPassword(1: CheckPasswordReq req);
HBResp heartBeat(1: HBReq req);
BalanceResp balance(1: BalanceReq req);
}