google-cloud-bigtable 0.6.2 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +4 -26
- data/CHANGELOG.md +85 -0
- data/CONTRIBUTING.md +1 -1
- data/OVERVIEW.md +388 -19
- data/lib/google-cloud-bigtable.rb +19 -22
- 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.rb +11 -17
- data/lib/google/cloud/bigtable/admin.rb +2 -2
- data/lib/google/cloud/bigtable/admin/v2.rb +2 -2
- data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb +2 -2
- data/lib/google/cloud/bigtable/admin/v2/credentials.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_instance_admin.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_table_admin.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/instance.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/table.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/iam_policy.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/options.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/policy.rb +7 -6
- data/lib/google/cloud/bigtable/admin/v2/doc/google/longrunning/operations.rb +2 -2
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/any.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/duration.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/empty.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/field_mask.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/timestamp.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/rpc/status.rb +7 -55
- data/lib/google/cloud/bigtable/admin/v2/doc/google/type/expr.rb +1 -1
- data/lib/google/cloud/bigtable/app_profile.rb +162 -96
- data/lib/google/cloud/bigtable/app_profile/job.rb +5 -8
- data/lib/google/cloud/bigtable/app_profile/list.rb +18 -12
- data/lib/google/cloud/bigtable/chunk_processor.rb +24 -36
- data/lib/google/cloud/bigtable/cluster.rb +45 -18
- data/lib/google/cloud/bigtable/cluster/job.rb +3 -7
- data/lib/google/cloud/bigtable/cluster/list.rb +22 -20
- data/lib/google/cloud/bigtable/column_family.rb +18 -231
- data/lib/google/cloud/bigtable/column_family_map.rb +426 -0
- data/lib/google/cloud/bigtable/column_range.rb +15 -7
- data/lib/google/cloud/bigtable/convert.rb +12 -4
- data/lib/google/cloud/bigtable/errors.rb +4 -1
- data/lib/google/cloud/bigtable/gc_rule.rb +188 -69
- data/lib/google/cloud/bigtable/instance.rb +209 -189
- data/lib/google/cloud/bigtable/instance/cluster_map.rb +17 -13
- data/lib/google/cloud/bigtable/instance/job.rb +6 -5
- data/lib/google/cloud/bigtable/instance/list.rb +18 -13
- data/lib/google/cloud/bigtable/longrunning_job.rb +7 -1
- data/lib/google/cloud/bigtable/mutation_entry.rb +36 -39
- data/lib/google/cloud/bigtable/mutation_operations.rb +90 -73
- data/lib/google/cloud/bigtable/policy.rb +9 -5
- data/lib/google/cloud/bigtable/project.rb +87 -196
- data/lib/google/cloud/bigtable/read_modify_write_rule.rb +15 -10
- data/lib/google/cloud/bigtable/read_operations.rb +42 -59
- data/lib/google/cloud/bigtable/routing_policy.rb +172 -0
- data/lib/google/cloud/bigtable/row.rb +32 -21
- data/lib/google/cloud/bigtable/row_filter.rb +80 -35
- data/lib/google/cloud/bigtable/row_filter/chain_filter.rb +119 -68
- data/lib/google/cloud/bigtable/row_filter/condition_filter.rb +8 -2
- data/lib/google/cloud/bigtable/row_filter/interleave_filter.rb +117 -66
- data/lib/google/cloud/bigtable/row_filter/simple_filter.rb +24 -9
- data/lib/google/cloud/bigtable/row_range.rb +5 -0
- data/lib/google/cloud/bigtable/rows_mutator.rb +14 -21
- data/lib/google/cloud/bigtable/rows_reader.rb +23 -18
- data/lib/google/cloud/bigtable/sample_row_key.rb +6 -3
- data/lib/google/cloud/bigtable/service.rb +200 -253
- data/lib/google/cloud/bigtable/status.rb +76 -0
- data/lib/google/cloud/bigtable/table.rb +158 -262
- data/lib/google/cloud/bigtable/table/cluster_state.rb +17 -6
- data/lib/google/cloud/bigtable/table/list.rb +16 -9
- data/lib/google/cloud/bigtable/v2.rb +2 -2
- data/lib/google/cloud/bigtable/v2/bigtable_client.rb +13 -13
- data/lib/google/cloud/bigtable/v2/credentials.rb +1 -1
- data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/bigtable.rb +17 -14
- data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/data.rb +1 -1
- data/lib/google/cloud/bigtable/v2/doc/google/protobuf/any.rb +1 -1
- data/lib/google/cloud/bigtable/v2/doc/google/protobuf/wrappers.rb +1 -1
- data/lib/google/cloud/bigtable/v2/doc/google/rpc/status.rb +7 -55
- data/lib/google/cloud/bigtable/value_range.rb +19 -13
- data/lib/google/cloud/bigtable/version.rb +1 -1
- metadata +67 -25
- data/lib/google/cloud/bigtable/table/column_family_map.rb +0 -70
@@ -19,15 +19,19 @@ module Google
|
|
19
19
|
module Cloud
|
20
20
|
module Bigtable
|
21
21
|
module RowFilter
|
22
|
+
##
|
22
23
|
# # ChainFilter
|
23
24
|
#
|
24
25
|
# A RowFilter that sends rows through several RowFilters in sequence.
|
25
26
|
#
|
26
27
|
# The elements of "filters" are chained together to process the input row:
|
27
|
-
#
|
28
|
+
#
|
29
|
+
# in row -> f(0) -> intermediate row -> f(1) -> ... -> f(N) -> out row
|
30
|
+
#
|
28
31
|
# The full chain is executed atomically.
|
29
32
|
#
|
30
33
|
# @example
|
34
|
+
# require "google/cloud/bigtable"
|
31
35
|
#
|
32
36
|
# chain = Google::Cloud::Bigtable::RowFilter.chain
|
33
37
|
# # Add filters to chain filter
|
@@ -37,15 +41,18 @@ module Google
|
|
37
41
|
# @private
|
38
42
|
# Creates an instance of a chain filter.
|
39
43
|
def initialize
|
40
|
-
@
|
44
|
+
@filters = []
|
41
45
|
end
|
42
46
|
|
43
|
-
|
47
|
+
##
|
48
|
+
# Adds a chain filter.
|
44
49
|
#
|
45
50
|
# A Chain RowFilter that sends rows through several RowFilters in sequence.
|
46
51
|
#
|
47
52
|
# The elements of "filters" are chained together to process the input row:
|
48
|
-
#
|
53
|
+
#
|
54
|
+
# in row -> f(0) -> intermediate row -> f(1) -> ... -> f(N) -> out row
|
55
|
+
#
|
49
56
|
# The full chain is executed atomically.
|
50
57
|
#
|
51
58
|
# @param filter [SimpleFilter, ChainFilter, InterleaveFilter, ConditionFilter]
|
@@ -53,6 +60,7 @@ module Google
|
|
53
60
|
# `self` instance of chain filter.
|
54
61
|
#
|
55
62
|
# @example Create a chain filter and add a chain filter.
|
63
|
+
# require "google/cloud/bigtable"
|
56
64
|
#
|
57
65
|
# chain_1 = Google::Cloud::Bigtable::RowFilter.chain
|
58
66
|
#
|
@@ -66,13 +74,12 @@ module Google
|
|
66
74
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.chain(chain_1)
|
67
75
|
#
|
68
76
|
def chain filter
|
69
|
-
unless filter.instance_of?
|
70
|
-
|
71
|
-
end
|
72
|
-
add(filter)
|
77
|
+
raise RowFilterError, "Filter type must be ChainFilter" unless filter.instance_of? ChainFilter
|
78
|
+
add filter
|
73
79
|
end
|
74
80
|
|
75
|
-
|
81
|
+
##
|
82
|
+
# Adds an interleave filter.
|
76
83
|
#
|
77
84
|
# A RowFilter that sends each row to each of several component
|
78
85
|
# RowFilters and interleaves the results.
|
@@ -109,7 +116,8 @@ module Google
|
|
109
116
|
# @return [Google::Cloud::Bigtable::RowFilter::ChainFilter]
|
110
117
|
# `self` instance of chain filter.
|
111
118
|
#
|
112
|
-
# @example Add interleave filter to chain filter
|
119
|
+
# @example Add an interleave filter to the chain filter.
|
120
|
+
# require "google/cloud/bigtable"
|
113
121
|
#
|
114
122
|
# interleave = Google::Cloud::Bigtable::RowFilter.interleave
|
115
123
|
#
|
@@ -119,13 +127,12 @@ module Google
|
|
119
127
|
# chain = Google::Cloud::Bigtable::RowFilter.chain.interleave(interleave)
|
120
128
|
#
|
121
129
|
def interleave filter
|
122
|
-
unless filter.instance_of?
|
123
|
-
|
124
|
-
end
|
125
|
-
add(filter)
|
130
|
+
raise RowFilterError, "Filter type must be InterleaveFilter" unless filter.instance_of? InterleaveFilter
|
131
|
+
add filter
|
126
132
|
end
|
127
133
|
|
128
|
-
|
134
|
+
##
|
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,24 +149,25 @@ 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
|
#
|
148
156
|
# label = Google::Cloud::Bigtable::RowFilter.label("user")
|
149
157
|
# strip_value = Google::Cloud::Bigtable::RowFilter.strip_value
|
150
158
|
#
|
151
|
-
# condition_filter = Google::Cloud::Bigtable::RowFilter.
|
159
|
+
# condition_filter = Google::Cloud::Bigtable::RowFilter.
|
160
|
+
# condition(predicate).on_match(label).otherwise(strip_value)
|
152
161
|
#
|
153
162
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.condition(condition_filter)
|
154
163
|
#
|
155
164
|
def condition filter
|
156
|
-
unless filter.instance_of?
|
157
|
-
|
158
|
-
end
|
159
|
-
add(filter)
|
165
|
+
raise RowFilterError, "Filter type must be ConditionFilter" unless filter.instance_of? ConditionFilter
|
166
|
+
add filter
|
160
167
|
end
|
161
168
|
|
162
|
-
|
169
|
+
##
|
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,14 +176,16 @@ 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
|
#
|
174
183
|
def pass
|
175
|
-
add
|
184
|
+
add RowFilter.pass
|
176
185
|
end
|
177
186
|
|
178
|
-
|
187
|
+
##
|
188
|
+
# Adds a block-all filter.
|
179
189
|
#
|
180
190
|
# Does not match any cells, regardless of input. Useful for temporarily
|
181
191
|
# disabling just part of a filter.
|
@@ -184,14 +194,16 @@ module Google
|
|
184
194
|
# `self` instance of chain filter.
|
185
195
|
#
|
186
196
|
# @example
|
197
|
+
# require "google/cloud/bigtable"
|
187
198
|
#
|
188
199
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.block
|
189
200
|
#
|
190
201
|
def block
|
191
|
-
add
|
202
|
+
add RowFilter.block
|
192
203
|
end
|
193
204
|
|
194
|
-
|
205
|
+
##
|
206
|
+
# Adds a sink filter.
|
195
207
|
#
|
196
208
|
# Outputs all cells directly to the output of the read rather than to any parent filter.
|
197
209
|
#
|
@@ -199,14 +211,16 @@ module Google
|
|
199
211
|
# `self` instance of chain filter.
|
200
212
|
#
|
201
213
|
# @example
|
214
|
+
# require "google/cloud/bigtable"
|
202
215
|
#
|
203
216
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.sink
|
204
217
|
#
|
205
218
|
def sink
|
206
|
-
add
|
219
|
+
add RowFilter.sink
|
207
220
|
end
|
208
221
|
|
209
|
-
|
222
|
+
##
|
223
|
+
# Adds a strip-value filter.
|
210
224
|
#
|
211
225
|
# Replaces each cell's value with an empty string.
|
212
226
|
#
|
@@ -214,13 +228,15 @@ module Google
|
|
214
228
|
# `self` instance of chain filter.
|
215
229
|
#
|
216
230
|
# @example
|
231
|
+
# require "google/cloud/bigtable"
|
217
232
|
#
|
218
233
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.strip_value
|
219
234
|
#
|
220
235
|
def strip_value
|
221
|
-
add
|
236
|
+
add RowFilter.strip_value
|
222
237
|
end
|
223
238
|
|
239
|
+
##
|
224
240
|
# Adds a key-filter instance to match keys using a regular expression.
|
225
241
|
#
|
226
242
|
# Matches only cells from rows whose keys satisfy the given RE2 regex. In
|
@@ -239,31 +255,35 @@ module Google
|
|
239
255
|
# `self` instance of chain filter.
|
240
256
|
#
|
241
257
|
# @example
|
258
|
+
# require "google/cloud/bigtable"
|
242
259
|
#
|
243
260
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.key("user-*")
|
244
261
|
#
|
245
262
|
def key regex
|
246
|
-
add
|
263
|
+
add RowFilter.key(regex)
|
247
264
|
end
|
248
265
|
|
249
|
-
|
266
|
+
##
|
267
|
+
# Adds a sample-probability filter.
|
250
268
|
#
|
251
269
|
# Matches all cells from a row with probability p, and matches no cells
|
252
270
|
# from the row with probability 1-p.
|
253
271
|
#
|
254
|
-
# @param probability [Float] Probability value
|
255
|
-
# Probability must be
|
272
|
+
# @param probability [Float] Probability value.
|
273
|
+
# Probability must be greater than 0 and less than 1.0.
|
256
274
|
# @return [Google::Cloud::Bigtable::RowFilter::ChainFilter]
|
257
275
|
# `self` instance of chain filter.
|
258
276
|
#
|
259
277
|
# @example
|
278
|
+
# require "google/cloud/bigtable"
|
260
279
|
#
|
261
280
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.sample(0.5)
|
262
281
|
#
|
263
282
|
def sample probability
|
264
|
-
add
|
283
|
+
add RowFilter.sample(probability)
|
265
284
|
end
|
266
285
|
|
286
|
+
##
|
267
287
|
# Adds a family-name-match filter using a regular expression.
|
268
288
|
#
|
269
289
|
# Matches only cells from columns whose families satisfy the given RE2
|
@@ -281,14 +301,16 @@ module Google
|
|
281
301
|
# `self` instance of chain filter.
|
282
302
|
#
|
283
303
|
# @example
|
304
|
+
# require "google/cloud/bigtable"
|
284
305
|
#
|
285
306
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.family("cf-*")
|
286
307
|
#
|
287
308
|
def family regex
|
288
|
-
add
|
309
|
+
add RowFilter.family(regex)
|
289
310
|
end
|
290
311
|
|
291
|
-
|
312
|
+
##
|
313
|
+
# Adds a column-qualifier-match filter using a regular expression.
|
292
314
|
#
|
293
315
|
# Matches only cells from columns whose qualifiers satisfy the given RE2
|
294
316
|
# regex.
|
@@ -305,13 +327,15 @@ module Google
|
|
305
327
|
# `self` instance of chain filter.
|
306
328
|
#
|
307
329
|
# @example
|
330
|
+
# require "google/cloud/bigtable"
|
308
331
|
#
|
309
332
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.qualifier("user-name*")
|
310
333
|
#
|
311
334
|
def qualifier regex
|
312
|
-
add
|
335
|
+
add RowFilter.qualifier(regex)
|
313
336
|
end
|
314
337
|
|
338
|
+
##
|
315
339
|
# Adds a value-match filter using a regular expression.
|
316
340
|
#
|
317
341
|
# Matches only cells with values that satisfy the given regular expression.
|
@@ -328,13 +352,15 @@ module Google
|
|
328
352
|
# `self` instance of chain filter.
|
329
353
|
#
|
330
354
|
# @example
|
355
|
+
# require "google/cloud/bigtable"
|
331
356
|
#
|
332
357
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.value("abc*")
|
333
358
|
#
|
334
359
|
def value regex
|
335
|
-
add
|
360
|
+
add RowFilter.value(regex)
|
336
361
|
end
|
337
362
|
|
363
|
+
##
|
338
364
|
# Adds a label filter instance to apply a label based on the result of read rows.
|
339
365
|
#
|
340
366
|
# Applies the given label to all cells in the output row. This allows
|
@@ -355,13 +381,15 @@ module Google
|
|
355
381
|
# `self` instance of chain filter.
|
356
382
|
#
|
357
383
|
# @example
|
384
|
+
# require "google/cloud/bigtable"
|
358
385
|
#
|
359
386
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.label("user-detail")
|
360
387
|
#
|
361
388
|
def label value
|
362
|
-
add
|
389
|
+
add RowFilter.label(value)
|
363
390
|
end
|
364
391
|
|
392
|
+
##
|
365
393
|
# Adds a cell-per-row-offset filter instance to skip the first N cells.
|
366
394
|
#
|
367
395
|
# Skips the first N cells of each row, matching all subsequent cells.
|
@@ -373,32 +401,36 @@ module Google
|
|
373
401
|
# `self` instance of chain filter.
|
374
402
|
#
|
375
403
|
# @example
|
404
|
+
# require "google/cloud/bigtable"
|
376
405
|
#
|
377
406
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.cells_per_row_offset(3)
|
378
407
|
#
|
379
408
|
def cells_per_row_offset offset
|
380
|
-
add
|
409
|
+
add RowFilter.cells_per_row_offset(offset)
|
381
410
|
end
|
382
411
|
|
383
|
-
|
412
|
+
##
|
413
|
+
# Adds a cells-per-row-limit filter.
|
384
414
|
#
|
385
415
|
# Matches only the first N cells of each row.
|
386
416
|
# If duplicate cells are present, as is possible when using an Interleave,
|
387
417
|
# each copy of the cell is counted separately.
|
388
418
|
#
|
389
|
-
# @param limit [String] Max cell match per row limit
|
419
|
+
# @param limit [String] Max cell match per row limit.
|
390
420
|
# @return [Google::Cloud::Bigtable::RowFilter::ChainFilter]
|
391
421
|
# `self` instance of chain filter.
|
392
422
|
#
|
393
423
|
# @example
|
424
|
+
# require "google/cloud/bigtable"
|
394
425
|
#
|
395
426
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.cells_per_row(5)
|
396
427
|
#
|
397
428
|
def cells_per_row limit
|
398
|
-
add
|
429
|
+
add RowFilter.cells_per_row(limit)
|
399
430
|
end
|
400
431
|
|
401
|
-
|
432
|
+
##
|
433
|
+
# Adds a cells-per-column filter.
|
402
434
|
#
|
403
435
|
# Matches only the most recent N cells within each column. For example,
|
404
436
|
# if N=2, this filter would match column `foo:bar` at timestamps 10 and 9,
|
@@ -407,19 +439,21 @@ module Google
|
|
407
439
|
# If duplicate cells are present, as is possible when using an Interleave,
|
408
440
|
# each copy of the cell is counted separately.
|
409
441
|
#
|
410
|
-
# @param limit [String] Max cell match per column limit
|
442
|
+
# @param limit [String] Max cell match per column limit.
|
411
443
|
# @return [Google::Cloud::Bigtable::RowFilter::ChainFilter]
|
412
444
|
# `self` instance of chain filter.
|
413
445
|
#
|
414
446
|
# @example
|
447
|
+
# require "google/cloud/bigtable"
|
415
448
|
#
|
416
449
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.cells_per_column(5)
|
417
450
|
#
|
418
451
|
def cells_per_column limit
|
419
|
-
add
|
452
|
+
add RowFilter.cells_per_column(limit)
|
420
453
|
end
|
421
454
|
|
422
|
-
|
455
|
+
##
|
456
|
+
# Adds a timestamp-range filter.
|
423
457
|
#
|
424
458
|
# Matches only cells with timestamps within the given range.
|
425
459
|
# Specifies a contiguous range of timestamps.
|
@@ -432,6 +466,7 @@ module Google
|
|
432
466
|
# `self` instance of chain filter.
|
433
467
|
#
|
434
468
|
# @example
|
469
|
+
# require "google/cloud/bigtable"
|
435
470
|
#
|
436
471
|
# timestamp_micros = (Time.now.to_f * 1000000).round(-3)
|
437
472
|
# from = timestamp_micros - 300000000
|
@@ -440,38 +475,49 @@ module Google
|
|
440
475
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.timestamp_range(from: from, to: to)
|
441
476
|
#
|
442
477
|
def timestamp_range from: nil, to: nil
|
443
|
-
add
|
478
|
+
add RowFilter.timestamp_range(from: from, to: to)
|
444
479
|
end
|
445
480
|
|
446
|
-
|
481
|
+
##
|
482
|
+
# Adds a value-range filter.
|
447
483
|
#
|
448
484
|
# Matches only cells with values that fall within the given range.
|
449
485
|
#
|
450
486
|
# See {Google::Cloud::Bigtable::ValueRange#from} and { Google::Cloud::Bigtable::ValueRange#to} for range
|
451
|
-
# option inclusive/exclusive options
|
487
|
+
# option inclusive/exclusive options.
|
452
488
|
#
|
453
489
|
# * The value at which to start the range. If neither field is set, interpreted as an empty string, inclusive.
|
454
|
-
# * The value at which to end the range. If neither field is set, interpreted as the infinite string,
|
490
|
+
# * The value at which to end the range. If neither field is set, interpreted as the infinite string,
|
491
|
+
# exclusive.
|
455
492
|
#
|
456
493
|
# @param range [Google::Cloud::Bigtable::ValueRange]
|
457
494
|
# @return [Google::Cloud::Bigtable::RowFilter::ChainFilter]
|
458
495
|
# `self` instance of chain filter.
|
459
496
|
#
|
460
|
-
# @example Start to end range
|
497
|
+
# @example Start to end range.
|
498
|
+
# require "google/cloud/bigtable"
|
461
499
|
#
|
462
|
-
#
|
500
|
+
# bigtable = Google::Cloud::Bigtable.new
|
501
|
+
# table = bigtable.table("my-instance", "my-table")
|
502
|
+
#
|
503
|
+
# range = table.new_value_range.from("value-001").to("value-005")
|
463
504
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.value_range(range)
|
464
505
|
#
|
465
|
-
# @example Start
|
506
|
+
# @example Start exclusive to infinite end range.
|
507
|
+
# require "google/cloud/bigtable"
|
508
|
+
#
|
509
|
+
# bigtable = Google::Cloud::Bigtable.new
|
510
|
+
# table = bigtable.table("my-instance", "my-table")
|
466
511
|
#
|
467
|
-
# range =
|
512
|
+
# range = table.new_value_range.from("value-001", inclusive: false)
|
468
513
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.value_range(range)
|
469
514
|
#
|
470
515
|
def value_range range
|
471
|
-
add
|
516
|
+
add RowFilter.value_range(range)
|
472
517
|
end
|
473
518
|
|
474
|
-
|
519
|
+
##
|
520
|
+
# Adds a column-range filter.
|
475
521
|
#
|
476
522
|
# Matches only cells from columns within the given range.
|
477
523
|
#
|
@@ -480,34 +526,38 @@ module Google
|
|
480
526
|
# `self` instance of chain filter.
|
481
527
|
#
|
482
528
|
# @example
|
529
|
+
# require "google/cloud/bigtable"
|
483
530
|
#
|
484
|
-
# range = Google::Cloud::Bigtable::ColumnRange.new(cf).from("field0").to('field5')
|
531
|
+
# range = Google::Cloud::Bigtable::ColumnRange.new("cf").from("field0").to('field5')
|
485
532
|
#
|
486
533
|
# filter = Google::Cloud::Bigtable::RowFilter.chain.column_range(range)
|
487
534
|
#
|
488
535
|
def column_range range
|
489
|
-
add
|
536
|
+
add RowFilter.column_range(range)
|
490
537
|
end
|
491
538
|
|
492
|
-
|
539
|
+
##
|
540
|
+
# Gets the number of filters in the chain.
|
493
541
|
#
|
494
542
|
# @return [Integer]
|
495
543
|
#
|
496
544
|
# @example
|
545
|
+
# require "google/cloud/bigtable"
|
497
546
|
#
|
498
|
-
#
|
499
|
-
#
|
547
|
+
# filter = Google::Cloud::Bigtable::RowFilter.chain.key("user-1*").label("user")
|
548
|
+
# filter.length # 2
|
500
549
|
#
|
501
550
|
def length
|
502
|
-
@
|
551
|
+
@filters.length
|
503
552
|
end
|
504
553
|
|
505
|
-
|
554
|
+
##
|
555
|
+
# Returns a frozen copy of the filters array.
|
506
556
|
#
|
507
|
-
# @return [Array<
|
557
|
+
# @return [Array<SimpleFilter|ChainFilter|InterleaveFilter|ConditionFilter>]
|
508
558
|
#
|
509
559
|
def filters
|
510
|
-
@
|
560
|
+
@filters.dup.freeze
|
511
561
|
end
|
512
562
|
|
513
563
|
# @private
|
@@ -517,10 +567,11 @@ module Google
|
|
517
567
|
# @return [Google::Bigtable::V2::RowFilter]
|
518
568
|
#
|
519
569
|
def to_grpc
|
520
|
-
Google::Bigtable::V2::RowFilter.new(
|
570
|
+
Google::Bigtable::V2::RowFilter.new(
|
571
|
+
chain: Google::Bigtable::V2::RowFilter::Chain.new(filters: @filters.map(&:to_grpc))
|
572
|
+
)
|
521
573
|
end
|
522
574
|
|
523
|
-
|
524
575
|
private
|
525
576
|
|
526
577
|
# @private
|
@@ -529,7 +580,7 @@ module Google
|
|
529
580
|
# @param filter [SimpleFilter, ChainFilter, InterleaveFilter, ConditionFilter]
|
530
581
|
#
|
531
582
|
def add filter
|
532
|
-
@
|
583
|
+
@filters << filter
|
533
584
|
self
|
534
585
|
end
|
535
586
|
end
|