rpc.proto 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883
  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. }
  326. message RangeResponse {
  327. ResponseHeader header = 1;
  328. // kvs is the list of key-value pairs matched by the range request.
  329. repeated mvccpb.KeyValue kvs = 2;
  330. // more indicates if there are more keys to return in the requested range.
  331. bool more = 3;
  332. }
  333. message PutRequest {
  334. // key is the key, in bytes, to put into the key-value store.
  335. bytes key = 1;
  336. // value is the value, in bytes, to associate with the key in the key-value store.
  337. bytes value = 2;
  338. // lease is the lease ID to associate with the key in the key-value store. A lease
  339. // value of 0 indicates no lease.
  340. int64 lease = 3;
  341. }
  342. message PutResponse {
  343. ResponseHeader header = 1;
  344. }
  345. message DeleteRangeRequest {
  346. // key is the first key to delete in the range.
  347. bytes key = 1;
  348. // range_end is the key following the last key to delete for the range [key, range_end).
  349. // If range_end is not given, the range is defined to contain only the key argument.
  350. // If range_end is '\0', the range is all keys greater than or equal to the key argument.
  351. bytes range_end = 2;
  352. }
  353. message DeleteRangeResponse {
  354. ResponseHeader header = 1;
  355. // deleted is the number of keys deleted by the delete range request.
  356. int64 deleted = 2;
  357. }
  358. message RequestOp {
  359. // request is a union of request types accepted by a transaction.
  360. oneof request {
  361. RangeRequest request_range = 1;
  362. PutRequest request_put = 2;
  363. DeleteRangeRequest request_delete_range = 3;
  364. }
  365. }
  366. message ResponseOp {
  367. // response is a union of response types returned by a transaction.
  368. oneof response {
  369. RangeResponse response_range = 1;
  370. PutResponse response_put = 2;
  371. DeleteRangeResponse response_delete_range = 3;
  372. }
  373. }
  374. message Compare {
  375. enum CompareResult {
  376. EQUAL = 0;
  377. GREATER = 1;
  378. LESS = 2;
  379. }
  380. enum CompareTarget {
  381. VERSION = 0;
  382. CREATE = 1;
  383. MOD = 2;
  384. VALUE= 3;
  385. }
  386. // result is logical comparison operation for this comparison.
  387. CompareResult result = 1;
  388. // target is the key-value field to inspect for the comparison.
  389. CompareTarget target = 2;
  390. // key is the subject key for the comparison operation.
  391. bytes key = 3;
  392. oneof target_union {
  393. // version is the version of the given key
  394. int64 version = 4;
  395. // create_revision is the creation revision of the given key
  396. int64 create_revision = 5;
  397. // mod_revision is the last modified revision of the given key.
  398. int64 mod_revision = 6;
  399. // value is the value of the given key, in bytes.
  400. bytes value = 7;
  401. }
  402. }
  403. // From google paxosdb paper:
  404. // Our implementation hinges around a powerful primitive which we call MultiOp. All other database
  405. // operations except for iteration are implemented as a single call to MultiOp. A MultiOp is applied atomically
  406. // and consists of three components:
  407. // 1. A list of tests called guard. Each test in guard checks a single entry in the database. It may check
  408. // for the absence or presence of a value, or compare with a given value. Two different tests in the guard
  409. // may apply to the same or different entries in the database. All tests in the guard are applied and
  410. // MultiOp returns the results. If all tests are true, MultiOp executes t op (see item 2 below), otherwise
  411. // it executes f op (see item 3 below).
  412. // 2. A list of database operations called t op. Each operation in the list is either an insert, delete, or
  413. // lookup operation, and applies to a single database entry. Two different operations in the list may apply
  414. // to the same or different entries in the database. These operations are executed
  415. // if guard evaluates to
  416. // true.
  417. // 3. A list of database operations called f op. Like t op, but executed if guard evaluates to false.
  418. message TxnRequest {
  419. // compare is a list of predicates representing a conjunction of terms.
  420. // If the comparisons succeed, then the success requests will be processed in order,
  421. // and the response will contain their respective responses in order.
  422. // If the comparisons fail, then the failure requests will be processed in order,
  423. // and the response will contain their respective responses in order.
  424. repeated Compare compare = 1;
  425. // success is a list of requests which will be applied when compare evaluates to true.
  426. repeated RequestOp success = 2;
  427. // failure is a list of requests which will be applied when compare evaluates to false.
  428. repeated RequestOp failure = 3;
  429. }
  430. message TxnResponse {
  431. ResponseHeader header = 1;
  432. // succeeded is set to true if the compare evaluated to true or false otherwise.
  433. bool succeeded = 2;
  434. // responses is a list of responses corresponding to the results from applying
  435. // success if succeeded is true or failure if succeeded is false.
  436. repeated ResponseOp responses = 3;
  437. }
  438. // CompactionRequest compacts the key-value store up to a given revision. All superseded keys
  439. // with a revision less than the compaction revision will be removed.
  440. message CompactionRequest {
  441. // revision is the key-value store revision for the compaction operation.
  442. int64 revision = 1;
  443. // physical is set so the RPC will wait until the compaction is physically
  444. // applied to the local database such that compacted entries are totally
  445. // removed from the backend database.
  446. bool physical = 2;
  447. }
  448. message CompactionResponse {
  449. ResponseHeader header = 1;
  450. }
  451. message HashRequest {
  452. }
  453. message HashResponse {
  454. ResponseHeader header = 1;
  455. // hash is the hash value computed from the responding member's key-value store.
  456. uint32 hash = 2;
  457. }
  458. message SnapshotRequest {
  459. }
  460. message SnapshotResponse {
  461. // header has the current key-value store information. The first header in the snapshot
  462. // stream indicates the point in time of the snapshot.
  463. ResponseHeader header = 1;
  464. // remaining_bytes is the number of blob bytes to be sent after this message
  465. uint64 remaining_bytes = 2;
  466. // blob contains the next chunk of the snapshot in the snapshot stream.
  467. bytes blob = 3;
  468. }
  469. message WatchRequest {
  470. // request_union is a request to either create a new watcher or cancel an existing watcher.
  471. oneof request_union {
  472. WatchCreateRequest create_request = 1;
  473. WatchCancelRequest cancel_request = 2;
  474. }
  475. }
  476. message WatchCreateRequest {
  477. // key is the key to register for watching.
  478. bytes key = 1;
  479. // range_end is the end of the range [key, range_end) to watch. If range_end is not given,
  480. // only the key argument is watched. If range_end is equal to '\0', all keys greater than
  481. // or equal to the key argument are watched.
  482. bytes range_end = 2;
  483. // start_revision is an optional revision to watch from (inclusive). No start_revision is "now".
  484. int64 start_revision = 3;
  485. // progress_notify is set so that the etcd server will periodically send a WatchResponse with
  486. // no events to the new watcher if there are no recent events. It is useful when clients
  487. // wish to recover a disconnected watcher starting from a recent known revision.
  488. // The etcd server may decide how often it will send notifications based on current load.
  489. bool progress_notify = 4;
  490. }
  491. message WatchCancelRequest {
  492. // watch_id is the watcher id to cancel so that no more events are transmitted.
  493. int64 watch_id = 1;
  494. }
  495. message WatchResponse {
  496. ResponseHeader header = 1;
  497. // watch_id is the ID of the watcher that corresponds to the response.
  498. int64 watch_id = 2;
  499. // created is set to true if the response is for a create watch request.
  500. // The client should record the watch_id and expect to receive events for
  501. // the created watcher from the same stream.
  502. // All events sent to the created watcher will attach with the same watch_id.
  503. bool created = 3;
  504. // canceled is set to true if the response is for a cancel watch request.
  505. // No further events will be sent to the canceled watcher.
  506. bool canceled = 4;
  507. // compact_revision is set to the minimum index if a watcher tries to watch
  508. // at a compacted index.
  509. //
  510. // This happens when creating a watcher at a compacted revision or the watcher cannot
  511. // catch up with the progress of the key-value store.
  512. //
  513. // The client should treat the watcher as canceled and should not try to create any
  514. // watcher with the same start_revision again.
  515. int64 compact_revision = 5;
  516. repeated mvccpb.Event events = 11;
  517. }
  518. message LeaseGrantRequest {
  519. // TTL is the advisory time-to-live in seconds.
  520. int64 TTL = 1;
  521. // ID is the requested ID for the lease. If ID is set to 0, the lessor chooses an ID.
  522. int64 ID = 2;
  523. }
  524. message LeaseGrantResponse {
  525. ResponseHeader header = 1;
  526. // ID is the lease ID for the granted lease.
  527. int64 ID = 2;
  528. // TTL is the server chosen lease time-to-live in seconds.
  529. int64 TTL = 3;
  530. string error = 4;
  531. }
  532. message LeaseRevokeRequest {
  533. // ID is the lease ID to revoke. When the ID is revoked, all associated keys will be deleted.
  534. int64 ID = 1;
  535. }
  536. message LeaseRevokeResponse {
  537. ResponseHeader header = 1;
  538. }
  539. message LeaseKeepAliveRequest {
  540. // ID is the lease ID for the lease to keep alive.
  541. int64 ID = 1;
  542. }
  543. message LeaseKeepAliveResponse {
  544. ResponseHeader header = 1;
  545. // ID is the lease ID from the keep alive request.
  546. int64 ID = 2;
  547. // TTL is the new time-to-live for the lease.
  548. int64 TTL = 3;
  549. }
  550. message Member {
  551. // ID is the member ID for this member.
  552. uint64 ID = 1;
  553. // name is the human-readable name of the member. If the member is not started, the name will be an empty string.
  554. string name = 2;
  555. // peerURLs is the list of URLs the member exposes to the cluster for communication.
  556. repeated string peerURLs = 3;
  557. // clientURLs is the list of URLs the member exposes to clients for communication. If the member is not started, clientURLs will be empty.
  558. repeated string clientURLs = 4;
  559. }
  560. message MemberAddRequest {
  561. // peerURLs is the list of URLs the added member will use to communicate with the cluster.
  562. repeated string peerURLs = 1;
  563. }
  564. message MemberAddResponse {
  565. ResponseHeader header = 1;
  566. // member is the member information for the added member.
  567. Member member = 2;
  568. }
  569. message MemberRemoveRequest {
  570. // ID is the member ID of the member to remove.
  571. uint64 ID = 1;
  572. }
  573. message MemberRemoveResponse {
  574. ResponseHeader header = 1;
  575. }
  576. message MemberUpdateRequest {
  577. // ID is the member ID of the member to update.
  578. uint64 ID = 1;
  579. // peerURLs is the new list of URLs the member will use to communicate with the cluster.
  580. repeated string peerURLs = 2;
  581. }
  582. message MemberUpdateResponse{
  583. ResponseHeader header = 1;
  584. }
  585. message MemberListRequest {
  586. }
  587. message MemberListResponse {
  588. ResponseHeader header = 1;
  589. // members is a list of all members associated with the cluster.
  590. repeated Member members = 2;
  591. }
  592. message DefragmentRequest {
  593. }
  594. message DefragmentResponse {
  595. ResponseHeader header = 1;
  596. }
  597. enum AlarmType {
  598. NONE = 0; // default, used to query if any alarm is active
  599. NOSPACE = 1; // space quota is exhausted
  600. }
  601. message AlarmRequest {
  602. enum AlarmAction {
  603. GET = 0;
  604. ACTIVATE = 1;
  605. DEACTIVATE = 2;
  606. }
  607. // action is the kind of alarm request to issue. The action
  608. // may GET alarm statuses, ACTIVATE an alarm, or DEACTIVATE a
  609. // raised alarm.
  610. AlarmAction action = 1;
  611. // memberID is the ID of the member associated with the alarm. If memberID is 0, the
  612. // alarm request covers all members.
  613. uint64 memberID = 2;
  614. // alarm is the type of alarm to consider for this request.
  615. AlarmType alarm = 3;
  616. }
  617. message AlarmMember {
  618. // memberID is the ID of the member associated with the raised alarm.
  619. uint64 memberID = 1;
  620. // alarm is the type of alarm which has been raised.
  621. AlarmType alarm = 2;
  622. }
  623. message AlarmResponse {
  624. ResponseHeader header = 1;
  625. // alarms is a list of alarms associated with the alarm request.
  626. repeated AlarmMember alarms = 2;
  627. }
  628. message StatusRequest {
  629. }
  630. message StatusResponse {
  631. ResponseHeader header = 1;
  632. // version is the cluster protocol version used by the responding member.
  633. string version = 2;
  634. // dbSize is the size of the backend database, in bytes, of the responding member.
  635. int64 dbSize = 3;
  636. // leader is the member ID which the responding member believes is the current leader.
  637. uint64 leader = 4;
  638. // raftIndex is the current raft index of the responding member.
  639. uint64 raftIndex = 5;
  640. // raftTerm is the current raft term of the responding member.
  641. uint64 raftTerm = 6;
  642. }
  643. message AuthEnableRequest {
  644. }
  645. message AuthDisableRequest {
  646. }
  647. message AuthenticateRequest {
  648. string name = 1;
  649. string password = 2;
  650. }
  651. message AuthUserAddRequest {
  652. string name = 1;
  653. string password = 2;
  654. }
  655. message AuthUserGetRequest {
  656. string name = 1;
  657. }
  658. message AuthUserDeleteRequest {
  659. // name is the name of the user to delete.
  660. string name = 1;
  661. }
  662. message AuthUserChangePasswordRequest {
  663. // name is the name of the user whose password is being changed.
  664. string name = 1;
  665. // password is the new password for the user.
  666. string password = 2;
  667. }
  668. message AuthUserGrantRoleRequest {
  669. // user is the name of the user which should be granted a given role.
  670. string user = 1;
  671. // role is the name of the role to grant to the user.
  672. string role = 2;
  673. }
  674. message AuthUserRevokeRoleRequest {
  675. string name = 1;
  676. string role = 2;
  677. }
  678. message AuthRoleAddRequest {
  679. // name is the name of the role to add to the authentication system.
  680. string name = 1;
  681. }
  682. message AuthRoleGetRequest {
  683. string role = 1;
  684. }
  685. message AuthUserListRequest {
  686. }
  687. message AuthRoleListRequest {
  688. }
  689. message AuthRoleDeleteRequest {
  690. string role = 1;
  691. }
  692. message AuthRoleGrantPermissionRequest {
  693. // name is the name of the role which will be granted the permission.
  694. string name = 1;
  695. // perm is the permission to grant to the role.
  696. authpb.Permission perm = 2;
  697. }
  698. message AuthRoleRevokePermissionRequest {
  699. string role = 1;
  700. string key = 2;
  701. string range_end = 3;
  702. }
  703. message AuthEnableResponse {
  704. ResponseHeader header = 1;
  705. }
  706. message AuthDisableResponse {
  707. ResponseHeader header = 1;
  708. }
  709. message AuthenticateResponse {
  710. ResponseHeader header = 1;
  711. // token is an authorized token that can be used in succeeding RPCs
  712. string token = 2;
  713. }
  714. message AuthUserAddResponse {
  715. ResponseHeader header = 1;
  716. }
  717. message AuthUserGetResponse {
  718. ResponseHeader header = 1;
  719. repeated string roles = 2;
  720. }
  721. message AuthUserDeleteResponse {
  722. ResponseHeader header = 1;
  723. }
  724. message AuthUserChangePasswordResponse {
  725. ResponseHeader header = 1;
  726. }
  727. message AuthUserGrantRoleResponse {
  728. ResponseHeader header = 1;
  729. }
  730. message AuthUserRevokeRoleResponse {
  731. ResponseHeader header = 1;
  732. }
  733. message AuthRoleAddResponse {
  734. ResponseHeader header = 1;
  735. }
  736. message AuthRoleGetResponse {
  737. ResponseHeader header = 1;
  738. repeated authpb.Permission perm = 2;
  739. }
  740. message AuthRoleListResponse {
  741. ResponseHeader header = 1;
  742. repeated string roles = 2;
  743. }
  744. message AuthUserListResponse {
  745. ResponseHeader header = 1;
  746. repeated string users = 2;
  747. }
  748. message AuthRoleDeleteResponse {
  749. ResponseHeader header = 1;
  750. }
  751. message AuthRoleGrantPermissionResponse {
  752. ResponseHeader header = 1;
  753. }
  754. message AuthRoleRevokePermissionResponse {
  755. ResponseHeader header = 1;
  756. }