rpc.proto 26 KB

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