| Abhay Kumar | 40252eb | 2025-10-13 13:25:53 +0000 | [diff] [blame^] | 1 | syntax = "proto3"; |
| 2 | package etcdserverpb; |
| 3 | |
| 4 | import "gogoproto/gogo.proto"; |
| 5 | import "etcd/api/mvccpb/kv.proto"; |
| 6 | import "etcd/api/authpb/auth.proto"; |
| 7 | import "etcd/api/versionpb/version.proto"; |
| 8 | |
| 9 | // for grpc-gateway |
| 10 | import "google/api/annotations.proto"; |
| 11 | import "protoc-gen-openapiv2/options/annotations.proto"; |
| 12 | |
| 13 | option go_package = "go.etcd.io/etcd/api/v3/etcdserverpb"; |
| 14 | |
| 15 | option (gogoproto.marshaler_all) = true; |
| 16 | option (gogoproto.unmarshaler_all) = true; |
| 17 | |
| 18 | option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { |
| 19 | security_definitions: { |
| 20 | security: { |
| 21 | key: "ApiKey"; |
| 22 | value: { |
| 23 | type: TYPE_API_KEY; |
| 24 | in: IN_HEADER; |
| 25 | name: "Authorization"; |
| 26 | } |
| 27 | } |
| 28 | } |
| 29 | security: { |
| 30 | security_requirement: { |
| 31 | key: "ApiKey"; |
| 32 | value: {}; |
| 33 | } |
| 34 | } |
| 35 | }; |
| 36 | |
| 37 | service KV { |
| 38 | // Range gets the keys in the range from the key-value store. |
| 39 | rpc Range(RangeRequest) returns (RangeResponse) { |
| 40 | option (google.api.http) = { |
| 41 | post: "/v3/kv/range" |
| 42 | body: "*" |
| 43 | }; |
| 44 | } |
| 45 | |
| 46 | // Put puts the given key into the key-value store. |
| 47 | // A put request increments the revision of the key-value store |
| 48 | // and generates one event in the event history. |
| 49 | rpc Put(PutRequest) returns (PutResponse) { |
| 50 | option (google.api.http) = { |
| 51 | post: "/v3/kv/put" |
| 52 | body: "*" |
| 53 | }; |
| 54 | } |
| 55 | |
| 56 | // DeleteRange deletes the given range from the key-value store. |
| 57 | // A delete request increments the revision of the key-value store |
| 58 | // and generates a delete event in the event history for every deleted key. |
| 59 | rpc DeleteRange(DeleteRangeRequest) returns (DeleteRangeResponse) { |
| 60 | option (google.api.http) = { |
| 61 | post: "/v3/kv/deleterange" |
| 62 | body: "*" |
| 63 | }; |
| 64 | } |
| 65 | |
| 66 | // Txn processes multiple requests in a single transaction. |
| 67 | // A txn request increments the revision of the key-value store |
| 68 | // and generates events with the same revision for every completed request. |
| 69 | // It is not allowed to modify the same key several times within one txn. |
| 70 | rpc Txn(TxnRequest) returns (TxnResponse) { |
| 71 | option (google.api.http) = { |
| 72 | post: "/v3/kv/txn" |
| 73 | body: "*" |
| 74 | }; |
| 75 | } |
| 76 | |
| 77 | // Compact compacts the event history in the etcd key-value store. The key-value |
| 78 | // store should be periodically compacted or the event history will continue to grow |
| 79 | // indefinitely. |
| 80 | rpc Compact(CompactionRequest) returns (CompactionResponse) { |
| 81 | option (google.api.http) = { |
| 82 | post: "/v3/kv/compaction" |
| 83 | body: "*" |
| 84 | }; |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | service Watch { |
| 89 | // Watch watches for events happening or that have happened. Both input and output |
| 90 | // are streams; the input stream is for creating and canceling watchers and the output |
| 91 | // stream sends events. One watch RPC can watch on multiple key ranges, streaming events |
| 92 | // for several watches at once. The entire event history can be watched starting from the |
| 93 | // last compaction revision. |
| 94 | rpc Watch(stream WatchRequest) returns (stream WatchResponse) { |
| 95 | option (google.api.http) = { |
| 96 | post: "/v3/watch" |
| 97 | body: "*" |
| 98 | }; |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | service Lease { |
| 103 | // LeaseGrant creates a lease which expires if the server does not receive a keepAlive |
| 104 | // within a given time to live period. All keys attached to the lease will be expired and |
| 105 | // deleted if the lease expires. Each expired key generates a delete event in the event history. |
| 106 | rpc LeaseGrant(LeaseGrantRequest) returns (LeaseGrantResponse) { |
| 107 | option (google.api.http) = { |
| 108 | post: "/v3/lease/grant" |
| 109 | body: "*" |
| 110 | }; |
| 111 | } |
| 112 | |
| 113 | // LeaseRevoke revokes a lease. All keys attached to the lease will expire and be deleted. |
| 114 | rpc LeaseRevoke(LeaseRevokeRequest) returns (LeaseRevokeResponse) { |
| 115 | option (google.api.http) = { |
| 116 | post: "/v3/lease/revoke" |
| 117 | body: "*" |
| 118 | additional_bindings { |
| 119 | post: "/v3/kv/lease/revoke" |
| 120 | body: "*" |
| 121 | } |
| 122 | }; |
| 123 | } |
| 124 | |
| 125 | // LeaseKeepAlive keeps the lease alive by streaming keep alive requests from the client |
| 126 | // to the server and streaming keep alive responses from the server to the client. |
| 127 | rpc LeaseKeepAlive(stream LeaseKeepAliveRequest) returns (stream LeaseKeepAliveResponse) { |
| 128 | option (google.api.http) = { |
| 129 | post: "/v3/lease/keepalive" |
| 130 | body: "*" |
| 131 | }; |
| 132 | } |
| 133 | |
| 134 | // LeaseTimeToLive retrieves lease information. |
| 135 | rpc LeaseTimeToLive(LeaseTimeToLiveRequest) returns (LeaseTimeToLiveResponse) { |
| 136 | option (google.api.http) = { |
| 137 | post: "/v3/lease/timetolive" |
| 138 | body: "*" |
| 139 | additional_bindings { |
| 140 | post: "/v3/kv/lease/timetolive" |
| 141 | body: "*" |
| 142 | } |
| 143 | }; |
| 144 | } |
| 145 | |
| 146 | // LeaseLeases lists all existing leases. |
| 147 | rpc LeaseLeases(LeaseLeasesRequest) returns (LeaseLeasesResponse) { |
| 148 | option (google.api.http) = { |
| 149 | post: "/v3/lease/leases" |
| 150 | body: "*" |
| 151 | additional_bindings { |
| 152 | post: "/v3/kv/lease/leases" |
| 153 | body: "*" |
| 154 | } |
| 155 | }; |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | service Cluster { |
| 160 | // MemberAdd adds a member into the cluster. |
| 161 | rpc MemberAdd(MemberAddRequest) returns (MemberAddResponse) { |
| 162 | option (google.api.http) = { |
| 163 | post: "/v3/cluster/member/add" |
| 164 | body: "*" |
| 165 | }; |
| 166 | } |
| 167 | |
| 168 | // MemberRemove removes an existing member from the cluster. |
| 169 | rpc MemberRemove(MemberRemoveRequest) returns (MemberRemoveResponse) { |
| 170 | option (google.api.http) = { |
| 171 | post: "/v3/cluster/member/remove" |
| 172 | body: "*" |
| 173 | }; |
| 174 | } |
| 175 | |
| 176 | // MemberUpdate updates the member configuration. |
| 177 | rpc MemberUpdate(MemberUpdateRequest) returns (MemberUpdateResponse) { |
| 178 | option (google.api.http) = { |
| 179 | post: "/v3/cluster/member/update" |
| 180 | body: "*" |
| 181 | }; |
| 182 | } |
| 183 | |
| 184 | // MemberList lists all the members in the cluster. |
| 185 | rpc MemberList(MemberListRequest) returns (MemberListResponse) { |
| 186 | option (google.api.http) = { |
| 187 | post: "/v3/cluster/member/list" |
| 188 | body: "*" |
| 189 | }; |
| 190 | } |
| 191 | |
| 192 | // MemberPromote promotes a member from raft learner (non-voting) to raft voting member. |
| 193 | rpc MemberPromote(MemberPromoteRequest) returns (MemberPromoteResponse) { |
| 194 | option (google.api.http) = { |
| 195 | post: "/v3/cluster/member/promote" |
| 196 | body: "*" |
| 197 | }; |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | service Maintenance { |
| 202 | // Alarm activates, deactivates, and queries alarms regarding cluster health. |
| 203 | rpc Alarm(AlarmRequest) returns (AlarmResponse) { |
| 204 | option (google.api.http) = { |
| 205 | post: "/v3/maintenance/alarm" |
| 206 | body: "*" |
| 207 | }; |
| 208 | } |
| 209 | |
| 210 | // Status gets the status of the member. |
| 211 | rpc Status(StatusRequest) returns (StatusResponse) { |
| 212 | option (google.api.http) = { |
| 213 | post: "/v3/maintenance/status" |
| 214 | body: "*" |
| 215 | }; |
| 216 | } |
| 217 | |
| 218 | // Defragment defragments a member's backend database to recover storage space. |
| 219 | rpc Defragment(DefragmentRequest) returns (DefragmentResponse) { |
| 220 | option (google.api.http) = { |
| 221 | post: "/v3/maintenance/defragment" |
| 222 | body: "*" |
| 223 | }; |
| 224 | } |
| 225 | |
| 226 | // Hash computes the hash of whole backend keyspace, |
| 227 | // including key, lease, and other buckets in storage. |
| 228 | // This is designed for testing ONLY! |
| 229 | // Do not rely on this in production with ongoing transactions, |
| 230 | // since Hash operation does not hold MVCC locks. |
| 231 | // Use "HashKV" API instead for "key" bucket consistency checks. |
| 232 | rpc Hash(HashRequest) returns (HashResponse) { |
| 233 | option (google.api.http) = { |
| 234 | post: "/v3/maintenance/hash" |
| 235 | body: "*" |
| 236 | }; |
| 237 | } |
| 238 | |
| 239 | // HashKV computes the hash of all MVCC keys up to a given revision. |
| 240 | // It only iterates "key" bucket in backend storage. |
| 241 | rpc HashKV(HashKVRequest) returns (HashKVResponse) { |
| 242 | option (google.api.http) = { |
| 243 | post: "/v3/maintenance/hashkv" |
| 244 | body: "*" |
| 245 | }; |
| 246 | } |
| 247 | |
| 248 | // Snapshot sends a snapshot of the entire backend from a member over a stream to a client. |
| 249 | rpc Snapshot(SnapshotRequest) returns (stream SnapshotResponse) { |
| 250 | option (google.api.http) = { |
| 251 | post: "/v3/maintenance/snapshot" |
| 252 | body: "*" |
| 253 | }; |
| 254 | } |
| 255 | |
| 256 | // MoveLeader requests current leader node to transfer its leadership to transferee. |
| 257 | rpc MoveLeader(MoveLeaderRequest) returns (MoveLeaderResponse) { |
| 258 | option (google.api.http) = { |
| 259 | post: "/v3/maintenance/transfer-leadership" |
| 260 | body: "*" |
| 261 | }; |
| 262 | } |
| 263 | |
| 264 | // Downgrade requests downgrades, verifies feasibility or cancels downgrade |
| 265 | // on the cluster version. |
| 266 | // Supported since etcd 3.5. |
| 267 | rpc Downgrade(DowngradeRequest) returns (DowngradeResponse) { |
| 268 | option (google.api.http) = { |
| 269 | post: "/v3/maintenance/downgrade" |
| 270 | body: "*" |
| 271 | }; |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | service Auth { |
| 276 | // AuthEnable enables authentication. |
| 277 | rpc AuthEnable(AuthEnableRequest) returns (AuthEnableResponse) { |
| 278 | option (google.api.http) = { |
| 279 | post: "/v3/auth/enable" |
| 280 | body: "*" |
| 281 | }; |
| 282 | } |
| 283 | |
| 284 | // AuthDisable disables authentication. |
| 285 | rpc AuthDisable(AuthDisableRequest) returns (AuthDisableResponse) { |
| 286 | option (google.api.http) = { |
| 287 | post: "/v3/auth/disable" |
| 288 | body: "*" |
| 289 | }; |
| 290 | } |
| 291 | |
| 292 | // AuthStatus displays authentication status. |
| 293 | rpc AuthStatus(AuthStatusRequest) returns (AuthStatusResponse) { |
| 294 | option (google.api.http) = { |
| 295 | post: "/v3/auth/status" |
| 296 | body: "*" |
| 297 | }; |
| 298 | } |
| 299 | |
| 300 | // Authenticate processes an authenticate request. |
| 301 | rpc Authenticate(AuthenticateRequest) returns (AuthenticateResponse) { |
| 302 | option (google.api.http) = { |
| 303 | post: "/v3/auth/authenticate" |
| 304 | body: "*" |
| 305 | }; |
| 306 | } |
| 307 | |
| 308 | // UserAdd adds a new user. User name cannot be empty. |
| 309 | rpc UserAdd(AuthUserAddRequest) returns (AuthUserAddResponse) { |
| 310 | option (google.api.http) = { |
| 311 | post: "/v3/auth/user/add" |
| 312 | body: "*" |
| 313 | }; |
| 314 | } |
| 315 | |
| 316 | // UserGet gets detailed user information. |
| 317 | rpc UserGet(AuthUserGetRequest) returns (AuthUserGetResponse) { |
| 318 | option (google.api.http) = { |
| 319 | post: "/v3/auth/user/get" |
| 320 | body: "*" |
| 321 | }; |
| 322 | } |
| 323 | |
| 324 | // UserList gets a list of all users. |
| 325 | rpc UserList(AuthUserListRequest) returns (AuthUserListResponse) { |
| 326 | option (google.api.http) = { |
| 327 | post: "/v3/auth/user/list" |
| 328 | body: "*" |
| 329 | }; |
| 330 | } |
| 331 | |
| 332 | // UserDelete deletes a specified user. |
| 333 | rpc UserDelete(AuthUserDeleteRequest) returns (AuthUserDeleteResponse) { |
| 334 | option (google.api.http) = { |
| 335 | post: "/v3/auth/user/delete" |
| 336 | body: "*" |
| 337 | }; |
| 338 | } |
| 339 | |
| 340 | // UserChangePassword changes the password of a specified user. |
| 341 | rpc UserChangePassword(AuthUserChangePasswordRequest) returns (AuthUserChangePasswordResponse) { |
| 342 | option (google.api.http) = { |
| 343 | post: "/v3/auth/user/changepw" |
| 344 | body: "*" |
| 345 | }; |
| 346 | } |
| 347 | |
| 348 | // UserGrant grants a role to a specified user. |
| 349 | rpc UserGrantRole(AuthUserGrantRoleRequest) returns (AuthUserGrantRoleResponse) { |
| 350 | option (google.api.http) = { |
| 351 | post: "/v3/auth/user/grant" |
| 352 | body: "*" |
| 353 | }; |
| 354 | } |
| 355 | |
| 356 | // UserRevokeRole revokes a role of specified user. |
| 357 | rpc UserRevokeRole(AuthUserRevokeRoleRequest) returns (AuthUserRevokeRoleResponse) { |
| 358 | option (google.api.http) = { |
| 359 | post: "/v3/auth/user/revoke" |
| 360 | body: "*" |
| 361 | }; |
| 362 | } |
| 363 | |
| 364 | // RoleAdd adds a new role. Role name cannot be empty. |
| 365 | rpc RoleAdd(AuthRoleAddRequest) returns (AuthRoleAddResponse) { |
| 366 | option (google.api.http) = { |
| 367 | post: "/v3/auth/role/add" |
| 368 | body: "*" |
| 369 | }; |
| 370 | } |
| 371 | |
| 372 | // RoleGet gets detailed role information. |
| 373 | rpc RoleGet(AuthRoleGetRequest) returns (AuthRoleGetResponse) { |
| 374 | option (google.api.http) = { |
| 375 | post: "/v3/auth/role/get" |
| 376 | body: "*" |
| 377 | }; |
| 378 | } |
| 379 | |
| 380 | // RoleList gets lists of all roles. |
| 381 | rpc RoleList(AuthRoleListRequest) returns (AuthRoleListResponse) { |
| 382 | option (google.api.http) = { |
| 383 | post: "/v3/auth/role/list" |
| 384 | body: "*" |
| 385 | }; |
| 386 | } |
| 387 | |
| 388 | // RoleDelete deletes a specified role. |
| 389 | rpc RoleDelete(AuthRoleDeleteRequest) returns (AuthRoleDeleteResponse) { |
| 390 | option (google.api.http) = { |
| 391 | post: "/v3/auth/role/delete" |
| 392 | body: "*" |
| 393 | }; |
| 394 | } |
| 395 | |
| 396 | // RoleGrantPermission grants a permission of a specified key or range to a specified role. |
| 397 | rpc RoleGrantPermission(AuthRoleGrantPermissionRequest) returns (AuthRoleGrantPermissionResponse) { |
| 398 | option (google.api.http) = { |
| 399 | post: "/v3/auth/role/grant" |
| 400 | body: "*" |
| 401 | }; |
| 402 | } |
| 403 | |
| 404 | // RoleRevokePermission revokes a key or range permission of a specified role. |
| 405 | rpc RoleRevokePermission(AuthRoleRevokePermissionRequest) returns (AuthRoleRevokePermissionResponse) { |
| 406 | option (google.api.http) = { |
| 407 | post: "/v3/auth/role/revoke" |
| 408 | body: "*" |
| 409 | }; |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | message ResponseHeader { |
| 414 | option (versionpb.etcd_version_msg) = "3.0"; |
| 415 | |
| 416 | // cluster_id is the ID of the cluster which sent the response. |
| 417 | uint64 cluster_id = 1; |
| 418 | // member_id is the ID of the member which sent the response. |
| 419 | uint64 member_id = 2; |
| 420 | // revision is the key-value store revision when the request was applied, and it's |
| 421 | // unset (so 0) in case of calls not interacting with key-value store. |
| 422 | // For watch progress responses, the header.revision indicates progress. All future events |
| 423 | // received in this stream are guaranteed to have a higher revision number than the |
| 424 | // header.revision number. |
| 425 | int64 revision = 3; |
| 426 | // raft_term is the raft term when the request was applied. |
| 427 | uint64 raft_term = 4; |
| 428 | } |
| 429 | |
| 430 | message RangeRequest { |
| 431 | option (versionpb.etcd_version_msg) = "3.0"; |
| 432 | |
| 433 | enum SortOrder { |
| 434 | option (versionpb.etcd_version_enum) = "3.0"; |
| 435 | NONE = 0; // default, no sorting |
| 436 | ASCEND = 1; // lowest target value first |
| 437 | DESCEND = 2; // highest target value first |
| 438 | } |
| 439 | enum SortTarget { |
| 440 | option (versionpb.etcd_version_enum) = "3.0"; |
| 441 | KEY = 0; |
| 442 | VERSION = 1; |
| 443 | CREATE = 2; |
| 444 | MOD = 3; |
| 445 | VALUE = 4; |
| 446 | } |
| 447 | |
| 448 | // key is the first key for the range. If range_end is not given, the request only looks up key. |
| 449 | bytes key = 1; |
| 450 | // range_end is the upper bound on the requested range [key, range_end). |
| 451 | // If range_end is '\0', the range is all keys >= key. |
| 452 | // If range_end is key plus one (e.g., "aa"+1 == "ab", "a\xff"+1 == "b"), |
| 453 | // then the range request gets all keys prefixed with key. |
| 454 | // If both key and range_end are '\0', then the range request returns all keys. |
| 455 | bytes range_end = 2; |
| 456 | // limit is a limit on the number of keys returned for the request. When limit is set to 0, |
| 457 | // it is treated as no limit. |
| 458 | int64 limit = 3; |
| 459 | // revision is the point-in-time of the key-value store to use for the range. |
| 460 | // If revision is less or equal to zero, the range is over the newest key-value store. |
| 461 | // If the revision has been compacted, ErrCompacted is returned as a response. |
| 462 | int64 revision = 4; |
| 463 | |
| 464 | // sort_order is the order for returned sorted results. |
| 465 | SortOrder sort_order = 5; |
| 466 | |
| 467 | // sort_target is the key-value field to use for sorting. |
| 468 | SortTarget sort_target = 6; |
| 469 | |
| 470 | // serializable sets the range request to use serializable member-local reads. |
| 471 | // Range requests are linearizable by default; linearizable requests have higher |
| 472 | // latency and lower throughput than serializable requests but reflect the current |
| 473 | // consensus of the cluster. For better performance, in exchange for possible stale reads, |
| 474 | // a serializable range request is served locally without needing to reach consensus |
| 475 | // with other nodes in the cluster. |
| 476 | bool serializable = 7; |
| 477 | |
| 478 | // keys_only when set returns only the keys and not the values. |
| 479 | bool keys_only = 8; |
| 480 | |
| 481 | // count_only when set returns only the count of the keys in the range. |
| 482 | bool count_only = 9; |
| 483 | |
| 484 | // min_mod_revision is the lower bound for returned key mod revisions; all keys with |
| 485 | // lesser mod revisions will be filtered away. |
| 486 | int64 min_mod_revision = 10 [(versionpb.etcd_version_field)="3.1"]; |
| 487 | |
| 488 | // max_mod_revision is the upper bound for returned key mod revisions; all keys with |
| 489 | // greater mod revisions will be filtered away. |
| 490 | int64 max_mod_revision = 11 [(versionpb.etcd_version_field)="3.1"]; |
| 491 | |
| 492 | // min_create_revision is the lower bound for returned key create revisions; all keys with |
| 493 | // lesser create revisions will be filtered away. |
| 494 | int64 min_create_revision = 12 [(versionpb.etcd_version_field)="3.1"]; |
| 495 | |
| 496 | // max_create_revision is the upper bound for returned key create revisions; all keys with |
| 497 | // greater create revisions will be filtered away. |
| 498 | int64 max_create_revision = 13 [(versionpb.etcd_version_field)="3.1"]; |
| 499 | } |
| 500 | |
| 501 | message RangeResponse { |
| 502 | option (versionpb.etcd_version_msg) = "3.0"; |
| 503 | |
| 504 | ResponseHeader header = 1; |
| 505 | // kvs is the list of key-value pairs matched by the range request. |
| 506 | // kvs is empty when count is requested. |
| 507 | repeated mvccpb.KeyValue kvs = 2; |
| 508 | // more indicates if there are more keys to return in the requested range. |
| 509 | bool more = 3; |
| 510 | // count is set to the actual number of keys within the range when requested. |
| 511 | // Unlike Kvs, it is unaffected by limits and filters (e.g., Min/Max, Create/Modify, Revisions) |
| 512 | // and reflects the full count within the specified range. |
| 513 | int64 count = 4; |
| 514 | } |
| 515 | |
| 516 | message PutRequest { |
| 517 | option (versionpb.etcd_version_msg) = "3.0"; |
| 518 | |
| 519 | // key is the key, in bytes, to put into the key-value store. |
| 520 | bytes key = 1; |
| 521 | // value is the value, in bytes, to associate with the key in the key-value store. |
| 522 | bytes value = 2; |
| 523 | // lease is the lease ID to associate with the key in the key-value store. A lease |
| 524 | // value of 0 indicates no lease. |
| 525 | int64 lease = 3; |
| 526 | |
| 527 | // If prev_kv is set, etcd gets the previous key-value pair before changing it. |
| 528 | // The previous key-value pair will be returned in the put response. |
| 529 | bool prev_kv = 4 [(versionpb.etcd_version_field)="3.1"]; |
| 530 | |
| 531 | // If ignore_value is set, etcd updates the key using its current value. |
| 532 | // Returns an error if the key does not exist. |
| 533 | bool ignore_value = 5 [(versionpb.etcd_version_field)="3.2"]; |
| 534 | |
| 535 | // If ignore_lease is set, etcd updates the key using its current lease. |
| 536 | // Returns an error if the key does not exist. |
| 537 | bool ignore_lease = 6 [(versionpb.etcd_version_field)="3.2"]; |
| 538 | } |
| 539 | |
| 540 | message PutResponse { |
| 541 | option (versionpb.etcd_version_msg) = "3.0"; |
| 542 | |
| 543 | ResponseHeader header = 1; |
| 544 | // if prev_kv is set in the request, the previous key-value pair will be returned. |
| 545 | mvccpb.KeyValue prev_kv = 2 [(versionpb.etcd_version_field)="3.1"]; |
| 546 | } |
| 547 | |
| 548 | message DeleteRangeRequest { |
| 549 | option (versionpb.etcd_version_msg) = "3.0"; |
| 550 | |
| 551 | // key is the first key to delete in the range. |
| 552 | bytes key = 1; |
| 553 | // range_end is the key following the last key to delete for the range [key, range_end). |
| 554 | // If range_end is not given, the range is defined to contain only the key argument. |
| 555 | // If range_end is one bit larger than the given key, then the range is all the keys |
| 556 | // with the prefix (the given key). |
| 557 | // If range_end is '\0', the range is all keys greater than or equal to the key argument. |
| 558 | bytes range_end = 2; |
| 559 | |
| 560 | // If prev_kv is set, etcd gets the previous key-value pairs before deleting it. |
| 561 | // The previous key-value pairs will be returned in the delete response. |
| 562 | bool prev_kv = 3 [(versionpb.etcd_version_field)="3.1"]; |
| 563 | } |
| 564 | |
| 565 | message DeleteRangeResponse { |
| 566 | option (versionpb.etcd_version_msg) = "3.0"; |
| 567 | |
| 568 | ResponseHeader header = 1; |
| 569 | // deleted is the number of keys deleted by the delete range request. |
| 570 | int64 deleted = 2; |
| 571 | // if prev_kv is set in the request, the previous key-value pairs will be returned. |
| 572 | repeated mvccpb.KeyValue prev_kvs = 3 [(versionpb.etcd_version_field)="3.1"]; |
| 573 | } |
| 574 | |
| 575 | message RequestOp { |
| 576 | option (versionpb.etcd_version_msg) = "3.0"; |
| 577 | // request is a union of request types accepted by a transaction. |
| 578 | oneof request { |
| 579 | RangeRequest request_range = 1; |
| 580 | PutRequest request_put = 2; |
| 581 | DeleteRangeRequest request_delete_range = 3; |
| 582 | TxnRequest request_txn = 4 [(versionpb.etcd_version_field)="3.3"]; |
| 583 | } |
| 584 | } |
| 585 | |
| 586 | message ResponseOp { |
| 587 | option (versionpb.etcd_version_msg) = "3.0"; |
| 588 | |
| 589 | // response is a union of response types returned by a transaction. |
| 590 | oneof response { |
| 591 | RangeResponse response_range = 1; |
| 592 | PutResponse response_put = 2; |
| 593 | DeleteRangeResponse response_delete_range = 3; |
| 594 | TxnResponse response_txn = 4 [(versionpb.etcd_version_field)="3.3"]; |
| 595 | } |
| 596 | } |
| 597 | |
| 598 | message Compare { |
| 599 | option (versionpb.etcd_version_msg) = "3.0"; |
| 600 | |
| 601 | enum CompareResult { |
| 602 | option (versionpb.etcd_version_enum) = "3.0"; |
| 603 | |
| 604 | EQUAL = 0; |
| 605 | GREATER = 1; |
| 606 | LESS = 2; |
| 607 | NOT_EQUAL = 3 [(versionpb.etcd_version_enum_value)="3.1"]; |
| 608 | } |
| 609 | enum CompareTarget { |
| 610 | option (versionpb.etcd_version_enum) = "3.0"; |
| 611 | |
| 612 | VERSION = 0; |
| 613 | CREATE = 1; |
| 614 | MOD = 2; |
| 615 | VALUE = 3; |
| 616 | LEASE = 4 [(versionpb.etcd_version_enum_value)="3.3"]; |
| 617 | } |
| 618 | // result is logical comparison operation for this comparison. |
| 619 | CompareResult result = 1; |
| 620 | // target is the key-value field to inspect for the comparison. |
| 621 | CompareTarget target = 2; |
| 622 | // key is the subject key for the comparison operation. |
| 623 | bytes key = 3; |
| 624 | oneof target_union { |
| 625 | // version is the version of the given key |
| 626 | int64 version = 4; |
| 627 | // create_revision is the creation revision of the given key |
| 628 | int64 create_revision = 5; |
| 629 | // mod_revision is the last modified revision of the given key. |
| 630 | int64 mod_revision = 6; |
| 631 | // value is the value of the given key, in bytes. |
| 632 | bytes value = 7; |
| 633 | // lease is the lease id of the given key. |
| 634 | int64 lease = 8 [(versionpb.etcd_version_field)="3.3"]; |
| 635 | // leave room for more target_union field tags, jump to 64 |
| 636 | } |
| 637 | |
| 638 | // range_end compares the given target to all keys in the range [key, range_end). |
| 639 | // See RangeRequest for more details on key ranges. |
| 640 | bytes range_end = 64 [(versionpb.etcd_version_field)="3.3"]; |
| 641 | // TODO: fill out with most of the rest of RangeRequest fields when needed. |
| 642 | } |
| 643 | |
| 644 | // From google paxosdb paper: |
| 645 | // Our implementation hinges around a powerful primitive which we call MultiOp. All other database |
| 646 | // operations except for iteration are implemented as a single call to MultiOp. A MultiOp is applied atomically |
| 647 | // and consists of three components: |
| 648 | // 1. A list of tests called guard. Each test in guard checks a single entry in the database. It may check |
| 649 | // for the absence or presence of a value, or compare with a given value. Two different tests in the guard |
| 650 | // may apply to the same or different entries in the database. All tests in the guard are applied and |
| 651 | // MultiOp returns the results. If all tests are true, MultiOp executes t op (see item 2 below), otherwise |
| 652 | // it executes f op (see item 3 below). |
| 653 | // 2. A list of database operations called t op. Each operation in the list is either an insert, delete, or |
| 654 | // lookup operation, and applies to a single database entry. Two different operations in the list may apply |
| 655 | // to the same or different entries in the database. These operations are executed |
| 656 | // if guard evaluates to |
| 657 | // true. |
| 658 | // 3. A list of database operations called f op. Like t op, but executed if guard evaluates to false. |
| 659 | message TxnRequest { |
| 660 | option (versionpb.etcd_version_msg) = "3.0"; |
| 661 | |
| 662 | // compare is a list of predicates representing a conjunction of terms. |
| 663 | // If the comparisons succeed, then the success requests will be processed in order, |
| 664 | // and the response will contain their respective responses in order. |
| 665 | // If the comparisons fail, then the failure requests will be processed in order, |
| 666 | // and the response will contain their respective responses in order. |
| 667 | repeated Compare compare = 1; |
| 668 | // success is a list of requests which will be applied when compare evaluates to true. |
| 669 | repeated RequestOp success = 2; |
| 670 | // failure is a list of requests which will be applied when compare evaluates to false. |
| 671 | repeated RequestOp failure = 3; |
| 672 | } |
| 673 | |
| 674 | message TxnResponse { |
| 675 | option (versionpb.etcd_version_msg) = "3.0"; |
| 676 | |
| 677 | ResponseHeader header = 1; |
| 678 | // succeeded is set to true if the compare evaluated to true or false otherwise. |
| 679 | bool succeeded = 2; |
| 680 | // responses is a list of responses corresponding to the results from applying |
| 681 | // success if succeeded is true or failure if succeeded is false. |
| 682 | repeated ResponseOp responses = 3; |
| 683 | } |
| 684 | |
| 685 | // CompactionRequest compacts the key-value store up to a given revision. All superseded keys |
| 686 | // with a revision less than the compaction revision will be removed. |
| 687 | message CompactionRequest { |
| 688 | option (versionpb.etcd_version_msg) = "3.0"; |
| 689 | |
| 690 | // revision is the key-value store revision for the compaction operation. |
| 691 | int64 revision = 1; |
| 692 | // physical is set so the RPC will wait until the compaction is physically |
| 693 | // applied to the local database such that compacted entries are totally |
| 694 | // removed from the backend database. |
| 695 | bool physical = 2; |
| 696 | } |
| 697 | |
| 698 | message CompactionResponse { |
| 699 | option (versionpb.etcd_version_msg) = "3.0"; |
| 700 | |
| 701 | ResponseHeader header = 1; |
| 702 | } |
| 703 | |
| 704 | message HashRequest { |
| 705 | option (versionpb.etcd_version_msg) = "3.0"; |
| 706 | } |
| 707 | |
| 708 | message HashKVRequest { |
| 709 | option (versionpb.etcd_version_msg) = "3.3"; |
| 710 | // revision is the key-value store revision for the hash operation. |
| 711 | int64 revision = 1; |
| 712 | } |
| 713 | |
| 714 | message HashKVResponse { |
| 715 | option (versionpb.etcd_version_msg) = "3.3"; |
| 716 | |
| 717 | ResponseHeader header = 1; |
| 718 | // hash is the hash value computed from the responding member's MVCC keys up to a given revision. |
| 719 | uint32 hash = 2; |
| 720 | // compact_revision is the compacted revision of key-value store when hash begins. |
| 721 | int64 compact_revision = 3; |
| 722 | // hash_revision is the revision up to which the hash is calculated. |
| 723 | int64 hash_revision = 4 [(versionpb.etcd_version_field)="3.6"]; |
| 724 | } |
| 725 | |
| 726 | message HashResponse { |
| 727 | option (versionpb.etcd_version_msg) = "3.0"; |
| 728 | |
| 729 | ResponseHeader header = 1; |
| 730 | // hash is the hash value computed from the responding member's KV's backend. |
| 731 | uint32 hash = 2; |
| 732 | } |
| 733 | |
| 734 | message SnapshotRequest { |
| 735 | option (versionpb.etcd_version_msg) = "3.3"; |
| 736 | } |
| 737 | |
| 738 | message SnapshotResponse { |
| 739 | option (versionpb.etcd_version_msg) = "3.3"; |
| 740 | |
| 741 | // header has the current key-value store information. The first header in the snapshot |
| 742 | // stream indicates the point in time of the snapshot. |
| 743 | ResponseHeader header = 1; |
| 744 | |
| 745 | // remaining_bytes is the number of blob bytes to be sent after this message |
| 746 | uint64 remaining_bytes = 2; |
| 747 | |
| 748 | // blob contains the next chunk of the snapshot in the snapshot stream. |
| 749 | bytes blob = 3; |
| 750 | |
| 751 | // local version of server that created the snapshot. |
| 752 | // In cluster with binaries with different version, each cluster can return different result. |
| 753 | // Informs which etcd server version should be used when restoring the snapshot. |
| 754 | string version = 4 [(versionpb.etcd_version_field)="3.6"]; |
| 755 | } |
| 756 | |
| 757 | message WatchRequest { |
| 758 | option (versionpb.etcd_version_msg) = "3.0"; |
| 759 | // request_union is a request to either create a new watcher or cancel an existing watcher. |
| 760 | oneof request_union { |
| 761 | WatchCreateRequest create_request = 1; |
| 762 | WatchCancelRequest cancel_request = 2; |
| 763 | WatchProgressRequest progress_request = 3 [(versionpb.etcd_version_field)="3.4"]; |
| 764 | } |
| 765 | } |
| 766 | |
| 767 | message WatchCreateRequest { |
| 768 | option (versionpb.etcd_version_msg) = "3.0"; |
| 769 | |
| 770 | // key is the key to register for watching. |
| 771 | bytes key = 1; |
| 772 | |
| 773 | // range_end is the end of the range [key, range_end) to watch. If range_end is not given, |
| 774 | // only the key argument is watched. If range_end is equal to '\0', all keys greater than |
| 775 | // or equal to the key argument are watched. |
| 776 | // If the range_end is one bit larger than the given key, |
| 777 | // then all keys with the prefix (the given key) will be watched. |
| 778 | bytes range_end = 2; |
| 779 | |
| 780 | // start_revision is an optional revision to watch from (inclusive). No start_revision is "now". |
| 781 | int64 start_revision = 3; |
| 782 | |
| 783 | // progress_notify is set so that the etcd server will periodically send a WatchResponse with |
| 784 | // no events to the new watcher if there are no recent events. It is useful when clients |
| 785 | // wish to recover a disconnected watcher starting from a recent known revision. |
| 786 | // The etcd server may decide how often it will send notifications based on current load. |
| 787 | bool progress_notify = 4; |
| 788 | |
| 789 | enum FilterType { |
| 790 | option (versionpb.etcd_version_enum) = "3.1"; |
| 791 | |
| 792 | // filter out put event. |
| 793 | NOPUT = 0; |
| 794 | // filter out delete event. |
| 795 | NODELETE = 1; |
| 796 | } |
| 797 | |
| 798 | // filters filter the events at server side before it sends back to the watcher. |
| 799 | repeated FilterType filters = 5 [(versionpb.etcd_version_field)="3.1"]; |
| 800 | |
| 801 | // If prev_kv is set, created watcher gets the previous KV before the event happens. |
| 802 | // If the previous KV is already compacted, nothing will be returned. |
| 803 | bool prev_kv = 6 [(versionpb.etcd_version_field)="3.1"]; |
| 804 | |
| 805 | // If watch_id is provided and non-zero, it will be assigned to this watcher. |
| 806 | // Since creating a watcher in etcd is not a synchronous operation, |
| 807 | // this can be used ensure that ordering is correct when creating multiple |
| 808 | // watchers on the same stream. Creating a watcher with an ID already in |
| 809 | // use on the stream will cause an error to be returned. |
| 810 | int64 watch_id = 7 [(versionpb.etcd_version_field)="3.4"]; |
| 811 | |
| 812 | // fragment enables splitting large revisions into multiple watch responses. |
| 813 | bool fragment = 8 [(versionpb.etcd_version_field)="3.4"]; |
| 814 | } |
| 815 | |
| 816 | message WatchCancelRequest { |
| 817 | option (versionpb.etcd_version_msg) = "3.1"; |
| 818 | // watch_id is the watcher id to cancel so that no more events are transmitted. |
| 819 | int64 watch_id = 1 [(versionpb.etcd_version_field)="3.1"]; |
| 820 | } |
| 821 | |
| 822 | // Requests the a watch stream progress status be sent in the watch response stream as soon as |
| 823 | // possible. |
| 824 | message WatchProgressRequest { |
| 825 | option (versionpb.etcd_version_msg) = "3.4"; |
| 826 | } |
| 827 | |
| 828 | message WatchResponse { |
| 829 | option (versionpb.etcd_version_msg) = "3.0"; |
| 830 | |
| 831 | ResponseHeader header = 1; |
| 832 | // watch_id is the ID of the watcher that corresponds to the response. |
| 833 | int64 watch_id = 2; |
| 834 | |
| 835 | // created is set to true if the response is for a create watch request. |
| 836 | // The client should record the watch_id and expect to receive events for |
| 837 | // the created watcher from the same stream. |
| 838 | // All events sent to the created watcher will attach with the same watch_id. |
| 839 | bool created = 3; |
| 840 | |
| 841 | // canceled is set to true if the response is for a cancel watch request |
| 842 | // or if the start_revision has already been compacted. |
| 843 | // No further events will be sent to the canceled watcher. |
| 844 | bool canceled = 4; |
| 845 | |
| 846 | // compact_revision is set to the minimum index if a watcher tries to watch |
| 847 | // at a compacted index. |
| 848 | // |
| 849 | // This happens when creating a watcher at a compacted revision or the watcher cannot |
| 850 | // catch up with the progress of the key-value store. |
| 851 | // |
| 852 | // The client should treat the watcher as canceled and should not try to create any |
| 853 | // watcher with the same start_revision again. |
| 854 | int64 compact_revision = 5; |
| 855 | |
| 856 | // cancel_reason indicates the reason for canceling the watcher. |
| 857 | string cancel_reason = 6 [(versionpb.etcd_version_field)="3.4"]; |
| 858 | |
| 859 | // framgment is true if large watch response was split over multiple responses. |
| 860 | bool fragment = 7 [(versionpb.etcd_version_field)="3.4"]; |
| 861 | |
| 862 | repeated mvccpb.Event events = 11; |
| 863 | } |
| 864 | |
| 865 | message LeaseGrantRequest { |
| 866 | option (versionpb.etcd_version_msg) = "3.0"; |
| 867 | |
| 868 | // TTL is the advisory time-to-live in seconds. Expired lease will return -1. |
| 869 | int64 TTL = 1; |
| 870 | // ID is the requested ID for the lease. If ID is set to 0, the lessor chooses an ID. |
| 871 | int64 ID = 2; |
| 872 | } |
| 873 | |
| 874 | message LeaseGrantResponse { |
| 875 | option (versionpb.etcd_version_msg) = "3.0"; |
| 876 | |
| 877 | ResponseHeader header = 1; |
| 878 | // ID is the lease ID for the granted lease. |
| 879 | int64 ID = 2; |
| 880 | // TTL is the server chosen lease time-to-live in seconds. |
| 881 | int64 TTL = 3; |
| 882 | string error = 4; |
| 883 | } |
| 884 | |
| 885 | message LeaseRevokeRequest { |
| 886 | option (versionpb.etcd_version_msg) = "3.0"; |
| 887 | |
| 888 | // ID is the lease ID to revoke. When the ID is revoked, all associated keys will be deleted. |
| 889 | int64 ID = 1; |
| 890 | } |
| 891 | |
| 892 | message LeaseRevokeResponse { |
| 893 | option (versionpb.etcd_version_msg) = "3.0"; |
| 894 | |
| 895 | ResponseHeader header = 1; |
| 896 | } |
| 897 | |
| 898 | message LeaseCheckpoint { |
| 899 | option (versionpb.etcd_version_msg) = "3.4"; |
| 900 | |
| 901 | // ID is the lease ID to checkpoint. |
| 902 | int64 ID = 1; |
| 903 | |
| 904 | // Remaining_TTL is the remaining time until expiry of the lease. |
| 905 | int64 remaining_TTL = 2; |
| 906 | } |
| 907 | |
| 908 | message LeaseCheckpointRequest { |
| 909 | option (versionpb.etcd_version_msg) = "3.4"; |
| 910 | |
| 911 | repeated LeaseCheckpoint checkpoints = 1; |
| 912 | } |
| 913 | |
| 914 | message LeaseCheckpointResponse { |
| 915 | option (versionpb.etcd_version_msg) = "3.4"; |
| 916 | |
| 917 | ResponseHeader header = 1; |
| 918 | } |
| 919 | |
| 920 | message LeaseKeepAliveRequest { |
| 921 | option (versionpb.etcd_version_msg) = "3.0"; |
| 922 | // ID is the lease ID for the lease to keep alive. |
| 923 | int64 ID = 1; |
| 924 | } |
| 925 | |
| 926 | message LeaseKeepAliveResponse { |
| 927 | option (versionpb.etcd_version_msg) = "3.0"; |
| 928 | |
| 929 | ResponseHeader header = 1; |
| 930 | // ID is the lease ID from the keep alive request. |
| 931 | int64 ID = 2; |
| 932 | // TTL is the new time-to-live for the lease. |
| 933 | int64 TTL = 3; |
| 934 | } |
| 935 | |
| 936 | message LeaseTimeToLiveRequest { |
| 937 | option (versionpb.etcd_version_msg) = "3.1"; |
| 938 | // ID is the lease ID for the lease. |
| 939 | int64 ID = 1; |
| 940 | // keys is true to query all the keys attached to this lease. |
| 941 | bool keys = 2; |
| 942 | } |
| 943 | |
| 944 | message LeaseTimeToLiveResponse { |
| 945 | option (versionpb.etcd_version_msg) = "3.1"; |
| 946 | |
| 947 | ResponseHeader header = 1; |
| 948 | // ID is the lease ID from the keep alive request. |
| 949 | int64 ID = 2; |
| 950 | // TTL is the remaining TTL in seconds for the lease; the lease will expire in under TTL+1 seconds. |
| 951 | int64 TTL = 3; |
| 952 | // GrantedTTL is the initial granted time in seconds upon lease creation/renewal. |
| 953 | int64 grantedTTL = 4; |
| 954 | // Keys is the list of keys attached to this lease. |
| 955 | repeated bytes keys = 5; |
| 956 | } |
| 957 | |
| 958 | message LeaseLeasesRequest { |
| 959 | option (versionpb.etcd_version_msg) = "3.3"; |
| 960 | } |
| 961 | |
| 962 | message LeaseStatus { |
| 963 | option (versionpb.etcd_version_msg) = "3.3"; |
| 964 | |
| 965 | int64 ID = 1; |
| 966 | // TODO: int64 TTL = 2; |
| 967 | } |
| 968 | |
| 969 | message LeaseLeasesResponse { |
| 970 | option (versionpb.etcd_version_msg) = "3.3"; |
| 971 | |
| 972 | ResponseHeader header = 1; |
| 973 | repeated LeaseStatus leases = 2; |
| 974 | } |
| 975 | |
| 976 | message Member { |
| 977 | option (versionpb.etcd_version_msg) = "3.0"; |
| 978 | |
| 979 | // ID is the member ID for this member. |
| 980 | uint64 ID = 1; |
| 981 | // name is the human-readable name of the member. If the member is not started, the name will be an empty string. |
| 982 | string name = 2; |
| 983 | // peerURLs is the list of URLs the member exposes to the cluster for communication. |
| 984 | repeated string peerURLs = 3; |
| 985 | // clientURLs is the list of URLs the member exposes to clients for communication. If the member is not started, clientURLs will be empty. |
| 986 | repeated string clientURLs = 4; |
| 987 | // isLearner indicates if the member is raft learner. |
| 988 | bool isLearner = 5 [(versionpb.etcd_version_field)="3.4"]; |
| 989 | } |
| 990 | |
| 991 | message MemberAddRequest { |
| 992 | option (versionpb.etcd_version_msg) = "3.0"; |
| 993 | |
| 994 | // peerURLs is the list of URLs the added member will use to communicate with the cluster. |
| 995 | repeated string peerURLs = 1; |
| 996 | // isLearner indicates if the added member is raft learner. |
| 997 | bool isLearner = 2 [(versionpb.etcd_version_field)="3.4"]; |
| 998 | } |
| 999 | |
| 1000 | message MemberAddResponse { |
| 1001 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1002 | |
| 1003 | ResponseHeader header = 1; |
| 1004 | // member is the member information for the added member. |
| 1005 | Member member = 2; |
| 1006 | // members is a list of all members after adding the new member. |
| 1007 | repeated Member members = 3; |
| 1008 | } |
| 1009 | |
| 1010 | message MemberRemoveRequest { |
| 1011 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1012 | // ID is the member ID of the member to remove. |
| 1013 | uint64 ID = 1; |
| 1014 | } |
| 1015 | |
| 1016 | message MemberRemoveResponse { |
| 1017 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1018 | |
| 1019 | ResponseHeader header = 1; |
| 1020 | // members is a list of all members after removing the member. |
| 1021 | repeated Member members = 2; |
| 1022 | } |
| 1023 | |
| 1024 | message MemberUpdateRequest { |
| 1025 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1026 | |
| 1027 | // ID is the member ID of the member to update. |
| 1028 | uint64 ID = 1; |
| 1029 | // peerURLs is the new list of URLs the member will use to communicate with the cluster. |
| 1030 | repeated string peerURLs = 2; |
| 1031 | } |
| 1032 | |
| 1033 | message MemberUpdateResponse{ |
| 1034 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1035 | |
| 1036 | ResponseHeader header = 1; |
| 1037 | // members is a list of all members after updating the member. |
| 1038 | repeated Member members = 2 [(versionpb.etcd_version_field)="3.1"]; |
| 1039 | } |
| 1040 | |
| 1041 | message MemberListRequest { |
| 1042 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1043 | |
| 1044 | bool linearizable = 1 [(versionpb.etcd_version_field)="3.5"]; |
| 1045 | } |
| 1046 | |
| 1047 | message MemberListResponse { |
| 1048 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1049 | |
| 1050 | ResponseHeader header = 1; |
| 1051 | // members is a list of all members associated with the cluster. |
| 1052 | repeated Member members = 2; |
| 1053 | } |
| 1054 | |
| 1055 | message MemberPromoteRequest { |
| 1056 | option (versionpb.etcd_version_msg) = "3.4"; |
| 1057 | // ID is the member ID of the member to promote. |
| 1058 | uint64 ID = 1; |
| 1059 | } |
| 1060 | |
| 1061 | message MemberPromoteResponse { |
| 1062 | option (versionpb.etcd_version_msg) = "3.4"; |
| 1063 | |
| 1064 | ResponseHeader header = 1; |
| 1065 | // members is a list of all members after promoting the member. |
| 1066 | repeated Member members = 2; |
| 1067 | } |
| 1068 | |
| 1069 | message DefragmentRequest { |
| 1070 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1071 | } |
| 1072 | |
| 1073 | message DefragmentResponse { |
| 1074 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1075 | |
| 1076 | ResponseHeader header = 1; |
| 1077 | } |
| 1078 | |
| 1079 | message MoveLeaderRequest { |
| 1080 | option (versionpb.etcd_version_msg) = "3.3"; |
| 1081 | // targetID is the node ID for the new leader. |
| 1082 | uint64 targetID = 1; |
| 1083 | } |
| 1084 | |
| 1085 | message MoveLeaderResponse { |
| 1086 | option (versionpb.etcd_version_msg) = "3.3"; |
| 1087 | |
| 1088 | ResponseHeader header = 1; |
| 1089 | } |
| 1090 | |
| 1091 | enum AlarmType { |
| 1092 | option (versionpb.etcd_version_enum) = "3.0"; |
| 1093 | |
| 1094 | NONE = 0; // default, used to query if any alarm is active |
| 1095 | NOSPACE = 1; // space quota is exhausted |
| 1096 | CORRUPT = 2 [(versionpb.etcd_version_enum_value)="3.3"]; // kv store corruption detected |
| 1097 | } |
| 1098 | |
| 1099 | message AlarmRequest { |
| 1100 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1101 | |
| 1102 | enum AlarmAction { |
| 1103 | option (versionpb.etcd_version_enum) = "3.0"; |
| 1104 | |
| 1105 | GET = 0; |
| 1106 | ACTIVATE = 1; |
| 1107 | DEACTIVATE = 2; |
| 1108 | } |
| 1109 | // action is the kind of alarm request to issue. The action |
| 1110 | // may GET alarm statuses, ACTIVATE an alarm, or DEACTIVATE a |
| 1111 | // raised alarm. |
| 1112 | AlarmAction action = 1; |
| 1113 | // memberID is the ID of the member associated with the alarm. If memberID is 0, the |
| 1114 | // alarm request covers all members. |
| 1115 | uint64 memberID = 2; |
| 1116 | // alarm is the type of alarm to consider for this request. |
| 1117 | AlarmType alarm = 3; |
| 1118 | } |
| 1119 | |
| 1120 | message AlarmMember { |
| 1121 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1122 | // memberID is the ID of the member associated with the raised alarm. |
| 1123 | uint64 memberID = 1; |
| 1124 | // alarm is the type of alarm which has been raised. |
| 1125 | AlarmType alarm = 2; |
| 1126 | } |
| 1127 | |
| 1128 | message AlarmResponse { |
| 1129 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1130 | |
| 1131 | ResponseHeader header = 1; |
| 1132 | // alarms is a list of alarms associated with the alarm request. |
| 1133 | repeated AlarmMember alarms = 2; |
| 1134 | } |
| 1135 | |
| 1136 | message DowngradeRequest { |
| 1137 | option (versionpb.etcd_version_msg) = "3.5"; |
| 1138 | |
| 1139 | enum DowngradeAction { |
| 1140 | option (versionpb.etcd_version_enum) = "3.5"; |
| 1141 | |
| 1142 | VALIDATE = 0; |
| 1143 | ENABLE = 1; |
| 1144 | CANCEL = 2; |
| 1145 | } |
| 1146 | |
| 1147 | // action is the kind of downgrade request to issue. The action may |
| 1148 | // VALIDATE the target version, DOWNGRADE the cluster version, |
| 1149 | // or CANCEL the current downgrading job. |
| 1150 | DowngradeAction action = 1; |
| 1151 | // version is the target version to downgrade. |
| 1152 | string version = 2; |
| 1153 | } |
| 1154 | |
| 1155 | message DowngradeResponse { |
| 1156 | option (versionpb.etcd_version_msg) = "3.5"; |
| 1157 | |
| 1158 | ResponseHeader header = 1; |
| 1159 | // version is the current cluster version. |
| 1160 | string version = 2; |
| 1161 | } |
| 1162 | |
| 1163 | // DowngradeVersionTestRequest is used for test only. The version in |
| 1164 | // this request will be read as the WAL record version.If the downgrade |
| 1165 | // target version is less than this version, then the downgrade(online) |
| 1166 | // or migration(offline) isn't safe, so shouldn't be allowed. |
| 1167 | message DowngradeVersionTestRequest { |
| 1168 | option (versionpb.etcd_version_msg) = "3.6"; |
| 1169 | |
| 1170 | string ver = 1; |
| 1171 | } |
| 1172 | |
| 1173 | message StatusRequest { |
| 1174 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1175 | } |
| 1176 | |
| 1177 | message StatusResponse { |
| 1178 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1179 | |
| 1180 | ResponseHeader header = 1; |
| 1181 | // version is the cluster protocol version used by the responding member. |
| 1182 | string version = 2; |
| 1183 | // dbSize is the size of the backend database physically allocated, in bytes, of the responding member. |
| 1184 | int64 dbSize = 3; |
| 1185 | // leader is the member ID which the responding member believes is the current leader. |
| 1186 | uint64 leader = 4; |
| 1187 | // raftIndex is the current raft committed index of the responding member. |
| 1188 | uint64 raftIndex = 5; |
| 1189 | // raftTerm is the current raft term of the responding member. |
| 1190 | uint64 raftTerm = 6; |
| 1191 | // raftAppliedIndex is the current raft applied index of the responding member. |
| 1192 | uint64 raftAppliedIndex = 7 [(versionpb.etcd_version_field)="3.4"]; |
| 1193 | // errors contains alarm/health information and status. |
| 1194 | repeated string errors = 8 [(versionpb.etcd_version_field)="3.4"]; |
| 1195 | // dbSizeInUse is the size of the backend database logically in use, in bytes, of the responding member. |
| 1196 | int64 dbSizeInUse = 9 [(versionpb.etcd_version_field)="3.4"]; |
| 1197 | // isLearner indicates if the member is raft learner. |
| 1198 | bool isLearner = 10 [(versionpb.etcd_version_field)="3.4"]; |
| 1199 | // storageVersion is the version of the db file. It might be updated with delay in relationship to the target cluster version. |
| 1200 | string storageVersion = 11 [(versionpb.etcd_version_field)="3.6"]; |
| 1201 | // dbSizeQuota is the configured etcd storage quota in bytes (the value passed to etcd instance by flag --quota-backend-bytes) |
| 1202 | int64 dbSizeQuota = 12 [(versionpb.etcd_version_field)="3.6"]; |
| 1203 | // downgradeInfo indicates if there is downgrade process. |
| 1204 | DowngradeInfo downgradeInfo = 13 [(versionpb.etcd_version_field)="3.6"]; |
| 1205 | } |
| 1206 | |
| 1207 | message DowngradeInfo { |
| 1208 | // enabled indicates whether the cluster is enabled to downgrade. |
| 1209 | bool enabled = 1; |
| 1210 | // targetVersion is the target downgrade version. |
| 1211 | string targetVersion = 2; |
| 1212 | } |
| 1213 | |
| 1214 | message AuthEnableRequest { |
| 1215 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1216 | } |
| 1217 | |
| 1218 | message AuthDisableRequest { |
| 1219 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1220 | } |
| 1221 | |
| 1222 | message AuthStatusRequest { |
| 1223 | option (versionpb.etcd_version_msg) = "3.5"; |
| 1224 | } |
| 1225 | |
| 1226 | message AuthenticateRequest { |
| 1227 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1228 | |
| 1229 | string name = 1; |
| 1230 | string password = 2; |
| 1231 | } |
| 1232 | |
| 1233 | message AuthUserAddRequest { |
| 1234 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1235 | |
| 1236 | string name = 1; |
| 1237 | string password = 2; |
| 1238 | authpb.UserAddOptions options = 3 [(versionpb.etcd_version_field)="3.4"]; |
| 1239 | string hashedPassword = 4 [(versionpb.etcd_version_field)="3.5"]; |
| 1240 | } |
| 1241 | |
| 1242 | message AuthUserGetRequest { |
| 1243 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1244 | |
| 1245 | string name = 1; |
| 1246 | } |
| 1247 | |
| 1248 | message AuthUserDeleteRequest { |
| 1249 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1250 | // name is the name of the user to delete. |
| 1251 | string name = 1; |
| 1252 | } |
| 1253 | |
| 1254 | message AuthUserChangePasswordRequest { |
| 1255 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1256 | |
| 1257 | // name is the name of the user whose password is being changed. |
| 1258 | string name = 1; |
| 1259 | // password is the new password for the user. Note that this field will be removed in the API layer. |
| 1260 | string password = 2; |
| 1261 | // hashedPassword is the new password for the user. Note that this field will be initialized in the API layer. |
| 1262 | string hashedPassword = 3 [(versionpb.etcd_version_field)="3.5"]; |
| 1263 | } |
| 1264 | |
| 1265 | message AuthUserGrantRoleRequest { |
| 1266 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1267 | |
| 1268 | // user is the name of the user which should be granted a given role. |
| 1269 | string user = 1; |
| 1270 | // role is the name of the role to grant to the user. |
| 1271 | string role = 2; |
| 1272 | } |
| 1273 | |
| 1274 | message AuthUserRevokeRoleRequest { |
| 1275 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1276 | |
| 1277 | string name = 1; |
| 1278 | string role = 2; |
| 1279 | } |
| 1280 | |
| 1281 | message AuthRoleAddRequest { |
| 1282 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1283 | |
| 1284 | // name is the name of the role to add to the authentication system. |
| 1285 | string name = 1; |
| 1286 | } |
| 1287 | |
| 1288 | message AuthRoleGetRequest { |
| 1289 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1290 | |
| 1291 | string role = 1; |
| 1292 | } |
| 1293 | |
| 1294 | message AuthUserListRequest { |
| 1295 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1296 | } |
| 1297 | |
| 1298 | message AuthRoleListRequest { |
| 1299 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1300 | } |
| 1301 | |
| 1302 | message AuthRoleDeleteRequest { |
| 1303 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1304 | |
| 1305 | string role = 1; |
| 1306 | } |
| 1307 | |
| 1308 | message AuthRoleGrantPermissionRequest { |
| 1309 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1310 | |
| 1311 | // name is the name of the role which will be granted the permission. |
| 1312 | string name = 1; |
| 1313 | // perm is the permission to grant to the role. |
| 1314 | authpb.Permission perm = 2; |
| 1315 | } |
| 1316 | |
| 1317 | message AuthRoleRevokePermissionRequest { |
| 1318 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1319 | |
| 1320 | string role = 1; |
| 1321 | bytes key = 2; |
| 1322 | bytes range_end = 3; |
| 1323 | } |
| 1324 | |
| 1325 | message AuthEnableResponse { |
| 1326 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1327 | |
| 1328 | ResponseHeader header = 1; |
| 1329 | } |
| 1330 | |
| 1331 | message AuthDisableResponse { |
| 1332 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1333 | |
| 1334 | ResponseHeader header = 1; |
| 1335 | } |
| 1336 | |
| 1337 | message AuthStatusResponse { |
| 1338 | option (versionpb.etcd_version_msg) = "3.5"; |
| 1339 | |
| 1340 | ResponseHeader header = 1; |
| 1341 | bool enabled = 2; |
| 1342 | // authRevision is the current revision of auth store |
| 1343 | uint64 authRevision = 3; |
| 1344 | } |
| 1345 | |
| 1346 | message AuthenticateResponse { |
| 1347 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1348 | |
| 1349 | ResponseHeader header = 1; |
| 1350 | // token is an authorized token that can be used in succeeding RPCs |
| 1351 | string token = 2; |
| 1352 | } |
| 1353 | |
| 1354 | message AuthUserAddResponse { |
| 1355 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1356 | |
| 1357 | ResponseHeader header = 1; |
| 1358 | } |
| 1359 | |
| 1360 | message AuthUserGetResponse { |
| 1361 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1362 | |
| 1363 | ResponseHeader header = 1; |
| 1364 | |
| 1365 | repeated string roles = 2; |
| 1366 | } |
| 1367 | |
| 1368 | message AuthUserDeleteResponse { |
| 1369 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1370 | |
| 1371 | ResponseHeader header = 1; |
| 1372 | } |
| 1373 | |
| 1374 | message AuthUserChangePasswordResponse { |
| 1375 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1376 | |
| 1377 | ResponseHeader header = 1; |
| 1378 | } |
| 1379 | |
| 1380 | message AuthUserGrantRoleResponse { |
| 1381 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1382 | |
| 1383 | ResponseHeader header = 1; |
| 1384 | } |
| 1385 | |
| 1386 | message AuthUserRevokeRoleResponse { |
| 1387 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1388 | |
| 1389 | ResponseHeader header = 1; |
| 1390 | } |
| 1391 | |
| 1392 | message AuthRoleAddResponse { |
| 1393 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1394 | |
| 1395 | ResponseHeader header = 1; |
| 1396 | } |
| 1397 | |
| 1398 | message AuthRoleGetResponse { |
| 1399 | ResponseHeader header = 1 [(versionpb.etcd_version_field)="3.0"]; |
| 1400 | |
| 1401 | repeated authpb.Permission perm = 2 [(versionpb.etcd_version_field)="3.0"]; |
| 1402 | } |
| 1403 | |
| 1404 | message AuthRoleListResponse { |
| 1405 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1406 | |
| 1407 | ResponseHeader header = 1; |
| 1408 | |
| 1409 | repeated string roles = 2; |
| 1410 | } |
| 1411 | |
| 1412 | message AuthUserListResponse { |
| 1413 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1414 | |
| 1415 | ResponseHeader header = 1; |
| 1416 | |
| 1417 | repeated string users = 2; |
| 1418 | } |
| 1419 | |
| 1420 | message AuthRoleDeleteResponse { |
| 1421 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1422 | |
| 1423 | ResponseHeader header = 1; |
| 1424 | } |
| 1425 | |
| 1426 | message AuthRoleGrantPermissionResponse { |
| 1427 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1428 | |
| 1429 | ResponseHeader header = 1; |
| 1430 | } |
| 1431 | |
| 1432 | message AuthRoleRevokePermissionResponse { |
| 1433 | option (versionpb.etcd_version_msg) = "3.0"; |
| 1434 | |
| 1435 | ResponseHeader header = 1; |
| 1436 | } |