etcdv3 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,966 @@
1
+ syntax = "proto3";
2
+ package etcdserverpb;
3
+
4
+ import "gogo.proto";
5
+ import "kv.proto";
6
+ import "auth.proto";
7
+
8
+ // for grpc-gateway
9
+ import "annotations.proto";
10
+
11
+ option (gogoproto.marshaler_all) = true;
12
+ option (gogoproto.unmarshaler_all) = true;
13
+
14
+ service KV {
15
+ // Range gets the keys in the range from the key-value store.
16
+ rpc Range(RangeRequest) returns (RangeResponse) {
17
+ option (google.api.http) = {
18
+ post: "/v3alpha/kv/range"
19
+ body: "*"
20
+ };
21
+ }
22
+
23
+ // Put puts the given key into the key-value store.
24
+ // A put request increments the revision of the key-value store
25
+ // and generates one event in the event history.
26
+ rpc Put(PutRequest) returns (PutResponse) {
27
+ option (google.api.http) = {
28
+ post: "/v3alpha/kv/put"
29
+ body: "*"
30
+ };
31
+ }
32
+
33
+ // DeleteRange deletes the given range from the key-value store.
34
+ // A delete request increments the revision of the key-value store
35
+ // and generates a delete event in the event history for every deleted key.
36
+ rpc DeleteRange(DeleteRangeRequest) returns (DeleteRangeResponse) {
37
+ option (google.api.http) = {
38
+ post: "/v3alpha/kv/deleterange"
39
+ body: "*"
40
+ };
41
+ }
42
+
43
+ // Txn processes multiple requests in a single transaction.
44
+ // A txn request increments the revision of the key-value store
45
+ // and generates events with the same revision for every completed request.
46
+ // It is not allowed to modify the same key several times within one txn.
47
+ rpc Txn(TxnRequest) returns (TxnResponse) {
48
+ option (google.api.http) = {
49
+ post: "/v3alpha/kv/txn"
50
+ body: "*"
51
+ };
52
+ }
53
+
54
+ // Compact compacts the event history in the etcd key-value store. The key-value
55
+ // store should be periodically compacted or the event history will continue to grow
56
+ // indefinitely.
57
+ rpc Compact(CompactionRequest) returns (CompactionResponse) {
58
+ option (google.api.http) = {
59
+ post: "/v3alpha/kv/compaction"
60
+ body: "*"
61
+ };
62
+ }
63
+ }
64
+
65
+ service Watch {
66
+ // Watch watches for events happening or that have happened. Both input and output
67
+ // are streams; the input stream is for creating and canceling watchers and the output
68
+ // stream sends events. One watch RPC can watch on multiple key ranges, streaming events
69
+ // for several watches at once. The entire event history can be watched starting from the
70
+ // last compaction revision.
71
+ rpc Watch(stream WatchRequest) returns (stream WatchResponse) {
72
+ option (google.api.http) = {
73
+ post: "/v3alpha/watch"
74
+ body: "*"
75
+ };
76
+ }
77
+ }
78
+
79
+ service Lease {
80
+ // LeaseGrant creates a lease which expires if the server does not receive a keepAlive
81
+ // within a given time to live period. All keys attached to the lease will be expired and
82
+ // deleted if the lease expires. Each expired key generates a delete event in the event history.
83
+ rpc LeaseGrant(LeaseGrantRequest) returns (LeaseGrantResponse) {
84
+ option (google.api.http) = {
85
+ post: "/v3alpha/lease/grant"
86
+ body: "*"
87
+ };
88
+ }
89
+
90
+ // LeaseRevoke revokes a lease. All keys attached to the lease will expire and be deleted.
91
+ rpc LeaseRevoke(LeaseRevokeRequest) returns (LeaseRevokeResponse) {
92
+ option (google.api.http) = {
93
+ post: "/v3alpha/kv/lease/revoke"
94
+ body: "*"
95
+ };
96
+ }
97
+
98
+ // LeaseKeepAlive keeps the lease alive by streaming keep alive requests from the client
99
+ // to the server and streaming keep alive responses from the server to the client.
100
+ rpc LeaseKeepAlive(stream LeaseKeepAliveRequest) returns (stream LeaseKeepAliveResponse) {
101
+ option (google.api.http) = {
102
+ post: "/v3alpha/lease/keepalive"
103
+ body: "*"
104
+ };
105
+ }
106
+
107
+ // LeaseTimeToLive retrieves lease information.
108
+ rpc LeaseTimeToLive(LeaseTimeToLiveRequest) returns (LeaseTimeToLiveResponse) {
109
+ option (google.api.http) = {
110
+ post: "/v3alpha/kv/lease/timetolive"
111
+ body: "*"
112
+ };
113
+ }
114
+
115
+ // TODO(xiangli) List all existing Leases?
116
+ }
117
+
118
+ service Cluster {
119
+ // MemberAdd adds a member into the cluster.
120
+ rpc MemberAdd(MemberAddRequest) returns (MemberAddResponse) {
121
+ option (google.api.http) = {
122
+ post: "/v3alpha/cluster/member/add"
123
+ body: "*"
124
+ };
125
+ }
126
+
127
+ // MemberRemove removes an existing member from the cluster.
128
+ rpc MemberRemove(MemberRemoveRequest) returns (MemberRemoveResponse) {
129
+ option (google.api.http) = {
130
+ post: "/v3alpha/cluster/member/remove"
131
+ body: "*"
132
+ };
133
+ }
134
+
135
+ // MemberUpdate updates the member configuration.
136
+ rpc MemberUpdate(MemberUpdateRequest) returns (MemberUpdateResponse) {
137
+ option (google.api.http) = {
138
+ post: "/v3alpha/cluster/member/update"
139
+ body: "*"
140
+ };
141
+ }
142
+
143
+ // MemberList lists all the members in the cluster.
144
+ rpc MemberList(MemberListRequest) returns (MemberListResponse) {
145
+ option (google.api.http) = {
146
+ post: "/v3alpha/cluster/member/list"
147
+ body: "*"
148
+ };
149
+ }
150
+ }
151
+
152
+ service Maintenance {
153
+ // Alarm activates, deactivates, and queries alarms regarding cluster health.
154
+ rpc Alarm(AlarmRequest) returns (AlarmResponse) {
155
+ option (google.api.http) = {
156
+ post: "/v3alpha/maintenance/alarm"
157
+ body: "*"
158
+ };
159
+ }
160
+
161
+ // Status gets the status of the member.
162
+ rpc Status(StatusRequest) returns (StatusResponse) {
163
+ option (google.api.http) = {
164
+ post: "/v3alpha/maintenance/status"
165
+ body: "*"
166
+ };
167
+ }
168
+
169
+ // Defragment defragments a member's backend database to recover storage space.
170
+ rpc Defragment(DefragmentRequest) returns (DefragmentResponse) {
171
+ option (google.api.http) = {
172
+ post: "/v3alpha/maintenance/defragment"
173
+ body: "*"
174
+ };
175
+ }
176
+
177
+ // Hash returns the hash of the local KV state for consistency checking purpose.
178
+ // This is designed for testing; do not use this in production when there
179
+ // are ongoing transactions.
180
+ rpc Hash(HashRequest) returns (HashResponse) {
181
+ option (google.api.http) = {
182
+ post: "/v3alpha/maintenance/hash"
183
+ body: "*"
184
+ };
185
+ }
186
+
187
+ // Snapshot sends a snapshot of the entire backend from a member over a stream to a client.
188
+ rpc Snapshot(SnapshotRequest) returns (stream SnapshotResponse) {
189
+ option (google.api.http) = {
190
+ post: "/v3alpha/maintenance/snapshot"
191
+ body: "*"
192
+ };
193
+ }
194
+ }
195
+
196
+ service Auth {
197
+ // AuthEnable enables authentication.
198
+ rpc AuthEnable(AuthEnableRequest) returns (AuthEnableResponse) {
199
+ option (google.api.http) = {
200
+ post: "/v3alpha/auth/enable"
201
+ body: "*"
202
+ };
203
+ }
204
+
205
+ // AuthDisable disables authentication.
206
+ rpc AuthDisable(AuthDisableRequest) returns (AuthDisableResponse) {
207
+ option (google.api.http) = {
208
+ post: "/v3alpha/auth/disable"
209
+ body: "*"
210
+ };
211
+ }
212
+
213
+ // Authenticate processes an authenticate request.
214
+ rpc Authenticate(AuthenticateRequest) returns (AuthenticateResponse) {
215
+ option (google.api.http) = {
216
+ post: "/v3alpha/auth/authenticate"
217
+ body: "*"
218
+ };
219
+ }
220
+
221
+ // UserAdd adds a new user.
222
+ rpc UserAdd(AuthUserAddRequest) returns (AuthUserAddResponse) {
223
+ option (google.api.http) = {
224
+ post: "/v3alpha/auth/user/add"
225
+ body: "*"
226
+ };
227
+ }
228
+
229
+ // UserGet gets detailed user information.
230
+ rpc UserGet(AuthUserGetRequest) returns (AuthUserGetResponse) {
231
+ option (google.api.http) = {
232
+ post: "/v3alpha/auth/user/get"
233
+ body: "*"
234
+ };
235
+ }
236
+
237
+ // UserList gets a list of all users.
238
+ rpc UserList(AuthUserListRequest) returns (AuthUserListResponse) {
239
+ option (google.api.http) = {
240
+ post: "/v3alpha/auth/user/list"
241
+ body: "*"
242
+ };
243
+ }
244
+
245
+ // UserDelete deletes a specified user.
246
+ rpc UserDelete(AuthUserDeleteRequest) returns (AuthUserDeleteResponse) {
247
+ option (google.api.http) = {
248
+ post: "/v3alpha/auth/user/delete"
249
+ body: "*"
250
+ };
251
+ }
252
+
253
+ // UserChangePassword changes the password of a specified user.
254
+ rpc UserChangePassword(AuthUserChangePasswordRequest) returns (AuthUserChangePasswordResponse) {
255
+ option (google.api.http) = {
256
+ post: "/v3alpha/auth/user/changepw"
257
+ body: "*"
258
+ };
259
+ }
260
+
261
+ // UserGrant grants a role to a specified user.
262
+ rpc UserGrantRole(AuthUserGrantRoleRequest) returns (AuthUserGrantRoleResponse) {
263
+ option (google.api.http) = {
264
+ post: "/v3alpha/auth/user/grant"
265
+ body: "*"
266
+ };
267
+ }
268
+
269
+ // UserRevokeRole revokes a role of specified user.
270
+ rpc UserRevokeRole(AuthUserRevokeRoleRequest) returns (AuthUserRevokeRoleResponse) {
271
+ option (google.api.http) = {
272
+ post: "/v3alpha/auth/user/revoke"
273
+ body: "*"
274
+ };
275
+ }
276
+
277
+ // RoleAdd adds a new role.
278
+ rpc RoleAdd(AuthRoleAddRequest) returns (AuthRoleAddResponse) {
279
+ option (google.api.http) = {
280
+ post: "/v3alpha/auth/role/add"
281
+ body: "*"
282
+ };
283
+ }
284
+
285
+ // RoleGet gets detailed role information.
286
+ rpc RoleGet(AuthRoleGetRequest) returns (AuthRoleGetResponse) {
287
+ option (google.api.http) = {
288
+ post: "/v3alpha/auth/role/get"
289
+ body: "*"
290
+ };
291
+ }
292
+
293
+ // RoleList gets lists of all roles.
294
+ rpc RoleList(AuthRoleListRequest) returns (AuthRoleListResponse) {
295
+ option (google.api.http) = {
296
+ post: "/v3alpha/auth/role/list"
297
+ body: "*"
298
+ };
299
+ }
300
+
301
+ // RoleDelete deletes a specified role.
302
+ rpc RoleDelete(AuthRoleDeleteRequest) returns (AuthRoleDeleteResponse) {
303
+ option (google.api.http) = {
304
+ post: "/v3alpha/auth/role/delete"
305
+ body: "*"
306
+ };
307
+ }
308
+
309
+ // RoleGrantPermission grants a permission of a specified key or range to a specified role.
310
+ rpc RoleGrantPermission(AuthRoleGrantPermissionRequest) returns (AuthRoleGrantPermissionResponse) {
311
+ option (google.api.http) = {
312
+ post: "/v3alpha/auth/role/grant"
313
+ body: "*"
314
+ };
315
+ }
316
+
317
+ // RoleRevokePermission revokes a key or range permission of a specified role.
318
+ rpc RoleRevokePermission(AuthRoleRevokePermissionRequest) returns (AuthRoleRevokePermissionResponse) {
319
+ option (google.api.http) = {
320
+ post: "/v3alpha/auth/role/revoke"
321
+ body: "*"
322
+ };
323
+ }
324
+ }
325
+
326
+ message ResponseHeader {
327
+ // cluster_id is the ID of the cluster which sent the response.
328
+ uint64 cluster_id = 1;
329
+ // member_id is the ID of the member which sent the response.
330
+ uint64 member_id = 2;
331
+ // revision is the key-value store revision when the request was applied.
332
+ int64 revision = 3;
333
+ // raft_term is the raft term when the request was applied.
334
+ uint64 raft_term = 4;
335
+ }
336
+
337
+ message RangeRequest {
338
+ enum SortOrder {
339
+ NONE = 0; // default, no sorting
340
+ ASCEND = 1; // lowest target value first
341
+ DESCEND = 2; // highest target value first
342
+ }
343
+ enum SortTarget {
344
+ KEY = 0;
345
+ VERSION = 1;
346
+ CREATE = 2;
347
+ MOD = 3;
348
+ VALUE = 4;
349
+ }
350
+
351
+ // key is the first key for the range. If range_end is not given, the request only looks up key.
352
+ bytes key = 1;
353
+ // range_end is the upper bound on the requested range [key, range_end).
354
+ // If range_end is '\0', the range is all keys >= key.
355
+ // If the range_end is one bit larger than the given key,
356
+ // then the range requests get the all keys with the prefix (the given key).
357
+ // If both key and range_end are '\0', then range requests returns all keys.
358
+ bytes range_end = 2;
359
+ // limit is a limit on the number of keys returned for the request.
360
+ int64 limit = 3;
361
+ // revision is the point-in-time of the key-value store to use for the range.
362
+ // If revision is less or equal to zero, the range is over the newest key-value store.
363
+ // If the revision has been compacted, ErrCompacted is returned as a response.
364
+ int64 revision = 4;
365
+
366
+ // sort_order is the order for returned sorted results.
367
+ SortOrder sort_order = 5;
368
+
369
+ // sort_target is the key-value field to use for sorting.
370
+ SortTarget sort_target = 6;
371
+
372
+ // serializable sets the range request to use serializable member-local reads.
373
+ // Range requests are linearizable by default; linearizable requests have higher
374
+ // latency and lower throughput than serializable requests but reflect the current
375
+ // consensus of the cluster. For better performance, in exchange for possible stale reads,
376
+ // a serializable range request is served locally without needing to reach consensus
377
+ // with other nodes in the cluster.
378
+ bool serializable = 7;
379
+
380
+ // keys_only when set returns only the keys and not the values.
381
+ bool keys_only = 8;
382
+
383
+ // count_only when set returns only the count of the keys in the range.
384
+ bool count_only = 9;
385
+
386
+ // min_mod_revision is the lower bound for returned key mod revisions; all keys with
387
+ // lesser mod revisions will be filtered away.
388
+ int64 min_mod_revision = 10;
389
+
390
+ // max_mod_revision is the upper bound for returned key mod revisions; all keys with
391
+ // greater mod revisions will be filtered away.
392
+ int64 max_mod_revision = 11;
393
+
394
+ // min_create_revision is the lower bound for returned key create revisions; all keys with
395
+ // lesser create trevisions will be filtered away.
396
+ int64 min_create_revision = 12;
397
+
398
+ // max_create_revision is the upper bound for returned key create revisions; all keys with
399
+ // greater create revisions will be filtered away.
400
+ int64 max_create_revision = 13;
401
+ }
402
+
403
+ message RangeResponse {
404
+ ResponseHeader header = 1;
405
+ // kvs is the list of key-value pairs matched by the range request.
406
+ // kvs is empty when count is requested.
407
+ repeated mvccpb.KeyValue kvs = 2;
408
+ // more indicates if there are more keys to return in the requested range.
409
+ bool more = 3;
410
+ // count is set to the number of keys within the range when requested.
411
+ int64 count = 4;
412
+ }
413
+
414
+ message PutRequest {
415
+ // key is the key, in bytes, to put into the key-value store.
416
+ bytes key = 1;
417
+ // value is the value, in bytes, to associate with the key in the key-value store.
418
+ bytes value = 2;
419
+ // lease is the lease ID to associate with the key in the key-value store. A lease
420
+ // value of 0 indicates no lease.
421
+ int64 lease = 3;
422
+
423
+ // If prev_kv is set, etcd gets the previous key-value pair before changing it.
424
+ // The previous key-value pair will be returned in the put response.
425
+ bool prev_kv = 4;
426
+ }
427
+
428
+ message PutResponse {
429
+ ResponseHeader header = 1;
430
+ // if prev_kv is set in the request, the previous key-value pair will be returned.
431
+ mvccpb.KeyValue prev_kv = 2;
432
+ }
433
+
434
+ message DeleteRangeRequest {
435
+ // key is the first key to delete in the range.
436
+ bytes key = 1;
437
+ // range_end is the key following the last key to delete for the range [key, range_end).
438
+ // If range_end is not given, the range is defined to contain only the key argument.
439
+ // If range_end is one bit larger than the given key, then the range is all
440
+ // the all keys with the prefix (the given key).
441
+ // If range_end is '\0', the range is all keys greater than or equal to the key argument.
442
+ bytes range_end = 2;
443
+
444
+ // If prev_kv is set, etcd gets the previous key-value pairs before deleting it.
445
+ // The previous key-value pairs will be returned in the delte response.
446
+ bool prev_kv = 3;
447
+ }
448
+
449
+ message DeleteRangeResponse {
450
+ ResponseHeader header = 1;
451
+ // deleted is the number of keys deleted by the delete range request.
452
+ int64 deleted = 2;
453
+ // if prev_kv is set in the request, the previous key-value pairs will be returned.
454
+ repeated mvccpb.KeyValue prev_kvs = 3;
455
+ }
456
+
457
+ message RequestOp {
458
+ // request is a union of request types accepted by a transaction.
459
+ oneof request {
460
+ RangeRequest request_range = 1;
461
+ PutRequest request_put = 2;
462
+ DeleteRangeRequest request_delete_range = 3;
463
+ }
464
+ }
465
+
466
+ message ResponseOp {
467
+ // response is a union of response types returned by a transaction.
468
+ oneof response {
469
+ RangeResponse response_range = 1;
470
+ PutResponse response_put = 2;
471
+ DeleteRangeResponse response_delete_range = 3;
472
+ }
473
+ }
474
+
475
+ message Compare {
476
+ enum CompareResult {
477
+ EQUAL = 0;
478
+ GREATER = 1;
479
+ LESS = 2;
480
+ NOT_EQUAL = 3;
481
+ }
482
+ enum CompareTarget {
483
+ VERSION = 0;
484
+ CREATE = 1;
485
+ MOD = 2;
486
+ VALUE= 3;
487
+ }
488
+ // result is logical comparison operation for this comparison.
489
+ CompareResult result = 1;
490
+ // target is the key-value field to inspect for the comparison.
491
+ CompareTarget target = 2;
492
+ // key is the subject key for the comparison operation.
493
+ bytes key = 3;
494
+ oneof target_union {
495
+ // version is the version of the given key
496
+ int64 version = 4;
497
+ // create_revision is the creation revision of the given key
498
+ int64 create_revision = 5;
499
+ // mod_revision is the last modified revision of the given key.
500
+ int64 mod_revision = 6;
501
+ // value is the value of the given key, in bytes.
502
+ bytes value = 7;
503
+ }
504
+ }
505
+
506
+ // From google paxosdb paper:
507
+ // Our implementation hinges around a powerful primitive which we call MultiOp. All other database
508
+ // operations except for iteration are implemented as a single call to MultiOp. A MultiOp is applied atomically
509
+ // and consists of three components:
510
+ // 1. A list of tests called guard. Each test in guard checks a single entry in the database. It may check
511
+ // for the absence or presence of a value, or compare with a given value. Two different tests in the guard
512
+ // may apply to the same or different entries in the database. All tests in the guard are applied and
513
+ // MultiOp returns the results. If all tests are true, MultiOp executes t op (see item 2 below), otherwise
514
+ // it executes f op (see item 3 below).
515
+ // 2. A list of database operations called t op. Each operation in the list is either an insert, delete, or
516
+ // lookup operation, and applies to a single database entry. Two different operations in the list may apply
517
+ // to the same or different entries in the database. These operations are executed
518
+ // if guard evaluates to
519
+ // true.
520
+ // 3. A list of database operations called f op. Like t op, but executed if guard evaluates to false.
521
+ message TxnRequest {
522
+ // compare is a list of predicates representing a conjunction of terms.
523
+ // If the comparisons succeed, then the success requests will be processed in order,
524
+ // and the response will contain their respective responses in order.
525
+ // If the comparisons fail, then the failure requests will be processed in order,
526
+ // and the response will contain their respective responses in order.
527
+ repeated Compare compare = 1;
528
+ // success is a list of requests which will be applied when compare evaluates to true.
529
+ repeated RequestOp success = 2;
530
+ // failure is a list of requests which will be applied when compare evaluates to false.
531
+ repeated RequestOp failure = 3;
532
+ }
533
+
534
+ message TxnResponse {
535
+ ResponseHeader header = 1;
536
+ // succeeded is set to true if the compare evaluated to true or false otherwise.
537
+ bool succeeded = 2;
538
+ // responses is a list of responses corresponding to the results from applying
539
+ // success if succeeded is true or failure if succeeded is false.
540
+ repeated ResponseOp responses = 3;
541
+ }
542
+
543
+ // CompactionRequest compacts the key-value store up to a given revision. All superseded keys
544
+ // with a revision less than the compaction revision will be removed.
545
+ message CompactionRequest {
546
+ // revision is the key-value store revision for the compaction operation.
547
+ int64 revision = 1;
548
+ // physical is set so the RPC will wait until the compaction is physically
549
+ // applied to the local database such that compacted entries are totally
550
+ // removed from the backend database.
551
+ bool physical = 2;
552
+ }
553
+
554
+ message CompactionResponse {
555
+ ResponseHeader header = 1;
556
+ }
557
+
558
+ message HashRequest {
559
+ }
560
+
561
+ message HashResponse {
562
+ ResponseHeader header = 1;
563
+ // hash is the hash value computed from the responding member's key-value store.
564
+ uint32 hash = 2;
565
+ }
566
+
567
+ message SnapshotRequest {
568
+ }
569
+
570
+ message SnapshotResponse {
571
+ // header has the current key-value store information. The first header in the snapshot
572
+ // stream indicates the point in time of the snapshot.
573
+ ResponseHeader header = 1;
574
+
575
+ // remaining_bytes is the number of blob bytes to be sent after this message
576
+ uint64 remaining_bytes = 2;
577
+
578
+ // blob contains the next chunk of the snapshot in the snapshot stream.
579
+ bytes blob = 3;
580
+ }
581
+
582
+ message WatchRequest {
583
+ // request_union is a request to either create a new watcher or cancel an existing watcher.
584
+ oneof request_union {
585
+ WatchCreateRequest create_request = 1;
586
+ WatchCancelRequest cancel_request = 2;
587
+ }
588
+ }
589
+
590
+ message WatchCreateRequest {
591
+ // key is the key to register for watching.
592
+ bytes key = 1;
593
+ // range_end is the end of the range [key, range_end) to watch. If range_end is not given,
594
+ // only the key argument is watched. If range_end is equal to '\0', all keys greater than
595
+ // or equal to the key argument are watched.
596
+ // If the range_end is one bit larger than the given key,
597
+ // then all keys with the prefix (the given key) will be watched.
598
+ bytes range_end = 2;
599
+ // start_revision is an optional revision to watch from (inclusive). No start_revision is "now".
600
+ int64 start_revision = 3;
601
+ // progress_notify is set so that the etcd server will periodically send a WatchResponse with
602
+ // no events to the new watcher if there are no recent events. It is useful when clients
603
+ // wish to recover a disconnected watcher starting from a recent known revision.
604
+ // The etcd server may decide how often it will send notifications based on current load.
605
+ bool progress_notify = 4;
606
+
607
+ enum FilterType {
608
+ // filter out put event.
609
+ NOPUT = 0;
610
+ // filter out delete event.
611
+ NODELETE = 1;
612
+ }
613
+ // filters filter the events at server side before it sends back to the watcher.
614
+ repeated FilterType filters = 5;
615
+
616
+ // If prev_kv is set, created watcher gets the previous KV before the event happens.
617
+ // If the previous KV is already compacted, nothing will be returned.
618
+ bool prev_kv = 6;
619
+ }
620
+
621
+ message WatchCancelRequest {
622
+ // watch_id is the watcher id to cancel so that no more events are transmitted.
623
+ int64 watch_id = 1;
624
+ }
625
+
626
+ message WatchResponse {
627
+ ResponseHeader header = 1;
628
+ // watch_id is the ID of the watcher that corresponds to the response.
629
+ int64 watch_id = 2;
630
+ // created is set to true if the response is for a create watch request.
631
+ // The client should record the watch_id and expect to receive events for
632
+ // the created watcher from the same stream.
633
+ // All events sent to the created watcher will attach with the same watch_id.
634
+ bool created = 3;
635
+ // canceled is set to true if the response is for a cancel watch request.
636
+ // No further events will be sent to the canceled watcher.
637
+ bool canceled = 4;
638
+ // compact_revision is set to the minimum index if a watcher tries to watch
639
+ // at a compacted index.
640
+ //
641
+ // This happens when creating a watcher at a compacted revision or the watcher cannot
642
+ // catch up with the progress of the key-value store.
643
+ //
644
+ // The client should treat the watcher as canceled and should not try to create any
645
+ // watcher with the same start_revision again.
646
+ int64 compact_revision = 5;
647
+
648
+ repeated mvccpb.Event events = 11;
649
+ }
650
+
651
+ message LeaseGrantRequest {
652
+ // TTL is the advisory time-to-live in seconds.
653
+ int64 TTL = 1;
654
+ // ID is the requested ID for the lease. If ID is set to 0, the lessor chooses an ID.
655
+ int64 ID = 2;
656
+ }
657
+
658
+ message LeaseGrantResponse {
659
+ ResponseHeader header = 1;
660
+ // ID is the lease ID for the granted lease.
661
+ int64 ID = 2;
662
+ // TTL is the server chosen lease time-to-live in seconds.
663
+ int64 TTL = 3;
664
+ string error = 4;
665
+ }
666
+
667
+ message LeaseRevokeRequest {
668
+ // ID is the lease ID to revoke. When the ID is revoked, all associated keys will be deleted.
669
+ int64 ID = 1;
670
+ }
671
+
672
+ message LeaseRevokeResponse {
673
+ ResponseHeader header = 1;
674
+ }
675
+
676
+ message LeaseKeepAliveRequest {
677
+ // ID is the lease ID for the lease to keep alive.
678
+ int64 ID = 1;
679
+ }
680
+
681
+ message LeaseKeepAliveResponse {
682
+ ResponseHeader header = 1;
683
+ // ID is the lease ID from the keep alive request.
684
+ int64 ID = 2;
685
+ // TTL is the new time-to-live for the lease.
686
+ int64 TTL = 3;
687
+ }
688
+
689
+ message LeaseTimeToLiveRequest {
690
+ // ID is the lease ID for the lease.
691
+ int64 ID = 1;
692
+ // keys is true to query all the keys attached to this lease.
693
+ bool keys = 2;
694
+ }
695
+
696
+ message LeaseTimeToLiveResponse {
697
+ ResponseHeader header = 1;
698
+ // ID is the lease ID from the keep alive request.
699
+ int64 ID = 2;
700
+ // TTL is the remaining TTL in seconds for the lease; the lease will expire in under TTL+1 seconds.
701
+ int64 TTL = 3;
702
+ // GrantedTTL is the initial granted time in seconds upon lease creation/renewal.
703
+ int64 grantedTTL = 4;
704
+ // Keys is the list of keys attached to this lease.
705
+ repeated bytes keys = 5;
706
+ }
707
+
708
+ message Member {
709
+ // ID is the member ID for this member.
710
+ uint64 ID = 1;
711
+ // name is the human-readable name of the member. If the member is not started, the name will be an empty string.
712
+ string name = 2;
713
+ // peerURLs is the list of URLs the member exposes to the cluster for communication.
714
+ repeated string peerURLs = 3;
715
+ // clientURLs is the list of URLs the member exposes to clients for communication. If the member is not started, clientURLs will be empty.
716
+ repeated string clientURLs = 4;
717
+ }
718
+
719
+ message MemberAddRequest {
720
+ // peerURLs is the list of URLs the added member will use to communicate with the cluster.
721
+ repeated string peerURLs = 1;
722
+ }
723
+
724
+ message MemberAddResponse {
725
+ ResponseHeader header = 1;
726
+ // member is the member information for the added member.
727
+ Member member = 2;
728
+ }
729
+
730
+ message MemberRemoveRequest {
731
+ // ID is the member ID of the member to remove.
732
+ uint64 ID = 1;
733
+ }
734
+
735
+ message MemberRemoveResponse {
736
+ ResponseHeader header = 1;
737
+ }
738
+
739
+ message MemberUpdateRequest {
740
+ // ID is the member ID of the member to update.
741
+ uint64 ID = 1;
742
+ // peerURLs is the new list of URLs the member will use to communicate with the cluster.
743
+ repeated string peerURLs = 2;
744
+ }
745
+
746
+ message MemberUpdateResponse{
747
+ ResponseHeader header = 1;
748
+ }
749
+
750
+ message MemberListRequest {
751
+ }
752
+
753
+ message MemberListResponse {
754
+ ResponseHeader header = 1;
755
+ // members is a list of all members associated with the cluster.
756
+ repeated Member members = 2;
757
+ }
758
+
759
+ message DefragmentRequest {
760
+ }
761
+
762
+ message DefragmentResponse {
763
+ ResponseHeader header = 1;
764
+ }
765
+
766
+ enum AlarmType {
767
+ NONE = 0; // default, used to query if any alarm is active
768
+ NOSPACE = 1; // space quota is exhausted
769
+ }
770
+
771
+ message AlarmRequest {
772
+ enum AlarmAction {
773
+ GET = 0;
774
+ ACTIVATE = 1;
775
+ DEACTIVATE = 2;
776
+ }
777
+ // action is the kind of alarm request to issue. The action
778
+ // may GET alarm statuses, ACTIVATE an alarm, or DEACTIVATE a
779
+ // raised alarm.
780
+ AlarmAction action = 1;
781
+ // memberID is the ID of the member associated with the alarm. If memberID is 0, the
782
+ // alarm request covers all members.
783
+ uint64 memberID = 2;
784
+ // alarm is the type of alarm to consider for this request.
785
+ AlarmType alarm = 3;
786
+ }
787
+
788
+ message AlarmMember {
789
+ // memberID is the ID of the member associated with the raised alarm.
790
+ uint64 memberID = 1;
791
+ // alarm is the type of alarm which has been raised.
792
+ AlarmType alarm = 2;
793
+ }
794
+
795
+ message AlarmResponse {
796
+ ResponseHeader header = 1;
797
+ // alarms is a list of alarms associated with the alarm request.
798
+ repeated AlarmMember alarms = 2;
799
+ }
800
+
801
+ message StatusRequest {
802
+ }
803
+
804
+ message StatusResponse {
805
+ ResponseHeader header = 1;
806
+ // version is the cluster protocol version used by the responding member.
807
+ string version = 2;
808
+ // dbSize is the size of the backend database, in bytes, of the responding member.
809
+ int64 dbSize = 3;
810
+ // leader is the member ID which the responding member believes is the current leader.
811
+ uint64 leader = 4;
812
+ // raftIndex is the current raft index of the responding member.
813
+ uint64 raftIndex = 5;
814
+ // raftTerm is the current raft term of the responding member.
815
+ uint64 raftTerm = 6;
816
+ }
817
+
818
+ message AuthEnableRequest {
819
+ }
820
+
821
+ message AuthDisableRequest {
822
+ }
823
+
824
+ message AuthenticateRequest {
825
+ string name = 1;
826
+ string password = 2;
827
+ }
828
+
829
+ message AuthUserAddRequest {
830
+ string name = 1;
831
+ string password = 2;
832
+ }
833
+
834
+ message AuthUserGetRequest {
835
+ string name = 1;
836
+ }
837
+
838
+ message AuthUserDeleteRequest {
839
+ // name is the name of the user to delete.
840
+ string name = 1;
841
+ }
842
+
843
+ message AuthUserChangePasswordRequest {
844
+ // name is the name of the user whose password is being changed.
845
+ string name = 1;
846
+ // password is the new password for the user.
847
+ string password = 2;
848
+ }
849
+
850
+ message AuthUserGrantRoleRequest {
851
+ // user is the name of the user which should be granted a given role.
852
+ string user = 1;
853
+ // role is the name of the role to grant to the user.
854
+ string role = 2;
855
+ }
856
+
857
+ message AuthUserRevokeRoleRequest {
858
+ string name = 1;
859
+ string role = 2;
860
+ }
861
+
862
+ message AuthRoleAddRequest {
863
+ // name is the name of the role to add to the authentication system.
864
+ string name = 1;
865
+ }
866
+
867
+ message AuthRoleGetRequest {
868
+ string role = 1;
869
+ }
870
+
871
+ message AuthUserListRequest {
872
+ }
873
+
874
+ message AuthRoleListRequest {
875
+ }
876
+
877
+ message AuthRoleDeleteRequest {
878
+ string role = 1;
879
+ }
880
+
881
+ message AuthRoleGrantPermissionRequest {
882
+ // name is the name of the role which will be granted the permission.
883
+ string name = 1;
884
+ // perm is the permission to grant to the role.
885
+ authpb.Permission perm = 2;
886
+ }
887
+
888
+ message AuthRoleRevokePermissionRequest {
889
+ string role = 1;
890
+ string key = 2;
891
+ string range_end = 3;
892
+ }
893
+
894
+ message AuthEnableResponse {
895
+ ResponseHeader header = 1;
896
+ }
897
+
898
+ message AuthDisableResponse {
899
+ ResponseHeader header = 1;
900
+ }
901
+
902
+ message AuthenticateResponse {
903
+ ResponseHeader header = 1;
904
+ // token is an authorized token that can be used in succeeding RPCs
905
+ string token = 2;
906
+ }
907
+
908
+ message AuthUserAddResponse {
909
+ ResponseHeader header = 1;
910
+ }
911
+
912
+ message AuthUserGetResponse {
913
+ ResponseHeader header = 1;
914
+
915
+ repeated string roles = 2;
916
+ }
917
+
918
+ message AuthUserDeleteResponse {
919
+ ResponseHeader header = 1;
920
+ }
921
+
922
+ message AuthUserChangePasswordResponse {
923
+ ResponseHeader header = 1;
924
+ }
925
+
926
+ message AuthUserGrantRoleResponse {
927
+ ResponseHeader header = 1;
928
+ }
929
+
930
+ message AuthUserRevokeRoleResponse {
931
+ ResponseHeader header = 1;
932
+ }
933
+
934
+ message AuthRoleAddResponse {
935
+ ResponseHeader header = 1;
936
+ }
937
+
938
+ message AuthRoleGetResponse {
939
+ ResponseHeader header = 1;
940
+
941
+ repeated authpb.Permission perm = 2;
942
+ }
943
+
944
+ message AuthRoleListResponse {
945
+ ResponseHeader header = 1;
946
+
947
+ repeated string roles = 2;
948
+ }
949
+
950
+ message AuthUserListResponse {
951
+ ResponseHeader header = 1;
952
+
953
+ repeated string users = 2;
954
+ }
955
+
956
+ message AuthRoleDeleteResponse {
957
+ ResponseHeader header = 1;
958
+ }
959
+
960
+ message AuthRoleGrantPermissionResponse {
961
+ ResponseHeader header = 1;
962
+ }
963
+
964
+ message AuthRoleRevokePermissionResponse {
965
+ ResponseHeader header = 1;
966
+ }