1// Copyright 2023 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.bigtable.v2; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/api/routing.proto"; 24import "google/bigtable/v2/data.proto"; 25import "google/bigtable/v2/request_stats.proto"; 26import "google/protobuf/duration.proto"; 27import "google/protobuf/timestamp.proto"; 28import "google/protobuf/wrappers.proto"; 29import "google/rpc/status.proto"; 30 31option csharp_namespace = "Google.Cloud.Bigtable.V2"; 32option go_package = "google.golang.org/genproto/googleapis/bigtable/v2;bigtable"; 33option java_multiple_files = true; 34option java_outer_classname = "BigtableProto"; 35option java_package = "com.google.bigtable.v2"; 36option php_namespace = "Google\\Cloud\\Bigtable\\V2"; 37option ruby_package = "Google::Cloud::Bigtable::V2"; 38option (google.api.resource_definition) = { 39 type: "bigtableadmin.googleapis.com/Instance" 40 pattern: "projects/{project}/instances/{instance}" 41}; 42option (google.api.resource_definition) = { 43 type: "bigtableadmin.googleapis.com/Table" 44 pattern: "projects/{project}/instances/{instance}/tables/{table}" 45}; 46option (google.api.resource_definition) = { 47 type: "bigtableadmin.googleapis.com/AuthorizedView" 48 pattern: "projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}" 49}; 50 51// Service for reading from and writing to existing Bigtable tables. 52service Bigtable { 53 option (google.api.default_host) = "bigtable.googleapis.com"; 54 option (google.api.oauth_scopes) = 55 "https://www.googleapis.com/auth/bigtable.data," 56 "https://www.googleapis.com/auth/bigtable.data.readonly," 57 "https://www.googleapis.com/auth/cloud-bigtable.data," 58 "https://www.googleapis.com/auth/cloud-bigtable.data.readonly," 59 "https://www.googleapis.com/auth/cloud-platform," 60 "https://www.googleapis.com/auth/cloud-platform.read-only"; 61 62 // Streams back the contents of all requested rows in key order, optionally 63 // applying the same Reader filter to each. Depending on their size, 64 // rows and cells may be broken up across multiple responses, but 65 // atomicity of each row will still be preserved. See the 66 // ReadRowsResponse documentation for details. 67 rpc ReadRows(ReadRowsRequest) returns (stream ReadRowsResponse) { 68 option (google.api.http) = { 69 post: "/v2/{table_name=projects/*/instances/*/tables/*}:readRows" 70 body: "*" 71 additional_bindings { 72 post: "/v2/{authorized_view_name=projects/*/instances/*/tables/*/authorizedViews/*}:readRows" 73 body: "*" 74 } 75 }; 76 option (google.api.routing) = { 77 routing_parameters { 78 field: "table_name" 79 path_template: "{table_name=projects/*/instances/*/tables/*}" 80 } 81 routing_parameters { field: "app_profile_id" } 82 routing_parameters { 83 field: "authorized_view_name" 84 path_template: "{authorized_view_name=projects/*/instances/*/tables/*/authorizedViews/*}" 85 } 86 }; 87 option (google.api.method_signature) = "table_name"; 88 option (google.api.method_signature) = "table_name,app_profile_id"; 89 } 90 91 // Returns a sample of row keys in the table. The returned row keys will 92 // delimit contiguous sections of the table of approximately equal size, 93 // which can be used to break up the data for distributed tasks like 94 // mapreduces. 95 rpc SampleRowKeys(SampleRowKeysRequest) 96 returns (stream SampleRowKeysResponse) { 97 option (google.api.http) = { 98 get: "/v2/{table_name=projects/*/instances/*/tables/*}:sampleRowKeys" 99 additional_bindings { 100 get: "/v2/{authorized_view_name=projects/*/instances/*/tables/*/authorizedViews/*}:sampleRowKeys" 101 } 102 }; 103 option (google.api.routing) = { 104 routing_parameters { 105 field: "table_name" 106 path_template: "{table_name=projects/*/instances/*/tables/*}" 107 } 108 routing_parameters { field: "app_profile_id" } 109 routing_parameters { 110 field: "authorized_view_name" 111 path_template: "{authorized_view_name=projects/*/instances/*/tables/*/authorizedViews/*}" 112 } 113 }; 114 option (google.api.method_signature) = "table_name"; 115 option (google.api.method_signature) = "table_name,app_profile_id"; 116 } 117 118 // Mutates a row atomically. Cells already present in the row are left 119 // unchanged unless explicitly changed by `mutation`. 120 rpc MutateRow(MutateRowRequest) returns (MutateRowResponse) { 121 option (google.api.http) = { 122 post: "/v2/{table_name=projects/*/instances/*/tables/*}:mutateRow" 123 body: "*" 124 additional_bindings { 125 post: "/v2/{authorized_view_name=projects/*/instances/*/tables/*/authorizedViews/*}:mutateRow" 126 body: "*" 127 } 128 }; 129 option (google.api.routing) = { 130 routing_parameters { 131 field: "table_name" 132 path_template: "{table_name=projects/*/instances/*/tables/*}" 133 } 134 routing_parameters { field: "app_profile_id" } 135 routing_parameters { 136 field: "authorized_view_name" 137 path_template: "{authorized_view_name=projects/*/instances/*/tables/*/authorizedViews/*}" 138 } 139 }; 140 option (google.api.method_signature) = "table_name,row_key,mutations"; 141 option (google.api.method_signature) = 142 "table_name,row_key,mutations,app_profile_id"; 143 } 144 145 // Mutates multiple rows in a batch. Each individual row is mutated 146 // atomically as in MutateRow, but the entire batch is not executed 147 // atomically. 148 rpc MutateRows(MutateRowsRequest) returns (stream MutateRowsResponse) { 149 option (google.api.http) = { 150 post: "/v2/{table_name=projects/*/instances/*/tables/*}:mutateRows" 151 body: "*" 152 additional_bindings { 153 post: "/v2/{authorized_view_name=projects/*/instances/*/tables/*/authorizedViews/*}:mutateRows" 154 body: "*" 155 } 156 }; 157 option (google.api.routing) = { 158 routing_parameters { 159 field: "table_name" 160 path_template: "{table_name=projects/*/instances/*/tables/*}" 161 } 162 routing_parameters { field: "app_profile_id" } 163 routing_parameters { 164 field: "authorized_view_name" 165 path_template: "{authorized_view_name=projects/*/instances/*/tables/*/authorizedViews/*}" 166 } 167 }; 168 option (google.api.method_signature) = "table_name,entries"; 169 option (google.api.method_signature) = "table_name,entries,app_profile_id"; 170 } 171 172 // Mutates a row atomically based on the output of a predicate Reader filter. 173 rpc CheckAndMutateRow(CheckAndMutateRowRequest) 174 returns (CheckAndMutateRowResponse) { 175 option (google.api.http) = { 176 post: "/v2/{table_name=projects/*/instances/*/tables/*}:checkAndMutateRow" 177 body: "*" 178 additional_bindings { 179 post: "/v2/{authorized_view_name=projects/*/instances/*/tables/*/authorizedViews/*}:checkAndMutateRow" 180 body: "*" 181 } 182 }; 183 option (google.api.routing) = { 184 routing_parameters { 185 field: "table_name" 186 path_template: "{table_name=projects/*/instances/*/tables/*}" 187 } 188 routing_parameters { field: "app_profile_id" } 189 routing_parameters { 190 field: "authorized_view_name" 191 path_template: "{authorized_view_name=projects/*/instances/*/tables/*/authorizedViews/*}" 192 } 193 }; 194 option (google.api.method_signature) = 195 "table_name,row_key,predicate_filter,true_mutations,false_mutations"; 196 option (google.api.method_signature) = 197 "table_name,row_key,predicate_filter,true_mutations,false_mutations,app_profile_id"; 198 } 199 200 // Warm up associated instance metadata for this connection. 201 // This call is not required but may be useful for connection keep-alive. 202 rpc PingAndWarm(PingAndWarmRequest) returns (PingAndWarmResponse) { 203 option (google.api.http) = { 204 post: "/v2/{name=projects/*/instances/*}:ping" 205 body: "*" 206 }; 207 option (google.api.routing) = { 208 routing_parameters { 209 field: "name" 210 path_template: "{name=projects/*/instances/*}" 211 } 212 routing_parameters { field: "app_profile_id" } 213 }; 214 option (google.api.method_signature) = "name"; 215 option (google.api.method_signature) = "name,app_profile_id"; 216 } 217 218 // Modifies a row atomically on the server. The method reads the latest 219 // existing timestamp and value from the specified columns and writes a new 220 // entry based on pre-defined read/modify/write rules. The new value for the 221 // timestamp is the greater of the existing timestamp or the current server 222 // time. The method returns the new contents of all modified cells. 223 rpc ReadModifyWriteRow(ReadModifyWriteRowRequest) 224 returns (ReadModifyWriteRowResponse) { 225 option (google.api.http) = { 226 post: "/v2/{table_name=projects/*/instances/*/tables/*}:readModifyWriteRow" 227 body: "*" 228 additional_bindings { 229 post: "/v2/{authorized_view_name=projects/*/instances/*/tables/*/authorizedViews/*}:readModifyWriteRow" 230 body: "*" 231 } 232 }; 233 option (google.api.routing) = { 234 routing_parameters { 235 field: "table_name" 236 path_template: "{table_name=projects/*/instances/*/tables/*}" 237 } 238 routing_parameters { field: "app_profile_id" } 239 routing_parameters { 240 field: "authorized_view_name" 241 path_template: "{authorized_view_name=projects/*/instances/*/tables/*/authorizedViews/*}" 242 } 243 }; 244 option (google.api.method_signature) = "table_name,row_key,rules"; 245 option (google.api.method_signature) = 246 "table_name,row_key,rules,app_profile_id"; 247 } 248 249 // NOTE: This API is intended to be used by Apache Beam BigtableIO. 250 // Returns the current list of partitions that make up the table's 251 // change stream. The union of partitions will cover the entire keyspace. 252 // Partitions can be read with `ReadChangeStream`. 253 rpc GenerateInitialChangeStreamPartitions( 254 GenerateInitialChangeStreamPartitionsRequest) 255 returns (stream GenerateInitialChangeStreamPartitionsResponse) { 256 option (google.api.http) = { 257 post: "/v2/{table_name=projects/*/instances/*/tables/*}:generateInitialChangeStreamPartitions" 258 body: "*" 259 }; 260 option (google.api.method_signature) = "table_name"; 261 option (google.api.method_signature) = "table_name,app_profile_id"; 262 } 263 264 // NOTE: This API is intended to be used by Apache Beam BigtableIO. 265 // Reads changes from a table's change stream. Changes will 266 // reflect both user-initiated mutations and mutations that are caused by 267 // garbage collection. 268 rpc ReadChangeStream(ReadChangeStreamRequest) 269 returns (stream ReadChangeStreamResponse) { 270 option (google.api.http) = { 271 post: "/v2/{table_name=projects/*/instances/*/tables/*}:readChangeStream" 272 body: "*" 273 }; 274 option (google.api.method_signature) = "table_name"; 275 option (google.api.method_signature) = "table_name,app_profile_id"; 276 } 277} 278 279// Request message for Bigtable.ReadRows. 280message ReadRowsRequest { 281 // The desired view into RequestStats that should be returned in the response. 282 // 283 // See also: RequestStats message. 284 enum RequestStatsView { 285 // The default / unset value. The API will default to the NONE option below. 286 REQUEST_STATS_VIEW_UNSPECIFIED = 0; 287 288 // Do not include any RequestStats in the response. This will leave the 289 // RequestStats embedded message unset in the response. 290 REQUEST_STATS_NONE = 1; 291 292 // Include the full set of available RequestStats in the response, 293 // applicable to this read. 294 REQUEST_STATS_FULL = 2; 295 } 296 297 // Optional. The unique name of the table from which to read. 298 // 299 // Values are of the form 300 // `projects/<project>/instances/<instance>/tables/<table>`. 301 string table_name = 1 [ 302 (google.api.field_behavior) = OPTIONAL, 303 (google.api.resource_reference) = { 304 type: "bigtableadmin.googleapis.com/Table" 305 } 306 ]; 307 308 // Optional. The unique name of the AuthorizedView from which to read. 309 // 310 // Values are of the form 311 // `projects/<project>/instances/<instance>/tables/<table>/authorizedViews/<authorized_view>`. 312 string authorized_view_name = 9 [ 313 (google.api.field_behavior) = OPTIONAL, 314 (google.api.resource_reference) = { 315 type: "bigtableadmin.googleapis.com/AuthorizedView" 316 } 317 ]; 318 319 // This value specifies routing for replication. If not specified, the 320 // "default" application profile will be used. 321 string app_profile_id = 5; 322 323 // The row keys and/or ranges to read sequentially. If not specified, reads 324 // from all rows. 325 RowSet rows = 2; 326 327 // The filter to apply to the contents of the specified row(s). If unset, 328 // reads the entirety of each row. 329 RowFilter filter = 3; 330 331 // The read will stop after committing to N rows' worth of results. The 332 // default (zero) is to return all results. 333 int64 rows_limit = 4; 334 335 // The view into RequestStats, as described above. 336 RequestStatsView request_stats_view = 6; 337 338 // Experimental API - Please note that this API is currently experimental 339 // and can change in the future. 340 // 341 // Return rows in lexiographical descending order of the row keys. The row 342 // contents will not be affected by this flag. 343 // 344 // Example result set: 345 // 346 // [ 347 // {key: "k2", "f:col1": "v1", "f:col2": "v1"}, 348 // {key: "k1", "f:col1": "v2", "f:col2": "v2"} 349 // ] 350 bool reversed = 7; 351} 352 353// Response message for Bigtable.ReadRows. 354message ReadRowsResponse { 355 // Specifies a piece of a row's contents returned as part of the read 356 // response stream. 357 message CellChunk { 358 // The row key for this chunk of data. If the row key is empty, 359 // this CellChunk is a continuation of the same row as the previous 360 // CellChunk in the response stream, even if that CellChunk was in a 361 // previous ReadRowsResponse message. 362 bytes row_key = 1; 363 364 // The column family name for this chunk of data. If this message 365 // is not present this CellChunk is a continuation of the same column 366 // family as the previous CellChunk. The empty string can occur as a 367 // column family name in a response so clients must check 368 // explicitly for the presence of this message, not just for 369 // `family_name.value` being non-empty. 370 google.protobuf.StringValue family_name = 2; 371 372 // The column qualifier for this chunk of data. If this message 373 // is not present, this CellChunk is a continuation of the same column 374 // as the previous CellChunk. Column qualifiers may be empty so 375 // clients must check for the presence of this message, not just 376 // for `qualifier.value` being non-empty. 377 google.protobuf.BytesValue qualifier = 3; 378 379 // The cell's stored timestamp, which also uniquely identifies it 380 // within its column. Values are always expressed in 381 // microseconds, but individual tables may set a coarser 382 // granularity to further restrict the allowed values. For 383 // example, a table which specifies millisecond granularity will 384 // only allow values of `timestamp_micros` which are multiples of 385 // 1000. Timestamps are only set in the first CellChunk per cell 386 // (for cells split into multiple chunks). 387 int64 timestamp_micros = 4; 388 389 // Labels applied to the cell by a 390 // [RowFilter][google.bigtable.v2.RowFilter]. Labels are only set 391 // on the first CellChunk per cell. 392 repeated string labels = 5; 393 394 // The value stored in the cell. Cell values can be split across 395 // multiple CellChunks. In that case only the value field will be 396 // set in CellChunks after the first: the timestamp and labels 397 // will only be present in the first CellChunk, even if the first 398 // CellChunk came in a previous ReadRowsResponse. 399 bytes value = 6; 400 401 // If this CellChunk is part of a chunked cell value and this is 402 // not the final chunk of that cell, value_size will be set to the 403 // total length of the cell value. The client can use this size 404 // to pre-allocate memory to hold the full cell value. 405 int32 value_size = 7; 406 407 // Signals to the client concerning previous CellChunks received. 408 oneof row_status { 409 // Indicates that the client should drop all previous chunks for 410 // `row_key`, as it will be re-read from the beginning. 411 bool reset_row = 8; 412 413 // Indicates that the client can safely process all previous chunks for 414 // `row_key`, as its data has been fully read. 415 bool commit_row = 9; 416 } 417 } 418 419 // A collection of a row's contents as part of the read request. 420 repeated CellChunk chunks = 1; 421 422 // Optionally the server might return the row key of the last row it 423 // has scanned. The client can use this to construct a more 424 // efficient retry request if needed: any row keys or portions of 425 // ranges less than this row key can be dropped from the request. 426 // This is primarily useful for cases where the server has read a 427 // lot of data that was filtered out since the last committed row 428 // key, allowing the client to skip that work on a retry. 429 bytes last_scanned_row_key = 2; 430 431 // 432 // If requested, provide enhanced query performance statistics. The semantics 433 // dictate: 434 // * request_stats is empty on every (streamed) response, except 435 // * request_stats has non-empty information after all chunks have been 436 // streamed, where the ReadRowsResponse message only contains 437 // request_stats. 438 // * For example, if a read request would have returned an empty 439 // response instead a single ReadRowsResponse is streamed with empty 440 // chunks and request_stats filled. 441 // 442 // Visually, response messages will stream as follows: 443 // ... -> {chunks: [...]} -> {chunks: [], request_stats: {...}} 444 // \______________________/ \________________________________/ 445 // Primary response Trailer of RequestStats info 446 // 447 // Or if the read did not return any values: 448 // {chunks: [], request_stats: {...}} 449 // \________________________________/ 450 // Trailer of RequestStats info 451 RequestStats request_stats = 3; 452} 453 454// Request message for Bigtable.SampleRowKeys. 455message SampleRowKeysRequest { 456 // Optional. The unique name of the table from which to sample row keys. 457 // 458 // Values are of the form 459 // `projects/<project>/instances/<instance>/tables/<table>`. 460 string table_name = 1 [ 461 (google.api.field_behavior) = OPTIONAL, 462 (google.api.resource_reference) = { 463 type: "bigtableadmin.googleapis.com/Table" 464 } 465 ]; 466 467 // Optional. The unique name of the AuthorizedView from which to sample row 468 // keys. 469 // 470 // Values are of the form 471 // `projects/<project>/instances/<instance>/tables/<table>/authorizedViews/<authorized_view>`. 472 string authorized_view_name = 4 [ 473 (google.api.field_behavior) = OPTIONAL, 474 (google.api.resource_reference) = { 475 type: "bigtableadmin.googleapis.com/AuthorizedView" 476 } 477 ]; 478 479 // This value specifies routing for replication. If not specified, the 480 // "default" application profile will be used. 481 string app_profile_id = 2; 482} 483 484// Response message for Bigtable.SampleRowKeys. 485message SampleRowKeysResponse { 486 // Sorted streamed sequence of sample row keys in the table. The table might 487 // have contents before the first row key in the list and after the last one, 488 // but a key containing the empty string indicates "end of table" and will be 489 // the last response given, if present. 490 // Note that row keys in this list may not have ever been written to or read 491 // from, and users should therefore not make any assumptions about the row key 492 // structure that are specific to their use case. 493 bytes row_key = 1; 494 495 // Approximate total storage space used by all rows in the table which precede 496 // `row_key`. Buffering the contents of all rows between two subsequent 497 // samples would require space roughly equal to the difference in their 498 // `offset_bytes` fields. 499 int64 offset_bytes = 2; 500} 501 502// Request message for Bigtable.MutateRow. 503message MutateRowRequest { 504 // Optional. The unique name of the table to which the mutation should be 505 // applied. 506 // 507 // Values are of the form 508 // `projects/<project>/instances/<instance>/tables/<table>`. 509 string table_name = 1 [ 510 (google.api.field_behavior) = OPTIONAL, 511 (google.api.resource_reference) = { 512 type: "bigtableadmin.googleapis.com/Table" 513 } 514 ]; 515 516 // Optional. The unique name of the AuthorizedView to which the mutation 517 // should be applied. 518 // 519 // Values are of the form 520 // `projects/<project>/instances/<instance>/tables/<table>/authorizedViews/<authorized_view>`. 521 string authorized_view_name = 6 [ 522 (google.api.field_behavior) = OPTIONAL, 523 (google.api.resource_reference) = { 524 type: "bigtableadmin.googleapis.com/AuthorizedView" 525 } 526 ]; 527 528 // This value specifies routing for replication. If not specified, the 529 // "default" application profile will be used. 530 string app_profile_id = 4; 531 532 // Required. The key of the row to which the mutation should be applied. 533 bytes row_key = 2 [(google.api.field_behavior) = REQUIRED]; 534 535 // Required. Changes to be atomically applied to the specified row. Entries 536 // are applied in order, meaning that earlier mutations can be masked by later 537 // ones. Must contain at least one entry and at most 100000. 538 repeated Mutation mutations = 3 [(google.api.field_behavior) = REQUIRED]; 539} 540 541// Response message for Bigtable.MutateRow. 542message MutateRowResponse {} 543 544// Request message for BigtableService.MutateRows. 545message MutateRowsRequest { 546 // A mutation for a given row. 547 message Entry { 548 // The key of the row to which the `mutations` should be applied. 549 bytes row_key = 1; 550 551 // Required. Changes to be atomically applied to the specified row. 552 // Mutations are applied in order, meaning that earlier mutations can be 553 // masked by later ones. You must specify at least one mutation. 554 repeated Mutation mutations = 2 [(google.api.field_behavior) = REQUIRED]; 555 } 556 557 // Optional. The unique name of the table to which the mutations should be 558 // applied. 559 // 560 // Values are of the form 561 // `projects/<project>/instances/<instance>/tables/<table>`. 562 string table_name = 1 [ 563 (google.api.field_behavior) = OPTIONAL, 564 (google.api.resource_reference) = { 565 type: "bigtableadmin.googleapis.com/Table" 566 } 567 ]; 568 569 // Optional. The unique name of the AuthorizedView to which the mutations 570 // should be applied. 571 // 572 // Values are of the form 573 // `projects/<project>/instances/<instance>/tables/<table>/authorizedViews/<authorized_view>`. 574 string authorized_view_name = 5 [ 575 (google.api.field_behavior) = OPTIONAL, 576 (google.api.resource_reference) = { 577 type: "bigtableadmin.googleapis.com/AuthorizedView" 578 } 579 ]; 580 581 // This value specifies routing for replication. If not specified, the 582 // "default" application profile will be used. 583 string app_profile_id = 3; 584 585 // Required. The row keys and corresponding mutations to be applied in bulk. 586 // Each entry is applied as an atomic mutation, but the entries may be 587 // applied in arbitrary order (even between entries for the same row). 588 // At least one entry must be specified, and in total the entries can 589 // contain at most 100000 mutations. 590 repeated Entry entries = 2 [(google.api.field_behavior) = REQUIRED]; 591} 592 593// Response message for BigtableService.MutateRows. 594message MutateRowsResponse { 595 // The result of applying a passed mutation in the original request. 596 message Entry { 597 // The index into the original request's `entries` list of the Entry 598 // for which a result is being reported. 599 int64 index = 1; 600 601 // The result of the request Entry identified by `index`. 602 // Depending on how requests are batched during execution, it is possible 603 // for one Entry to fail due to an error with another Entry. In the event 604 // that this occurs, the same error will be reported for both entries. 605 google.rpc.Status status = 2; 606 } 607 608 // One or more results for Entries from the batch request. 609 repeated Entry entries = 1; 610 611 // Information about how client should limit the rate (QPS). Primirily used by 612 // supported official Cloud Bigtable clients. If unset, the rate limit info is 613 // not provided by the server. 614 optional RateLimitInfo rate_limit_info = 3; 615} 616 617// Information about how client should adjust the load to Bigtable. 618message RateLimitInfo { 619 // Time that clients should wait before adjusting the target rate again. 620 // If clients adjust rate too frequently, the impact of the previous 621 // adjustment may not have been taken into account and may 622 // over-throttle or under-throttle. If clients adjust rate too slowly, they 623 // will not be responsive to load changes on server side, and may 624 // over-throttle or under-throttle. 625 google.protobuf.Duration period = 1; 626 627 // If it has been at least one `period` since the last load adjustment, the 628 // client should multiply the current load by this value to get the new target 629 // load. For example, if the current load is 100 and `factor` is 0.8, the new 630 // target load should be 80. After adjusting, the client should ignore 631 // `factor` until another `period` has passed. 632 // 633 // The client can measure its load using any unit that's comparable over time 634 // For example, QPS can be used as long as each request involves a similar 635 // amount of work. 636 double factor = 2; 637} 638 639// Request message for Bigtable.CheckAndMutateRow. 640message CheckAndMutateRowRequest { 641 // Optional. The unique name of the table to which the conditional mutation 642 // should be applied. 643 // 644 // Values are of the form 645 // `projects/<project>/instances/<instance>/tables/<table>`. 646 string table_name = 1 [ 647 (google.api.field_behavior) = OPTIONAL, 648 (google.api.resource_reference) = { 649 type: "bigtableadmin.googleapis.com/Table" 650 } 651 ]; 652 653 // Optional. The unique name of the AuthorizedView to which the conditional 654 // mutation should be applied. 655 // 656 // Values are of the form 657 // `projects/<project>/instances/<instance>/tables/<table>/authorizedViews/<authorized_view>`. 658 string authorized_view_name = 9 [ 659 (google.api.field_behavior) = OPTIONAL, 660 (google.api.resource_reference) = { 661 type: "bigtableadmin.googleapis.com/AuthorizedView" 662 } 663 ]; 664 665 // This value specifies routing for replication. If not specified, the 666 // "default" application profile will be used. 667 string app_profile_id = 7; 668 669 // Required. The key of the row to which the conditional mutation should be 670 // applied. 671 bytes row_key = 2 [(google.api.field_behavior) = REQUIRED]; 672 673 // The filter to be applied to the contents of the specified row. Depending 674 // on whether or not any results are yielded, either `true_mutations` or 675 // `false_mutations` will be executed. If unset, checks that the row contains 676 // any values at all. 677 RowFilter predicate_filter = 6; 678 679 // Changes to be atomically applied to the specified row if `predicate_filter` 680 // yields at least one cell when applied to `row_key`. Entries are applied in 681 // order, meaning that earlier mutations can be masked by later ones. 682 // Must contain at least one entry if `false_mutations` is empty, and at most 683 // 100000. 684 repeated Mutation true_mutations = 4; 685 686 // Changes to be atomically applied to the specified row if `predicate_filter` 687 // does not yield any cells when applied to `row_key`. Entries are applied in 688 // order, meaning that earlier mutations can be masked by later ones. 689 // Must contain at least one entry if `true_mutations` is empty, and at most 690 // 100000. 691 repeated Mutation false_mutations = 5; 692} 693 694// Response message for Bigtable.CheckAndMutateRow. 695message CheckAndMutateRowResponse { 696 // Whether or not the request's `predicate_filter` yielded any results for 697 // the specified row. 698 bool predicate_matched = 1; 699} 700 701// Request message for client connection keep-alive and warming. 702message PingAndWarmRequest { 703 // Required. The unique name of the instance to check permissions for as well 704 // as respond. Values are of the form 705 // `projects/<project>/instances/<instance>`. 706 string name = 1 [ 707 (google.api.field_behavior) = REQUIRED, 708 (google.api.resource_reference) = { 709 type: "bigtableadmin.googleapis.com/Instance" 710 } 711 ]; 712 713 // This value specifies routing for replication. If not specified, the 714 // "default" application profile will be used. 715 string app_profile_id = 2; 716} 717 718// Response message for Bigtable.PingAndWarm connection keepalive and warming. 719message PingAndWarmResponse {} 720 721// Request message for Bigtable.ReadModifyWriteRow. 722message ReadModifyWriteRowRequest { 723 // Optional. The unique name of the table to which the read/modify/write rules 724 // should be applied. 725 // 726 // Values are of the form 727 // `projects/<project>/instances/<instance>/tables/<table>`. 728 string table_name = 1 [ 729 (google.api.field_behavior) = OPTIONAL, 730 (google.api.resource_reference) = { 731 type: "bigtableadmin.googleapis.com/Table" 732 } 733 ]; 734 735 // Optional. The unique name of the AuthorizedView to which the 736 // read/modify/write rules should be applied. 737 // 738 // Values are of the form 739 // `projects/<project>/instances/<instance>/tables/<table>/authorizedViews/<authorized_view>`. 740 string authorized_view_name = 6 [ 741 (google.api.field_behavior) = OPTIONAL, 742 (google.api.resource_reference) = { 743 type: "bigtableadmin.googleapis.com/AuthorizedView" 744 } 745 ]; 746 747 // This value specifies routing for replication. If not specified, the 748 // "default" application profile will be used. 749 string app_profile_id = 4; 750 751 // Required. The key of the row to which the read/modify/write rules should be 752 // applied. 753 bytes row_key = 2 [(google.api.field_behavior) = REQUIRED]; 754 755 // Required. Rules specifying how the specified row's contents are to be 756 // transformed into writes. Entries are applied in order, meaning that earlier 757 // rules will affect the results of later ones. 758 repeated ReadModifyWriteRule rules = 3 759 [(google.api.field_behavior) = REQUIRED]; 760} 761 762// Response message for Bigtable.ReadModifyWriteRow. 763message ReadModifyWriteRowResponse { 764 // A Row containing the new contents of all cells modified by the request. 765 Row row = 1; 766} 767 768// NOTE: This API is intended to be used by Apache Beam BigtableIO. 769// Request message for Bigtable.GenerateInitialChangeStreamPartitions. 770message GenerateInitialChangeStreamPartitionsRequest { 771 // Required. The unique name of the table from which to get change stream 772 // partitions. Values are of the form 773 // `projects/<project>/instances/<instance>/tables/<table>`. 774 // Change streaming must be enabled on the table. 775 string table_name = 1 [ 776 (google.api.field_behavior) = REQUIRED, 777 (google.api.resource_reference) = { 778 type: "bigtableadmin.googleapis.com/Table" 779 } 780 ]; 781 782 // This value specifies routing for replication. If not specified, the 783 // "default" application profile will be used. 784 // Single cluster routing must be configured on the profile. 785 string app_profile_id = 2; 786} 787 788// NOTE: This API is intended to be used by Apache Beam BigtableIO. 789// Response message for Bigtable.GenerateInitialChangeStreamPartitions. 790message GenerateInitialChangeStreamPartitionsResponse { 791 // A partition of the change stream. 792 StreamPartition partition = 1; 793} 794 795// NOTE: This API is intended to be used by Apache Beam BigtableIO. 796// Request message for Bigtable.ReadChangeStream. 797message ReadChangeStreamRequest { 798 // Required. The unique name of the table from which to read a change stream. 799 // Values are of the form 800 // `projects/<project>/instances/<instance>/tables/<table>`. 801 // Change streaming must be enabled on the table. 802 string table_name = 1 [ 803 (google.api.field_behavior) = REQUIRED, 804 (google.api.resource_reference) = { 805 type: "bigtableadmin.googleapis.com/Table" 806 } 807 ]; 808 809 // This value specifies routing for replication. If not specified, the 810 // "default" application profile will be used. 811 // Single cluster routing must be configured on the profile. 812 string app_profile_id = 2; 813 814 // The partition to read changes from. 815 StreamPartition partition = 3; 816 817 // Options for describing where we want to start reading from the stream. 818 oneof start_from { 819 // Start reading the stream at the specified timestamp. This timestamp must 820 // be within the change stream retention period, less than or equal to the 821 // current time, and after change stream creation, whichever is greater. 822 // This value is inclusive and will be truncated to microsecond granularity. 823 google.protobuf.Timestamp start_time = 4; 824 825 // Tokens that describe how to resume reading a stream where reading 826 // previously left off. If specified, changes will be read starting at the 827 // the position. Tokens are delivered on the stream as part of `Heartbeat` 828 // and `CloseStream` messages. 829 // 830 // If a single token is provided, the token’s partition must exactly match 831 // the request’s partition. If multiple tokens are provided, as in the case 832 // of a partition merge, the union of the token partitions must exactly 833 // cover the request’s partition. Otherwise, INVALID_ARGUMENT will be 834 // returned. 835 StreamContinuationTokens continuation_tokens = 6; 836 } 837 838 // If specified, OK will be returned when the stream advances beyond 839 // this time. Otherwise, changes will be continuously delivered on the stream. 840 // This value is inclusive and will be truncated to microsecond granularity. 841 google.protobuf.Timestamp end_time = 5; 842 843 // If specified, the duration between `Heartbeat` messages on the stream. 844 // Otherwise, defaults to 5 seconds. 845 google.protobuf.Duration heartbeat_duration = 7; 846} 847 848// NOTE: This API is intended to be used by Apache Beam BigtableIO. 849// Response message for Bigtable.ReadChangeStream. 850message ReadChangeStreamResponse { 851 // A partial or complete mutation. 852 message MutationChunk { 853 // Information about the chunking of this mutation. 854 // Only `SetCell` mutations can be chunked, and all chunks for a `SetCell` 855 // will be delivered contiguously with no other mutation types interleaved. 856 message ChunkInfo { 857 // The total value size of all the chunks that make up the `SetCell`. 858 int32 chunked_value_size = 1; 859 860 // The byte offset of this chunk into the total value size of the 861 // mutation. 862 int32 chunked_value_offset = 2; 863 864 // When true, this is the last chunk of a chunked `SetCell`. 865 bool last_chunk = 3; 866 } 867 868 // If set, then the mutation is a `SetCell` with a chunked value across 869 // multiple messages. 870 ChunkInfo chunk_info = 1; 871 872 // If this is a continuation of a chunked message (`chunked_value_offset` > 873 // 0), ignore all fields except the `SetCell`'s value and merge it with 874 // the previous message by concatenating the value fields. 875 Mutation mutation = 2; 876 } 877 878 // A message corresponding to one or more mutations to the partition 879 // being streamed. A single logical `DataChange` message may also be split 880 // across a sequence of multiple individual messages. Messages other than 881 // the first in a sequence will only have the `type` and `chunks` fields 882 // populated, with the final message in the sequence also containing `done` 883 // set to true. 884 message DataChange { 885 // The type of mutation. 886 enum Type { 887 // The type is unspecified. 888 TYPE_UNSPECIFIED = 0; 889 890 // A user-initiated mutation. 891 USER = 1; 892 893 // A system-initiated mutation as part of garbage collection. 894 // https://cloud.google.com/bigtable/docs/garbage-collection 895 GARBAGE_COLLECTION = 2; 896 897 // This is a continuation of a multi-message change. 898 CONTINUATION = 3; 899 } 900 901 // The type of the mutation. 902 Type type = 1; 903 904 // The cluster where the mutation was applied. 905 // Not set when `type` is `GARBAGE_COLLECTION`. 906 string source_cluster_id = 2; 907 908 // The row key for all mutations that are part of this `DataChange`. 909 // If the `DataChange` is chunked across multiple messages, then this field 910 // will only be set for the first message. 911 bytes row_key = 3; 912 913 // The timestamp at which the mutation was applied on the Bigtable server. 914 google.protobuf.Timestamp commit_timestamp = 4; 915 916 // A value that lets stream consumers reconstruct Bigtable's 917 // conflict resolution semantics. 918 // https://cloud.google.com/bigtable/docs/writes#conflict-resolution 919 // In the event that the same row key, column family, column qualifier, 920 // timestamp are modified on different clusters at the same 921 // `commit_timestamp`, the mutation with the larger `tiebreaker` will be the 922 // one chosen for the eventually consistent state of the system. 923 int32 tiebreaker = 5; 924 925 // The mutations associated with this change to the partition. 926 // May contain complete mutations or chunks of a multi-message chunked 927 // `DataChange` record. 928 repeated MutationChunk chunks = 6; 929 930 // When true, indicates that the entire `DataChange` has been read 931 // and the client can safely process the message. 932 bool done = 8; 933 934 // An encoded position for this stream's partition to restart reading from. 935 // This token is for the StreamPartition from the request. 936 string token = 9; 937 938 // An estimate of the commit timestamp that is usually lower than or equal 939 // to any timestamp for a record that will be delivered in the future on the 940 // stream. It is possible that, under particular circumstances that a future 941 // record has a timestamp is is lower than a previously seen timestamp. For 942 // an example usage see 943 // https://beam.apache.org/documentation/basics/#watermarks 944 google.protobuf.Timestamp estimated_low_watermark = 10; 945 } 946 947 // A periodic message with information that can be used to checkpoint 948 // the state of a stream. 949 message Heartbeat { 950 // A token that can be provided to a subsequent `ReadChangeStream` call 951 // to pick up reading at the current stream position. 952 StreamContinuationToken continuation_token = 1; 953 954 // An estimate of the commit timestamp that is usually lower than or equal 955 // to any timestamp for a record that will be delivered in the future on the 956 // stream. It is possible that, under particular circumstances that a future 957 // record has a timestamp is is lower than a previously seen timestamp. For 958 // an example usage see 959 // https://beam.apache.org/documentation/basics/#watermarks 960 google.protobuf.Timestamp estimated_low_watermark = 2; 961 } 962 963 // A message indicating that the client should stop reading from the stream. 964 // If status is OK and `continuation_tokens` & `new_partitions` are empty, the 965 // stream has finished (for example if there was an `end_time` specified). 966 // If `continuation_tokens` & `new_partitions` are present, then a change in 967 // partitioning requires the client to open a new stream for each token to 968 // resume reading. Example: 969 // [B, D) ends 970 // | 971 // v 972 // new_partitions: [A, C) [C, E) 973 // continuation_tokens.partitions: [B,C) [C,D) 974 // ^---^ ^---^ 975 // ^ ^ 976 // | | 977 // | StreamContinuationToken 2 978 // | 979 // StreamContinuationToken 1 980 // To read the new partition [A,C), supply the continuation tokens whose 981 // ranges cover the new partition, for example ContinuationToken[A,B) & 982 // ContinuationToken[B,C). 983 message CloseStream { 984 // The status of the stream. 985 google.rpc.Status status = 1; 986 987 // If non-empty, contains the information needed to resume reading their 988 // associated partitions. 989 repeated StreamContinuationToken continuation_tokens = 2; 990 991 // If non-empty, contains the new partitions to start reading from, which 992 // are related to but not necessarily identical to the partitions for the 993 // above `continuation_tokens`. 994 repeated StreamPartition new_partitions = 3; 995 } 996 997 // The data or control message on the stream. 998 oneof stream_record { 999 // A mutation to the partition. 1000 DataChange data_change = 1; 1001 1002 // A periodic heartbeat message. 1003 Heartbeat heartbeat = 2; 1004 1005 // An indication that the stream should be closed. 1006 CloseStream close_stream = 3; 1007 } 1008} 1009