Skip to content

Commit

Permalink
feat!: rename ListChangeStreamPartitions to GenerateInitialChangeStre…
Browse files Browse the repository at this point in the history
…amPartitions (googleapis#1347)

* Rename ListChangeStreamPartitions to GenerateInitialChangeStreamPartitions

Change-Id: Id306df92de00e172ae900a9c4bf95de856edd90f

* Fix formatting

Change-Id: I5a45afa15b8b4b65a10fd17987f2d832f6924213

* Fix more formatting

Change-Id: Ib7668abf8f61a5c939323c55dad14bc57501232e

* Fix more formatting after rebase

Change-Id: I88a545e8d34db9f5e675b6ef7409a9fbf3102d3d
  • Loading branch information
tonytanger authored and Teng Zhong committed Sep 2, 2022
1 parent 2cde452 commit 76d9c45
Show file tree
Hide file tree
Showing 22 changed files with 2,250 additions and 1,735 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,7 @@ public UnaryCallable<ReadModifyWriteRow, Row> readModifyWriteRowCallable() {
* String tableId = "[TABLE]";
*
* try {
* ServerStream<RowRange> stream = bigtableDataClient.listChangeStreamPartitions(tableId);
* ServerStream<RowRange> stream = bigtableDataClient.generateInitialChangeStreamPartitions(tableId);
* int count = 0;
*
* // Iterator style
Expand All @@ -1525,8 +1525,8 @@ public UnaryCallable<ReadModifyWriteRow, Row> readModifyWriteRowCallable() {
* @see ServerStreamingCallable For call styles.
*/
@InternalApi("Used in Changestream beam pipeline.")
public ServerStream<RowRange> listChangeStreamPartitions(String tableId) {
return listChangeStreamPartitionsCallable().call(tableId);
public ServerStream<RowRange> generateInitialChangeStreamPartitions(String tableId) {
return generateInitialChangeStreamPartitionsCallable().call(tableId);
}

/**
Expand All @@ -1538,7 +1538,7 @@ public ServerStream<RowRange> listChangeStreamPartitions(String tableId) {
* try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
* String tableId = "[TABLE]";
*
* bigtableDataClient.listChangeStreamPartitionsAsync(tableId, new ResponseObserver<RowRange>() {
* bigtableDataClient.generateInitialChangeStreamPartitionsAsync(tableId, new ResponseObserver<RowRange>() {
* StreamController controller;
* int count = 0;
*
Expand Down Expand Up @@ -1567,8 +1567,9 @@ public ServerStream<RowRange> listChangeStreamPartitions(String tableId) {
* }</pre>
*/
@InternalApi("Used in Changestream beam pipeline.")
public void listChangeStreamPartitionsAsync(String tableId, ResponseObserver<RowRange> observer) {
listChangeStreamPartitionsCallable().call(tableId, observer);
public void generateInitialChangeStreamPartitionsAsync(
String tableId, ResponseObserver<RowRange> observer) {
generateInitialChangeStreamPartitionsCallable().call(tableId, observer);
}

/**
Expand All @@ -1583,7 +1584,7 @@ public void listChangeStreamPartitionsAsync(String tableId, ResponseObserver<Row
*
* // Iterator style
* try {
* for(RowRange partition : bigtableDataClient.listChangeStreamPartitionsCallable().call(tableId)) {
* for(RowRange partition : bigtableDataClient.generateInitialChangeStreamPartitionsCallable().call(tableId)) {
* // Do something with partition
* }
* } catch (NotFoundException e) {
Expand All @@ -1594,7 +1595,7 @@ public void listChangeStreamPartitionsAsync(String tableId, ResponseObserver<Row
*
* // Sync style
* try {
* List<RowRange> partitions = bigtableDataClient.listChangeStreamPartitionsCallable().all().call(tableId);
* List<RowRange> partitions = bigtableDataClient.generateInitialChangeStreamPartitionsCallable().all().call(tableId);
* } catch (NotFoundException e) {
* System.out.println("Tried to read a non-existent table");
* } catch (RuntimeException e) {
Expand All @@ -1603,7 +1604,7 @@ public void listChangeStreamPartitionsAsync(String tableId, ResponseObserver<Row
*
* // Point look up
* ApiFuture<RowRange> partitionFuture =
* bigtableDataClient.listChangeStreamPartitionsCallable().first().futureCall(tableId);
* bigtableDataClient.generateInitialChangeStreamPartitionsCallable().first().futureCall(tableId);
*
* ApiFutures.addCallback(partitionFuture, new ApiFutureCallback<RowRange>() {
* public void onFailure(Throwable t) {
Expand All @@ -1625,8 +1626,8 @@ public void listChangeStreamPartitionsAsync(String tableId, ResponseObserver<Row
* @see ServerStreamingCallable For call styles.
*/
@InternalApi("Used in Changestream beam pipeline.")
public ServerStreamingCallable<String, RowRange> listChangeStreamPartitionsCallable() {
return stub.listChangeStreamPartitionsCallable();
public ServerStreamingCallable<String, RowRange> generateInitialChangeStreamPartitionsCallable() {
return stub.generateInitialChangeStreamPartitionsCallable();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"CheckAndMutateRow": {
"methods": ["checkAndMutateRow", "checkAndMutateRow", "checkAndMutateRow", "checkAndMutateRow", "checkAndMutateRow", "checkAndMutateRowCallable"]
},
"GenerateInitialChangeStreamPartitions": {
"methods": ["generateInitialChangeStreamPartitionsCallable"]
},
"MutateRow": {
"methods": ["mutateRow", "mutateRow", "mutateRow", "mutateRow", "mutateRow", "mutateRowCallable"]
},
Expand All @@ -22,6 +25,9 @@
"PingAndWarm": {
"methods": ["pingAndWarm", "pingAndWarm", "pingAndWarm", "pingAndWarm", "pingAndWarm", "pingAndWarmCallable"]
},
"ReadChangeStream": {
"methods": ["readChangeStreamCallable"]
},
"ReadModifyWriteRow": {
"methods": ["readModifyWriteRow", "readModifyWriteRow", "readModifyWriteRow", "readModifyWriteRow", "readModifyWriteRow", "readModifyWriteRowCallable"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import com.google.api.gax.rpc.UnaryCallable;
import com.google.bigtable.v2.CheckAndMutateRowRequest;
import com.google.bigtable.v2.CheckAndMutateRowResponse;
import com.google.bigtable.v2.ListChangeStreamPartitionsRequest;
import com.google.bigtable.v2.ListChangeStreamPartitionsResponse;
import com.google.bigtable.v2.GenerateInitialChangeStreamPartitionsRequest;
import com.google.bigtable.v2.GenerateInitialChangeStreamPartitionsResponse;
import com.google.bigtable.v2.MutateRowRequest;
import com.google.bigtable.v2.MutateRowResponse;
import com.google.bigtable.v2.MutateRowsRequest;
Expand Down Expand Up @@ -78,10 +78,11 @@ public UnaryCallable<PingAndWarmRequest, PingAndWarmResponse> pingAndWarmCallabl
}

public ServerStreamingCallable<
ListChangeStreamPartitionsRequest, ListChangeStreamPartitionsResponse>
listChangeStreamPartitionsCallable() {
GenerateInitialChangeStreamPartitionsRequest,
GenerateInitialChangeStreamPartitionsResponse>
generateInitialChangeStreamPartitionsCallable() {
throw new UnsupportedOperationException(
"Not implemented: listChangeStreamPartitionsCallable()");
"Not implemented: generateInitialChangeStreamPartitionsCallable()");
}

public ServerStreamingCallable<ReadChangeStreamRequest, ReadChangeStreamResponse>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.bigtable.v2.CheckAndMutateRowRequest;
import com.google.bigtable.v2.CheckAndMutateRowResponse;
import com.google.bigtable.v2.ListChangeStreamPartitionsRequest;
import com.google.bigtable.v2.ListChangeStreamPartitionsResponse;
import com.google.bigtable.v2.GenerateInitialChangeStreamPartitionsRequest;
import com.google.bigtable.v2.GenerateInitialChangeStreamPartitionsResponse;
import com.google.bigtable.v2.MutateRowRequest;
import com.google.bigtable.v2.MutateRowResponse;
import com.google.bigtable.v2.MutateRowsRequest;
Expand Down Expand Up @@ -88,8 +88,9 @@ public class BigtableStubSettings extends StubSettings<BigtableStubSettings> {
private final UnaryCallSettings<ReadModifyWriteRowRequest, ReadModifyWriteRowResponse>
readModifyWriteRowSettings;
private final ServerStreamingCallSettings<
ListChangeStreamPartitionsRequest, ListChangeStreamPartitionsResponse>
listChangeStreamPartitionsSettings;
GenerateInitialChangeStreamPartitionsRequest,
GenerateInitialChangeStreamPartitionsResponse>
generateInitialChangeStreamPartitionsSettings;
private final ServerStreamingCallSettings<ReadChangeStreamRequest, ReadChangeStreamResponse>
readChangeStreamSettings;

Expand Down Expand Up @@ -131,11 +132,14 @@ public UnaryCallSettings<PingAndWarmRequest, PingAndWarmResponse> pingAndWarmSet
return readModifyWriteRowSettings;
}

/** Returns the object with the settings used for calls to listChangeStreamPartitions. */
/**
* Returns the object with the settings used for calls to generateInitialChangeStreamPartitions.
*/
public ServerStreamingCallSettings<
ListChangeStreamPartitionsRequest, ListChangeStreamPartitionsResponse>
listChangeStreamPartitionsSettings() {
return listChangeStreamPartitionsSettings;
GenerateInitialChangeStreamPartitionsRequest,
GenerateInitialChangeStreamPartitionsResponse>
generateInitialChangeStreamPartitionsSettings() {
return generateInitialChangeStreamPartitionsSettings;
}

/** Returns the object with the settings used for calls to readChangeStream. */
Expand Down Expand Up @@ -225,8 +229,8 @@ protected BigtableStubSettings(Builder settingsBuilder) throws IOException {
checkAndMutateRowSettings = settingsBuilder.checkAndMutateRowSettings().build();
pingAndWarmSettings = settingsBuilder.pingAndWarmSettings().build();
readModifyWriteRowSettings = settingsBuilder.readModifyWriteRowSettings().build();
listChangeStreamPartitionsSettings =
settingsBuilder.listChangeStreamPartitionsSettings().build();
generateInitialChangeStreamPartitionsSettings =
settingsBuilder.generateInitialChangeStreamPartitionsSettings().build();
readChangeStreamSettings = settingsBuilder.readChangeStreamSettings().build();
}

Expand All @@ -247,8 +251,9 @@ public static class Builder extends StubSettings.Builder<BigtableStubSettings, B
private final UnaryCallSettings.Builder<ReadModifyWriteRowRequest, ReadModifyWriteRowResponse>
readModifyWriteRowSettings;
private final ServerStreamingCallSettings.Builder<
ListChangeStreamPartitionsRequest, ListChangeStreamPartitionsResponse>
listChangeStreamPartitionsSettings;
GenerateInitialChangeStreamPartitionsRequest,
GenerateInitialChangeStreamPartitionsResponse>
generateInitialChangeStreamPartitionsSettings;
private final ServerStreamingCallSettings.Builder<
ReadChangeStreamRequest, ReadChangeStreamResponse>
readChangeStreamSettings;
Expand Down Expand Up @@ -362,7 +367,7 @@ protected Builder(ClientContext clientContext) {
checkAndMutateRowSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
pingAndWarmSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
readModifyWriteRowSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listChangeStreamPartitionsSettings = ServerStreamingCallSettings.newBuilder();
generateInitialChangeStreamPartitionsSettings = ServerStreamingCallSettings.newBuilder();
readChangeStreamSettings = ServerStreamingCallSettings.newBuilder();

unaryMethodSettingsBuilders =
Expand All @@ -384,7 +389,8 @@ protected Builder(BigtableStubSettings settings) {
checkAndMutateRowSettings = settings.checkAndMutateRowSettings.toBuilder();
pingAndWarmSettings = settings.pingAndWarmSettings.toBuilder();
readModifyWriteRowSettings = settings.readModifyWriteRowSettings.toBuilder();
listChangeStreamPartitionsSettings = settings.listChangeStreamPartitionsSettings.toBuilder();
generateInitialChangeStreamPartitionsSettings =
settings.generateInitialChangeStreamPartitionsSettings.toBuilder();
readChangeStreamSettings = settings.readChangeStreamSettings.toBuilder();

unaryMethodSettingsBuilders =
Expand Down Expand Up @@ -445,7 +451,7 @@ private static Builder initDefaults(Builder builder) {
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));

builder
.listChangeStreamPartitionsSettings()
.generateInitialChangeStreamPartitionsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_5_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_5_params"));

Expand Down Expand Up @@ -513,11 +519,14 @@ public UnaryCallSettings.Builder<MutateRowRequest, MutateRowResponse> mutateRowS
return readModifyWriteRowSettings;
}

/** Returns the builder for the settings used for calls to listChangeStreamPartitions. */
/**
* Returns the builder for the settings used for calls to generateInitialChangeStreamPartitions.
*/
public ServerStreamingCallSettings.Builder<
ListChangeStreamPartitionsRequest, ListChangeStreamPartitionsResponse>
listChangeStreamPartitionsSettings() {
return listChangeStreamPartitionsSettings;
GenerateInitialChangeStreamPartitionsRequest,
GenerateInitialChangeStreamPartitionsResponse>
generateInitialChangeStreamPartitionsSettings() {
return generateInitialChangeStreamPartitionsSettings;
}

/** Returns the builder for the settings used for calls to readChangeStream. */
Expand Down
Loading

0 comments on commit 76d9c45

Please sign in to comment.