bigtable.proto 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. // Copyright 2019 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/bigtable/v2/data.proto";
  21. import "google/protobuf/wrappers.proto";
  22. import "google/rpc/status.proto";
  23. option csharp_namespace = "Google.Cloud.Bigtable.V2";
  24. option go_package = "google.golang.org/genproto/googleapis/bigtable/v2;bigtable";
  25. option java_multiple_files = true;
  26. option java_outer_classname = "BigtableProto";
  27. option java_package = "com.google.bigtable.v2";
  28. option php_namespace = "Google\\Cloud\\Bigtable\\V2";
  29. option ruby_package = "Google::Cloud::Bigtable::V2";
  30. option (google.api.resource_definition) = {
  31. type: "bigtable.googleapis.com/Table"
  32. pattern: "projects/{project}/instances/{instance}/tables/{table}"
  33. };
  34. // Service for reading from and writing to existing Bigtable tables.
  35. service Bigtable {
  36. option (google.api.default_host) = "bigtable.googleapis.com";
  37. option (google.api.oauth_scopes) =
  38. "https://www.googleapis.com/auth/bigtable.data,"
  39. "https://www.googleapis.com/auth/bigtable.data.readonly,"
  40. "https://www.googleapis.com/auth/cloud-bigtable.data,"
  41. "https://www.googleapis.com/auth/cloud-bigtable.data.readonly,"
  42. "https://www.googleapis.com/auth/cloud-platform,"
  43. "https://www.googleapis.com/auth/cloud-platform.read-only";
  44. // Streams back the contents of all requested rows in key order, optionally
  45. // applying the same Reader filter to each. Depending on their size,
  46. // rows and cells may be broken up across multiple responses, but
  47. // atomicity of each row will still be preserved. See the
  48. // ReadRowsResponse documentation for details.
  49. rpc ReadRows(ReadRowsRequest) returns (stream ReadRowsResponse) {
  50. option (google.api.http) = {
  51. post: "/v2/{table_name=projects/*/instances/*/tables/*}:readRows"
  52. body: "*"
  53. };
  54. option (google.api.method_signature) = "table_name";
  55. option (google.api.method_signature) = "table_name,app_profile_id";
  56. }
  57. // Returns a sample of row keys in the table. The returned row keys will
  58. // delimit contiguous sections of the table of approximately equal size,
  59. // which can be used to break up the data for distributed tasks like
  60. // mapreduces.
  61. rpc SampleRowKeys(SampleRowKeysRequest) returns (stream SampleRowKeysResponse) {
  62. option (google.api.http) = {
  63. get: "/v2/{table_name=projects/*/instances/*/tables/*}:sampleRowKeys"
  64. };
  65. option (google.api.method_signature) = "table_name";
  66. option (google.api.method_signature) = "table_name,app_profile_id";
  67. }
  68. // Mutates a row atomically. Cells already present in the row are left
  69. // unchanged unless explicitly changed by `mutation`.
  70. rpc MutateRow(MutateRowRequest) returns (MutateRowResponse) {
  71. option (google.api.http) = {
  72. post: "/v2/{table_name=projects/*/instances/*/tables/*}:mutateRow"
  73. body: "*"
  74. };
  75. option (google.api.method_signature) = "table_name,row_key,mutations";
  76. option (google.api.method_signature) = "table_name,row_key,mutations,app_profile_id";
  77. }
  78. // Mutates multiple rows in a batch. Each individual row is mutated
  79. // atomically as in MutateRow, but the entire batch is not executed
  80. // atomically.
  81. rpc MutateRows(MutateRowsRequest) returns (stream MutateRowsResponse) {
  82. option (google.api.http) = {
  83. post: "/v2/{table_name=projects/*/instances/*/tables/*}:mutateRows"
  84. body: "*"
  85. };
  86. option (google.api.method_signature) = "table_name,entries";
  87. option (google.api.method_signature) = "table_name,entries,app_profile_id";
  88. }
  89. // Mutates a row atomically based on the output of a predicate Reader filter.
  90. rpc CheckAndMutateRow(CheckAndMutateRowRequest) returns (CheckAndMutateRowResponse) {
  91. option (google.api.http) = {
  92. post: "/v2/{table_name=projects/*/instances/*/tables/*}:checkAndMutateRow"
  93. body: "*"
  94. };
  95. option (google.api.method_signature) = "table_name,row_key,predicate_filter,true_mutations,false_mutations";
  96. option (google.api.method_signature) = "table_name,row_key,predicate_filter,true_mutations,false_mutations,app_profile_id";
  97. }
  98. // Modifies a row atomically on the server. The method reads the latest
  99. // existing timestamp and value from the specified columns and writes a new
  100. // entry based on pre-defined read/modify/write rules. The new value for the
  101. // timestamp is the greater of the existing timestamp or the current server
  102. // time. The method returns the new contents of all modified cells.
  103. rpc ReadModifyWriteRow(ReadModifyWriteRowRequest) returns (ReadModifyWriteRowResponse) {
  104. option (google.api.http) = {
  105. post: "/v2/{table_name=projects/*/instances/*/tables/*}:readModifyWriteRow"
  106. body: "*"
  107. };
  108. option (google.api.method_signature) = "table_name,row_key,rules";
  109. option (google.api.method_signature) = "table_name,row_key,rules,app_profile_id";
  110. }
  111. }
  112. // Request message for Bigtable.ReadRows.
  113. message ReadRowsRequest {
  114. // Required. The unique name of the table from which to read.
  115. // Values are of the form
  116. // `projects/<project>/instances/<instance>/tables/<table>`.
  117. string table_name = 1 [
  118. (google.api.field_behavior) = REQUIRED,
  119. (google.api.resource_reference) = {
  120. type: "bigtable.googleapis.com/Table"
  121. }
  122. ];
  123. // This value specifies routing for replication. If not specified, the
  124. // "default" application profile will be used.
  125. string app_profile_id = 5;
  126. // The row keys and/or ranges to read. If not specified, reads from all rows.
  127. RowSet rows = 2;
  128. // The filter to apply to the contents of the specified row(s). If unset,
  129. // reads the entirety of each row.
  130. RowFilter filter = 3;
  131. // The read will terminate after committing to N rows' worth of results. The
  132. // default (zero) is to return all results.
  133. int64 rows_limit = 4;
  134. }
  135. // Response message for Bigtable.ReadRows.
  136. message ReadRowsResponse {
  137. // Specifies a piece of a row's contents returned as part of the read
  138. // response stream.
  139. message CellChunk {
  140. // The row key for this chunk of data. If the row key is empty,
  141. // this CellChunk is a continuation of the same row as the previous
  142. // CellChunk in the response stream, even if that CellChunk was in a
  143. // previous ReadRowsResponse message.
  144. bytes row_key = 1;
  145. // The column family name for this chunk of data. If this message
  146. // is not present this CellChunk is a continuation of the same column
  147. // family as the previous CellChunk. The empty string can occur as a
  148. // column family name in a response so clients must check
  149. // explicitly for the presence of this message, not just for
  150. // `family_name.value` being non-empty.
  151. google.protobuf.StringValue family_name = 2;
  152. // The column qualifier for this chunk of data. If this message
  153. // is not present, this CellChunk is a continuation of the same column
  154. // as the previous CellChunk. Column qualifiers may be empty so
  155. // clients must check for the presence of this message, not just
  156. // for `qualifier.value` being non-empty.
  157. google.protobuf.BytesValue qualifier = 3;
  158. // The cell's stored timestamp, which also uniquely identifies it
  159. // within its column. Values are always expressed in
  160. // microseconds, but individual tables may set a coarser
  161. // granularity to further restrict the allowed values. For
  162. // example, a table which specifies millisecond granularity will
  163. // only allow values of `timestamp_micros` which are multiples of
  164. // 1000. Timestamps are only set in the first CellChunk per cell
  165. // (for cells split into multiple chunks).
  166. int64 timestamp_micros = 4;
  167. // Labels applied to the cell by a
  168. // [RowFilter][google.bigtable.v2.RowFilter]. Labels are only set
  169. // on the first CellChunk per cell.
  170. repeated string labels = 5;
  171. // The value stored in the cell. Cell values can be split across
  172. // multiple CellChunks. In that case only the value field will be
  173. // set in CellChunks after the first: the timestamp and labels
  174. // will only be present in the first CellChunk, even if the first
  175. // CellChunk came in a previous ReadRowsResponse.
  176. bytes value = 6;
  177. // If this CellChunk is part of a chunked cell value and this is
  178. // not the final chunk of that cell, value_size will be set to the
  179. // total length of the cell value. The client can use this size
  180. // to pre-allocate memory to hold the full cell value.
  181. int32 value_size = 7;
  182. // Signals to the client concerning previous CellChunks received.
  183. oneof row_status {
  184. // Indicates that the client should drop all previous chunks for
  185. // `row_key`, as it will be re-read from the beginning.
  186. bool reset_row = 8;
  187. // Indicates that the client can safely process all previous chunks for
  188. // `row_key`, as its data has been fully read.
  189. bool commit_row = 9;
  190. }
  191. }
  192. // A collection of a row's contents as part of the read request.
  193. repeated CellChunk chunks = 1;
  194. // Optionally the server might return the row key of the last row it
  195. // has scanned. The client can use this to construct a more
  196. // efficient retry request if needed: any row keys or portions of
  197. // ranges less than this row key can be dropped from the request.
  198. // This is primarily useful for cases where the server has read a
  199. // lot of data that was filtered out since the last committed row
  200. // key, allowing the client to skip that work on a retry.
  201. bytes last_scanned_row_key = 2;
  202. }
  203. // Request message for Bigtable.SampleRowKeys.
  204. message SampleRowKeysRequest {
  205. // Required. The unique name of the table from which to sample row keys.
  206. // Values are of the form
  207. // `projects/<project>/instances/<instance>/tables/<table>`.
  208. string table_name = 1 [
  209. (google.api.field_behavior) = REQUIRED,
  210. (google.api.resource_reference) = {
  211. type: "bigtable.googleapis.com/Table"
  212. }
  213. ];
  214. // This value specifies routing for replication. If not specified, the
  215. // "default" application profile will be used.
  216. string app_profile_id = 2;
  217. }
  218. // Response message for Bigtable.SampleRowKeys.
  219. message SampleRowKeysResponse {
  220. // Sorted streamed sequence of sample row keys in the table. The table might
  221. // have contents before the first row key in the list and after the last one,
  222. // but a key containing the empty string indicates "end of table" and will be
  223. // the last response given, if present.
  224. // Note that row keys in this list may not have ever been written to or read
  225. // from, and users should therefore not make any assumptions about the row key
  226. // structure that are specific to their use case.
  227. bytes row_key = 1;
  228. // Approximate total storage space used by all rows in the table which precede
  229. // `row_key`. Buffering the contents of all rows between two subsequent
  230. // samples would require space roughly equal to the difference in their
  231. // `offset_bytes` fields.
  232. int64 offset_bytes = 2;
  233. }
  234. // Request message for Bigtable.MutateRow.
  235. message MutateRowRequest {
  236. // Required. The unique name of the table to which the mutation should be applied.
  237. // Values are of the form
  238. // `projects/<project>/instances/<instance>/tables/<table>`.
  239. string table_name = 1 [
  240. (google.api.field_behavior) = REQUIRED,
  241. (google.api.resource_reference) = {
  242. type: "bigtable.googleapis.com/Table"
  243. }
  244. ];
  245. // This value specifies routing for replication. If not specified, the
  246. // "default" application profile will be used.
  247. string app_profile_id = 4;
  248. // Required. The key of the row to which the mutation should be applied.
  249. bytes row_key = 2 [(google.api.field_behavior) = REQUIRED];
  250. // Required. Changes to be atomically applied to the specified row. Entries are applied
  251. // in order, meaning that earlier mutations can be masked by later ones.
  252. // Must contain at least one entry and at most 100000.
  253. repeated Mutation mutations = 3 [(google.api.field_behavior) = REQUIRED];
  254. }
  255. // Response message for Bigtable.MutateRow.
  256. message MutateRowResponse {
  257. }
  258. // Request message for BigtableService.MutateRows.
  259. message MutateRowsRequest {
  260. // A mutation for a given row.
  261. message Entry {
  262. // The key of the row to which the `mutations` should be applied.
  263. bytes row_key = 1;
  264. // Required. Changes to be atomically applied to the specified row. Mutations are
  265. // applied in order, meaning that earlier mutations can be masked by
  266. // later ones.
  267. // You must specify at least one mutation.
  268. repeated Mutation mutations = 2 [(google.api.field_behavior) = REQUIRED];
  269. }
  270. // Required. The unique name of the table to which the mutations should be applied.
  271. string table_name = 1 [
  272. (google.api.field_behavior) = REQUIRED,
  273. (google.api.resource_reference) = {
  274. type: "bigtable.googleapis.com/Table"
  275. }
  276. ];
  277. // This value specifies routing for replication. If not specified, the
  278. // "default" application profile will be used.
  279. string app_profile_id = 3;
  280. // Required. The row keys and corresponding mutations to be applied in bulk.
  281. // Each entry is applied as an atomic mutation, but the entries may be
  282. // applied in arbitrary order (even between entries for the same row).
  283. // At least one entry must be specified, and in total the entries can
  284. // contain at most 100000 mutations.
  285. repeated Entry entries = 2 [(google.api.field_behavior) = REQUIRED];
  286. }
  287. // Response message for BigtableService.MutateRows.
  288. message MutateRowsResponse {
  289. // The result of applying a passed mutation in the original request.
  290. message Entry {
  291. // The index into the original request's `entries` list of the Entry
  292. // for which a result is being reported.
  293. int64 index = 1;
  294. // The result of the request Entry identified by `index`.
  295. // Depending on how requests are batched during execution, it is possible
  296. // for one Entry to fail due to an error with another Entry. In the event
  297. // that this occurs, the same error will be reported for both entries.
  298. google.rpc.Status status = 2;
  299. }
  300. // One or more results for Entries from the batch request.
  301. repeated Entry entries = 1;
  302. }
  303. // Request message for Bigtable.CheckAndMutateRow.
  304. message CheckAndMutateRowRequest {
  305. // Required. The unique name of the table to which the conditional mutation should be
  306. // applied.
  307. // Values are of the form
  308. // `projects/<project>/instances/<instance>/tables/<table>`.
  309. string table_name = 1 [
  310. (google.api.field_behavior) = REQUIRED,
  311. (google.api.resource_reference) = {
  312. type: "bigtable.googleapis.com/Table"
  313. }
  314. ];
  315. // This value specifies routing for replication. If not specified, the
  316. // "default" application profile will be used.
  317. string app_profile_id = 7;
  318. // Required. The key of the row to which the conditional mutation should be applied.
  319. bytes row_key = 2 [(google.api.field_behavior) = REQUIRED];
  320. // The filter to be applied to the contents of the specified row. Depending
  321. // on whether or not any results are yielded, either `true_mutations` or
  322. // `false_mutations` will be executed. If unset, checks that the row contains
  323. // any values at all.
  324. RowFilter predicate_filter = 6;
  325. // Changes to be atomically applied to the specified row if `predicate_filter`
  326. // yields at least one cell when applied to `row_key`. Entries are applied in
  327. // order, meaning that earlier mutations can be masked by later ones.
  328. // Must contain at least one entry if `false_mutations` is empty, and at most
  329. // 100000.
  330. repeated Mutation true_mutations = 4;
  331. // Changes to be atomically applied to the specified row if `predicate_filter`
  332. // does not yield any cells when applied to `row_key`. Entries are applied in
  333. // order, meaning that earlier mutations can be masked by later ones.
  334. // Must contain at least one entry if `true_mutations` is empty, and at most
  335. // 100000.
  336. repeated Mutation false_mutations = 5;
  337. }
  338. // Response message for Bigtable.CheckAndMutateRow.
  339. message CheckAndMutateRowResponse {
  340. // Whether or not the request's `predicate_filter` yielded any results for
  341. // the specified row.
  342. bool predicate_matched = 1;
  343. }
  344. // Request message for Bigtable.ReadModifyWriteRow.
  345. message ReadModifyWriteRowRequest {
  346. // Required. The unique name of the table to which the read/modify/write rules should be
  347. // applied.
  348. // Values are of the form
  349. // `projects/<project>/instances/<instance>/tables/<table>`.
  350. string table_name = 1 [
  351. (google.api.field_behavior) = REQUIRED,
  352. (google.api.resource_reference) = {
  353. type: "bigtable.googleapis.com/Table"
  354. }
  355. ];
  356. // This value specifies routing for replication. If not specified, the
  357. // "default" application profile will be used.
  358. string app_profile_id = 4;
  359. // Required. The key of the row to which the read/modify/write rules should be applied.
  360. bytes row_key = 2 [(google.api.field_behavior) = REQUIRED];
  361. // Required. Rules specifying how the specified row's contents are to be transformed
  362. // into writes. Entries are applied in order, meaning that earlier rules will
  363. // affect the results of later ones.
  364. repeated ReadModifyWriteRule rules = 3 [(google.api.field_behavior) = REQUIRED];
  365. }
  366. // Response message for Bigtable.ReadModifyWriteRow.
  367. message ReadModifyWriteRowResponse {
  368. // A Row containing the new contents of all cells modified by the request.
  369. Row row = 1;
  370. }