Skip to content

Fluent DSL TableAdmin client #3395

Merged
pongad merged 10 commits into
googleapis:masterfrom
spollapally:adminclient-table-mv
Jun 26, 2018
Merged

Fluent DSL TableAdmin client #3395
pongad merged 10 commits into
googleapis:masterfrom
spollapally:adminclient-table-mv

Conversation

@spollapally

Copy link
Copy Markdown

No description provided.

@spollapally spollapally requested a review from pongad as a code owner June 19, 2018 20:09
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 19, 2018
* TableAdminRequests.createTable("tableId")
* .addColumnFamily("cf1")
* .addColumnFamily("cf2", GCRULES.maxVersions(10))
* .withGranularity(TimestampGranularity.MILLIS)

This comment was marked as spam.

* .rule(GCRULES.maxVersions(10)))
* .drop("mf1")
* client.modifyFamilies(modifyFamiliesReq);
* }

This comment was marked as spam.

*
* <p>Sample code to get started:
*
* <pre><code>

This comment was marked as spam.

}

/**
* Creates, Updates and drops ColumnFamilies as per the request See {@link

This comment was marked as spam.

* .rule(GCRULES.maxVersions(10)))
* .drop("mf1")
* client.modifyFamiliesAsync(modifyFamiliesReq);
* }

This comment was marked as spam.

* @return
*/
public ModifyFamilies create(String familyId) {
return createWithGCRule(familyId, null);

This comment was marked as spam.

* @param gcRule
* @return
*/
public ModifyFamilies createWithGCRule(String familyId, GCRule gcRule) {

This comment was marked as spam.

This comment was marked as spam.

* @param gcRule
* @return
*/
public ModifyFamilies updateWithGCRule(String familyId, GCRule gcRule) {

This comment was marked as spam.

* @param GenerateConsistencyTokenResponse - Protobuf ConsistencyTokenResponse
* @return ConsistencyToken - ConsistencyToken response wrapper
*/
public static ConsistencyToken convertTokenResponse(

This comment was marked as spam.

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.

@spollapally spollapally force-pushed the adminclient-table-mv branch from ad80709 to b28ce92 Compare June 20, 2018 07:10
@spollapally

spollapally commented Jun 20, 2018 via email

Copy link
Copy Markdown
Author

*
* client.createTableAsync(createTableReq);
* }
* }</pre>

This comment was marked as spam.

* .union()
* .rule(GCRULES.maxAge(Duration.ofSeconds(100)))
* .rule(GCRULES.maxVersions(1)))
* .createWithGCRule(

This comment was marked as spam.

* .union()
* .rule(GCRULES.maxAge(Duration.ofSeconds(100)))
* .rule(GCRULES.maxVersions(1)))
* .createWithGCRule(

This comment was marked as spam.

/** Casts the rule to IntersectionRule. On failure throws a ClassCastException */
public IntersectionRule getIntersectionOrThow() {
return (IntersectionRule) this;
}

This comment was marked as spam.

}

/** 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.

* @param familyId
* @return
*/
public ModifyFamilies create(String familyId) {

This comment was marked as spam.

*
* @return TimestampGranularity
*/
public TimestampGranularity getTimestampGranularity() {

This comment was marked as spam.

@igorbernstein2 igorbernstein2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after these changes. @pongad, would you mind reviewing?

* BigtableTableAdminSettings bigtableTableAdminSettings =
* BigtableTableAdminSettings.newBuilder()
* .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
* .build();

This comment was marked as spam.

* .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
* .build();
* TableAdminClient client =
* TableAdminClient.create(InstanceName.of("[PROJECT]", "[INSTANCE]"), bigtableTableAdminSettings);

This comment was marked as spam.

* BigtableTableAdminSettings bigtableTableAdminSettings =
* BigtableTableAdminSettings.newBuilder().setEndpoint(myEndpoint).build();
* TableAdminClient client =
* TableAdminClient.create(InstanceName.of("[PROJECT]", "[INSTANCE]"), bigtableTableAdminSettings);

This comment was marked as spam.

* 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.

* @return ApiFuture<Boolean>
*/
public ApiFuture<Boolean> isConsistentAsync(String tableId, ConsistencyToken token) {
ApiFuture<CheckConsistencyResponse> CheckConsResp =

This comment was marked as spam.


/** Gets the configured maximum versions */
public int getMaxVersions() {
return toProto().getMaxNumVersions();

This comment was marked as spam.

@pongad pongad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@igorbernstein2

Copy link
Copy Markdown
Contributor

@pongad thanks for looking.
LGTM after typo fix

@spollapally spollapally force-pushed the adminclient-table-mv branch from b79a90b to c6a974e Compare June 26, 2018 00:19
@pongad pongad merged commit 675ace7 into googleapis:master Jun 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants