rpc.proto 27 KB

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