Skip to content

Commit 7190f34

Browse files
rahulKQLchingor13
authored andcommitted
---
yaml --- r: 34949 b: refs/heads/autosynth-trace c: 00c8bb1 h: refs/heads/master i: 34947: c968d20
1 parent 1143c93 commit 7190f34

4 files changed

Lines changed: 39 additions & 32 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ refs/heads/autosynth-spanner: d963fe4368e79cf6abae5d511785e8ced8ac57f4
141141
refs/heads/autosynth-speech: c563dcd420cce0a37c39b1b9c24be1b9ba604dc7
142142
refs/heads/autosynth-tasks: 25d1eafe8cb66b00e3dad765dac74a5b45b83e63
143143
refs/heads/autosynth-texttospeech: 7a3ad430dddaed7a76f2026064502680c9339915
144-
refs/heads/autosynth-trace: 6b78c52cfa63334e3846e348752f8345d78f0aa8
144+
refs/heads/autosynth-trace: 00c8bb1f1942734200ebc89483334d68e5bd15a1
145145
refs/heads/autosynth-websecurityscanner: fa561b356aabcd92d415ae8dc88fd8d87dbc5b23
146146
refs/heads/bigquerystorage: 06db74d123d7f8a3ef48755c2fcabed09faf8e64
147147
refs/heads/elharo-patch-1: ce159ef828d3c545991ff78e7b6e0d912a9453e9

branches/autosynth-trace/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient.ListTablesPagedResponse;
3030
import com.google.cloud.bigtable.admin.v2.internal.NameUtil;
3131
import com.google.cloud.bigtable.admin.v2.models.CreateTableRequest;
32+
import com.google.cloud.bigtable.admin.v2.models.GCRules;
3233
import com.google.cloud.bigtable.admin.v2.models.ModifyColumnFamiliesRequest;
3334
import com.google.cloud.bigtable.admin.v2.models.Table;
3435
import com.google.cloud.bigtable.admin.v2.stub.EnhancedBigtableTableAdminStub;
@@ -177,13 +178,24 @@ public void close() {
177178
* <p>Sample code:
178179
*
179180
* <pre>{@code
181+
* // A table with a single column family, which retains only the latest value.
180182
* Table table = client.createTable(
181183
* CreateTableRequest.of("my-table")
182-
* .addFamily("cf2", GCRULES.maxVersions(1)
184+
* .addFamily("cf2", GCRULES.maxVersions(1))
185+
* );
186+
*
187+
* // Another table with more complex garbage collection rules.
188+
* Table table = client.createTable(
189+
* CreateTableRequest.of("my-table")
190+
* .addFamily("cf2", GCRULES.union()
191+
* .rule(GCRULES.maxAge(Duration.ofDays(30)))
192+
* .rule(GCRULES.maxVersions(5))
193+
* )
183194
* );
184195
* }</pre>
185196
*
186197
* @see CreateTableRequest for available options.
198+
* @see GCRules for the documentation on available garbage collection rules.
187199
*/
188200
@SuppressWarnings("WeakerAccess")
189201
public Table createTable(CreateTableRequest request) {
@@ -196,9 +208,19 @@ public Table createTable(CreateTableRequest request) {
196208
* <p>Sample code:
197209
*
198210
* <pre>{@code
211+
* // A table with a single column family, which retains values up to 7 days.
199212
* ApiFuture<Table> tableFuture = client.createTableAsync(
200213
* CreateTableRequest.of("my-table")
201-
* .addFamily("cf", GCRules.GCRULES.maxVersions(1))
214+
* .addFamily("cf", GCRULES.maxAge(Duration.ofDays(7)))
215+
* );
216+
*
217+
* // Another table with more complex garbage collection rules.
218+
* ApiFuture<Table> tableFuture = client.createTableAsync(
219+
* CreateTableRequest.of("my-table")
220+
* .addFamily("cf", GCRULES.intersection()
221+
* .rule(GCRULES.maxAge(120, TimeUnit.HOURS))
222+
* .rule(GCRULES.maxVersions(10))
223+
* )
202224
* );
203225
*
204226
* ApiFutures.addCallback(
@@ -217,6 +239,7 @@ public Table createTable(CreateTableRequest request) {
217239
* }</pre>
218240
*
219241
* @see CreateTableRequest for available options.
242+
* @see GCRules for the documentation on available garbage collection rules.
220243
*/
221244
@SuppressWarnings("WeakerAccess")
222245
public ApiFuture<Table> createTableAsync(CreateTableRequest request) {

branches/autosynth-trace/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/CreateTableRequest.java

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,28 +36,19 @@
3636
* </ul>
3737
*/
3838
public final class CreateTableRequest {
39-
// TODO(igorbernstein): rename to requestBuilder
4039
private final com.google.bigtable.admin.v2.CreateTableRequest.Builder requestBuilder =
4140
com.google.bigtable.admin.v2.CreateTableRequest.newBuilder();
4241

4342
public static CreateTableRequest of(String tableId) {
4443
return new CreateTableRequest(tableId);
4544
}
4645

47-
/**
48-
* Configures table with the specified id
49-
*
50-
* @param tableId
51-
*/
46+
/** Configures table with the specified id */
5247
private CreateTableRequest(String tableId) {
5348
requestBuilder.setTableId(tableId);
5449
}
5550

56-
/**
57-
* Adds a new columnFamily to the configuration
58-
*
59-
* @param familyId
60-
*/
51+
/** Adds a new columnFamily to the configuration */
6152
public CreateTableRequest addFamily(String familyId) {
6253
Preconditions.checkNotNull(familyId);
6354
requestBuilder.getTableBuilder().putColumnFamilies(familyId, ColumnFamily.getDefaultInstance());
@@ -68,8 +59,7 @@ public CreateTableRequest addFamily(String familyId) {
6859
* Adds a new columnFamily with {@link GCRule} to the configuration. Please note that calling this
6960
* method with the same familyId will overwrite the previous family.
7061
*
71-
* @param familyId
72-
* @param gcRule
62+
* @see GCRule for available options.
7363
*/
7464
public CreateTableRequest addFamily(String familyId, GCRule gcRule) {
7565
Preconditions.checkNotNull(familyId);
@@ -79,11 +69,7 @@ public CreateTableRequest addFamily(String familyId, GCRule gcRule) {
7969
return this;
8070
}
8171

82-
/**
83-
* Adds split at the specified key to the configuration
84-
*
85-
* @param key
86-
*/
72+
/** Adds split at the specified key to the configuration */
8773
public CreateTableRequest addSplit(ByteString key) {
8874
Preconditions.checkNotNull(key);
8975
requestBuilder.addInitialSplitsBuilder().setKey(key);

branches/autosynth-trace/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/GCRules.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@
3030

3131
// TODO(igorbernstein2): the distinction between GcRule & GCRule is too subtle, use fully qualified
3232
// names for the protos.
33-
/** Wraps {@link GcRule} protocol buffer object and exposes a simpler Fluent DSL model */
33+
/**
34+
* Wraps {@link GcRule} protocol buffer object and exposes a friendly API.
35+
*
36+
* <p>Note: Garbage collection executes opportunistically in the background, and so it's possible
37+
* for reads to return a cell even if it matches the active GC expression for its family. Please use
38+
* appropriate filters in your reads to exclude cells which are eligible for garbage collection.
39+
*/
3440
@BetaApi
3541
public final class GCRules {
3642
/** Factory method to create GCRules - entry point into the DSL. */
@@ -124,11 +130,7 @@ private IntersectionRule() {
124130
rulesList = new ArrayList<>();
125131
}
126132

127-
/**
128-
* Adds a new GCRule
129-
*
130-
* @param rule
131-
*/
133+
/** Adds a new GCRule */
132134
// TODO(igorbernstein2): consider renaming this to addRule
133135
public IntersectionRule rule(@Nonnull GCRule rule) {
134136
rulesList.add(rule);
@@ -189,11 +191,7 @@ private UnionRule() {
189191
rulesList = new ArrayList<>();
190192
}
191193

192-
/**
193-
* Adds a new GCRule
194-
*
195-
* @param rule
196-
*/
194+
/** Adds a new GCRule */
197195
public UnionRule rule(@Nonnull GCRule rule) {
198196
rulesList.add(rule);
199197
return this;

0 commit comments

Comments
 (0)