Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
public final class BigtableInstanceAdminClient implements AutoCloseable {
private final String projectId;
private final BigtableInstanceAdminStub stub;
private final BaseBigtableInstanceAdminClient baseClient;
private final BigtableInstanceAdminClientV2 baseClient;

/** Constructs an instance of BigtableInstanceAdminClient with the given project ID. */
public static BigtableInstanceAdminClient create(@Nonnull String projectId) throws IOException {
Expand All @@ -148,7 +148,7 @@ private BigtableInstanceAdminClient(
@Nonnull String projectId, @Nonnull BigtableInstanceAdminStub stub) {
this.projectId = projectId;
this.stub = stub;
this.baseClient = BaseBigtableInstanceAdminClient.create(stub);
this.baseClient = BigtableInstanceAdminClientV2.create(stub);
}

/** Gets the project ID this client is associated with. */
Expand All @@ -160,7 +160,7 @@ public String getProjectId() {
* Returns the modern autogenerated client. This provides access to the newest features and
* proto-based methods.
*/
public BaseBigtableInstanceAdminClient getBaseClient() {
public BigtableInstanceAdminClientV2 getBaseClient() {
return baseClient;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public final class BigtableTableAdminClient implements AutoCloseable {
private final EnhancedBigtableTableAdminStub stub;
private final String projectId;
private final String instanceId;
private final BaseBigtableTableAdminClient baseClient;
private final BigtableTableAdminClientV2 baseClient;

/** Constructs an instance of BigtableTableAdminClient with the given project and instance IDs. */
public static BigtableTableAdminClient create(
Expand Down Expand Up @@ -209,7 +209,12 @@ private BigtableTableAdminClient(
this.projectId = projectId;
this.instanceId = instanceId;
this.stub = stub;
this.baseClient = BaseBigtableTableAdminClient.create(stub);
this.baseClient =
new BigtableTableAdminClientV2(
stub,
(com.google.cloud.bigtable.admin.v2.stub.AwaitConsistencyCallable)
stub.awaitConsistencyCallable(),
stub.awaitOptimizeRestoredTableCallable());
}

/** Gets the project ID of the instance whose tables this client manages. */
Expand All @@ -226,7 +231,7 @@ public String getInstanceId() {
* Returns the modern autogenerated client. This provides access to the newest features and
* proto-based methods.
*/
public BaseBigtableTableAdminClient getBaseClient() {
public BigtableTableAdminClientV2 getBaseClient() {
return baseClient;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import com.google.cloud.bigtable.admin.v2.models.ConsistencyRequest;
import com.google.cloud.bigtable.admin.v2.models.OptimizeRestoredTableOperationToken;
import com.google.cloud.bigtable.admin.v2.models.RestoredTableResult;
import com.google.cloud.bigtable.admin.v2.stub.AwaitConsistencyCallable;
import com.google.cloud.bigtable.admin.v2.stub.BigtableTableAdminStub;
import com.google.cloud.bigtable.admin.v2.stub.BigtableTableAdminStubSettings;
import com.google.common.base.Strings;
Expand All @@ -57,7 +56,8 @@
* generator cannot handle natively (e.g., chained Long Running Operations, Consistency Polling).
*/
public class BigtableTableAdminClientV2 extends BaseBigtableTableAdminClient {
private final AwaitConsistencyCallable awaitConsistencyCallable;
private final com.google.cloud.bigtable.admin.v2.stub.AwaitConsistencyCallable
awaitConsistencyCallable;
private final OperationCallable<Void, Empty, OptimizeRestoredTableMetadata>
optimizeRestoredTableOperationBaseCallable;

Expand All @@ -79,16 +79,16 @@ protected BigtableTableAdminClientV2(BigtableTableAdminStub stub) {
@com.google.common.annotations.VisibleForTesting
BigtableTableAdminClientV2(
BigtableTableAdminStub stub,
AwaitConsistencyCallable awaitConsistencyCallable,
com.google.cloud.bigtable.admin.v2.stub.AwaitConsistencyCallable awaitConsistencyCallable,
OperationCallable<Void, Empty, OptimizeRestoredTableMetadata>
optimizeRestoredTableOperationBaseCallable) {
super(stub);
this.awaitConsistencyCallable = awaitConsistencyCallable;
this.optimizeRestoredTableOperationBaseCallable = optimizeRestoredTableOperationBaseCallable;
}

private AwaitConsistencyCallable createAwaitConsistencyCallable(
BigtableTableAdminStubSettings settings) throws IOException {
private com.google.cloud.bigtable.admin.v2.stub.AwaitConsistencyCallable
createAwaitConsistencyCallable(BigtableTableAdminStubSettings settings) throws IOException {
ClientContext clientContext = ClientContext.create(settings);
// TODO(igorbernstein2): expose polling settings
RetrySettings pollingSettings =
Expand All @@ -103,7 +103,7 @@ private AwaitConsistencyCallable createAwaitConsistencyCallable(
.setRpcTimeoutMultiplier(1.0)
.build();

return AwaitConsistencyCallable.create(
return com.google.cloud.bigtable.admin.v2.stub.AwaitConsistencyCallable.create(
getStub().generateConsistencyTokenCallable(),
getStub().checkConsistencyCallable(),
clientContext,
Expand Down Expand Up @@ -199,11 +199,6 @@ public static final BigtableTableAdminClientV2 create(BaseBigtableTableAdminSett
return new BigtableTableAdminClientV2(settings);
}

/** Constructs an instance of BigtableTableAdminClientV2 with the given stub. */
public static final BigtableTableAdminClientV2 create(BigtableTableAdminStub stub) {
return new BigtableTableAdminClientV2(stub);
}

/**
* Awaits the completion of the "Optimize Restored Table" operation.
*
Expand Down Expand Up @@ -322,8 +317,9 @@ private UnaryCallable<ConsistencyRequest, Void> getAwaitConsistencyCallable() {
return awaitConsistencyCallable;
}
throw new IllegalStateException(
"AwaitConsistencyCallable not initialized. BigtableTableAdminClientV2 must be "
+ "initialized via settings to use this functionality.");
"com.google.cloud.bigtable.admin.v2.stub.AwaitConsistencyCallable not initialized."
+ " BigtableTableAdminClientV2 must be initialized via settings to use this"
+ " functionality.");
}

private OperationCallable<Void, Empty, OptimizeRestoredTableMetadata>
Expand Down
Loading