Fluent DSL TableAdmin client #3395
Conversation
| * TableAdminRequests.createTable("tableId") | ||
| * .addColumnFamily("cf1") | ||
| * .addColumnFamily("cf2", GCRULES.maxVersions(10)) | ||
| * .withGranularity(TimestampGranularity.MILLIS) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * .rule(GCRULES.maxVersions(10))) | ||
| * .drop("mf1") | ||
| * client.modifyFamilies(modifyFamiliesReq); | ||
| * } |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * | ||
| * <p>Sample code to get started: | ||
| * | ||
| * <pre><code> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| } | ||
|
|
||
| /** | ||
| * Creates, Updates and drops ColumnFamilies as per the request See {@link |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * .rule(GCRULES.maxVersions(10))) | ||
| * .drop("mf1") | ||
| * client.modifyFamiliesAsync(modifyFamiliesReq); | ||
| * } |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * @return | ||
| */ | ||
| public ModifyFamilies create(String familyId) { | ||
| return createWithGCRule(familyId, null); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * @param gcRule | ||
| * @return | ||
| */ | ||
| public ModifyFamilies createWithGCRule(String familyId, GCRule gcRule) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * @param gcRule | ||
| * @return | ||
| */ | ||
| public ModifyFamilies updateWithGCRule(String familyId, GCRule gcRule) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * @param GenerateConsistencyTokenResponse - Protobuf ConsistencyTokenResponse | ||
| * @return ConsistencyToken - ConsistencyToken response wrapper | ||
| */ | ||
| public static ConsistencyToken convertTokenResponse( |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| private Map<String, ClusterState> clusterStates = new HashMap<>(); | ||
| private Map<String, ColumnFamily> columnFamilies = new HashMap<>(); | ||
|
|
||
| private Table(com.google.bigtable.admin.v2.Table table) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
ad80709 to
b28ce92
Compare
|
Can you please check the latest commit. It should be fixed there.
…On Wed, Jun 20, 2018 at 11:45 AM, Igor Bernstein ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In google-cloud-clients/google-cloud-bigtable/src/main/java/
com/google/cloud/bigtable/admin/v2/models/TableAdminResponses.java
<#3395 (comment)>
:
> + }
+
+ @OverRide
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("tableName", tableName)
+ .add("timestampGranularity", timestampGranularity)
+ .add("clusterStates", getClusterStates())
+ .add("columnFamiles", getColumnFamiles())
+ .toString();
+ }
+ }
+
+ /** Wrapper for ***@***.*** ClusterState} protocol buffer object */
+ public static final class ClusterState {
+ private String id;
please fix
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3395 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AfisGFYsBh1tGALGoWPmlXom-mR70kGwks5t-m4EgaJpZM4UuKE1>
.
|
| * | ||
| * client.createTableAsync(createTableReq); | ||
| * } | ||
| * }</pre> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * .union() | ||
| * .rule(GCRULES.maxAge(Duration.ofSeconds(100))) | ||
| * .rule(GCRULES.maxVersions(1))) | ||
| * .createWithGCRule( |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * .union() | ||
| * .rule(GCRULES.maxAge(Duration.ofSeconds(100))) | ||
| * .rule(GCRULES.maxVersions(1))) | ||
| * .createWithGCRule( |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| /** Casts the rule to IntersectionRule. On failure throws a ClassCastException */ | ||
| public IntersectionRule getIntersectionOrThow() { | ||
| return (IntersectionRule) this; | ||
| } |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| } | ||
|
|
||
| /** Helpers to support casting rules the Type, when the Type is known */ | ||
| public abstract static class BaseRule implements GCRule { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * @param familyId | ||
| * @return | ||
| */ | ||
| public ModifyFamilies create(String familyId) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * | ||
| * @return TimestampGranularity | ||
| */ | ||
| public TimestampGranularity getTimestampGranularity() { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
igorbernstein2
left a comment
There was a problem hiding this comment.
LGTM after these changes. @pongad, would you mind reviewing?
| * BigtableTableAdminSettings bigtableTableAdminSettings = | ||
| * BigtableTableAdminSettings.newBuilder() | ||
| * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) | ||
| * .build(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) | ||
| * .build(); | ||
| * TableAdminClient client = | ||
| * TableAdminClient.create(InstanceName.of("[PROJECT]", "[INSTANCE]"), bigtableTableAdminSettings); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * BigtableTableAdminSettings bigtableTableAdminSettings = | ||
| * BigtableTableAdminSettings.newBuilder().setEndpoint(myEndpoint).build(); | ||
| * TableAdminClient client = | ||
| * TableAdminClient.create(InstanceName.of("[PROJECT]", "[INSTANCE]"), bigtableTableAdminSettings); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * try(TableAdminClient client = TableAdminClient.create(InstanceName.of("[PROJECT]", "[INSTANCE]"))) { | ||
| * CreateTable createTableReq = | ||
| * TableAdminRequests.createTable("tableId") | ||
| * .addColumnFamily("cf2", GCRULES.maxVersions(10)) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * @return ApiFuture<Boolean> | ||
| */ | ||
| public ApiFuture<Boolean> isConsistentAsync(String tableId, ConsistencyToken token) { | ||
| ApiFuture<CheckConsistencyResponse> CheckConsResp = |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| /** Gets the configured maximum versions */ | ||
| public int getMaxVersions() { | ||
| return toProto().getMaxNumVersions(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
pongad
left a comment
There was a problem hiding this comment.
I don't know BigTable very well, but nothing looks wrong to me apart from the typo.
@igorbernstein2 could you give an "official" approval?
| * | ||
| * @return DefaultRule | ||
| */ | ||
| public DefaultRule defaulRule() { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
@pongad thanks for looking. |
b79a90b to
c6a974e
Compare
No description provided.