google-cloud-bigtable 0.6.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +4 -26
  3. data/CHANGELOG.md +85 -0
  4. data/CONTRIBUTING.md +1 -1
  5. data/OVERVIEW.md +388 -19
  6. data/lib/google-cloud-bigtable.rb +19 -22
  7. data/lib/google/bigtable/admin/v2/bigtable_table_admin_services_pb.rb +1 -1
  8. data/lib/google/bigtable/v2/bigtable_pb.rb +3 -0
  9. data/lib/google/bigtable/v2/bigtable_services_pb.rb +1 -1
  10. data/lib/google/cloud/bigtable.rb +11 -17
  11. data/lib/google/cloud/bigtable/admin.rb +1 -1
  12. data/lib/google/cloud/bigtable/admin/v2.rb +1 -1
  13. data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb +1 -1
  14. data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/policy.rb +42 -21
  15. data/lib/google/cloud/bigtable/app_profile.rb +162 -96
  16. data/lib/google/cloud/bigtable/app_profile/job.rb +5 -8
  17. data/lib/google/cloud/bigtable/app_profile/list.rb +18 -12
  18. data/lib/google/cloud/bigtable/chunk_processor.rb +24 -36
  19. data/lib/google/cloud/bigtable/cluster.rb +45 -18
  20. data/lib/google/cloud/bigtable/cluster/job.rb +3 -7
  21. data/lib/google/cloud/bigtable/cluster/list.rb +22 -20
  22. data/lib/google/cloud/bigtable/column_family.rb +18 -231
  23. data/lib/google/cloud/bigtable/column_family_map.rb +426 -0
  24. data/lib/google/cloud/bigtable/column_range.rb +15 -7
  25. data/lib/google/cloud/bigtable/convert.rb +12 -4
  26. data/lib/google/cloud/bigtable/errors.rb +4 -1
  27. data/lib/google/cloud/bigtable/gc_rule.rb +188 -69
  28. data/lib/google/cloud/bigtable/instance.rb +209 -189
  29. data/lib/google/cloud/bigtable/instance/cluster_map.rb +17 -13
  30. data/lib/google/cloud/bigtable/instance/job.rb +6 -5
  31. data/lib/google/cloud/bigtable/instance/list.rb +18 -13
  32. data/lib/google/cloud/bigtable/longrunning_job.rb +7 -1
  33. data/lib/google/cloud/bigtable/mutation_entry.rb +36 -39
  34. data/lib/google/cloud/bigtable/mutation_operations.rb +90 -73
  35. data/lib/google/cloud/bigtable/policy.rb +9 -5
  36. data/lib/google/cloud/bigtable/project.rb +87 -196
  37. data/lib/google/cloud/bigtable/read_modify_write_rule.rb +15 -10
  38. data/lib/google/cloud/bigtable/read_operations.rb +42 -59
  39. data/lib/google/cloud/bigtable/routing_policy.rb +172 -0
  40. data/lib/google/cloud/bigtable/row.rb +32 -21
  41. data/lib/google/cloud/bigtable/row_filter.rb +80 -35
  42. data/lib/google/cloud/bigtable/row_filter/chain_filter.rb +119 -68
  43. data/lib/google/cloud/bigtable/row_filter/condition_filter.rb +8 -2
  44. data/lib/google/cloud/bigtable/row_filter/interleave_filter.rb +117 -66
  45. data/lib/google/cloud/bigtable/row_filter/simple_filter.rb +24 -9
  46. data/lib/google/cloud/bigtable/row_range.rb +5 -0
  47. data/lib/google/cloud/bigtable/rows_mutator.rb +14 -21
  48. data/lib/google/cloud/bigtable/rows_reader.rb +23 -18
  49. data/lib/google/cloud/bigtable/sample_row_key.rb +6 -3
  50. data/lib/google/cloud/bigtable/service.rb +200 -253
  51. data/lib/google/cloud/bigtable/status.rb +76 -0
  52. data/lib/google/cloud/bigtable/table.rb +158 -262
  53. data/lib/google/cloud/bigtable/table/cluster_state.rb +17 -6
  54. data/lib/google/cloud/bigtable/table/list.rb +16 -9
  55. data/lib/google/cloud/bigtable/v2.rb +1 -1
  56. data/lib/google/cloud/bigtable/v2/bigtable_client.rb +12 -12
  57. data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/bigtable.rb +16 -13
  58. data/lib/google/cloud/bigtable/value_range.rb +19 -13
  59. data/lib/google/cloud/bigtable/version.rb +1 -1
  60. metadata +67 -25
  61. data/lib/google/cloud/bigtable/table/column_family_map.rb +0 -70
@@ -18,24 +18,29 @@
18
18
  module Google
19
19
  module Cloud
20
20
  module Bigtable
21
+ ##
21
22
  # # Row
22
23
  #
23
24
  # Row structure based on merged cells using read row state.
25
+ #
24
26
  class Row
27
+ ##
25
28
  # Cell
26
29
  #
27
30
  # Row cell built from data chunks.
31
+ #
28
32
  class Cell
29
33
  attr_reader :family, :qualifier, :value, :labels, :timestamp
30
34
 
35
+ ##
31
36
  # Creates a row cell instance.
32
37
  #
33
- # @param family [String] Column family name
34
- # @param qualifier [String] Column cell qualifier name
35
- # @param timestamp [Integer] Timestamp in microseconds
36
- # @param value [String] Cell value
37
- # @param labels [Array<String>] List of label array
38
-
38
+ # @param family [String] Column family name.
39
+ # @param qualifier [String] Column cell qualifier name.
40
+ # @param timestamp [Integer] Timestamp in microseconds.
41
+ # @param value [String] Cell value.
42
+ # @param labels [Array<String>] List of label array.
43
+ #
39
44
  def initialize family, qualifier, timestamp, value, labels = []
40
45
  @family = family
41
46
  @qualifier = qualifier
@@ -44,30 +49,32 @@ module Google
44
49
  @labels = labels
45
50
  end
46
51
 
52
+ ##
47
53
  # Converts timestamp to Time instance.
48
54
  #
49
- # @param granularity [Symbol] Optional
50
- # Valid granularity types are `:micros`, `millis`
51
- # Default granularity is a millis.
55
+ # @param granularity [Symbol] Optional.
56
+ # Valid granularity types are `:micros`, `:millis`.
57
+ # Default is `:millis`.
52
58
  # @return [Time | nil]
53
59
  #
54
60
  def to_time granularity = nil
55
61
  return nil if @timestamp.zero?
56
- return Time.at(@timestamp / 100_0000.0) if granularity == :micros
57
- Time.at(@timestamp / 1000.0)
62
+ return Time.at @timestamp / 1_000_000.0 if granularity == :micros
63
+ Time.at @timestamp / 1000.0
58
64
  end
59
65
 
66
+ ##
60
67
  # Converts a value to an integer.
61
68
  #
62
69
  # @return [Integer]
63
70
  #
64
71
  def to_i
65
- @value.unpack("q>").first
72
+ @value.unpack1 "q>"
66
73
  end
67
74
 
68
75
  # @private
69
76
  #
70
- # Cell object comparator
77
+ # Cell object comparator.
71
78
  #
72
79
  # @return [Boolean]
73
80
  #
@@ -80,22 +87,28 @@ module Google
80
87
  end
81
88
  end
82
89
 
83
- # @return [String] Row key
90
+ ##
91
+ # @return [String] Row key.
92
+ #
84
93
  attr_accessor :key
85
94
 
86
- # @return [Hash{String => Array<Google::Cloud::Bigtable::Row::Cell>}] Row cells
95
+ ##
96
+ # @return [Hash{String => Array<Google::Cloud::Bigtable::Row::Cell>}] Row cells.
97
+ #
87
98
  attr_accessor :cells
88
99
 
100
+ ##
89
101
  # Creates a flat row object.
90
102
  #
91
- # @param key [String] Row key name
103
+ # @param key [String] Row key name.
92
104
  #
93
105
  def initialize key = nil
94
106
  @key = key
95
107
  @cells = Hash.new { |h, k| h[k] = [] }
96
108
  end
97
109
 
98
- # List of column families names
110
+ ##
111
+ # List of column families names.
99
112
  #
100
113
  # @return [Array<String>]
101
114
  #
@@ -105,15 +118,13 @@ module Google
105
118
 
106
119
  # @private
107
120
  #
108
- # FlatRow object comparator
121
+ # FlatRow object comparator.
109
122
  #
110
123
  # @return [Boolean]
111
124
  #
112
125
  def == other
113
126
  return false unless self.class == other.class
114
- if key != other.key || column_families != other.column_families
115
- return false
116
- end
127
+ return false if key != other.key || column_families != other.column_families
117
128
 
118
129
  cells.all? do |family, list|
119
130
  list == other.cells[family]
@@ -26,6 +26,7 @@ require "google/cloud/bigtable/row_filter/condition_filter"
26
26
  module Google
27
27
  module Cloud
28
28
  module Bigtable
29
+ ##
29
30
  # # RowFilter
30
31
  #
31
32
  # Takes a row as input and produces an alternate view of the row based on
@@ -120,6 +121,7 @@ module Google
120
121
  # while the other does not.
121
122
  #
122
123
  # @example
124
+ # require "google/cloud/bigtable"
123
125
  #
124
126
  # # Pass filter
125
127
  # Google::Cloud::Bigtable::RowFilter.pass
@@ -145,11 +147,12 @@ module Google
145
147
 
146
148
  private_constant :PASS, :BLOCK, :SINK, :STRIP_VALUE
147
149
 
150
+ ##
148
151
  # Creates a chain filter instance.
149
152
  #
150
153
  # A chain RowFilter that sends rows through several RowFilters in sequence.
151
154
  #
152
- # See {Google::Cloud::Bigtable::RowFilter::ChainFilter}
155
+ # See {Google::Cloud::Bigtable::RowFilter::ChainFilter}.
153
156
  #
154
157
  # The elements of "filters" are chained together to process the input row:
155
158
  # in row -> f(0) -> intermediate row -> f(1) -> ... -> f(N) -> out row
@@ -158,6 +161,7 @@ module Google
158
161
  # @return [Google::Cloud::Bigtable::RowFilter::ChainFilter]
159
162
  #
160
163
  # @example Create chain filter with simple filter.
164
+ # require "google/cloud/bigtable"
161
165
  #
162
166
  # chain = Google::Cloud::Bigtable::RowFilter.chain
163
167
  #
@@ -166,9 +170,10 @@ module Google
166
170
  # chain.strip_value
167
171
  #
168
172
  # # OR
169
- # chain.key("user-*).strip_value
173
+ # chain.key("user-*").strip_value
170
174
  #
171
175
  # @example Create complex chain filter.
176
+ # require "google/cloud/bigtable"
172
177
  #
173
178
  # chain = Google::Cloud::Bigtable::RowFilter.chain
174
179
  #
@@ -176,12 +181,13 @@ module Google
176
181
  # chain_1.label("users").qualifier("name").cells_per_row(5)
177
182
  #
178
183
  # # Add to main chain filter
179
- # chain.chain(chain_1).value("xyz*).key("user-*")
184
+ # chain.chain(chain_1).value("xyz*").key("user-*")
180
185
  #
181
186
  def self.chain
182
187
  ChainFilter.new
183
188
  end
184
189
 
190
+ ##
185
191
  # Creates an interleave filter.
186
192
  #
187
193
  # A RowFilter that sends each row to each of several component
@@ -216,6 +222,7 @@ module Google
216
222
  # @return [Google::Cloud::Bigtable::RowFilter::InterleaveFilter]
217
223
  #
218
224
  # @example Create an interleave filter with simple filter.
225
+ # require "google/cloud/bigtable"
219
226
  #
220
227
  # interleave = Google::Cloud::Bigtable::RowFilter.interleave
221
228
  #
@@ -224,9 +231,10 @@ module Google
224
231
  # interleave.sink
225
232
  #
226
233
  # # OR
227
- # interleave.key("user-*).sink
234
+ # interleave.key("user-*").sink
228
235
  #
229
236
  # @example Create complex interleave filter.
237
+ # require "google/cloud/bigtable"
230
238
  #
231
239
  # interleave = Google::Cloud::Bigtable::RowFilter.interleave
232
240
  #
@@ -234,12 +242,13 @@ module Google
234
242
  # chain_1.label("users").qualifier("name").cells_per_row(5)
235
243
  #
236
244
  # # Add to main chain filter
237
- # interleave.chain(chain_1).value("xyz*).key("user-*")
245
+ # interleave.chain(chain_1).value("xyz*").key("user-*")
238
246
  #
239
247
  def self.interleave
240
248
  InterleaveFilter.new
241
249
  end
242
250
 
251
+ ##
243
252
  # Creates a condition filter instance.
244
253
  #
245
254
  # A RowFilter that evaluates one of two possible RowFilters, depending on
@@ -250,12 +259,13 @@ module Google
250
259
  # results. Additionally, condition filters have poor performance, especially
251
260
  # when filters are set for the false condition.
252
261
  #
253
- # Cannot be used within the `predicate_filter`, `true_filter`, or `false_filter`
262
+ # Cannot be used within the `predicate_filter`, `true_filter`, or `false_filter`.
254
263
  #
255
264
  # @param predicate [SimpleFilter, ChainFilter, InterleaveFilter, ConditionFilter]
256
265
  # @return [Google::Cloud::Bigtable::RowFilter::ConditionFilter]
257
266
  #
258
267
  # @example
268
+ # require "google/cloud/bigtable"
259
269
  #
260
270
  # predicate = Google::Cloud::Bigtable::RowFilter.key("user-*")
261
271
  # condition = Google::Cloud::Bigtable::RowFilter.condition(predicate)
@@ -267,9 +277,10 @@ module Google
267
277
  # condition.on_match(label).otherwise(strip_value)
268
278
  #
269
279
  def self.condition predicate
270
- ConditionFilter.new(predicate)
280
+ ConditionFilter.new predicate
271
281
  end
272
282
 
283
+ ##
273
284
  # Creates a pass filter instance.
274
285
  #
275
286
  # Matches all cells, regardless of input. Functionally equivalent to
@@ -278,6 +289,7 @@ module Google
278
289
  # @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
279
290
  #
280
291
  # @example
292
+ # require "google/cloud/bigtable"
281
293
  #
282
294
  # filter = Google::Cloud::Bigtable::RowFilter.pass
283
295
  #
@@ -285,6 +297,7 @@ module Google
285
297
  PASS
286
298
  end
287
299
 
300
+ ##
288
301
  # Creates a block-all filter instance.
289
302
  #
290
303
  # Does not match any cells, regardless of input. Useful for temporarily
@@ -293,6 +306,7 @@ module Google
293
306
  # @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
294
307
  #
295
308
  # @example
309
+ # require "google/cloud/bigtable"
296
310
  #
297
311
  # filter = Google::Cloud::Bigtable::RowFilter.block
298
312
  #
@@ -300,14 +314,16 @@ module Google
300
314
  BLOCK
301
315
  end
302
316
 
317
+ ##
303
318
  # Creates a sink filter instance.
304
319
  #
305
320
  # Outputs all cells directly to the output of the read rather than to any
306
- # parent filter
321
+ # parent filter.
307
322
  #
308
323
  # @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
309
324
  #
310
325
  # @example
326
+ # require "google/cloud/bigtable"
311
327
  #
312
328
  # filter = Google::Cloud::Bigtable::RowFilter.sink
313
329
  #
@@ -315,6 +331,7 @@ module Google
315
331
  SINK
316
332
  end
317
333
 
334
+ ##
318
335
  # Creates a strip value filter instance.
319
336
  #
320
337
  # Replaces each cell's value with an empty string.
@@ -322,6 +339,7 @@ module Google
322
339
  # @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
323
340
  #
324
341
  # @example
342
+ # require "google/cloud/bigtable"
325
343
  #
326
344
  # filter = Google::Cloud::Bigtable::RowFilter.strip_value
327
345
  #
@@ -329,6 +347,7 @@ module Google
329
347
  STRIP_VALUE
330
348
  end
331
349
 
350
+ ##
332
351
  # Creates a key filter instance to match a row key using a regular expression.
333
352
  #
334
353
  # Matches only cells from rows whose row keys satisfy the given RE2 regex. In
@@ -339,37 +358,40 @@ module Google
339
358
  # will not match the new line character `\n`, which may be present in a
340
359
  # binary key.
341
360
  #
342
- # For Regex syntax:
343
- # @see https://github.com/google/re2/wiki/Syntax
361
+ # @see https://github.com/google/re2/wiki/Syntax Regex syntax
344
362
  #
345
363
  # @param regex [String] Regex to match row keys.
346
364
  # @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
347
365
  #
348
366
  # @example
367
+ # require "google/cloud/bigtable"
349
368
  #
350
369
  # filter = Google::Cloud::Bigtable::RowFilter.key("user-.*")
351
370
  #
352
371
  def self.key regex
353
- SimpleFilter.new.key(regex)
372
+ SimpleFilter.new.key regex
354
373
  end
355
374
 
375
+ ##
356
376
  # Creates a sample probability filter instance.
357
377
  #
358
378
  # Matches all cells from a row with probability p, and matches no cells
359
379
  # from the row with probability 1-p.
360
380
  #
361
- # @param probability [Float] Probability value
362
- # Probability must be greather then 0 and less then 1.0
381
+ # @param probability [Float] Probability value.
382
+ # Probability must be greater than 0 and less than 1.0.
363
383
  # @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
364
384
  #
365
385
  # @example
386
+ # require "google/cloud/bigtable"
366
387
  #
367
388
  # filter = Google::Cloud::Bigtable::RowFilter.sample(0.5)
368
389
  #
369
390
  def self.sample probability
370
- SimpleFilter.new.sample(probability)
391
+ SimpleFilter.new.sample probability
371
392
  end
372
393
 
394
+ ##
373
395
  # Creates a family name match filter using a regular expression.
374
396
  #
375
397
  # Matches only cells from columns whose families satisfy the given RE2
@@ -379,20 +401,21 @@ module Google
379
401
  # `\n`, it is sufficient to use `.` as a full wildcard when matching
380
402
  # column family names.
381
403
  #
382
- # For Regex syntax:
383
- # @see https://github.com/google/re2/wiki/Syntax
404
+ # @see https://github.com/google/re2/wiki/Syntax Regex syntax
384
405
  #
385
406
  # @param regex [String] Regex to match family name.
386
407
  # @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
387
408
  #
388
409
  # @example
410
+ # require "google/cloud/bigtable"
389
411
  #
390
412
  # filter = Google::Cloud::Bigtable::RowFilter.family("cf-.*")
391
413
  #
392
414
  def self.family regex
393
- SimpleFilter.new.family(regex)
415
+ SimpleFilter.new.family regex
394
416
  end
395
417
 
418
+ ##
396
419
  # Creates a column qualifier match filter using a regular expression.
397
420
  #
398
421
  # Matches only cells from columns whose qualifiers satisfy the given RE2
@@ -402,20 +425,21 @@ module Google
402
425
  # character will not match the new line character `\n`, which may be
403
426
  # present in a binary qualifier.
404
427
  #
405
- # For Regex syntax:
406
- # @see https://github.com/google/re2/wiki/Syntax
428
+ # @see https://github.com/google/re2/wiki/Syntax Regex syntax
407
429
  #
408
430
  # @param regex [String] Regex to match column qualifier name.
409
431
  # @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
410
432
  #
411
433
  # @example
434
+ # require "google/cloud/bigtable"
412
435
  #
413
436
  # filter = Google::Cloud::Bigtable::RowFilter.qualifier("user-name.*")
414
437
  #
415
438
  def self.qualifier regex
416
- SimpleFilter.new.qualifier(regex)
439
+ SimpleFilter.new.qualifier regex
417
440
  end
418
441
 
442
+ ##
419
443
  # Creates a value match filter using a regular expression.
420
444
  #
421
445
  # Matches only cells with values that satisfy the given regular expression.
@@ -424,20 +448,21 @@ module Google
424
448
  # will not match the new line character `\n`, which may be present in a
425
449
  # binary value.
426
450
  #
427
- # For Regex syntax:
428
- # @see https://github.com/google/re2/wiki/Syntax
451
+ # @see https://github.com/google/re2/wiki/Syntax Regex syntax
429
452
  #
430
453
  # @param regex [String] Regex to match cell value.
431
454
  # @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
432
455
  #
433
456
  # @example
457
+ # require "google/cloud/bigtable"
434
458
  #
435
459
  # filter = Google::Cloud::Bigtable::RowFilter.value("abc.*")
436
460
  #
437
461
  def self.value regex
438
- SimpleFilter.new.value(regex)
462
+ SimpleFilter.new.value regex
439
463
  end
440
464
 
465
+ ##
441
466
  # Creates a label filter instance to apply a label based on the result of
442
467
  # read rows.
443
468
  #
@@ -458,13 +483,15 @@ module Google
458
483
  # @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
459
484
  #
460
485
  # @example
486
+ # require "google/cloud/bigtable"
461
487
  #
462
488
  # filter = Google::Cloud::Bigtable::RowFilter.label("user-detail")
463
489
  #
464
490
  def self.label value
465
- SimpleFilter.new.label(value)
491
+ SimpleFilter.new.label value
466
492
  end
467
493
 
494
+ ##
468
495
  # Creates a cell-per-row-offset filter instance to skip first N cells.
469
496
  #
470
497
  # Skips the first N cells of each row, matching all subsequent cells.
@@ -475,13 +502,15 @@ module Google
475
502
  # @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
476
503
  #
477
504
  # @example
505
+ # require "google/cloud/bigtable"
478
506
  #
479
507
  # filter = Google::Cloud::Bigtable::RowFilter.cells_per_row_offset(3)
480
508
  #
481
509
  def self.cells_per_row_offset offset
482
- SimpleFilter.new.cells_per_row_offset(offset)
510
+ SimpleFilter.new.cells_per_row_offset offset
483
511
  end
484
512
 
513
+ ##
485
514
  # Create a cells-per-row limit filter instance.
486
515
  #
487
516
  # Matches only the first N cells of each row.
@@ -492,13 +521,15 @@ module Google
492
521
  # @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
493
522
  #
494
523
  # @example
524
+ # require "google/cloud/bigtable"
495
525
  #
496
526
  # filter = Google::Cloud::Bigtable::RowFilter.cells_per_row(5)
497
527
  #
498
528
  def self.cells_per_row limit
499
- SimpleFilter.new.cells_per_row(limit)
529
+ SimpleFilter.new.cells_per_row limit
500
530
  end
501
531
 
532
+ ##
502
533
  # Creates cells-per-column filter instance.
503
534
  #
504
535
  # Matches only the most recent N cells within each column.
@@ -509,13 +540,15 @@ module Google
509
540
  # @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
510
541
  #
511
542
  # @example
543
+ # require "google/cloud/bigtable"
512
544
  #
513
545
  # filter = Google::Cloud::Bigtable::RowFilter.cells_per_column(5)
514
546
  #
515
547
  def self.cells_per_column limit
516
- SimpleFilter.new.cells_per_column(limit)
548
+ SimpleFilter.new.cells_per_column limit
517
549
  end
518
550
 
551
+ ##
519
552
  # Creates a timestamp-range filter instance.
520
553
  #
521
554
  # Matches only cells with timestamps within the given range.
@@ -526,6 +559,7 @@ module Google
526
559
  # @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
527
560
  #
528
561
  # @example
562
+ # require "google/cloud/bigtable"
529
563
  #
530
564
  # timestamp_micros = (Time.now.to_f * 1000000).round(-3)
531
565
  # from = timestamp_micros - 300000000
@@ -540,9 +574,10 @@ module Google
540
574
  # filter = Google::Cloud::Bigtable::RowFilter.timestamp_range(to: to)
541
575
  #
542
576
  def self.timestamp_range from: nil, to: nil
543
- SimpleFilter.new.timestamp_range(from, to)
577
+ SimpleFilter.new.timestamp_range from, to
544
578
  end
545
579
 
580
+ ##
546
581
  # Creates a value-range filter instance.
547
582
  #
548
583
  # Matches only cells with values that fall within the given range.
@@ -558,20 +593,29 @@ module Google
558
593
  # @param range [Google::Cloud::Bigtable::ValueRange]
559
594
  # @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
560
595
  #
561
- # @example Start to end range
596
+ # @example Start to end range.
597
+ # require "google/cloud/bigtable"
562
598
  #
563
- # range = Google::Cloud::Bigtable::ValueRange.from("abc").to("xyz")
599
+ # bigtable = Google::Cloud::Bigtable.new
600
+ # table = bigtable.table("my-instance", "my-table")
601
+ #
602
+ # range = table.new_value_range.from("value-001", inclusive: false)
564
603
  # filter = Google::Cloud::Bigtable::RowFilter.value_range(range)
565
604
  #
566
- # @example Start exlusive to infinite end range
605
+ # @example Start exclusive to infinite end range.
606
+ # require "google/cloud/bigtable"
607
+ #
608
+ # bigtable = Google::Cloud::Bigtable.new
609
+ # table = bigtable.table("my-instance", "my-table")
567
610
  #
568
- # range = Google::Cloud::Bigtable::ValueRange.from("abc", inclusive: false)
611
+ # range = table.new_value_range.from("value-001", inclusive: false)
569
612
  # filter = Google::Cloud::Bigtable::RowFilter.value_range(range)
570
613
  #
571
614
  def self.value_range range
572
- SimpleFilter.new.value_range(range)
615
+ SimpleFilter.new.value_range range
573
616
  end
574
617
 
618
+ ##
575
619
  # Creates a column-range filter instance.
576
620
  #
577
621
  # Matches only cells from columns within the given range.
@@ -580,13 +624,14 @@ module Google
580
624
  # @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
581
625
  #
582
626
  # @example
627
+ # require "google/cloud/bigtable"
583
628
  #
584
- # range = Google::Cloud::Bigtable::ColumnRange.new(cf).from("field0").to("field5")
629
+ # range = Google::Cloud::Bigtable::ColumnRange.new("cf").from("field0").to("field5")
585
630
  #
586
631
  # filter = Google::Cloud::Bigtable::RowFilter.column_range(range)
587
632
  #
588
633
  def self.column_range range
589
- SimpleFilter.new.column_range(range)
634
+ SimpleFilter.new.column_range range
590
635
  end
591
636
  end
592
637
  end