google-cloud-bigtable 0.8.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/OVERVIEW.md +388 -19
- data/lib/google-cloud-bigtable.rb +0 -1
- data/lib/google/bigtable/admin/v2/bigtable_table_admin_services_pb.rb +1 -1
- data/lib/google/bigtable/v2/bigtable_pb.rb +3 -0
- data/lib/google/bigtable/v2/bigtable_services_pb.rb +1 -1
- data/lib/google/cloud/bigtable/admin.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/policy.rb +6 -5
- data/lib/google/cloud/bigtable/app_profile.rb +13 -13
- data/lib/google/cloud/bigtable/app_profile/list.rb +7 -7
- data/lib/google/cloud/bigtable/cluster.rb +7 -7
- data/lib/google/cloud/bigtable/cluster/list.rb +2 -2
- data/lib/google/cloud/bigtable/column_family.rb +3 -1
- data/lib/google/cloud/bigtable/column_family_map.rb +8 -8
- data/lib/google/cloud/bigtable/column_range.rb +6 -6
- data/lib/google/cloud/bigtable/gc_rule.rb +8 -8
- data/lib/google/cloud/bigtable/instance.rb +74 -64
- data/lib/google/cloud/bigtable/instance/cluster_map.rb +8 -6
- data/lib/google/cloud/bigtable/instance/job.rb +2 -2
- data/lib/google/cloud/bigtable/instance/list.rb +4 -4
- data/lib/google/cloud/bigtable/longrunning_job.rb +1 -1
- data/lib/google/cloud/bigtable/mutation_entry.rb +17 -16
- data/lib/google/cloud/bigtable/mutation_operations.rb +10 -11
- data/lib/google/cloud/bigtable/project.rb +28 -59
- data/lib/google/cloud/bigtable/read_modify_write_rule.rb +6 -6
- data/lib/google/cloud/bigtable/read_operations.rb +14 -18
- data/lib/google/cloud/bigtable/routing_policy.rb +3 -2
- data/lib/google/cloud/bigtable/row.rb +14 -14
- data/lib/google/cloud/bigtable/row_filter.rb +31 -15
- data/lib/google/cloud/bigtable/row_filter/chain_filter.rb +49 -26
- data/lib/google/cloud/bigtable/row_filter/condition_filter.rb +4 -1
- data/lib/google/cloud/bigtable/row_filter/interleave_filter.rb +44 -24
- data/lib/google/cloud/bigtable/row_filter/simple_filter.rb +3 -3
- data/lib/google/cloud/bigtable/rows_reader.rb +2 -2
- data/lib/google/cloud/bigtable/sample_row_key.rb +1 -1
- data/lib/google/cloud/bigtable/table.rb +18 -18
- data/lib/google/cloud/bigtable/table/cluster_state.rb +10 -5
- data/lib/google/cloud/bigtable/table/list.rb +2 -2
- data/lib/google/cloud/bigtable/v2.rb +1 -1
- data/lib/google/cloud/bigtable/v2/bigtable_client.rb +21 -12
- data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/bigtable.rb +34 -13
- data/lib/google/cloud/bigtable/value_range.rb +14 -13
- data/lib/google/cloud/bigtable/version.rb +1 -1
- metadata +2 -2
@@ -86,7 +86,7 @@ module Google
|
|
86
86
|
# The default (zero) is to return all results.
|
87
87
|
# @return [Array<Google::Cloud::Bigtable::Row> | :yields: row]
|
88
88
|
# Array of row or yield block for each processed row.
|
89
|
-
# @example Read with limit
|
89
|
+
# @example Read with limit.
|
90
90
|
# require "google/cloud/bigtable"
|
91
91
|
#
|
92
92
|
# bigtable = Google::Cloud::Bigtable.new
|
@@ -96,7 +96,7 @@ module Google
|
|
96
96
|
# puts row
|
97
97
|
# end
|
98
98
|
#
|
99
|
-
# @example Read using row keys
|
99
|
+
# @example Read using row keys.
|
100
100
|
# require "google/cloud/bigtable"
|
101
101
|
#
|
102
102
|
# bigtable = Google::Cloud::Bigtable.new
|
@@ -106,7 +106,7 @@ module Google
|
|
106
106
|
# puts row
|
107
107
|
# end
|
108
108
|
#
|
109
|
-
# @example Read using row ranges
|
109
|
+
# @example Read using row ranges.
|
110
110
|
# require "google/cloud/bigtable"
|
111
111
|
#
|
112
112
|
# bigtable = Google::Cloud::Bigtable.new
|
@@ -118,8 +118,7 @@ module Google
|
|
118
118
|
# puts row
|
119
119
|
# end
|
120
120
|
#
|
121
|
-
# @example Read using filter
|
122
|
-
#
|
121
|
+
# @example Read using filter.
|
123
122
|
# require "google/cloud/bigtable"
|
124
123
|
#
|
125
124
|
# bigtable = Google::Cloud::Bigtable.new
|
@@ -133,8 +132,7 @@ module Google
|
|
133
132
|
# puts row
|
134
133
|
# end
|
135
134
|
#
|
136
|
-
# @example Read using filter with limit
|
137
|
-
#
|
135
|
+
# @example Read using filter with limit.
|
138
136
|
# require "google/cloud/bigtable"
|
139
137
|
#
|
140
138
|
# bigtable = Google::Cloud::Bigtable.new
|
@@ -169,13 +167,12 @@ module Google
|
|
169
167
|
##
|
170
168
|
# Reads a single row by row key.
|
171
169
|
#
|
172
|
-
# @param key [String] Row key. Required
|
170
|
+
# @param key [String] Row key. Required.
|
173
171
|
# @param filter [Google::Cloud::Bigtable::RowFilter]
|
174
172
|
# The filter to apply to the contents of the specified row. Optional.
|
175
173
|
# @return [Google::Cloud::Bigtable::Row]
|
176
174
|
#
|
177
|
-
# @example
|
178
|
-
#
|
175
|
+
# @example
|
179
176
|
# require "google/cloud/bigtable"
|
180
177
|
#
|
181
178
|
# bigtable = Google::Cloud::Bigtable.new
|
@@ -183,8 +180,7 @@ module Google
|
|
183
180
|
#
|
184
181
|
# row = table.read_row("user-1")
|
185
182
|
#
|
186
|
-
# @example Read row
|
187
|
-
#
|
183
|
+
# @example Read row with filter.
|
188
184
|
# require "google/cloud/bigtable"
|
189
185
|
#
|
190
186
|
# bigtable = Google::Cloud::Bigtable.new
|
@@ -216,7 +212,7 @@ module Google
|
|
216
212
|
# # OR
|
217
213
|
# range = table.new_value_range.from("abc").to("xyz")
|
218
214
|
#
|
219
|
-
# @example With exclusive from range
|
215
|
+
# @example With exclusive from range.
|
220
216
|
# require "google/cloud/bigtable"
|
221
217
|
#
|
222
218
|
# bigtable = Google::Cloud::Bigtable.new
|
@@ -229,9 +225,9 @@ module Google
|
|
229
225
|
end
|
230
226
|
|
231
227
|
##
|
232
|
-
#
|
228
|
+
# Gets a new instance of ColumnRange.
|
233
229
|
#
|
234
|
-
# @param family [String] Column family name
|
230
|
+
# @param family [String] Column family name.
|
235
231
|
# @return [Google::Cloud::Bigtable::ColumnRange]
|
236
232
|
#
|
237
233
|
# @example
|
@@ -247,7 +243,7 @@ module Google
|
|
247
243
|
# # OR
|
248
244
|
# range = table.new_column_range("test-family").from("key-1").to("key-5")
|
249
245
|
#
|
250
|
-
# @example With exclusive from range
|
246
|
+
# @example With exclusive from range.
|
251
247
|
# require "google/cloud/bigtable"
|
252
248
|
#
|
253
249
|
# bigtable = Google::Cloud::Bigtable.new
|
@@ -260,7 +256,7 @@ module Google
|
|
260
256
|
end
|
261
257
|
|
262
258
|
##
|
263
|
-
#
|
259
|
+
# Gets a new instance of RowRange.
|
264
260
|
#
|
265
261
|
# @return [Google::Cloud::Bigtable::RowRange]
|
266
262
|
#
|
@@ -277,7 +273,7 @@ module Google
|
|
277
273
|
# # OR
|
278
274
|
# range = table.new_row_range.from("key-1").to("key-5")
|
279
275
|
#
|
280
|
-
# @example With exclusive from range
|
276
|
+
# @example With exclusive from range.
|
281
277
|
# require "google/cloud/bigtable"
|
282
278
|
#
|
283
279
|
# bigtable = Google::Cloud::Bigtable.new
|
@@ -33,7 +33,7 @@ module Google
|
|
33
33
|
# availability. Value contains `cluster_id` and optional field
|
34
34
|
# `allow_transactional_writes`.
|
35
35
|
#
|
36
|
-
# @example Create an app profile with a single cluster routing policy
|
36
|
+
# @example Create an app profile with a single cluster routing policy.
|
37
37
|
# require "google/cloud/bigtable"
|
38
38
|
#
|
39
39
|
# bigtable = Google::Cloud::Bigtable.new
|
@@ -52,7 +52,7 @@ module Google
|
|
52
52
|
# )
|
53
53
|
# puts app_profile.routing_policy
|
54
54
|
#
|
55
|
-
# @example Create an app profile with multi-cluster routing policy
|
55
|
+
# @example Create an app profile with multi-cluster routing policy.
|
56
56
|
# require "google/cloud/bigtable"
|
57
57
|
#
|
58
58
|
# bigtable = Google::Cloud::Bigtable.new
|
@@ -139,6 +139,7 @@ module Google
|
|
139
139
|
# allowed by this app profile. It is unsafe to send these requests to
|
140
140
|
# the same table/row/column in multiple clusters.
|
141
141
|
# Default value is false.
|
142
|
+
#
|
142
143
|
class SingleClusterRouting < RoutingPolicy
|
143
144
|
attr_reader :cluster_id, :allow_transactional_writes
|
144
145
|
|
@@ -35,11 +35,11 @@ module Google
|
|
35
35
|
##
|
36
36
|
# Creates a row cell instance.
|
37
37
|
#
|
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
|
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
43
|
#
|
44
44
|
def initialize family, qualifier, timestamp, value, labels = []
|
45
45
|
@family = family
|
@@ -52,9 +52,9 @@ module Google
|
|
52
52
|
##
|
53
53
|
# Converts timestamp to Time instance.
|
54
54
|
#
|
55
|
-
# @param granularity [Symbol] Optional
|
56
|
-
# Valid granularity types are `:micros`,
|
57
|
-
# Default
|
55
|
+
# @param granularity [Symbol] Optional.
|
56
|
+
# Valid granularity types are `:micros`, `:millis`.
|
57
|
+
# Default is `:millis`.
|
58
58
|
# @return [Time | nil]
|
59
59
|
#
|
60
60
|
def to_time granularity = nil
|
@@ -74,7 +74,7 @@ module Google
|
|
74
74
|
|
75
75
|
# @private
|
76
76
|
#
|
77
|
-
# Cell object comparator
|
77
|
+
# Cell object comparator.
|
78
78
|
#
|
79
79
|
# @return [Boolean]
|
80
80
|
#
|
@@ -88,19 +88,19 @@ module Google
|
|
88
88
|
end
|
89
89
|
|
90
90
|
##
|
91
|
-
# @return [String] Row key
|
91
|
+
# @return [String] Row key.
|
92
92
|
#
|
93
93
|
attr_accessor :key
|
94
94
|
|
95
95
|
##
|
96
|
-
# @return [Hash{String => Array<Google::Cloud::Bigtable::Row::Cell>}] Row cells
|
96
|
+
# @return [Hash{String => Array<Google::Cloud::Bigtable::Row::Cell>}] Row cells.
|
97
97
|
#
|
98
98
|
attr_accessor :cells
|
99
99
|
|
100
100
|
##
|
101
101
|
# Creates a flat row object.
|
102
102
|
#
|
103
|
-
# @param key [String] Row key name
|
103
|
+
# @param key [String] Row key name.
|
104
104
|
#
|
105
105
|
def initialize key = nil
|
106
106
|
@key = key
|
@@ -108,7 +108,7 @@ module Google
|
|
108
108
|
end
|
109
109
|
|
110
110
|
##
|
111
|
-
# List of column families names
|
111
|
+
# List of column families names.
|
112
112
|
#
|
113
113
|
# @return [Array<String>]
|
114
114
|
#
|
@@ -118,7 +118,7 @@ module Google
|
|
118
118
|
|
119
119
|
# @private
|
120
120
|
#
|
121
|
-
# FlatRow object comparator
|
121
|
+
# FlatRow object comparator.
|
122
122
|
#
|
123
123
|
# @return [Boolean]
|
124
124
|
#
|
@@ -121,6 +121,7 @@ module Google
|
|
121
121
|
# while the other does not.
|
122
122
|
#
|
123
123
|
# @example
|
124
|
+
# require "google/cloud/bigtable"
|
124
125
|
#
|
125
126
|
# # Pass filter
|
126
127
|
# Google::Cloud::Bigtable::RowFilter.pass
|
@@ -151,7 +152,7 @@ module Google
|
|
151
152
|
#
|
152
153
|
# A chain RowFilter that sends rows through several RowFilters in sequence.
|
153
154
|
#
|
154
|
-
# See {Google::Cloud::Bigtable::RowFilter::ChainFilter}
|
155
|
+
# See {Google::Cloud::Bigtable::RowFilter::ChainFilter}.
|
155
156
|
#
|
156
157
|
# The elements of "filters" are chained together to process the input row:
|
157
158
|
# in row -> f(0) -> intermediate row -> f(1) -> ... -> f(N) -> out row
|
@@ -160,6 +161,7 @@ module Google
|
|
160
161
|
# @return [Google::Cloud::Bigtable::RowFilter::ChainFilter]
|
161
162
|
#
|
162
163
|
# @example Create chain filter with simple filter.
|
164
|
+
# require "google/cloud/bigtable"
|
163
165
|
#
|
164
166
|
# chain = Google::Cloud::Bigtable::RowFilter.chain
|
165
167
|
#
|
@@ -171,6 +173,7 @@ module Google
|
|
171
173
|
# chain.key("user-*").strip_value
|
172
174
|
#
|
173
175
|
# @example Create complex chain filter.
|
176
|
+
# require "google/cloud/bigtable"
|
174
177
|
#
|
175
178
|
# chain = Google::Cloud::Bigtable::RowFilter.chain
|
176
179
|
#
|
@@ -219,6 +222,7 @@ module Google
|
|
219
222
|
# @return [Google::Cloud::Bigtable::RowFilter::InterleaveFilter]
|
220
223
|
#
|
221
224
|
# @example Create an interleave filter with simple filter.
|
225
|
+
# require "google/cloud/bigtable"
|
222
226
|
#
|
223
227
|
# interleave = Google::Cloud::Bigtable::RowFilter.interleave
|
224
228
|
#
|
@@ -230,6 +234,7 @@ module Google
|
|
230
234
|
# interleave.key("user-*").sink
|
231
235
|
#
|
232
236
|
# @example Create complex interleave filter.
|
237
|
+
# require "google/cloud/bigtable"
|
233
238
|
#
|
234
239
|
# interleave = Google::Cloud::Bigtable::RowFilter.interleave
|
235
240
|
#
|
@@ -254,12 +259,13 @@ module Google
|
|
254
259
|
# results. Additionally, condition filters have poor performance, especially
|
255
260
|
# when filters are set for the false condition.
|
256
261
|
#
|
257
|
-
# 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`.
|
258
263
|
#
|
259
264
|
# @param predicate [SimpleFilter, ChainFilter, InterleaveFilter, ConditionFilter]
|
260
265
|
# @return [Google::Cloud::Bigtable::RowFilter::ConditionFilter]
|
261
266
|
#
|
262
267
|
# @example
|
268
|
+
# require "google/cloud/bigtable"
|
263
269
|
#
|
264
270
|
# predicate = Google::Cloud::Bigtable::RowFilter.key("user-*")
|
265
271
|
# condition = Google::Cloud::Bigtable::RowFilter.condition(predicate)
|
@@ -283,6 +289,7 @@ module Google
|
|
283
289
|
# @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
|
284
290
|
#
|
285
291
|
# @example
|
292
|
+
# require "google/cloud/bigtable"
|
286
293
|
#
|
287
294
|
# filter = Google::Cloud::Bigtable::RowFilter.pass
|
288
295
|
#
|
@@ -299,6 +306,7 @@ module Google
|
|
299
306
|
# @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
|
300
307
|
#
|
301
308
|
# @example
|
309
|
+
# require "google/cloud/bigtable"
|
302
310
|
#
|
303
311
|
# filter = Google::Cloud::Bigtable::RowFilter.block
|
304
312
|
#
|
@@ -310,11 +318,12 @@ module Google
|
|
310
318
|
# Creates a sink filter instance.
|
311
319
|
#
|
312
320
|
# Outputs all cells directly to the output of the read rather than to any
|
313
|
-
# parent filter
|
321
|
+
# parent filter.
|
314
322
|
#
|
315
323
|
# @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
|
316
324
|
#
|
317
325
|
# @example
|
326
|
+
# require "google/cloud/bigtable"
|
318
327
|
#
|
319
328
|
# filter = Google::Cloud::Bigtable::RowFilter.sink
|
320
329
|
#
|
@@ -330,6 +339,7 @@ module Google
|
|
330
339
|
# @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
|
331
340
|
#
|
332
341
|
# @example
|
342
|
+
# require "google/cloud/bigtable"
|
333
343
|
#
|
334
344
|
# filter = Google::Cloud::Bigtable::RowFilter.strip_value
|
335
345
|
#
|
@@ -348,13 +358,13 @@ module Google
|
|
348
358
|
# will not match the new line character `\n`, which may be present in a
|
349
359
|
# binary key.
|
350
360
|
#
|
351
|
-
#
|
352
|
-
# @see https://github.com/google/re2/wiki/Syntax
|
361
|
+
# @see https://github.com/google/re2/wiki/Syntax Regex syntax
|
353
362
|
#
|
354
363
|
# @param regex [String] Regex to match row keys.
|
355
364
|
# @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
|
356
365
|
#
|
357
366
|
# @example
|
367
|
+
# require "google/cloud/bigtable"
|
358
368
|
#
|
359
369
|
# filter = Google::Cloud::Bigtable::RowFilter.key("user-.*")
|
360
370
|
#
|
@@ -368,11 +378,12 @@ module Google
|
|
368
378
|
# Matches all cells from a row with probability p, and matches no cells
|
369
379
|
# from the row with probability 1-p.
|
370
380
|
#
|
371
|
-
# @param probability [Float] Probability value
|
372
|
-
# Probability must be
|
381
|
+
# @param probability [Float] Probability value.
|
382
|
+
# Probability must be greater than 0 and less than 1.0.
|
373
383
|
# @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
|
374
384
|
#
|
375
385
|
# @example
|
386
|
+
# require "google/cloud/bigtable"
|
376
387
|
#
|
377
388
|
# filter = Google::Cloud::Bigtable::RowFilter.sample(0.5)
|
378
389
|
#
|
@@ -390,13 +401,13 @@ module Google
|
|
390
401
|
# `\n`, it is sufficient to use `.` as a full wildcard when matching
|
391
402
|
# column family names.
|
392
403
|
#
|
393
|
-
#
|
394
|
-
# @see https://github.com/google/re2/wiki/Syntax
|
404
|
+
# @see https://github.com/google/re2/wiki/Syntax Regex syntax
|
395
405
|
#
|
396
406
|
# @param regex [String] Regex to match family name.
|
397
407
|
# @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
|
398
408
|
#
|
399
409
|
# @example
|
410
|
+
# require "google/cloud/bigtable"
|
400
411
|
#
|
401
412
|
# filter = Google::Cloud::Bigtable::RowFilter.family("cf-.*")
|
402
413
|
#
|
@@ -414,13 +425,13 @@ module Google
|
|
414
425
|
# character will not match the new line character `\n`, which may be
|
415
426
|
# present in a binary qualifier.
|
416
427
|
#
|
417
|
-
#
|
418
|
-
# @see https://github.com/google/re2/wiki/Syntax
|
428
|
+
# @see https://github.com/google/re2/wiki/Syntax Regex syntax
|
419
429
|
#
|
420
430
|
# @param regex [String] Regex to match column qualifier name.
|
421
431
|
# @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
|
422
432
|
#
|
423
433
|
# @example
|
434
|
+
# require "google/cloud/bigtable"
|
424
435
|
#
|
425
436
|
# filter = Google::Cloud::Bigtable::RowFilter.qualifier("user-name.*")
|
426
437
|
#
|
@@ -437,13 +448,13 @@ module Google
|
|
437
448
|
# will not match the new line character `\n`, which may be present in a
|
438
449
|
# binary value.
|
439
450
|
#
|
440
|
-
#
|
441
|
-
# @see https://github.com/google/re2/wiki/Syntax
|
451
|
+
# @see https://github.com/google/re2/wiki/Syntax Regex syntax
|
442
452
|
#
|
443
453
|
# @param regex [String] Regex to match cell value.
|
444
454
|
# @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
|
445
455
|
#
|
446
456
|
# @example
|
457
|
+
# require "google/cloud/bigtable"
|
447
458
|
#
|
448
459
|
# filter = Google::Cloud::Bigtable::RowFilter.value("abc.*")
|
449
460
|
#
|
@@ -472,6 +483,7 @@ module Google
|
|
472
483
|
# @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
|
473
484
|
#
|
474
485
|
# @example
|
486
|
+
# require "google/cloud/bigtable"
|
475
487
|
#
|
476
488
|
# filter = Google::Cloud::Bigtable::RowFilter.label("user-detail")
|
477
489
|
#
|
@@ -490,6 +502,7 @@ module Google
|
|
490
502
|
# @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
|
491
503
|
#
|
492
504
|
# @example
|
505
|
+
# require "google/cloud/bigtable"
|
493
506
|
#
|
494
507
|
# filter = Google::Cloud::Bigtable::RowFilter.cells_per_row_offset(3)
|
495
508
|
#
|
@@ -508,6 +521,7 @@ module Google
|
|
508
521
|
# @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
|
509
522
|
#
|
510
523
|
# @example
|
524
|
+
# require "google/cloud/bigtable"
|
511
525
|
#
|
512
526
|
# filter = Google::Cloud::Bigtable::RowFilter.cells_per_row(5)
|
513
527
|
#
|
@@ -526,6 +540,7 @@ module Google
|
|
526
540
|
# @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
|
527
541
|
#
|
528
542
|
# @example
|
543
|
+
# require "google/cloud/bigtable"
|
529
544
|
#
|
530
545
|
# filter = Google::Cloud::Bigtable::RowFilter.cells_per_column(5)
|
531
546
|
#
|
@@ -544,6 +559,7 @@ module Google
|
|
544
559
|
# @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
|
545
560
|
#
|
546
561
|
# @example
|
562
|
+
# require "google/cloud/bigtable"
|
547
563
|
#
|
548
564
|
# timestamp_micros = (Time.now.to_f * 1000000).round(-3)
|
549
565
|
# from = timestamp_micros - 300000000
|
@@ -577,7 +593,7 @@ module Google
|
|
577
593
|
# @param range [Google::Cloud::Bigtable::ValueRange]
|
578
594
|
# @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
|
579
595
|
#
|
580
|
-
# @example Start to end range
|
596
|
+
# @example Start to end range.
|
581
597
|
# require "google/cloud/bigtable"
|
582
598
|
#
|
583
599
|
# bigtable = Google::Cloud::Bigtable.new
|
@@ -586,7 +602,7 @@ module Google
|
|
586
602
|
# range = table.new_value_range.from("value-001", inclusive: false)
|
587
603
|
# filter = Google::Cloud::Bigtable::RowFilter.value_range(range)
|
588
604
|
#
|
589
|
-
# @example Start
|
605
|
+
# @example Start exclusive to infinite end range.
|
590
606
|
# require "google/cloud/bigtable"
|
591
607
|
#
|
592
608
|
# bigtable = Google::Cloud::Bigtable.new
|
@@ -25,10 +25,13 @@ module Google
|
|
25
25
|
# A RowFilter that sends rows through several RowFilters in sequence.
|
26
26
|
#
|
27
27
|
# The elements of "filters" are chained together to process the input row:
|
28
|
-
#
|
28
|
+
#
|
29
|
+
# in row -> f(0) -> intermediate row -> f(1) -> ... -> f(N) -> out row
|
30
|
+
#
|
29
31
|
# The full chain is executed atomically.
|
30
32
|
#
|
31
33
|
# @example
|
34
|
+
# require "google/cloud/bigtable"
|
32
35
|
#
|
33
36
|
# chain = Google::Cloud::Bigtable::RowFilter.chain
|
34
37
|
# # Add filters to chain filter
|
@@ -42,12 +45,14 @@ module Google
|
|
42
45
|
end
|
43
46
|
|
44
47
|
##
|
45
|
-
# Adds a chain filter
|
48
|
+
# Adds a chain filter.
|
46
49
|
#
|
47
50
|
# A Chain RowFilter that sends rows through several RowFilters in sequence.
|
48
51
|
#
|
49
52
|
# The elements of "filters" are chained together to process the input row:
|
50
|
-
#
|
53
|
+
#
|
54
|
+
# in row -> f(0) -> intermediate row -> f(1) -> ... -> f(N) -> out row
|
55
|
+
#
|
51
56
|
# The full chain is executed atomically.
|
52
57
|
#
|
53
58
|
# @param filter [SimpleFilter, ChainFilter, InterleaveFilter, ConditionFilter]
|
@@ -55,6 +60,7 @@ module Google
|
|
55
60
|
# `self` instance of chain filter.
|
56
61
|
#
|
57
62
|
# @example Create a chain filter and add a chain filter.
|
63
|
+
# require "google/cloud/bigtable"
|
58
64
|
#
|
59
65
|
# chain_1 = Google::Cloud::Bigtable::RowFilter.chain
|
60
66
|
#
|
@@ -73,7 +79,7 @@ module Google
|
|
73
79
|
end
|
74
80
|
|
75
81
|
##
|
76
|
-
#
|
82
|
+
# Adds an interleave filter.
|
77
83
|
#
|
78
84
|
# A RowFilter that sends each row to each of several component
|
79
85
|
# RowFilters and interleaves the results.
|
@@ -110,7 +116,8 @@ module Google
|
|
110
116
|
# @return [Google::Cloud::Bigtable::RowFilter::ChainFilter]
|
111
117
|
# `self` instance of chain filter.
|
112
118
|
#
|
113
|
-
# @example Add interleave filter to chain filter
|
119
|
+
# @example Add an interleave filter to the chain filter.
|
120
|
+
# require "google/cloud/bigtable"
|
114
121
|
#
|
115
122
|
# interleave = Google::Cloud::Bigtable::RowFilter.interleave
|
116
123
|
#
|
@@ -125,7 +132,7 @@ module Google
|
|
125
132
|
end
|
126
133
|
|
127
134
|
##
|
128
|
-
# Adds a condition filter
|
135
|
+
# Adds a condition filter.
|
129
136
|
#
|
130
137
|
# A RowFilter that evaluates one of two possible RowFilters, depending on
|
131
138
|
# whether or not a predicate RowFilter outputs any cells from the input row.
|
@@ -142,6 +149,7 @@ module Google
|
|
142
149
|
# `self` instance of chain filter.
|
143
150
|
#
|
144
151
|
# @example
|
152
|
+
# require "google/cloud/bigtable"
|
145
153
|
#
|
146
154
|
# predicate = Google::Cloud::Bigtable::RowFilter.key("user-*")
|
147
155
|
#
|
@@ -159,7 +167,7 @@ module Google
|
|
159
167
|
end
|
160
168
|
|
161
169
|
##
|
162
|
-
# Adds a pass filter
|
170
|
+
# Adds a pass filter.
|
163
171
|
#
|
164
172
|
# Matches all cells, regardless of input. Functionally equivalent to
|
165
173
|
# leaving `filter` unset, but included for completeness.
|
@@ -168,6 +176,7 @@ module Google
|
|
168
176
|
# `self` instance of chain filter.
|
169
177
|
#
|
170
178
|
# @example
|
179
|
+
# require "google/cloud/bigtable"
|
171
180
|
#
|
172
181
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.pass
|
173
182
|
#
|
@@ -176,7 +185,7 @@ module Google
|
|
176
185
|
end
|
177
186
|
|
178
187
|
##
|
179
|
-
# Adds a block-all filter
|
188
|
+
# Adds a block-all filter.
|
180
189
|
#
|
181
190
|
# Does not match any cells, regardless of input. Useful for temporarily
|
182
191
|
# disabling just part of a filter.
|
@@ -185,6 +194,7 @@ module Google
|
|
185
194
|
# `self` instance of chain filter.
|
186
195
|
#
|
187
196
|
# @example
|
197
|
+
# require "google/cloud/bigtable"
|
188
198
|
#
|
189
199
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.block
|
190
200
|
#
|
@@ -193,7 +203,7 @@ module Google
|
|
193
203
|
end
|
194
204
|
|
195
205
|
##
|
196
|
-
# Adds a sink filter
|
206
|
+
# Adds a sink filter.
|
197
207
|
#
|
198
208
|
# Outputs all cells directly to the output of the read rather than to any parent filter.
|
199
209
|
#
|
@@ -201,6 +211,7 @@ module Google
|
|
201
211
|
# `self` instance of chain filter.
|
202
212
|
#
|
203
213
|
# @example
|
214
|
+
# require "google/cloud/bigtable"
|
204
215
|
#
|
205
216
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.sink
|
206
217
|
#
|
@@ -209,7 +220,7 @@ module Google
|
|
209
220
|
end
|
210
221
|
|
211
222
|
##
|
212
|
-
# Adds a strip-value filter
|
223
|
+
# Adds a strip-value filter.
|
213
224
|
#
|
214
225
|
# Replaces each cell's value with an empty string.
|
215
226
|
#
|
@@ -217,6 +228,7 @@ module Google
|
|
217
228
|
# `self` instance of chain filter.
|
218
229
|
#
|
219
230
|
# @example
|
231
|
+
# require "google/cloud/bigtable"
|
220
232
|
#
|
221
233
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.strip_value
|
222
234
|
#
|
@@ -243,6 +255,7 @@ module Google
|
|
243
255
|
# `self` instance of chain filter.
|
244
256
|
#
|
245
257
|
# @example
|
258
|
+
# require "google/cloud/bigtable"
|
246
259
|
#
|
247
260
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.key("user-*")
|
248
261
|
#
|
@@ -251,17 +264,18 @@ module Google
|
|
251
264
|
end
|
252
265
|
|
253
266
|
##
|
254
|
-
# Adds a sample-probability filter
|
267
|
+
# Adds a sample-probability filter.
|
255
268
|
#
|
256
269
|
# Matches all cells from a row with probability p, and matches no cells
|
257
270
|
# from the row with probability 1-p.
|
258
271
|
#
|
259
|
-
# @param probability [Float] Probability value
|
260
|
-
# Probability must be
|
272
|
+
# @param probability [Float] Probability value.
|
273
|
+
# Probability must be greater than 0 and less than 1.0.
|
261
274
|
# @return [Google::Cloud::Bigtable::RowFilter::ChainFilter]
|
262
275
|
# `self` instance of chain filter.
|
263
276
|
#
|
264
277
|
# @example
|
278
|
+
# require "google/cloud/bigtable"
|
265
279
|
#
|
266
280
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.sample(0.5)
|
267
281
|
#
|
@@ -287,6 +301,7 @@ module Google
|
|
287
301
|
# `self` instance of chain filter.
|
288
302
|
#
|
289
303
|
# @example
|
304
|
+
# require "google/cloud/bigtable"
|
290
305
|
#
|
291
306
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.family("cf-*")
|
292
307
|
#
|
@@ -295,7 +310,7 @@ module Google
|
|
295
310
|
end
|
296
311
|
|
297
312
|
##
|
298
|
-
#
|
313
|
+
# Adds a column-qualifier-match filter using a regular expression.
|
299
314
|
#
|
300
315
|
# Matches only cells from columns whose qualifiers satisfy the given RE2
|
301
316
|
# regex.
|
@@ -312,6 +327,7 @@ module Google
|
|
312
327
|
# `self` instance of chain filter.
|
313
328
|
#
|
314
329
|
# @example
|
330
|
+
# require "google/cloud/bigtable"
|
315
331
|
#
|
316
332
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.qualifier("user-name*")
|
317
333
|
#
|
@@ -336,6 +352,7 @@ module Google
|
|
336
352
|
# `self` instance of chain filter.
|
337
353
|
#
|
338
354
|
# @example
|
355
|
+
# require "google/cloud/bigtable"
|
339
356
|
#
|
340
357
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.value("abc*")
|
341
358
|
#
|
@@ -364,6 +381,7 @@ module Google
|
|
364
381
|
# `self` instance of chain filter.
|
365
382
|
#
|
366
383
|
# @example
|
384
|
+
# require "google/cloud/bigtable"
|
367
385
|
#
|
368
386
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.label("user-detail")
|
369
387
|
#
|
@@ -383,6 +401,7 @@ module Google
|
|
383
401
|
# `self` instance of chain filter.
|
384
402
|
#
|
385
403
|
# @example
|
404
|
+
# require "google/cloud/bigtable"
|
386
405
|
#
|
387
406
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.cells_per_row_offset(3)
|
388
407
|
#
|
@@ -391,17 +410,18 @@ module Google
|
|
391
410
|
end
|
392
411
|
|
393
412
|
##
|
394
|
-
# Adds a cells-per-row-limit filter
|
413
|
+
# Adds a cells-per-row-limit filter.
|
395
414
|
#
|
396
415
|
# Matches only the first N cells of each row.
|
397
416
|
# If duplicate cells are present, as is possible when using an Interleave,
|
398
417
|
# each copy of the cell is counted separately.
|
399
418
|
#
|
400
|
-
# @param limit [String] Max cell match per row limit
|
419
|
+
# @param limit [String] Max cell match per row limit.
|
401
420
|
# @return [Google::Cloud::Bigtable::RowFilter::ChainFilter]
|
402
421
|
# `self` instance of chain filter.
|
403
422
|
#
|
404
423
|
# @example
|
424
|
+
# require "google/cloud/bigtable"
|
405
425
|
#
|
406
426
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.cells_per_row(5)
|
407
427
|
#
|
@@ -410,7 +430,7 @@ module Google
|
|
410
430
|
end
|
411
431
|
|
412
432
|
##
|
413
|
-
# Adds a cells-per-column filter
|
433
|
+
# Adds a cells-per-column filter.
|
414
434
|
#
|
415
435
|
# Matches only the most recent N cells within each column. For example,
|
416
436
|
# if N=2, this filter would match column `foo:bar` at timestamps 10 and 9,
|
@@ -419,11 +439,12 @@ module Google
|
|
419
439
|
# If duplicate cells are present, as is possible when using an Interleave,
|
420
440
|
# each copy of the cell is counted separately.
|
421
441
|
#
|
422
|
-
# @param limit [String] Max cell match per column limit
|
442
|
+
# @param limit [String] Max cell match per column limit.
|
423
443
|
# @return [Google::Cloud::Bigtable::RowFilter::ChainFilter]
|
424
444
|
# `self` instance of chain filter.
|
425
445
|
#
|
426
446
|
# @example
|
447
|
+
# require "google/cloud/bigtable"
|
427
448
|
#
|
428
449
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.cells_per_column(5)
|
429
450
|
#
|
@@ -432,7 +453,7 @@ module Google
|
|
432
453
|
end
|
433
454
|
|
434
455
|
##
|
435
|
-
# Adds a timestamp-range filter
|
456
|
+
# Adds a timestamp-range filter.
|
436
457
|
#
|
437
458
|
# Matches only cells with timestamps within the given range.
|
438
459
|
# Specifies a contiguous range of timestamps.
|
@@ -445,6 +466,7 @@ module Google
|
|
445
466
|
# `self` instance of chain filter.
|
446
467
|
#
|
447
468
|
# @example
|
469
|
+
# require "google/cloud/bigtable"
|
448
470
|
#
|
449
471
|
# timestamp_micros = (Time.now.to_f * 1000000).round(-3)
|
450
472
|
# from = timestamp_micros - 300000000
|
@@ -457,12 +479,12 @@ module Google
|
|
457
479
|
end
|
458
480
|
|
459
481
|
##
|
460
|
-
# Adds a value-range filter
|
482
|
+
# Adds a value-range filter.
|
461
483
|
#
|
462
484
|
# Matches only cells with values that fall within the given range.
|
463
485
|
#
|
464
486
|
# See {Google::Cloud::Bigtable::ValueRange#from} and { Google::Cloud::Bigtable::ValueRange#to} for range
|
465
|
-
# option inclusive/exclusive options
|
487
|
+
# option inclusive/exclusive options.
|
466
488
|
#
|
467
489
|
# * The value at which to start the range. If neither field is set, interpreted as an empty string, inclusive.
|
468
490
|
# * The value at which to end the range. If neither field is set, interpreted as the infinite string,
|
@@ -472,7 +494,7 @@ module Google
|
|
472
494
|
# @return [Google::Cloud::Bigtable::RowFilter::ChainFilter]
|
473
495
|
# `self` instance of chain filter.
|
474
496
|
#
|
475
|
-
# @example Start to end range
|
497
|
+
# @example Start to end range.
|
476
498
|
# require "google/cloud/bigtable"
|
477
499
|
#
|
478
500
|
# bigtable = Google::Cloud::Bigtable.new
|
@@ -481,7 +503,7 @@ module Google
|
|
481
503
|
# range = table.new_value_range.from("value-001").to("value-005")
|
482
504
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.value_range(range)
|
483
505
|
#
|
484
|
-
# @example Start exclusive to infinite end range
|
506
|
+
# @example Start exclusive to infinite end range.
|
485
507
|
# require "google/cloud/bigtable"
|
486
508
|
#
|
487
509
|
# bigtable = Google::Cloud::Bigtable.new
|
@@ -495,7 +517,7 @@ module Google
|
|
495
517
|
end
|
496
518
|
|
497
519
|
##
|
498
|
-
# Adds a column-range filter
|
520
|
+
# Adds a column-range filter.
|
499
521
|
#
|
500
522
|
# Matches only cells from columns within the given range.
|
501
523
|
#
|
@@ -520,9 +542,10 @@ module Google
|
|
520
542
|
# @return [Integer]
|
521
543
|
#
|
522
544
|
# @example
|
545
|
+
# require "google/cloud/bigtable"
|
523
546
|
#
|
524
|
-
#
|
525
|
-
#
|
547
|
+
# filter = Google::Cloud::Bigtable::RowFilter.chain.key("user-1*").label("user")
|
548
|
+
# filter.length # 2
|
526
549
|
#
|
527
550
|
def length
|
528
551
|
@filters.length
|