rpc.proto 27 KB

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