rpc.proto 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846
  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 or lists all users.
  191. rpc UserGet(AuthUserGetRequest) returns (AuthUserGetResponse) {
  192. option (google.api.http) = {
  193. post: "/v3alpha/auth/user/get"
  194. body: "*"
  195. };
  196. }
  197. // UserDelete deletes a specified user.
  198. rpc UserDelete(AuthUserDeleteRequest) returns (AuthUserDeleteResponse) {
  199. option (google.api.http) = {
  200. post: "/v3alpha/auth/user/delete"
  201. body: "*"
  202. };
  203. }
  204. // UserChangePassword changes the password of a specified user.
  205. rpc UserChangePassword(AuthUserChangePasswordRequest) returns (AuthUserChangePasswordResponse) {
  206. option (google.api.http) = {
  207. post: "/v3alpha/auth/user/changepw"
  208. body: "*"
  209. };
  210. }
  211. // UserGrant grants a role to a specified user.
  212. rpc UserGrantRole(AuthUserGrantRoleRequest) returns (AuthUserGrantRoleResponse) {
  213. option (google.api.http) = {
  214. post: "/v3alpha/auth/user/grant"
  215. body: "*"
  216. };
  217. }
  218. // UserRevokeRole revokes a role of specified user.
  219. rpc UserRevokeRole(AuthUserRevokeRoleRequest) returns (AuthUserRevokeRoleResponse) {
  220. option (google.api.http) = {
  221. post: "/v3alpha/auth/user/revoke"
  222. body: "*"
  223. };
  224. }
  225. // RoleAdd adds a new role.
  226. rpc RoleAdd(AuthRoleAddRequest) returns (AuthRoleAddResponse) {
  227. option (google.api.http) = {
  228. post: "/v3alpha/auth/role/add"
  229. body: "*"
  230. };
  231. }
  232. // RoleGet gets detailed role information or lists all roles.
  233. rpc RoleGet(AuthRoleGetRequest) returns (AuthRoleGetResponse) {
  234. option (google.api.http) = {
  235. post: "/v3alpha/auth/role/get"
  236. body: "*"
  237. };
  238. }
  239. // RoleDelete deletes a specified role.
  240. rpc RoleDelete(AuthRoleDeleteRequest) returns (AuthRoleDeleteResponse) {
  241. option (google.api.http) = {
  242. post: "/v3alpha/auth/role/delete"
  243. body: "*"
  244. };
  245. }
  246. // RoleGrantPermission grants a permission of a specified key or range to a specified role.
  247. rpc RoleGrantPermission(AuthRoleGrantPermissionRequest) returns (AuthRoleGrantPermissionResponse) {
  248. option (google.api.http) = {
  249. post: "/v3alpha/auth/role/grant"
  250. body: "*"
  251. };
  252. }
  253. // RoleRevokePermission revokes a key or range permission of a specified role.
  254. rpc RoleRevokePermission(AuthRoleRevokePermissionRequest) returns (AuthRoleRevokePermissionResponse) {
  255. option (google.api.http) = {
  256. post: "/v3alpha/auth/role/revoke"
  257. body: "*"
  258. };
  259. }
  260. }
  261. message ResponseHeader {
  262. // cluster_id is the ID of the cluster which sent the response.
  263. uint64 cluster_id = 1;
  264. // member_id is the ID of the member which sent the response.
  265. uint64 member_id = 2;
  266. // revision is the key-value store revision when the request was applied.
  267. int64 revision = 3;
  268. // raft_term is the raft term when the request was applied.
  269. uint64 raft_term = 4;
  270. }
  271. message RangeRequest {
  272. enum SortOrder {
  273. NONE = 0; // default, no sorting
  274. ASCEND = 1; // lowest target value first
  275. DESCEND = 2; // highest target value first
  276. }
  277. enum SortTarget {
  278. KEY = 0;
  279. VERSION = 1;
  280. CREATE = 2;
  281. MOD = 3;
  282. VALUE = 4;
  283. }
  284. // key is the first key for the range. If range_end is not given, the request only looks up key.
  285. bytes key = 1;
  286. // range_end is the upper bound on the requested range [key, range_end).
  287. // If range_end is '\0', the range is all keys >= key.
  288. // If the range_end is one bit larger than the given key,
  289. // then the range requests get the all keys with the prefix (the given key).
  290. // If both key and range_end are '\0', then range requests returns all keys.
  291. bytes range_end = 2;
  292. // limit is a limit on the number of keys returned for the request.
  293. int64 limit = 3;
  294. // revision is the point-in-time of the key-value store to use for the range.
  295. // If revision is less or equal to zero, the range is over the newest key-value store.
  296. // If the revision has been compacted, ErrCompacted is returned as a response.
  297. int64 revision = 4;
  298. // sort_order is the order for returned sorted results.
  299. SortOrder sort_order = 5;
  300. // sort_target is the key-value field to use for sorting.
  301. SortTarget sort_target = 6;
  302. // serializable sets the range request to use serializable member-local reads.
  303. // Range requests are linearizable by default; linearizable requests have higher
  304. // latency and lower throughput than serializable requests but reflect the current
  305. // consensus of the cluster. For better performance, in exchange for possible stale reads,
  306. // a serializable range request is served locally without needing to reach consensus
  307. // with other nodes in the cluster.
  308. bool serializable = 7;
  309. }
  310. message RangeResponse {
  311. ResponseHeader header = 1;
  312. // kvs is the list of key-value pairs matched by the range request.
  313. repeated mvccpb.KeyValue kvs = 2;
  314. // more indicates if there are more keys to return in the requested range.
  315. bool more = 3;
  316. }
  317. message PutRequest {
  318. // key is the key, in bytes, to put into the key-value store.
  319. bytes key = 1;
  320. // value is the value, in bytes, to associate with the key in the key-value store.
  321. bytes value = 2;
  322. // lease is the lease ID to associate with the key in the key-value store. A lease
  323. // value of 0 indicates no lease.
  324. int64 lease = 3;
  325. }
  326. message PutResponse {
  327. ResponseHeader header = 1;
  328. }
  329. message DeleteRangeRequest {
  330. // key is the first key to delete in the range.
  331. bytes key = 1;
  332. // range_end is the key following the last key to delete for the range [key, range_end).
  333. // If range_end is not given, the range is defined to contain only the key argument.
  334. // If range_end is '\0', the range is all keys greater than or equal to the key argument.
  335. bytes range_end = 2;
  336. }
  337. message DeleteRangeResponse {
  338. ResponseHeader header = 1;
  339. // deleted is the number of keys deleted by the delete range request.
  340. int64 deleted = 2;
  341. }
  342. message RequestOp {
  343. // request is a union of request types accepted by a transaction.
  344. oneof request {
  345. RangeRequest request_range = 1;
  346. PutRequest request_put = 2;
  347. DeleteRangeRequest request_delete_range = 3;
  348. }
  349. }
  350. message ResponseOp {
  351. // response is a union of response types returned by a transaction.
  352. oneof response {
  353. RangeResponse response_range = 1;
  354. PutResponse response_put = 2;
  355. DeleteRangeResponse response_delete_range = 3;
  356. }
  357. }
  358. message Compare {
  359. enum CompareResult {
  360. EQUAL = 0;
  361. GREATER = 1;
  362. LESS = 2;
  363. }
  364. enum CompareTarget {
  365. VERSION = 0;
  366. CREATE = 1;
  367. MOD = 2;
  368. VALUE= 3;
  369. }
  370. // result is logical comparison operation for this comparison.
  371. CompareResult result = 1;
  372. // target is the key-value field to inspect for the comparison.
  373. CompareTarget target = 2;
  374. // key is the subject key for the comparison operation.
  375. bytes key = 3;
  376. oneof target_union {
  377. // version is the version of the given key
  378. int64 version = 4;
  379. // create_revision is the creation revision of the given key
  380. int64 create_revision = 5;
  381. // mod_revision is the last modified revision of the given key.
  382. int64 mod_revision = 6;
  383. // value is the value of the given key, in bytes.
  384. bytes value = 7;
  385. }
  386. }
  387. // From google paxosdb paper:
  388. // Our implementation hinges around a powerful primitive which we call MultiOp. All other database
  389. // operations except for iteration are implemented as a single call to MultiOp. A MultiOp is applied atomically
  390. // and consists of three components:
  391. // 1. A list of tests called guard. Each test in guard checks a single entry in the database. It may check
  392. // for the absence or presence of a value, or compare with a given value. Two different tests in the guard
  393. // may apply to the same or different entries in the database. All tests in the guard are applied and
  394. // MultiOp returns the results. If all tests are true, MultiOp executes t op (see item 2 below), otherwise
  395. // it executes f op (see item 3 below).
  396. // 2. A list of database operations called t op. Each operation in the list is either an insert, delete, or
  397. // lookup operation, and applies to a single database entry. Two different operations in the list may apply
  398. // to the same or different entries in the database. These operations are executed
  399. // if guard evaluates to
  400. // true.
  401. // 3. A list of database operations called f op. Like t op, but executed if guard evaluates to false.
  402. message TxnRequest {
  403. // compare is a list of predicates representing a conjunction of terms.
  404. // If the comparisons succeed, then the success requests will be processed in order,
  405. // and the response will contain their respective responses in order.
  406. // If the comparisons fail, then the failure requests will be processed in order,
  407. // and the response will contain their respective responses in order.
  408. repeated Compare compare = 1;
  409. // success is a list of requests which will be applied when compare evaluates to true.
  410. repeated RequestOp success = 2;
  411. // failure is a list of requests which will be applied when compare evaluates to false.
  412. repeated RequestOp failure = 3;
  413. }
  414. message TxnResponse {
  415. ResponseHeader header = 1;
  416. // succeeded is set to true if the compare evaluated to true or false otherwise.
  417. bool succeeded = 2;
  418. // responses is a list of responses corresponding to the results from applying
  419. // success if succeeded is true or failure if succeeded is false.
  420. repeated ResponseOp responses = 3;
  421. }
  422. // CompactionRequest compacts the key-value store up to a given revision. All superseded keys
  423. // with a revision less than the compaction revision will be removed.
  424. message CompactionRequest {
  425. // revision is the key-value store revision for the compaction operation.
  426. int64 revision = 1;
  427. // physical is set so the RPC will wait until the compaction is physically
  428. // applied to the local database such that compacted entries are totally
  429. // removed from the backend database.
  430. bool physical = 2;
  431. }
  432. message CompactionResponse {
  433. ResponseHeader header = 1;
  434. }
  435. message HashRequest {
  436. }
  437. message HashResponse {
  438. ResponseHeader header = 1;
  439. // hash is the hash value computed from the responding member's key-value store.
  440. uint32 hash = 2;
  441. }
  442. message SnapshotRequest {
  443. }
  444. message SnapshotResponse {
  445. // header has the current key-value store information. The first header in the snapshot
  446. // stream indicates the point in time of the snapshot.
  447. ResponseHeader header = 1;
  448. // remaining_bytes is the number of blob bytes to be sent after this message
  449. uint64 remaining_bytes = 2;
  450. // blob contains the next chunk of the snapshot in the snapshot stream.
  451. bytes blob = 3;
  452. }
  453. message WatchRequest {
  454. // request_union is a request to either create a new watcher or cancel an existing watcher.
  455. oneof request_union {
  456. WatchCreateRequest create_request = 1;
  457. WatchCancelRequest cancel_request = 2;
  458. }
  459. }
  460. message WatchCreateRequest {
  461. // key is the key to register for watching.
  462. bytes key = 1;
  463. // range_end is the end of the range [key, range_end) to watch. If range_end is not given,
  464. // only the key argument is watched. If range_end is equal to '\0', all keys greater than
  465. // or equal to the key argument are watched.
  466. bytes range_end = 2;
  467. // start_revision is an optional revision to watch from (inclusive). No start_revision is "now".
  468. int64 start_revision = 3;
  469. // progress_notify is set so that the etcd server will periodically send a WatchResponse with
  470. // no events to the new watcher if there are no recent events. It is useful when clients
  471. // wish to recover a disconnected watcher starting from a recent known revision.
  472. // The etcd server may decide how often it will send notifications based on current load.
  473. bool progress_notify = 4;
  474. }
  475. message WatchCancelRequest {
  476. // watch_id is the watcher id to cancel so that no more events are transmitted.
  477. int64 watch_id = 1;
  478. }
  479. message WatchResponse {
  480. ResponseHeader header = 1;
  481. // watch_id is the ID of the watcher that corresponds to the response.
  482. int64 watch_id = 2;
  483. // created is set to true if the response is for a create watch request.
  484. // The client should record the watch_id and expect to receive events for
  485. // the created watcher from the same stream.
  486. // All events sent to the created watcher will attach with the same watch_id.
  487. bool created = 3;
  488. // canceled is set to true if the response is for a cancel watch request.
  489. // No further events will be sent to the canceled watcher.
  490. bool canceled = 4;
  491. // compact_revision is set to the minimum index if a watcher tries to watch
  492. // at a compacted index.
  493. //
  494. // This happens when creating a watcher at a compacted revision or the watcher cannot
  495. // catch up with the progress of the key-value store.
  496. //
  497. // The client should treat the watcher as canceled and should not try to create any
  498. // watcher with the same start_revision again.
  499. int64 compact_revision = 5;
  500. repeated mvccpb.Event events = 11;
  501. }
  502. message LeaseGrantRequest {
  503. // TTL is the advisory time-to-live in seconds.
  504. int64 TTL = 1;
  505. // ID is the requested ID for the lease. If ID is set to 0, the lessor chooses an ID.
  506. int64 ID = 2;
  507. }
  508. message LeaseGrantResponse {
  509. ResponseHeader header = 1;
  510. // ID is the lease ID for the granted lease.
  511. int64 ID = 2;
  512. // TTL is the server chosen lease time-to-live in seconds.
  513. int64 TTL = 3;
  514. string error = 4;
  515. }
  516. message LeaseRevokeRequest {
  517. // ID is the lease ID to revoke. When the ID is revoked, all associated keys will be deleted.
  518. int64 ID = 1;
  519. }
  520. message LeaseRevokeResponse {
  521. ResponseHeader header = 1;
  522. }
  523. message LeaseKeepAliveRequest {
  524. // ID is the lease ID for the lease to keep alive.
  525. int64 ID = 1;
  526. }
  527. message LeaseKeepAliveResponse {
  528. ResponseHeader header = 1;
  529. // ID is the lease ID from the keep alive request.
  530. int64 ID = 2;
  531. // TTL is the new time-to-live for the lease.
  532. int64 TTL = 3;
  533. }
  534. message Member {
  535. // ID is the member ID for this member.
  536. uint64 ID = 1;
  537. // name is the human-readable name of the member. If the member is not started, the name will be an empty string.
  538. string name = 2;
  539. // peerURLs is the list of URLs the member exposes to the cluster for communication.
  540. repeated string peerURLs = 3;
  541. // clientURLs is the list of URLs the member exposes to clients for communication. If the member is not started, clientURLs will be empty.
  542. repeated string clientURLs = 4;
  543. }
  544. message MemberAddRequest {
  545. // peerURLs is the list of URLs the added member will use to communicate with the cluster.
  546. repeated string peerURLs = 1;
  547. }
  548. message MemberAddResponse {
  549. ResponseHeader header = 1;
  550. // member is the member information for the added member.
  551. Member member = 2;
  552. }
  553. message MemberRemoveRequest {
  554. // ID is the member ID of the member to remove.
  555. uint64 ID = 1;
  556. }
  557. message MemberRemoveResponse {
  558. ResponseHeader header = 1;
  559. }
  560. message MemberUpdateRequest {
  561. // ID is the member ID of the member to update.
  562. uint64 ID = 1;
  563. // peerURLs is the new list of URLs the member will use to communicate with the cluster.
  564. repeated string peerURLs = 2;
  565. }
  566. message MemberUpdateResponse{
  567. ResponseHeader header = 1;
  568. }
  569. message MemberListRequest {
  570. }
  571. message MemberListResponse {
  572. ResponseHeader header = 1;
  573. // members is a list of all members associated with the cluster.
  574. repeated Member members = 2;
  575. }
  576. message DefragmentRequest {
  577. }
  578. message DefragmentResponse {
  579. ResponseHeader header = 1;
  580. }
  581. enum AlarmType {
  582. NONE = 0; // default, used to query if any alarm is active
  583. NOSPACE = 1; // space quota is exhausted
  584. }
  585. message AlarmRequest {
  586. enum AlarmAction {
  587. GET = 0;
  588. ACTIVATE = 1;
  589. DEACTIVATE = 2;
  590. }
  591. // action is the kind of alarm request to issue. The action
  592. // may GET alarm statuses, ACTIVATE an alarm, or DEACTIVATE a
  593. // raised alarm.
  594. AlarmAction action = 1;
  595. // memberID is the ID of the member associated with the alarm. If memberID is 0, the
  596. // alarm request covers all members.
  597. uint64 memberID = 2;
  598. // alarm is the type of alarm to consider for this request.
  599. AlarmType alarm = 3;
  600. }
  601. message AlarmMember {
  602. // memberID is the ID of the member associated with the raised alarm.
  603. uint64 memberID = 1;
  604. // alarm is the type of alarm which has been raised.
  605. AlarmType alarm = 2;
  606. }
  607. message AlarmResponse {
  608. ResponseHeader header = 1;
  609. // alarms is a list of alarms associated with the alarm request.
  610. repeated AlarmMember alarms = 2;
  611. }
  612. message StatusRequest {
  613. }
  614. message StatusResponse {
  615. ResponseHeader header = 1;
  616. // version is the cluster protocol version used by the responding member.
  617. string version = 2;
  618. // dbSize is the size of the backend database, in bytes, of the responding member.
  619. int64 dbSize = 3;
  620. // leader is the member ID which the responding member believes is the current leader.
  621. uint64 leader = 4;
  622. // raftIndex is the current raft index of the responding member.
  623. uint64 raftIndex = 5;
  624. // raftTerm is the current raft term of the responding member.
  625. uint64 raftTerm = 6;
  626. }
  627. message AuthEnableRequest {
  628. }
  629. message AuthDisableRequest {
  630. }
  631. message AuthenticateRequest {
  632. string name = 1;
  633. string password = 2;
  634. }
  635. message AuthUserAddRequest {
  636. string name = 1;
  637. string password = 2;
  638. }
  639. message AuthUserGetRequest {
  640. string name = 1;
  641. }
  642. message AuthUserDeleteRequest {
  643. // name is the name of the user to delete.
  644. string name = 1;
  645. }
  646. message AuthUserChangePasswordRequest {
  647. // name is the name of the user whose password is being changed.
  648. string name = 1;
  649. // password is the new password for the user.
  650. string password = 2;
  651. }
  652. message AuthUserGrantRoleRequest {
  653. // user is the name of the user which should be granted a given role.
  654. string user = 1;
  655. // role is the name of the role to grant to the user.
  656. string role = 2;
  657. }
  658. message AuthUserRevokeRoleRequest {
  659. string name = 1;
  660. string role = 2;
  661. }
  662. message AuthRoleAddRequest {
  663. // name is the name of the role to add to the authentication system.
  664. string name = 1;
  665. }
  666. message AuthRoleGetRequest {
  667. string role = 1;
  668. }
  669. message AuthRoleDeleteRequest {
  670. string role = 1;
  671. }
  672. message AuthRoleGrantPermissionRequest {
  673. // name is the name of the role which will be granted the permission.
  674. string name = 1;
  675. // perm is the permission to grant to the role.
  676. authpb.Permission perm = 2;
  677. }
  678. message AuthRoleRevokePermissionRequest {
  679. string role = 1;
  680. string key = 2;
  681. string range_end = 3;
  682. }
  683. message AuthEnableResponse {
  684. ResponseHeader header = 1;
  685. }
  686. message AuthDisableResponse {
  687. ResponseHeader header = 1;
  688. }
  689. message AuthenticateResponse {
  690. ResponseHeader header = 1;
  691. // token is an authorized token that can be used in succeeding RPCs
  692. string token = 2;
  693. }
  694. message AuthUserAddResponse {
  695. ResponseHeader header = 1;
  696. }
  697. message AuthUserGetResponse {
  698. ResponseHeader header = 1;
  699. repeated string roles = 2;
  700. }
  701. message AuthUserDeleteResponse {
  702. ResponseHeader header = 1;
  703. }
  704. message AuthUserChangePasswordResponse {
  705. ResponseHeader header = 1;
  706. }
  707. message AuthUserGrantRoleResponse {
  708. ResponseHeader header = 1;
  709. }
  710. message AuthUserRevokeRoleResponse {
  711. ResponseHeader header = 1;
  712. }
  713. message AuthRoleAddResponse {
  714. ResponseHeader header = 1;
  715. }
  716. message AuthRoleGetResponse {
  717. ResponseHeader header = 1;
  718. repeated authpb.Permission perm = 2;
  719. }
  720. message AuthRoleDeleteResponse {
  721. ResponseHeader header = 1;
  722. }
  723. message AuthRoleGrantPermissionResponse {
  724. ResponseHeader header = 1;
  725. }
  726. message AuthRoleRevokePermissionResponse {
  727. ResponseHeader header = 1;
  728. }