| 1 |
syntax = "proto3"; |
| 2 |
package etcdserverpb; |
| 3 |
|
| 4 |
import "gogoproto/gogo.proto"; |
| 5 |
import "etcd/mvcc/mvccpb/kv.proto"; |
| 6 |
import "etcd/auth/authpb/auth.proto"; |
| 7 |
|
| 8 |
// for grpc-gateway |
| 9 |
import "google/api/annotations.proto"; |
| 10 |
|
| 11 |
option (gogoproto.marshaler_all) = true; |
| 12 |
option (gogoproto.unmarshaler_all) = true; |
| 13 |
|
| 14 |
service KV { |
| 15 |
// Range gets the keys in the range from the key-value store. |
| 16 |
rpc Range(RangeRequest) returns (RangeResponse) { |
| 17 |
option (google.api.http) = { |
| 18 |
post: "/v3beta/kv/range" |
| 19 |
body: "*" |
| 20 |
}; |
| 21 |
} |
| 22 |
|
| 23 |
// Put puts the given key into the key-value store. |
| 24 |
// A put request increments the revision of the key-value store |
| 25 |
// and generates one event in the event history. |
| 26 |
rpc Put(PutRequest) returns (PutResponse) { |
| 27 |
option (google.api.http) = { |
| 28 |
post: "/v3beta/kv/put" |
| 29 |
body: "*" |
| 30 |
}; |
| 31 |
} |
| 32 |
|
| 33 |
// DeleteRange deletes the given range from the key-value store. |
| 34 |
// A delete request increments the revision of the key-value store |
| 35 |
// and generates a delete event in the event history for every deleted key. |
| 36 |
rpc DeleteRange(DeleteRangeRequest) returns (DeleteRangeResponse) { |
| 37 |
option (google.api.http) = { |
| 38 |
post: "/v3beta/kv/deleterange" |
| 39 |
body: "*" |
| 40 |
}; |
| 41 |
} |
| 42 |
|
| 43 |
// Txn processes multiple requests in a single transaction. |
| 44 |
// A txn request increments the revision of the key-value store |
| 45 |
// and generates events with the same revision for every completed request. |
| 46 |
// It is not allowed to modify the same key several times within one txn. |
| 47 |
rpc Txn(TxnRequest) returns (TxnResponse) { |
| 48 |
option (google.api.http) = { |
| 49 |
post: "/v3beta/kv/txn" |
| 50 |
body: "*" |
| 51 |
}; |
| 52 |
} |
| 53 |
|
| 54 |
// Compact compacts the event history in the etcd key-value store. The key-value |
| 55 |
// store should be periodically compacted or the event history will continue to grow |
| 56 |
// indefinitely. |
| 57 |
rpc Compact(CompactionRequest) returns (CompactionResponse) { |
| 58 |
option (google.api.http) = { |
| 59 |
post: "/v3beta/kv/compaction" |
| 60 |
body: "*" |
| 61 |
}; |
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
service Watch { |
| 66 |
// Watch watches for events happening or that have happened. Both input and output |
| 67 |
// are streams; the input stream is for creating and canceling watchers and the output |
| 68 |
// stream sends events. One watch RPC can watch on multiple key ranges, streaming events |
| 69 |
// for several watches at once. The entire event history can be watched starting from the |
| 70 |
// last compaction revision. |
| 71 |
rpc Watch(stream WatchRequest) returns (stream WatchResponse) { |
| 72 |
option (google.api.http) = { |
| 73 |
post: "/v3beta/watch" |
| 74 |
body: "*" |
| 75 |
}; |
| 76 |
} |
| 77 |
} |
| 78 |
|
| 79 |
service Lease { |
| 80 |
// LeaseGrant creates a lease which expires if the server does not receive a keepAlive |
| 81 |
// within a given time to live period. All keys attached to the lease will be expired and |
| 82 |
// deleted if the lease expires. Each expired key generates a delete event in the event history. |
| 83 |
rpc LeaseGrant(LeaseGrantRequest) returns (LeaseGrantResponse) { |
| 84 |
option (google.api.http) = { |
| 85 |
post: "/v3beta/lease/grant" |
| 86 |
body: "*" |
| 87 |
}; |
| 88 |
} |
| 89 |
|
| 90 |
// LeaseRevoke revokes a lease. All keys attached to the lease will expire and be deleted. |
| 91 |
rpc LeaseRevoke(LeaseRevokeRequest) returns (LeaseRevokeResponse) { |
| 92 |
option (google.api.http) = { |
| 93 |
post: "/v3beta/kv/lease/revoke" |
| 94 |
body: "*" |
| 95 |
}; |
| 96 |
} |
| 97 |
|
| 98 |
// LeaseKeepAlive keeps the lease alive by streaming keep alive requests from the client |
| 99 |
// to the server and streaming keep alive responses from the server to the client. |
| 100 |
rpc LeaseKeepAlive(stream LeaseKeepAliveRequest) returns (stream LeaseKeepAliveResponse) { |
| 101 |
option (google.api.http) = { |
| 102 |
post: "/v3beta/lease/keepalive" |
| 103 |
body: "*" |
| 104 |
}; |
| 105 |
} |
| 106 |
|
| 107 |
// LeaseTimeToLive retrieves lease information. |
| 108 |
rpc LeaseTimeToLive(LeaseTimeToLiveRequest) returns (LeaseTimeToLiveResponse) { |
| 109 |
option (google.api.http) = { |
| 110 |
post: "/v3beta/kv/lease/timetolive" |
| 111 |
body: "*" |
| 112 |
}; |
| 113 |
} |
| 114 |
|
| 115 |
// LeaseLeases lists all existing leases. |
| 116 |
rpc LeaseLeases(LeaseLeasesRequest) returns (LeaseLeasesResponse) { |
| 117 |
option (google.api.http) = { |
| 118 |
post: "/v3beta/kv/lease/leases" |
| 119 |
body: "*" |
| 120 |
}; |
| 121 |
} |
| 122 |
} |
| 123 |
|
| 124 |
service Cluster { |
| 125 |
// MemberAdd adds a member into the cluster. |
| 126 |
rpc MemberAdd(MemberAddRequest) returns (MemberAddResponse) { |
| 127 |
option (google.api.http) = { |
| 128 |
post: "/v3beta/cluster/member/add" |
| 129 |
body: "*" |
| 130 |
}; |
| 131 |
} |
| 132 |
|
| 133 |
// MemberRemove removes an existing member from the cluster. |
| 134 |
rpc MemberRemove(MemberRemoveRequest) returns (MemberRemoveResponse) { |
| 135 |
option (google.api.http) = { |
| 136 |
post: "/v3beta/cluster/member/remove" |
| 137 |
body: "*" |
| 138 |
}; |
| 139 |
} |
| 140 |
|
| 141 |
// MemberUpdate updates the member configuration. |
| 142 |
rpc MemberUpdate(MemberUpdateRequest) returns (MemberUpdateResponse) { |
| 143 |
option (google.api.http) = { |
| 144 |
post: "/v3beta/cluster/member/update" |
| 145 |
body: "*" |
| 146 |
}; |
| 147 |
} |
| 148 |
|
| 149 |
// MemberList lists all the members in the cluster. |
| 150 |
rpc MemberList(MemberListRequest) returns (MemberListResponse) { |
| 151 |
option (google.api.http) = { |
| 152 |
post: "/v3beta/cluster/member/list" |
| 153 |
body: "*" |
| 154 |
}; |
| 155 |
} |
| 156 |
} |
| 157 |
|
| 158 |
service Maintenance { |
| 159 |
// Alarm activates, deactivates, and queries alarms regarding cluster health. |
| 160 |
rpc Alarm(AlarmRequest) returns (AlarmResponse) { |
| 161 |
option (google.api.http) = { |
| 162 |
post: "/v3beta/maintenance/alarm" |
| 163 |
body: "*" |
| 164 |
}; |
| 165 |
} |
| 166 |
|
| 167 |
// Status gets the status of the member. |
| 168 |
rpc Status(StatusRequest) returns (StatusResponse) { |
| 169 |
option (google.api.http) = { |
| 170 |
post: "/v3beta/maintenance/status" |
| 171 |
body: "*" |
| 172 |
}; |
| 173 |
} |
| 174 |
|
| 175 |
// Defragment defragments a member's backend database to recover storage space. |
| 176 |
rpc Defragment(DefragmentRequest) returns (DefragmentResponse) { |
| 177 |
option (google.api.http) = { |
| 178 |
post: "/v3beta/maintenance/defragment" |
| 179 |
body: "*" |
| 180 |
}; |
| 181 |
} |
| 182 |
|
| 183 |
// Hash computes the hash of the KV's backend. |
| 184 |
// This is designed for testing; do not use this in production when there |
| 185 |
// are ongoing transactions. |
| 186 |
rpc Hash(HashRequest) returns (HashResponse) { |
| 187 |
option (google.api.http) = { |
| 188 |
post: "/v3beta/maintenance/hash" |
| 189 |
body: "*" |
| 190 |
}; |
| 191 |
} |
| 192 |
|
| 193 |
// HashKV computes the hash of all MVCC keys up to a given revision. |
| 194 |
rpc HashKV(HashKVRequest) returns (HashKVResponse) { |
| 195 |
option (google.api.http) = { |
| 196 |
post: "/v3beta/maintenance/hash" |
| 197 |
body: "*" |
| 198 |
}; |
| 199 |
} |
| 200 |
|
| 201 |
// Snapshot sends a snapshot of the entire backend from a member over a stream to a client. |
| 202 |
rpc Snapshot(SnapshotRequest) returns (stream SnapshotResponse) { |
| 203 |
option (google.api.http) = { |
| 204 |
post: "/v3beta/maintenance/snapshot" |
| 205 |
body: "*" |
| 206 |
}; |
| 207 |
} |
| 208 |
|
| 209 |
// MoveLeader requests current leader node to transfer its leadership to transferee. |
| 210 |
rpc MoveLeader(MoveLeaderRequest) returns (MoveLeaderResponse) { |
| 211 |
option (google.api.http) = { |
| 212 |
post: "/v3beta/maintenance/transfer-leadership" |
| 213 |
body: "*" |
| 214 |
}; |
| 215 |
} |
| 216 |
} |
| 217 |
|
| 218 |
service Auth { |
| 219 |
// AuthEnable enables authentication. |
| 220 |
rpc AuthEnable(AuthEnableRequest) returns (AuthEnableResponse) { |
| 221 |
option (google.api.http) = { |
| 222 |
post: "/v3beta/auth/enable" |
| 223 |
body: "*" |
| 224 |
}; |
| 225 |
} |
| 226 |
|
| 227 |
// AuthDisable disables authentication. |
| 228 |
rpc AuthDisable(AuthDisableRequest) returns (AuthDisableResponse) { |
| 229 |
option (google.api.http) = { |
| 230 |
post: "/v3beta/auth/disable" |
| 231 |
body: "*" |
| 232 |
}; |
| 233 |
} |
| 234 |
|
| 235 |
// Authenticate processes an authenticate request. |
| 236 |
rpc Authenticate(AuthenticateRequest) returns (AuthenticateResponse) { |
| 237 |
option (google.api.http) = { |
| 238 |
post: "/v3beta/auth/authenticate" |
| 239 |
body: "*" |
| 240 |
}; |
| 241 |
} |
| 242 |
|
| 243 |
// UserAdd adds a new user. |
| 244 |
rpc UserAdd(AuthUserAddRequest) returns (AuthUserAddResponse) { |
| 245 |
option (google.api.http) = { |
| 246 |
post: "/v3beta/auth/user/add" |
| 247 |
body: "*" |
| 248 |
}; |
| 249 |
} |
| 250 |
|
| 251 |
// UserGet gets detailed user information. |
| 252 |
rpc UserGet(AuthUserGetRequest) returns (AuthUserGetResponse) { |
| 253 |
option (google.api.http) = { |
| 254 |
post: "/v3beta/auth/user/get" |
| 255 |
body: "*" |
| 256 |
}; |
| 257 |
} |
| 258 |
|
| 259 |
// UserList gets a list of all users. |
| 260 |
rpc UserList(AuthUserListRequest) returns (AuthUserListResponse) { |
| 261 |
option (google.api.http) = { |
| 262 |
post: "/v3beta/auth/user/list" |
| 263 |
body: "*" |
| 264 |
}; |
| 265 |
} |
| 266 |
|
| 267 |
// UserDelete deletes a specified user. |
| 268 |
rpc UserDelete(AuthUserDeleteRequest) returns (AuthUserDeleteResponse) { |
| 269 |
option (google.api.http) = { |
| 270 |
post: "/v3beta/auth/user/delete" |
| 271 |
body: "*" |
| 272 |
}; |
| 273 |
} |
| 274 |
|
| 275 |
// UserChangePassword changes the password of a specified user. |
| 276 |
rpc UserChangePassword(AuthUserChangePasswordRequest) returns (AuthUserChangePasswordResponse) { |
| 277 |
option (google.api.http) = { |
| 278 |
post: "/v3beta/auth/user/changepw" |
| 279 |
body: "*" |
| 280 |
}; |
| 281 |
} |
| 282 |
|
| 283 |
// UserGrant grants a role to a specified user. |
| 284 |
rpc UserGrantRole(AuthUserGrantRoleRequest) returns (AuthUserGrantRoleResponse) { |
| 285 |
option (google.api.http) = { |
| 286 |
post: "/v3beta/auth/user/grant" |
| 287 |
body: "*" |
| 288 |
}; |
| 289 |
} |
| 290 |
|
| 291 |
// UserRevokeRole revokes a role of specified user. |
| 292 |
rpc UserRevokeRole(AuthUserRevokeRoleRequest) returns (AuthUserRevokeRoleResponse) { |
| 293 |
option (google.api.http) = { |
| 294 |
post: "/v3beta/auth/user/revoke" |
| 295 |
body: "*" |
| 296 |
}; |
| 297 |
} |
| 298 |
|
| 299 |
// RoleAdd adds a new role. |
| 300 |
rpc RoleAdd(AuthRoleAddRequest) returns (AuthRoleAddResponse) { |
| 301 |
option (google.api.http) = { |
| 302 |
post: "/v3beta/auth/role/add" |
| 303 |
body: "*" |
| 304 |
}; |
| 305 |
} |
| 306 |
|
| 307 |
// RoleGet gets detailed role information. |
| 308 |
rpc RoleGet(AuthRoleGetRequest) returns (AuthRoleGetResponse) { |
| 309 |
option (google.api.http) = { |
| 310 |
post: "/v3beta/auth/role/get" |
| 311 |
body: "*" |
| 312 |
}; |
| 313 |
} |
| 314 |
|
| 315 |
// RoleList gets lists of all roles. |
| 316 |
rpc RoleList(AuthRoleListRequest) returns (AuthRoleListResponse) { |
| 317 |
option (google.api.http) = { |
| 318 |
post: "/v3beta/auth/role/list" |
| 319 |
body: "*" |
| 320 |
}; |
| 321 |
} |
| 322 |
|
| 323 |
// RoleDelete deletes a specified role. |
| 324 |
rpc RoleDelete(AuthRoleDeleteRequest) returns (AuthRoleDeleteResponse) { |
| 325 |
option (google.api.http) = { |
| 326 |
post: "/v3beta/auth/role/delete" |
| 327 |
body: "*" |
| 328 |
}; |
| 329 |
} |
| 330 |
|
| 331 |
// RoleGrantPermission grants a permission of a specified key or range to a specified role. |
| 332 |
rpc RoleGrantPermission(AuthRoleGrantPermissionRequest) returns (AuthRoleGrantPermissionResponse) { |
| 333 |
option (google.api.http) = { |
| 334 |
post: "/v3beta/auth/role/grant" |
| 335 |
body: "*" |
| 336 |
}; |
| 337 |
} |
| 338 |
|
| 339 |
// RoleRevokePermission revokes a key or range permission of a specified role. |
| 340 |
rpc RoleRevokePermission(AuthRoleRevokePermissionRequest) returns (AuthRoleRevokePermissionResponse) { |
| 341 |
option (google.api.http) = { |
| 342 |
post: "/v3beta/auth/role/revoke" |
| 343 |
body: "*" |
| 344 |
}; |
| 345 |
} |
| 346 |
} |
| 347 |
|
| 348 |
message ResponseHeader { |
| 349 |
// cluster_id is the ID of the cluster which sent the response. |
| 350 |
uint64 cluster_id = 1; |
| 351 |
// member_id is the ID of the member which sent the response. |
| 352 |
uint64 member_id = 2; |
| 353 |
// revision is the key-value store revision when the request was applied. |
| 354 |
int64 revision = 3; |
| 355 |
// raft_term is the raft term when the request was applied. |
| 356 |
uint64 raft_term = 4; |
| 357 |
} |
| 358 |
|
| 359 |
message RangeRequest { |
| 360 |
enum SortOrder { |
| 361 |
NONE = 0; // default, no sorting |
| 362 |
ASCEND = 1; // lowest target value first |
| 363 |
DESCEND = 2; // highest target value first |
| 364 |
} |
| 365 |
enum SortTarget { |
| 366 |
KEY = 0; |
| 367 |
VERSION = 1; |
| 368 |
CREATE = 2; |
| 369 |
MOD = 3; |
| 370 |
VALUE = 4; |
| 371 |
} |
| 372 |
|
| 373 |
// key is the first key for the range. If range_end is not given, the request only looks up key. |
| 374 |
bytes key = 1; |
| 375 |
// range_end is the upper bound on the requested range [key, range_end). |
| 376 |
// If range_end is '\0', the range is all keys >= key. |
| 377 |
// If range_end is key plus one (e.g., "aa"+1 == "ab", "a\xff"+1 == "b"), |
| 378 |
// then the range request gets all keys prefixed with key. |
| 379 |
// If both key and range_end are '\0', then the range request returns all keys. |
| 380 |
bytes range_end = 2; |
| 381 |
// limit is a limit on the number of keys returned for the request. When limit is set to 0, |
| 382 |
// it is treated as no limit. |
| 383 |
int64 limit = 3; |
| 384 |
// revision is the point-in-time of the key-value store to use for the range. |
| 385 |
// If revision is less or equal to zero, the range is over the newest key-value store. |
| 386 |
// If the revision has been compacted, ErrCompacted is returned as a response. |
| 387 |
int64 revision = 4; |
| 388 |
|
| 389 |
// sort_order is the order for returned sorted results. |
| 390 |
SortOrder sort_order = 5; |
| 391 |
|
| 392 |
// sort_target is the key-value field to use for sorting. |
| 393 |
SortTarget sort_target = 6; |
| 394 |
|
| 395 |
// serializable sets the range request to use serializable member-local reads. |
| 396 |
// Range requests are linearizable by default; linearizable requests have higher |
| 397 |
// latency and lower throughput than serializable requests but reflect the current |
| 398 |
// consensus of the cluster. For better performance, in exchange for possible stale reads, |
| 399 |
// a serializable range request is served locally without needing to reach consensus |
| 400 |
// with other nodes in the cluster. |
| 401 |
bool serializable = 7; |
| 402 |
|
| 403 |
// keys_only when set returns only the keys and not the values. |
| 404 |
bool keys_only = 8; |
| 405 |
|
| 406 |
// count_only when set returns only the count of the keys in the range. |
| 407 |
bool count_only = 9; |
| 408 |
|
| 409 |
// min_mod_revision is the lower bound for returned key mod revisions; all keys with |
| 410 |
// lesser mod revisions will be filtered away. |
| 411 |
int64 min_mod_revision = 10; |
| 412 |
|
| 413 |
// max_mod_revision is the upper bound for returned key mod revisions; all keys with |
| 414 |
// greater mod revisions will be filtered away. |
| 415 |
int64 max_mod_revision = 11; |
| 416 |
|
| 417 |
// min_create_revision is the lower bound for returned key create revisions; all keys with |
| 418 |
// lesser create trevisions will be filtered away. |
| 419 |
int64 min_create_revision = 12; |
| 420 |
|
| 421 |
// max_create_revision is the upper bound for returned key create revisions; all keys with |
| 422 |
// greater create revisions will be filtered away. |
| 423 |
int64 max_create_revision = 13; |
| 424 |
} |
| 425 |
|
| 426 |
message RangeResponse { |
| 427 |
ResponseHeader header = 1; |
| 428 |
// kvs is the list of key-value pairs matched by the range request. |
| 429 |
// kvs is empty when count is requested. |
| 430 |
repeated mvccpb.KeyValue kvs = 2; |
| 431 |
// more indicates if there are more keys to return in the requested range. |
| 432 |
bool more = 3; |
| 433 |
// count is set to the number of keys within the range when requested. |
| 434 |
int64 count = 4; |
| 435 |
} |
| 436 |
|
| 437 |
message PutRequest { |
| 438 |
// key is the key, in bytes, to put into the key-value store. |
| 439 |
bytes key = 1; |
| 440 |
// value is the value, in bytes, to associate with the key in the key-value store. |
| 441 |
bytes value = 2; |
| 442 |
// lease is the lease ID to associate with the key in the key-value store. A lease |
| 443 |
// value of 0 indicates no lease. |
| 444 |
int64 lease = 3; |
| 445 |
|
| 446 |
// If prev_kv is set, etcd gets the previous key-value pair before changing it. |
| 447 |
// The previous key-value pair will be returned in the put response. |
| 448 |
bool prev_kv = 4; |
| 449 |
|
| 450 |
// If ignore_value is set, etcd updates the key using its current value. |
| 451 |
// Returns an error if the key does not exist. |
| 452 |
bool ignore_value = 5; |
| 453 |
|
| 454 |
// If ignore_lease is set, etcd updates the key using its current lease. |
| 455 |
// Returns an error if the key does not exist. |
| 456 |
bool ignore_lease = 6; |
| 457 |
} |
| 458 |
|
| 459 |
message PutResponse { |
| 460 |
ResponseHeader header = 1; |
| 461 |
// if prev_kv is set in the request, the previous key-value pair will be returned. |
| 462 |
mvccpb.KeyValue prev_kv = 2; |
| 463 |
} |
| 464 |
|
| 465 |
message DeleteRangeRequest { |
| 466 |
// key is the first key to delete in the range. |
| 467 |
bytes key = 1; |
| 468 |
// range_end is the key following the last key to delete for the range [key, range_end). |
| 469 |
// If range_end is not given, the range is defined to contain only the key argument. |
| 470 |
// If range_end is one bit larger than the given key, then the range is all the keys |
| 471 |
// with the prefix (the given key). |
| 472 |
// If range_end is '\0', the range is all keys greater than or equal to the key argument. |
| 473 |
bytes range_end = 2; |
| 474 |
|
| 475 |
// If prev_kv is set, etcd gets the previous key-value pairs before deleting it. |
| 476 |
// The previous key-value pairs will be returned in the delete response. |
| 477 |
bool prev_kv = 3; |
| 478 |
} |
| 479 |
|
| 480 |
message DeleteRangeResponse { |
| 481 |
ResponseHeader header = 1; |
| 482 |
// deleted is the number of keys deleted by the delete range request. |
| 483 |
int64 deleted = 2; |
| 484 |
// if prev_kv is set in the request, the previous key-value pairs will be returned. |
| 485 |
repeated mvccpb.KeyValue prev_kvs = 3; |
| 486 |
} |
| 487 |
|
| 488 |
message RequestOp { |
| 489 |
// request is a union of request types accepted by a transaction. |
| 490 |
oneof request { |
| 491 |
RangeRequest request_range = 1; |
| 492 |
PutRequest request_put = 2; |
| 493 |
DeleteRangeRequest request_delete_range = 3; |
| 494 |
TxnRequest request_txn = 4; |
| 495 |
} |
| 496 |
} |
| 497 |
|
| 498 |
message ResponseOp { |
| 499 |
// response is a union of response types returned by a transaction. |
| 500 |
oneof response { |
| 501 |
RangeResponse response_range = 1; |
| 502 |
PutResponse response_put = 2; |
| 503 |
DeleteRangeResponse response_delete_range = 3; |
| 504 |
TxnResponse response_txn = 4; |
| 505 |
} |
| 506 |
} |
| 507 |
|
| 508 |
message Compare { |
| 509 |
enum CompareResult { |
| 510 |
EQUAL = 0; |
| 511 |
GREATER = 1; |
| 512 |
LESS = 2; |
| 513 |
NOT_EQUAL = 3; |
| 514 |
} |
| 515 |
enum CompareTarget { |
| 516 |
VERSION = 0; |
| 517 |
CREATE = 1; |
| 518 |
MOD = 2; |
| 519 |
VALUE= 3; |
| 520 |
LEASE = 4; |
| 521 |
} |
| 522 |
// result is logical comparison operation for this comparison. |
| 523 |
CompareResult result = 1; |
| 524 |
// target is the key-value field to inspect for the comparison. |
| 525 |
CompareTarget target = 2; |
| 526 |
// key is the subject key for the comparison operation. |
| 527 |
bytes key = 3; |
| 528 |
oneof target_union { |
| 529 |
// version is the version of the given key |
| 530 |
int64 version = 4; |
| 531 |
// create_revision is the creation revision of the given key |
| 532 |
int64 create_revision = 5; |
| 533 |
// mod_revision is the last modified revision of the given key. |
| 534 |
int64 mod_revision = 6; |
| 535 |
// value is the value of the given key, in bytes. |
| 536 |
bytes value = 7; |
| 537 |
// lease is the lease id of the given key. |
| 538 |
int64 lease = 8; |
| 539 |
// leave room for more target_union field tags, jump to 64 |
| 540 |
} |
| 541 |
|
| 542 |
// range_end compares the given target to all keys in the range [key, range_end). |
| 543 |
// See RangeRequest for more details on key ranges. |
| 544 |
bytes range_end = 64; |
| 545 |
// TODO: fill out with most of the rest of RangeRequest fields when needed. |
| 546 |
} |
| 547 |
|
| 548 |
// From google paxosdb paper: |
| 549 |
// Our implementation hinges around a powerful primitive which we call MultiOp. All other database |
| 550 |
// operations except for iteration are implemented as a single call to MultiOp. A MultiOp is applied atomically |
| 551 |
// and consists of three components: |
| 552 |
// 1. A list of tests called guard. Each test in guard checks a single entry in the database. It may check |
| 553 |
// for the absence or presence of a value, or compare with a given value. Two different tests in the guard |
| 554 |
// may apply to the same or different entries in the database. All tests in the guard are applied and |
| 555 |
// MultiOp returns the results. If all tests are true, MultiOp executes t op (see item 2 below), otherwise |
| 556 |
// it executes f op (see item 3 below). |
| 557 |
// 2. A list of database operations called t op. Each operation in the list is either an insert, delete, or |
| 558 |
// lookup operation, and applies to a single database entry. Two different operations in the list may apply |
| 559 |
// to the same or different entries in the database. These operations are executed |
| 560 |
// if guard evaluates to |
| 561 |
// true. |
| 562 |
// 3. A list of database operations called f op. Like t op, but executed if guard evaluates to false. |
| 563 |
message TxnRequest { |
| 564 |
// compare is a list of predicates representing a conjunction of terms. |
| 565 |
// If the comparisons succeed, then the success requests will be processed in order, |
| 566 |
// and the response will contain their respective responses in order. |
| 567 |
// If the comparisons fail, then the failure requests will be processed in order, |
| 568 |
// and the response will contain their respective responses in order. |
| 569 |
repeated Compare compare = 1; |
| 570 |
// success is a list of requests which will be applied when compare evaluates to true. |
| 571 |
repeated RequestOp success = 2; |
| 572 |
// failure is a list of requests which will be applied when compare evaluates to false. |
| 573 |
repeated RequestOp failure = 3; |
| 574 |
} |
| 575 |
|
| 576 |
message TxnResponse { |
| 577 |
ResponseHeader header = 1; |
| 578 |
// succeeded is set to true if the compare evaluated to true or false otherwise. |
| 579 |
bool succeeded = 2; |
| 580 |
// responses is a list of responses corresponding to the results from applying |
| 581 |
// success if succeeded is true or failure if succeeded is false. |
| 582 |
repeated ResponseOp responses = 3; |
| 583 |
} |
| 584 |
|
| 585 |
// CompactionRequest compacts the key-value store up to a given revision. All superseded keys |
| 586 |
// with a revision less than the compaction revision will be removed. |
| 587 |
message CompactionRequest { |
| 588 |
// revision is the key-value store revision for the compaction operation. |
| 589 |
int64 revision = 1; |
| 590 |
// physical is set so the RPC will wait until the compaction is physically |
| 591 |
// applied to the local database such that compacted entries are totally |
| 592 |
// removed from the backend database. |
| 593 |
bool physical = 2; |
| 594 |
} |
| 595 |
|
| 596 |
message CompactionResponse { |
| 597 |
ResponseHeader header = 1; |
| 598 |
} |
| 599 |
|
| 600 |
message HashRequest { |
| 601 |
} |
| 602 |
|
| 603 |
message HashKVRequest { |
| 604 |
// revision is the key-value store revision for the hash operation. |
| 605 |
int64 revision = 1; |
| 606 |
} |
| 607 |
|
| 608 |
message HashKVResponse { |
| 609 |
ResponseHeader header = 1; |
| 610 |
// hash is the hash value computed from the responding member's MVCC keys up to a given revision. |
| 611 |
uint32 hash = 2; |
| 612 |
// compact_revision is the compacted revision of key-value store when hash begins. |
| 613 |
int64 compact_revision = 3; |
| 614 |
} |
| 615 |
|
| 616 |
message HashResponse { |
| 617 |
ResponseHeader header = 1; |
| 618 |
// hash is the hash value computed from the responding member's KV's backend. |
| 619 |
uint32 hash = 2; |
| 620 |
} |
| 621 |
|
| 622 |
message SnapshotRequest { |
| 623 |
} |
| 624 |
|
| 625 |
message SnapshotResponse { |
| 626 |
// header has the current key-value store information. The first header in the snapshot |
| 627 |
// stream indicates the point in time of the snapshot. |
| 628 |
ResponseHeader header = 1; |
| 629 |
|
| 630 |
// remaining_bytes is the number of blob bytes to be sent after this message |
| 631 |
uint64 remaining_bytes = 2; |
| 632 |
|
| 633 |
// blob contains the next chunk of the snapshot in the snapshot stream. |
| 634 |
bytes blob = 3; |
| 635 |
} |
| 636 |
|
| 637 |
message WatchRequest { |
| 638 |
// request_union is a request to either create a new watcher or cancel an existing watcher. |
| 639 |
oneof request_union { |
| 640 |
WatchCreateRequest create_request = 1; |
| 641 |
WatchCancelRequest cancel_request = 2; |
| 642 |
} |
| 643 |
} |
| 644 |
|
| 645 |
message WatchCreateRequest { |
| 646 |
// key is the key to register for watching. |
| 647 |
bytes key = 1; |
| 648 |
// range_end is the end of the range [key, range_end) to watch. If range_end is not given, |
| 649 |
// only the key argument is watched. If range_end is equal to '\0', all keys greater than |
| 650 |
// or equal to the key argument are watched. |
| 651 |
// If the range_end is one bit larger than the given key, |
| 652 |
// then all keys with the prefix (the given key) will be watched. |
| 653 |
bytes range_end = 2; |
| 654 |
// start_revision is an optional revision to watch from (inclusive). No start_revision is "now". |
| 655 |
int64 start_revision = 3; |
| 656 |
// progress_notify is set so that the etcd server will periodically send a WatchResponse with |
| 657 |
// no events to the new watcher if there are no recent events. It is useful when clients |
| 658 |
// wish to recover a disconnected watcher starting from a recent known revision. |
| 659 |
// The etcd server may decide how often it will send notifications based on current load. |
| 660 |
bool progress_notify = 4; |
| 661 |
|
| 662 |
enum FilterType { |
| 663 |
// filter out put event. |
| 664 |
NOPUT = 0; |
| 665 |
// filter out delete event. |
| 666 |
NODELETE = 1; |
| 667 |
} |
| 668 |
// filters filter the events at server side before it sends back to the watcher. |
| 669 |
repeated FilterType filters = 5; |
| 670 |
|
| 671 |
// If prev_kv is set, created watcher gets the previous KV before the event happens. |
| 672 |
// If the previous KV is already compacted, nothing will be returned. |
| 673 |
bool prev_kv = 6; |
| 674 |
} |
| 675 |
|
| 676 |
message WatchCancelRequest { |
| 677 |
// watch_id is the watcher id to cancel so that no more events are transmitted. |
| 678 |
int64 watch_id = 1; |
| 679 |
} |
| 680 |
|
| 681 |
message WatchResponse { |
| 682 |
ResponseHeader header = 1; |
| 683 |
// watch_id is the ID of the watcher that corresponds to the response. |
| 684 |
int64 watch_id = 2; |
| 685 |
// created is set to true if the response is for a create watch request. |
| 686 |
// The client should record the watch_id and expect to receive events for |
| 687 |
// the created watcher from the same stream. |
| 688 |
// All events sent to the created watcher will attach with the same watch_id. |
| 689 |
bool created = 3; |
| 690 |
// canceled is set to true if the response is for a cancel watch request. |
| 691 |
// No further events will be sent to the canceled watcher. |
| 692 |
bool canceled = 4; |
| 693 |
// compact_revision is set to the minimum index if a watcher tries to watch |
| 694 |
// at a compacted index. |
| 695 |
// |
| 696 |
// This happens when creating a watcher at a compacted revision or the watcher cannot |
| 697 |
// catch up with the progress of the key-value store. |
| 698 |
// |
| 699 |
// The client should treat the watcher as canceled and should not try to create any |
| 700 |
// watcher with the same start_revision again. |
| 701 |
int64 compact_revision = 5; |
| 702 |
|
| 703 |
// cancel_reason indicates the reason for canceling the watcher. |
| 704 |
string cancel_reason = 6; |
| 705 |
|
| 706 |
repeated mvccpb.Event events = 11; |
| 707 |
} |
| 708 |
|
| 709 |
message LeaseGrantRequest { |
| 710 |
// TTL is the advisory time-to-live in seconds. Expired lease will return -1. |
| 711 |
int64 TTL = 1; |
| 712 |
// ID is the requested ID for the lease. If ID is set to 0, the lessor chooses an ID. |
| 713 |
int64 ID = 2; |
| 714 |
} |
| 715 |
|
| 716 |
message LeaseGrantResponse { |
| 717 |
ResponseHeader header = 1; |
| 718 |
// ID is the lease ID for the granted lease. |
| 719 |
int64 ID = 2; |
| 720 |
// TTL is the server chosen lease time-to-live in seconds. |
| 721 |
int64 TTL = 3; |
| 722 |
string error = 4; |
| 723 |
} |
| 724 |
|
| 725 |
message LeaseRevokeRequest { |
| 726 |
// ID is the lease ID to revoke. When the ID is revoked, all associated keys will be deleted. |
| 727 |
int64 ID = 1; |
| 728 |
} |
| 729 |
|
| 730 |
message LeaseRevokeResponse { |
| 731 |
ResponseHeader header = 1; |
| 732 |
} |
| 733 |
|
| 734 |
message LeaseKeepAliveRequest { |
| 735 |
// ID is the lease ID for the lease to keep alive. |
| 736 |
int64 ID = 1; |
| 737 |
} |
| 738 |
|
| 739 |
message LeaseKeepAliveResponse { |
| 740 |
ResponseHeader header = 1; |
| 741 |
// ID is the lease ID from the keep alive request. |
| 742 |
int64 ID = 2; |
| 743 |
// TTL is the new time-to-live for the lease. |
| 744 |
int64 TTL = 3; |
| 745 |
} |
| 746 |
|
| 747 |
message LeaseTimeToLiveRequest { |
| 748 |
// ID is the lease ID for the lease. |
| 749 |
int64 ID = 1; |
| 750 |
// keys is true to query all the keys attached to this lease. |
| 751 |
bool keys = 2; |
| 752 |
} |
| 753 |
|
| 754 |
message LeaseTimeToLiveResponse { |
| 755 |
ResponseHeader header = 1; |
| 756 |
// ID is the lease ID from the keep alive request. |
| 757 |
int64 ID = 2; |
| 758 |
// TTL is the remaining TTL in seconds for the lease; the lease will expire in under TTL+1 seconds. |
| 759 |
int64 TTL = 3; |
| 760 |
// GrantedTTL is the initial granted time in seconds upon lease creation/renewal. |
| 761 |
int64 grantedTTL = 4; |
| 762 |
// Keys is the list of keys attached to this lease. |
| 763 |
repeated bytes keys = 5; |
| 764 |
} |
| 765 |
|
| 766 |
message LeaseLeasesRequest { |
| 767 |
} |
| 768 |
|
| 769 |
message LeaseStatus { |
| 770 |
int64 ID = 1; |
| 771 |
// TODO: int64 TTL = 2; |
| 772 |
} |
| 773 |
|
| 774 |
message LeaseLeasesResponse { |
| 775 |
ResponseHeader header = 1; |
| 776 |
repeated LeaseStatus leases = 2; |
| 777 |
} |
| 778 |
|
| 779 |
message Member { |
| 780 |
// ID is the member ID for this member. |
| 781 |
uint64 ID = 1; |
| 782 |
// name is the human-readable name of the member. If the member is not started, the name will be an empty string. |
| 783 |
string name = 2; |
| 784 |
// peerURLs is the list of URLs the member exposes to the cluster for communication. |
| 785 |
repeated string peerURLs = 3; |
| 786 |
// clientURLs is the list of URLs the member exposes to clients for communication. If the member is not started, clientURLs will be empty. |
| 787 |
repeated string clientURLs = 4; |
| 788 |
} |
| 789 |
|
| 790 |
message MemberAddRequest { |
| 791 |
// peerURLs is the list of URLs the added member will use to communicate with the cluster. |
| 792 |
repeated string peerURLs = 1; |
| 793 |
} |
| 794 |
|
| 795 |
message MemberAddResponse { |
| 796 |
ResponseHeader header = 1; |
| 797 |
// member is the member information for the added member. |
| 798 |
Member member = 2; |
| 799 |
// members is a list of all members after adding the new member. |
| 800 |
repeated Member members = 3; |
| 801 |
} |
| 802 |
|
| 803 |
message MemberRemoveRequest { |
| 804 |
// ID is the member ID of the member to remove. |
| 805 |
uint64 ID = 1; |
| 806 |
} |
| 807 |
|
| 808 |
message MemberRemoveResponse { |
| 809 |
ResponseHeader header = 1; |
| 810 |
// members is a list of all members after removing the member. |
| 811 |
repeated Member members = 2; |
| 812 |
} |
| 813 |
|
| 814 |
message MemberUpdateRequest { |
| 815 |
// ID is the member ID of the member to update. |
| 816 |
uint64 ID = 1; |
| 817 |
// peerURLs is the new list of URLs the member will use to communicate with the cluster. |
| 818 |
repeated string peerURLs = 2; |
| 819 |
} |
| 820 |
|
| 821 |
message MemberUpdateResponse{ |
| 822 |
ResponseHeader header = 1; |
| 823 |
// members is a list of all members after updating the member. |
| 824 |
repeated Member members = 2; |
| 825 |
} |
| 826 |
|
| 827 |
message MemberListRequest { |
| 828 |
} |
| 829 |
|
| 830 |
message MemberListResponse { |
| 831 |
ResponseHeader header = 1; |
| 832 |
// members is a list of all members associated with the cluster. |
| 833 |
repeated Member members = 2; |
| 834 |
} |
| 835 |
|
| 836 |
message DefragmentRequest { |
| 837 |
} |
| 838 |
|
| 839 |
message DefragmentResponse { |
| 840 |
ResponseHeader header = 1; |
| 841 |
} |
| 842 |
|
| 843 |
message MoveLeaderRequest { |
| 844 |
// targetID is the node ID for the new leader. |
| 845 |
uint64 targetID = 1; |
| 846 |
} |
| 847 |
|
| 848 |
message MoveLeaderResponse { |
| 849 |
ResponseHeader header = 1; |
| 850 |
} |
| 851 |
|
| 852 |
enum AlarmType { |
| 853 |
NONE = 0; // default, used to query if any alarm is active |
| 854 |
NOSPACE = 1; // space quota is exhausted |
| 855 |
CORRUPT = 2; // kv store corruption detected |
| 856 |
} |
| 857 |
|
| 858 |
message AlarmRequest { |
| 859 |
enum AlarmAction { |
| 860 |
GET = 0; |
| 861 |
ACTIVATE = 1; |
| 862 |
DEACTIVATE = 2; |
| 863 |
} |
| 864 |
// action is the kind of alarm request to issue. The action |
| 865 |
// may GET alarm statuses, ACTIVATE an alarm, or DEACTIVATE a |
| 866 |
// raised alarm. |
| 867 |
AlarmAction action = 1; |
| 868 |
// memberID is the ID of the member associated with the alarm. If memberID is 0, the |
| 869 |
// alarm request covers all members. |
| 870 |
uint64 memberID = 2; |
| 871 |
// alarm is the type of alarm to consider for this request. |
| 872 |
AlarmType alarm = 3; |
| 873 |
} |
| 874 |
|
| 875 |
message AlarmMember { |
| 876 |
// memberID is the ID of the member associated with the raised alarm. |
| 877 |
uint64 memberID = 1; |
| 878 |
// alarm is the type of alarm which has been raised. |
| 879 |
AlarmType alarm = 2; |
| 880 |
} |
| 881 |
|
| 882 |
message AlarmResponse { |
| 883 |
ResponseHeader header = 1; |
| 884 |
// alarms is a list of alarms associated with the alarm request. |
| 885 |
repeated AlarmMember alarms = 2; |
| 886 |
} |
| 887 |
|
| 888 |
message StatusRequest { |
| 889 |
} |
| 890 |
|
| 891 |
message StatusResponse { |
| 892 |
ResponseHeader header = 1; |
| 893 |
// version is the cluster protocol version used by the responding member. |
| 894 |
string version = 2; |
| 895 |
// dbSize is the size of the backend database, in bytes, of the responding member. |
| 896 |
int64 dbSize = 3; |
| 897 |
// leader is the member ID which the responding member believes is the current leader. |
| 898 |
uint64 leader = 4; |
| 899 |
// raftIndex is the current raft index of the responding member. |
| 900 |
uint64 raftIndex = 5; |
| 901 |
// raftTerm is the current raft term of the responding member. |
| 902 |
uint64 raftTerm = 6; |
| 903 |
} |
| 904 |
|
| 905 |
message AuthEnableRequest { |
| 906 |
} |
| 907 |
|
| 908 |
message AuthDisableRequest { |
| 909 |
} |
| 910 |
|
| 911 |
message AuthenticateRequest { |
| 912 |
string name = 1; |
| 913 |
string password = 2; |
| 914 |
} |
| 915 |
|
| 916 |
message AuthUserAddRequest { |
| 917 |
string name = 1; |
| 918 |
string password = 2; |
| 919 |
} |
| 920 |
|
| 921 |
message AuthUserGetRequest { |
| 922 |
string name = 1; |
| 923 |
} |
| 924 |
|
| 925 |
message AuthUserDeleteRequest { |
| 926 |
// name is the name of the user to delete. |
| 927 |
string name = 1; |
| 928 |
} |
| 929 |
|
| 930 |
message AuthUserChangePasswordRequest { |
| 931 |
// name is the name of the user whose password is being changed. |
| 932 |
string name = 1; |
| 933 |
// password is the new password for the user. |
| 934 |
string password = 2; |
| 935 |
} |
| 936 |
|
| 937 |
message AuthUserGrantRoleRequest { |
| 938 |
// user is the name of the user which should be granted a given role. |
| 939 |
string user = 1; |
| 940 |
// role is the name of the role to grant to the user. |
| 941 |
string role = 2; |
| 942 |
} |
| 943 |
|
| 944 |
message AuthUserRevokeRoleRequest { |
| 945 |
string name = 1; |
| 946 |
string role = 2; |
| 947 |
} |
| 948 |
|
| 949 |
message AuthRoleAddRequest { |
| 950 |
// name is the name of the role to add to the authentication system. |
| 951 |
string name = 1; |
| 952 |
} |
| 953 |
|
| 954 |
message AuthRoleGetRequest { |
| 955 |
string role = 1; |
| 956 |
} |
| 957 |
|
| 958 |
message AuthUserListRequest { |
| 959 |
} |
| 960 |
|
| 961 |
message AuthRoleListRequest { |
| 962 |
} |
| 963 |
|
| 964 |
message AuthRoleDeleteRequest { |
| 965 |
string role = 1; |
| 966 |
} |
| 967 |
|
| 968 |
message AuthRoleGrantPermissionRequest { |
| 969 |
// name is the name of the role which will be granted the permission. |
| 970 |
string name = 1; |
| 971 |
// perm is the permission to grant to the role. |
| 972 |
authpb.Permission perm = 2; |
| 973 |
} |
| 974 |
|
| 975 |
message AuthRoleRevokePermissionRequest { |
| 976 |
string role = 1; |
| 977 |
string key = 2; |
| 978 |
string range_end = 3; |
| 979 |
} |
| 980 |
|
| 981 |
message AuthEnableResponse { |
| 982 |
ResponseHeader header = 1; |
| 983 |
} |
| 984 |
|
| 985 |
message AuthDisableResponse { |
| 986 |
ResponseHeader header = 1; |
| 987 |
} |
| 988 |
|
| 989 |
message AuthenticateResponse { |
| 990 |
ResponseHeader header = 1; |
| 991 |
// token is an authorized token that can be used in succeeding RPCs |
| 992 |
string token = 2; |
| 993 |
} |
| 994 |
|
| 995 |
message AuthUserAddResponse { |
| 996 |
ResponseHeader header = 1; |
| 997 |
} |
| 998 |
|
| 999 |
message AuthUserGetResponse { |
| 1000 |
ResponseHeader header = 1; |
| 1001 |
|
| 1002 |
repeated string roles = 2; |
| 1003 |
} |
| 1004 |
|
| 1005 |
message AuthUserDeleteResponse { |
| 1006 |
ResponseHeader header = 1; |
| 1007 |
} |
| 1008 |
|
| 1009 |
message AuthUserChangePasswordResponse { |
| 1010 |
ResponseHeader header = 1; |
| 1011 |
} |
| 1012 |
|
| 1013 |
message AuthUserGrantRoleResponse { |
| 1014 |
ResponseHeader header = 1; |
| 1015 |
} |
| 1016 |
|
| 1017 |
message AuthUserRevokeRoleResponse { |
| 1018 |
ResponseHeader header = 1; |
| 1019 |
} |
| 1020 |
|
| 1021 |
message AuthRoleAddResponse { |
| 1022 |
ResponseHeader header = 1; |
| 1023 |
} |
| 1024 |
|
| 1025 |
message AuthRoleGetResponse { |
| 1026 |
ResponseHeader header = 1; |
| 1027 |
|
| 1028 |
repeated authpb.Permission perm = 2; |
| 1029 |
} |
| 1030 |
|
| 1031 |
message AuthRoleListResponse { |
| 1032 |
ResponseHeader header = 1; |
| 1033 |
|
| 1034 |
repeated string roles = 2; |
| 1035 |
} |
| 1036 |
|
| 1037 |
message AuthUserListResponse { |
| 1038 |
ResponseHeader header = 1; |
| 1039 |
|
| 1040 |
repeated string users = 2; |
| 1041 |
} |
| 1042 |
|
| 1043 |
message AuthRoleDeleteResponse { |
| 1044 |
ResponseHeader header = 1; |
| 1045 |
} |
| 1046 |
|
| 1047 |
message AuthRoleGrantPermissionResponse { |
| 1048 |
ResponseHeader header = 1; |
| 1049 |
} |
| 1050 |
|
| 1051 |
message AuthRoleRevokePermissionResponse { |
| 1052 |
ResponseHeader header = 1; |
| 1053 |
} |