bigtable.proto 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. // Copyright 2022 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. syntax = "proto3";
  15. package google.bigtable.v2;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/api/routing.proto";
  21. import "google/bigtable/v2/data.proto";
  22. import "google/bigtable/v2/request_stats.proto";
  23. import "google/protobuf/wrappers.proto";
  24. import "google/rpc/status.proto";
  25. option csharp_namespace = "Google.Cloud.Bigtable.V2";
  26. option go_package = "google.golang.org/genproto/googleapis/bigtable/v2;bigtable";
  27. option java_multiple_files = true;
  28. option java_outer_classname = "BigtableProto";
  29. option java_package = "com.google.bigtable.v2";
  30. option php_namespace = "Google\\Cloud\\Bigtable\\V2";
  31. option ruby_package = "Google::Cloud::Bigtable::V2";
  32. option (google.api.resource_definition) = {
  33. type: "bigtableadmin.googleapis.com/Instance"
  34. pattern: "projects/{project}/instances/{instance}"
  35. };
  36. option (google.api.resource_definition) = {
  37. type: "bigtableadmin.googleapis.com/Table"
  38. pattern: "projects/{project}/instances/{instance}/tables/{table}"
  39. };
  40. // Service for reading from and writing to existing Bigtable tables.
  41. service Bigtable {
  42. option (google.api.default_host) = "bigtable.googleapis.com";
  43. option (google.api.oauth_scopes) =
  44. "https://www.googleapis.com/auth/bigtable.data,"
  45. "https://www.googleapis.com/auth/bigtable.data.readonly,"
  46. "https://www.googleapis.com/auth/cloud-bigtable.data,"
  47. "https://www.googleapis.com/auth/cloud-bigtable.data.readonly,"
  48. "https://www.googleapis.com/auth/cloud-platform,"
  49. "https://www.googleapis.com/auth/cloud-platform.read-only";
  50. // Streams back the contents of all requested rows in key order, optionally
  51. // applying the same Reader filter to each. Depending on their size,
  52. // rows and cells may be broken up across multiple responses, but
  53. // atomicity of each row will still be preserved. See the
  54. // ReadRowsResponse documentation for details.
  55. rpc ReadRows(ReadRowsRequest) returns (stream ReadRowsResponse) {
  56. option (google.api.http) = {
  57. post: "/v2/{table_name=projects/*/instances/*/tables/*}:readRows"
  58. body: "*"
  59. };
  60. option (google.api.routing) = {
  61. routing_parameters {
  62. field: "table_name"
  63. path_template: "{table_name=projects/*/instances/*/tables/*}"
  64. }
  65. routing_parameters {
  66. field: "app_profile_id"
  67. }
  68. };
  69. option (google.api.method_signature) = "table_name";
  70. option (google.api.method_signature) = "table_name,app_profile_id";
  71. }
  72. // Returns a sample of row keys in the table. The returned row keys will
  73. // delimit contiguous sections of the table of approximately equal size,
  74. // which can be used to break up the data for distributed tasks like
  75. // mapreduces.
  76. rpc SampleRowKeys(SampleRowKeysRequest) returns (stream SampleRowKeysResponse) {
  77. option (google.api.http) = {
  78. get: "/v2/{table_name=projects/*/instances/*/tables/*}:sampleRowKeys"
  79. };
  80. option (google.api.routing) = {
  81. routing_parameters {
  82. field: "table_name"
  83. path_template: "{table_name=projects/*/instances/*/tables/*}"
  84. }
  85. routing_parameters {
  86. field: "app_profile_id"
  87. }
  88. };
  89. option (google.api.method_signature) = "table_name";
  90. option (google.api.method_signature) = "table_name,app_profile_id";
  91. }
  92. // Mutates a row atomically. Cells already present in the row are left
  93. // unchanged unless explicitly changed by `mutation`.
  94. rpc MutateRow(MutateRowRequest) returns (MutateRowResponse) {
  95. option (google.api.http) = {
  96. post: "/v2/{table_name=projects/*/instances/*/tables/*}:mutateRow"
  97. body: "*"
  98. };
  99. option (google.api.routing) = {
  100. routing_parameters {
  101. field: "table_name"
  102. path_template: "{table_name=projects/*/instances/*/tables/*}"
  103. }
  104. routing_parameters {
  105. field: "app_profile_id"
  106. }
  107. };
  108. option (google.api.method_signature) = "table_name,row_key,mutations";
  109. option (google.api.method_signature) = "table_name,row_key,mutations,app_profile_id";
  110. }
  111. // Mutates multiple rows in a batch. Each individual row is mutated
  112. // atomically as in MutateRow, but the entire batch is not executed
  113. // atomically.
  114. rpc MutateRows(MutateRowsRequest) returns (stream MutateRowsResponse) {
  115. option (google.api.http) = {
  116. post: "/v2/{table_name=projects/*/instances/*/tables/*}:mutateRows"
  117. body: "*"
  118. };
  119. option (google.api.routing) = {
  120. routing_parameters {
  121. field: "table_name"
  122. path_template: "{table_name=projects/*/instances/*/tables/*}"
  123. }
  124. routing_parameters {
  125. field: "app_profile_id"
  126. }
  127. };
  128. option (google.api.method_signature) = "table_name,entries";
  129. option (google.api.method_signature) = "table_name,entries,app_profile_id";
  130. }
  131. // Mutates a row atomically based on the output of a predicate Reader filter.
  132. rpc CheckAndMutateRow(CheckAndMutateRowRequest) returns (CheckAndMutateRowResponse) {
  133. option (google.api.http) = {
  134. post: "/v2/{table_name=projects/*/instances/*/tables/*}:checkAndMutateRow"
  135. body: "*"
  136. };
  137. option (google.api.routing) = {
  138. routing_parameters {
  139. field: "table_name"
  140. path_template: "{table_name=projects/*/instances/*/tables/*}"
  141. }
  142. routing_parameters {
  143. field: "app_profile_id"
  144. }
  145. };
  146. option (google.api.method_signature) = "table_name,row_key,predicate_filter,true_mutations,false_mutations";
  147. option (google.api.method_signature) = "table_name,row_key,predicate_filter,true_mutations,false_mutations,app_profile_id";
  148. }
  149. // Warm up associated instance metadata for this connection.
  150. // This call is not required but may be useful for connection keep-alive.
  151. rpc PingAndWarm(PingAndWarmRequest) returns (PingAndWarmResponse) {
  152. option (google.api.http) = {
  153. post: "/v2/{name=projects/*/instances/*}:ping"
  154. body: "*"
  155. };
  156. option (google.api.routing) = {
  157. routing_parameters {
  158. field: "name"
  159. path_template: "{name=projects/*/instances/*}"
  160. }
  161. routing_parameters {
  162. field: "app_profile_id"
  163. }
  164. };
  165. option (google.api.method_signature) = "name";
  166. option (google.api.method_signature) = "name,app_profile_id";
  167. }
  168. // Modifies a row atomically on the server. The method reads the latest
  169. // existing timestamp and value from the specified columns and writes a new
  170. // entry based on pre-defined read/modify/write rules. The new value for the
  171. // timestamp is the greater of the existing timestamp or the current server
  172. // time. The method returns the new contents of all modified cells.
  173. rpc ReadModifyWriteRow(ReadModifyWriteRowRequest) returns (ReadModifyWriteRowResponse) {
  174. option (google.api.http) = {
  175. post: "/v2/{table_name=projects/*/instances/*/tables/*}:readModifyWriteRow"
  176. body: "*"
  177. };
  178. option (google.api.routing) = {
  179. routing_parameters {
  180. field: "table_name"
  181. path_template: "{table_name=projects/*/instances/*/tables/*}"
  182. }
  183. routing_parameters {
  184. field: "app_profile_id"
  185. }
  186. };
  187. option (google.api.method_signature) = "table_name,row_key,rules";
  188. option (google.api.method_signature) = "table_name,row_key,rules,app_profile_id";
  189. }
  190. }
  191. // Request message for Bigtable.ReadRows.
  192. message ReadRowsRequest {
  193. //
  194. // The desired view into RequestStats that should be returned in the response.
  195. //
  196. // See also: RequestStats message.
  197. enum RequestStatsView {
  198. // The default / unset value. The API will default to the NONE option below.
  199. REQUEST_STATS_VIEW_UNSPECIFIED = 0;
  200. // Do not include any RequestStats in the response. This will leave the
  201. // RequestStats embedded message unset in the response.
  202. REQUEST_STATS_NONE = 1;
  203. // Include the full set of available RequestStats in the response,
  204. // applicable to this read.
  205. REQUEST_STATS_FULL = 2;
  206. }
  207. // Required. The unique name of the table from which to read.
  208. // Values are of the form
  209. // `projects/<project>/instances/<instance>/tables/<table>`.
  210. string table_name = 1 [
  211. (google.api.field_behavior) = REQUIRED,
  212. (google.api.resource_reference) = {
  213. type: "bigtableadmin.googleapis.com/Table"
  214. }
  215. ];
  216. // This value specifies routing for replication. This API only accepts the
  217. // empty value of app_profile_id.
  218. string app_profile_id = 5;
  219. // The row keys and/or ranges to read sequentially. If not specified, reads
  220. // from all rows.
  221. RowSet rows = 2;
  222. // The filter to apply to the contents of the specified row(s). If unset,
  223. // reads the entirety of each row.
  224. RowFilter filter = 3;
  225. // The read will stop after committing to N rows' worth of results. The
  226. // default (zero) is to return all results.
  227. int64 rows_limit = 4;
  228. // The view into RequestStats, as described above.
  229. RequestStatsView request_stats_view = 6;
  230. }
  231. // Response message for Bigtable.ReadRows.
  232. message ReadRowsResponse {
  233. // Specifies a piece of a row's contents returned as part of the read
  234. // response stream.
  235. message CellChunk {
  236. // The row key for this chunk of data. If the row key is empty,
  237. // this CellChunk is a continuation of the same row as the previous
  238. // CellChunk in the response stream, even if that CellChunk was in a
  239. // previous ReadRowsResponse message.
  240. bytes row_key = 1;
  241. // The column family name for this chunk of data. If this message
  242. // is not present this CellChunk is a continuation of the same column
  243. // family as the previous CellChunk. The empty string can occur as a
  244. // column family name in a response so clients must check
  245. // explicitly for the presence of this message, not just for
  246. // `family_name.value` being non-empty.
  247. google.protobuf.StringValue family_name = 2;
  248. // The column qualifier for this chunk of data. If this message
  249. // is not present, this CellChunk is a continuation of the same column
  250. // as the previous CellChunk. Column qualifiers may be empty so
  251. // clients must check for the presence of this message, not just
  252. // for `qualifier.value` being non-empty.
  253. google.protobuf.BytesValue qualifier = 3;
  254. // The cell's stored timestamp, which also uniquely identifies it
  255. // within its column. Values are always expressed in
  256. // microseconds, but individual tables may set a coarser
  257. // granularity to further restrict the allowed values. For
  258. // example, a table which specifies millisecond granularity will
  259. // only allow values of `timestamp_micros` which are multiples of
  260. // 1000. Timestamps are only set in the first CellChunk per cell
  261. // (for cells split into multiple chunks).
  262. int64 timestamp_micros = 4;
  263. // Labels applied to the cell by a
  264. // [RowFilter][google.bigtable.v2.RowFilter]. Labels are only set
  265. // on the first CellChunk per cell.
  266. repeated string labels = 5;
  267. // The value stored in the cell. Cell values can be split across
  268. // multiple CellChunks. In that case only the value field will be
  269. // set in CellChunks after the first: the timestamp and labels
  270. // will only be present in the first CellChunk, even if the first
  271. // CellChunk came in a previous ReadRowsResponse.
  272. bytes value = 6;
  273. // If this CellChunk is part of a chunked cell value and this is
  274. // not the final chunk of that cell, value_size will be set to the
  275. // total length of the cell value. The client can use this size
  276. // to pre-allocate memory to hold the full cell value.
  277. int32 value_size = 7;
  278. // Signals to the client concerning previous CellChunks received.
  279. oneof row_status {
  280. // Indicates that the client should drop all previous chunks for
  281. // `row_key`, as it will be re-read from the beginning.
  282. bool reset_row = 8;
  283. // Indicates that the client can safely process all previous chunks for
  284. // `row_key`, as its data has been fully read.
  285. bool commit_row = 9;
  286. }
  287. }
  288. // A collection of a row's contents as part of the read request.
  289. repeated CellChunk chunks = 1;
  290. // Optionally the server might return the row key of the last row it
  291. // has scanned. The client can use this to construct a more
  292. // efficient retry request if needed: any row keys or portions of
  293. // ranges less than this row key can be dropped from the request.
  294. // This is primarily useful for cases where the server has read a
  295. // lot of data that was filtered out since the last committed row
  296. // key, allowing the client to skip that work on a retry.
  297. bytes last_scanned_row_key = 2;
  298. //
  299. // If requested, provide enhanced query performance statistics. The semantics
  300. // dictate:
  301. // * request_stats is empty on every (streamed) response, except
  302. // * request_stats has non-empty information after all chunks have been
  303. // streamed, where the ReadRowsResponse message only contains
  304. // request_stats.
  305. // * For example, if a read request would have returned an empty
  306. // response instead a single ReadRowsResponse is streamed with empty
  307. // chunks and request_stats filled.
  308. //
  309. // Visually, response messages will stream as follows:
  310. // ... -> {chunks: [...]} -> {chunks: [], request_stats: {...}}
  311. // \______________________/ \________________________________/
  312. // Primary response Trailer of RequestStats info
  313. //
  314. // Or if the read did not return any values:
  315. // {chunks: [], request_stats: {...}}
  316. // \________________________________/
  317. // Trailer of RequestStats info
  318. RequestStats request_stats = 3;
  319. }
  320. // Request message for Bigtable.SampleRowKeys.
  321. message SampleRowKeysRequest {
  322. // Required. The unique name of the table from which to sample row keys.
  323. // Values are of the form
  324. // `projects/<project>/instances/<instance>/tables/<table>`.
  325. string table_name = 1 [
  326. (google.api.field_behavior) = REQUIRED,
  327. (google.api.resource_reference) = {
  328. type: "bigtableadmin.googleapis.com/Table"
  329. }
  330. ];
  331. // This value specifies routing for replication. If not specified, the
  332. // "default" application profile will be used.
  333. string app_profile_id = 2;
  334. }
  335. // Response message for Bigtable.SampleRowKeys.
  336. message SampleRowKeysResponse {
  337. // Sorted streamed sequence of sample row keys in the table. The table might
  338. // have contents before the first row key in the list and after the last one,
  339. // but a key containing the empty string indicates "end of table" and will be
  340. // the last response given, if present.
  341. // Note that row keys in this list may not have ever been written to or read
  342. // from, and users should therefore not make any assumptions about the row key
  343. // structure that are specific to their use case.
  344. bytes row_key = 1;
  345. // Approximate total storage space used by all rows in the table which precede
  346. // `row_key`. Buffering the contents of all rows between two subsequent
  347. // samples would require space roughly equal to the difference in their
  348. // `offset_bytes` fields.
  349. int64 offset_bytes = 2;
  350. }
  351. // Request message for Bigtable.MutateRow.
  352. message MutateRowRequest {
  353. // Required. The unique name of the table to which the mutation should be applied.
  354. // Values are of the form
  355. // `projects/<project>/instances/<instance>/tables/<table>`.
  356. string table_name = 1 [
  357. (google.api.field_behavior) = REQUIRED,
  358. (google.api.resource_reference) = {
  359. type: "bigtableadmin.googleapis.com/Table"
  360. }
  361. ];
  362. // This value specifies routing for replication. If not specified, the
  363. // "default" application profile will be used.
  364. string app_profile_id = 4;
  365. // Required. The key of the row to which the mutation should be applied.
  366. bytes row_key = 2 [(google.api.field_behavior) = REQUIRED];
  367. // Required. Changes to be atomically applied to the specified row. Entries are applied
  368. // in order, meaning that earlier mutations can be masked by later ones.
  369. // Must contain at least one entry and at most 100000.
  370. repeated Mutation mutations = 3 [(google.api.field_behavior) = REQUIRED];
  371. }
  372. // Response message for Bigtable.MutateRow.
  373. message MutateRowResponse {
  374. }
  375. // Request message for BigtableService.MutateRows.
  376. message MutateRowsRequest {
  377. // A mutation for a given row.
  378. message Entry {
  379. // The key of the row to which the `mutations` should be applied.
  380. bytes row_key = 1;
  381. // Required. Changes to be atomically applied to the specified row. Mutations are
  382. // applied in order, meaning that earlier mutations can be masked by
  383. // later ones.
  384. // You must specify at least one mutation.
  385. repeated Mutation mutations = 2 [(google.api.field_behavior) = REQUIRED];
  386. }
  387. // Required. The unique name of the table to which the mutations should be applied.
  388. string table_name = 1 [
  389. (google.api.field_behavior) = REQUIRED,
  390. (google.api.resource_reference) = {
  391. type: "bigtableadmin.googleapis.com/Table"
  392. }
  393. ];
  394. // This value specifies routing for replication. If not specified, the
  395. // "default" application profile will be used.
  396. string app_profile_id = 3;
  397. // Required. The row keys and corresponding mutations to be applied in bulk.
  398. // Each entry is applied as an atomic mutation, but the entries may be
  399. // applied in arbitrary order (even between entries for the same row).
  400. // At least one entry must be specified, and in total the entries can
  401. // contain at most 100000 mutations.
  402. repeated Entry entries = 2 [(google.api.field_behavior) = REQUIRED];
  403. }
  404. // Response message for BigtableService.MutateRows.
  405. message MutateRowsResponse {
  406. // The result of applying a passed mutation in the original request.
  407. message Entry {
  408. // The index into the original request's `entries` list of the Entry
  409. // for which a result is being reported.
  410. int64 index = 1;
  411. // The result of the request Entry identified by `index`.
  412. // Depending on how requests are batched during execution, it is possible
  413. // for one Entry to fail due to an error with another Entry. In the event
  414. // that this occurs, the same error will be reported for both entries.
  415. google.rpc.Status status = 2;
  416. }
  417. // One or more results for Entries from the batch request.
  418. repeated Entry entries = 1;
  419. }
  420. // Request message for Bigtable.CheckAndMutateRow.
  421. message CheckAndMutateRowRequest {
  422. // Required. The unique name of the table to which the conditional mutation should be
  423. // applied.
  424. // Values are of the form
  425. // `projects/<project>/instances/<instance>/tables/<table>`.
  426. string table_name = 1 [
  427. (google.api.field_behavior) = REQUIRED,
  428. (google.api.resource_reference) = {
  429. type: "bigtableadmin.googleapis.com/Table"
  430. }
  431. ];
  432. // This value specifies routing for replication. If not specified, the
  433. // "default" application profile will be used.
  434. string app_profile_id = 7;
  435. // Required. The key of the row to which the conditional mutation should be applied.
  436. bytes row_key = 2 [(google.api.field_behavior) = REQUIRED];
  437. // The filter to be applied to the contents of the specified row. Depending
  438. // on whether or not any results are yielded, either `true_mutations` or
  439. // `false_mutations` will be executed. If unset, checks that the row contains
  440. // any values at all.
  441. RowFilter predicate_filter = 6;
  442. // Changes to be atomically applied to the specified row if `predicate_filter`
  443. // yields at least one cell when applied to `row_key`. Entries are applied in
  444. // order, meaning that earlier mutations can be masked by later ones.
  445. // Must contain at least one entry if `false_mutations` is empty, and at most
  446. // 100000.
  447. repeated Mutation true_mutations = 4;
  448. // Changes to be atomically applied to the specified row if `predicate_filter`
  449. // does not yield any cells when applied to `row_key`. Entries are applied in
  450. // order, meaning that earlier mutations can be masked by later ones.
  451. // Must contain at least one entry if `true_mutations` is empty, and at most
  452. // 100000.
  453. repeated Mutation false_mutations = 5;
  454. }
  455. // Response message for Bigtable.CheckAndMutateRow.
  456. message CheckAndMutateRowResponse {
  457. // Whether or not the request's `predicate_filter` yielded any results for
  458. // the specified row.
  459. bool predicate_matched = 1;
  460. }
  461. // Request message for client connection keep-alive and warming.
  462. message PingAndWarmRequest {
  463. // Required. The unique name of the instance to check permissions for as well as
  464. // respond. Values are of the form `projects/<project>/instances/<instance>`.
  465. string name = 1 [
  466. (google.api.field_behavior) = REQUIRED,
  467. (google.api.resource_reference) = {
  468. type: "bigtableadmin.googleapis.com/Instance"
  469. }
  470. ];
  471. // This value specifies routing for replication. If not specified, the
  472. // "default" application profile will be used.
  473. string app_profile_id = 2;
  474. }
  475. // Response message for Bigtable.PingAndWarm connection keepalive and warming.
  476. message PingAndWarmResponse {}
  477. // Request message for Bigtable.ReadModifyWriteRow.
  478. message ReadModifyWriteRowRequest {
  479. // Required. The unique name of the table to which the read/modify/write rules should be
  480. // applied.
  481. // Values are of the form
  482. // `projects/<project>/instances/<instance>/tables/<table>`.
  483. string table_name = 1 [
  484. (google.api.field_behavior) = REQUIRED,
  485. (google.api.resource_reference) = {
  486. type: "bigtableadmin.googleapis.com/Table"
  487. }
  488. ];
  489. // This value specifies routing for replication. If not specified, the
  490. // "default" application profile will be used.
  491. string app_profile_id = 4;
  492. // Required. The key of the row to which the read/modify/write rules should be applied.
  493. bytes row_key = 2 [(google.api.field_behavior) = REQUIRED];
  494. // Required. Rules specifying how the specified row's contents are to be transformed
  495. // into writes. Entries are applied in order, meaning that earlier rules will
  496. // affect the results of later ones.
  497. repeated ReadModifyWriteRule rules = 3 [(google.api.field_behavior) = REQUIRED];
  498. }
  499. // Response message for Bigtable.ReadModifyWriteRow.
  500. message ReadModifyWriteRowResponse {
  501. // A Row containing the new contents of all cells modified by the request.
  502. Row row = 1;
  503. }