From ecbdb52ddc920bd493b284fb7d96b359a2f773f9 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 1 Mar 2023 15:13:13 -0500 Subject: [PATCH] feat: add new_partitions field for CloseStream for Cloud Bigtable ChangeStream (#1247) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add new_partitions field for CloseStream for Cloud Bigtable ChangeStream PiperOrigin-RevId: 512957844 Source-Link: https://github.com/googleapis/googleapis/commit/c5650ae0426ef1a82de84e5144ba26fcc5bb8549 Source-Link: https://github.com/googleapis/googleapis-gen/commit/a71ec9cc0a871286587f1df1c5e434c5bc338f91 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTcxZWM5Y2MwYTg3MTI4NjU4N2YxZGYxYzVlNDM0YzViYzMzOGY5MSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- protos/google/bigtable/v2/bigtable.proto | 32 +++++++++++++--- protos/protos.d.ts | 6 +++ protos/protos.js | 47 +++++++++++++++++++++++- protos/protos.json | 5 +++ 4 files changed, 83 insertions(+), 7 deletions(-) diff --git a/protos/google/bigtable/v2/bigtable.proto b/protos/google/bigtable/v2/bigtable.proto index c85e0cfc8..098d17e3e 100644 --- a/protos/google/bigtable/v2/bigtable.proto +++ b/protos/google/bigtable/v2/bigtable.proto @@ -788,17 +788,37 @@ message ReadChangeStreamResponse { } // A message indicating that the client should stop reading from the stream. - // If status is OK and `continuation_tokens` is empty, the stream has finished - // (for example if there was an `end_time` specified). - // If `continuation_tokens` is present, then a change in partitioning requires - // the client to open a new stream for each token to resume reading. + // If status is OK and `continuation_tokens` & `new_partitions` are empty, the + // stream has finished (for example if there was an `end_time` specified). + // If `continuation_tokens` & `new_partitions` are present, then a change in + // partitioning requires the client to open a new stream for each token to + // resume reading. Example: + // [B, D) ends + // | + // v + // new_partitions: [A, C) [C, E) + // continuation_tokens.partitions: [B,C) [C,D) + // ^---^ ^---^ + // ^ ^ + // | | + // | StreamContinuationToken 2 + // | + // StreamContinuationToken 1 + // To read the new partition [A,C), supply the continuation tokens whose + // ranges cover the new partition, for example ContinuationToken[A,B) & + // ContinuationToken[B,C). message CloseStream { // The status of the stream. google.rpc.Status status = 1; - // If non-empty, contains the information needed to start reading the new - // partition(s) that contain segments of this partition's row range. + // If non-empty, contains the information needed to resume reading their + // associated partitions. repeated StreamContinuationToken continuation_tokens = 2; + + // If non-empty, contains the new partitions to start reading from, which + // are related to but not necessarily identical to the partitions for the + // above `continuation_tokens`. + repeated StreamPartition new_partitions = 3; } // The data or control message on the stream. diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 1b0fe2e01..adce7f9af 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -13311,6 +13311,9 @@ export namespace google { /** CloseStream continuationTokens */ continuationTokens?: (google.bigtable.v2.IStreamContinuationToken[]|null); + + /** CloseStream newPartitions */ + newPartitions?: (google.bigtable.v2.IStreamPartition[]|null); } /** Represents a CloseStream. */ @@ -13328,6 +13331,9 @@ export namespace google { /** CloseStream continuationTokens. */ public continuationTokens: google.bigtable.v2.IStreamContinuationToken[]; + /** CloseStream newPartitions. */ + public newPartitions: google.bigtable.v2.IStreamPartition[]; + /** * Creates a new CloseStream instance using the specified properties. * @param [properties] Properties to set diff --git a/protos/protos.js b/protos/protos.js index 4882e79b2..e3ea4ff84 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -31380,6 +31380,7 @@ * @interface ICloseStream * @property {google.rpc.IStatus|null} [status] CloseStream status * @property {Array.|null} [continuationTokens] CloseStream continuationTokens + * @property {Array.|null} [newPartitions] CloseStream newPartitions */ /** @@ -31392,6 +31393,7 @@ */ function CloseStream(properties) { this.continuationTokens = []; + this.newPartitions = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -31414,6 +31416,14 @@ */ CloseStream.prototype.continuationTokens = $util.emptyArray; + /** + * CloseStream newPartitions. + * @member {Array.} newPartitions + * @memberof google.bigtable.v2.ReadChangeStreamResponse.CloseStream + * @instance + */ + CloseStream.prototype.newPartitions = $util.emptyArray; + /** * Creates a new CloseStream instance using the specified properties. * @function create @@ -31443,6 +31453,9 @@ if (message.continuationTokens != null && message.continuationTokens.length) for (var i = 0; i < message.continuationTokens.length; ++i) $root.google.bigtable.v2.StreamContinuationToken.encode(message.continuationTokens[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.newPartitions != null && message.newPartitions.length) + for (var i = 0; i < message.newPartitions.length; ++i) + $root.google.bigtable.v2.StreamPartition.encode(message.newPartitions[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -31487,6 +31500,12 @@ message.continuationTokens.push($root.google.bigtable.v2.StreamContinuationToken.decode(reader, reader.uint32())); break; } + case 3: { + if (!(message.newPartitions && message.newPartitions.length)) + message.newPartitions = []; + message.newPartitions.push($root.google.bigtable.v2.StreamPartition.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -31536,6 +31555,15 @@ return "continuationTokens." + error; } } + if (message.newPartitions != null && message.hasOwnProperty("newPartitions")) { + if (!Array.isArray(message.newPartitions)) + return "newPartitions: array expected"; + for (var i = 0; i < message.newPartitions.length; ++i) { + var error = $root.google.bigtable.v2.StreamPartition.verify(message.newPartitions[i]); + if (error) + return "newPartitions." + error; + } + } return null; }; @@ -31566,6 +31594,16 @@ message.continuationTokens[i] = $root.google.bigtable.v2.StreamContinuationToken.fromObject(object.continuationTokens[i]); } } + if (object.newPartitions) { + if (!Array.isArray(object.newPartitions)) + throw TypeError(".google.bigtable.v2.ReadChangeStreamResponse.CloseStream.newPartitions: array expected"); + message.newPartitions = []; + for (var i = 0; i < object.newPartitions.length; ++i) { + if (typeof object.newPartitions[i] !== "object") + throw TypeError(".google.bigtable.v2.ReadChangeStreamResponse.CloseStream.newPartitions: object expected"); + message.newPartitions[i] = $root.google.bigtable.v2.StreamPartition.fromObject(object.newPartitions[i]); + } + } return message; }; @@ -31582,8 +31620,10 @@ if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) + if (options.arrays || options.defaults) { object.continuationTokens = []; + object.newPartitions = []; + } if (options.defaults) object.status = null; if (message.status != null && message.hasOwnProperty("status")) @@ -31593,6 +31633,11 @@ for (var j = 0; j < message.continuationTokens.length; ++j) object.continuationTokens[j] = $root.google.bigtable.v2.StreamContinuationToken.toObject(message.continuationTokens[j], options); } + if (message.newPartitions && message.newPartitions.length) { + object.newPartitions = []; + for (var j = 0; j < message.newPartitions.length; ++j) + object.newPartitions[j] = $root.google.bigtable.v2.StreamPartition.toObject(message.newPartitions[j], options); + } return object; }; diff --git a/protos/protos.json b/protos/protos.json index 40c274db0..71a826e24 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -3702,6 +3702,11 @@ "rule": "repeated", "type": "StreamContinuationToken", "id": 2 + }, + "newPartitions": { + "rule": "repeated", + "type": "StreamPartition", + "id": 3 } } }