google-cloud-bigtable 2.0.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +38 -0
- data/CONTRIBUTING.md +2 -2
- data/LOGGING.md +1 -1
- data/OVERVIEW.md +4 -4
- data/lib/google-cloud-bigtable.rb +1 -0
- data/lib/google/cloud/bigtable/app_profile/list.rb +2 -2
- data/lib/google/cloud/bigtable/backup.rb +121 -0
- data/lib/google/cloud/bigtable/backup/list.rb +2 -2
- data/lib/google/cloud/bigtable/chunk_processor.rb +4 -3
- data/lib/google/cloud/bigtable/cluster/list.rb +2 -2
- data/lib/google/cloud/bigtable/column_family.rb +4 -0
- data/lib/google/cloud/bigtable/column_family_map.rb +2 -0
- data/lib/google/cloud/bigtable/convert.rb +12 -0
- data/lib/google/cloud/bigtable/gc_rule.rb +2 -0
- data/lib/google/cloud/bigtable/instance.rb +2 -2
- data/lib/google/cloud/bigtable/instance/list.rb +2 -2
- data/lib/google/cloud/bigtable/mutation_entry.rb +12 -9
- data/lib/google/cloud/bigtable/mutation_operations.rb +6 -5
- data/lib/google/cloud/bigtable/policy.rb +2 -1
- data/lib/google/cloud/bigtable/routing_policy.rb +3 -1
- data/lib/google/cloud/bigtable/row.rb +5 -1
- data/lib/google/cloud/bigtable/row_filter/simple_filter.rb +6 -1
- data/lib/google/cloud/bigtable/rows_reader.rb +6 -6
- data/lib/google/cloud/bigtable/service.rb +41 -0
- data/lib/google/cloud/bigtable/status.rb +4 -1
- data/lib/google/cloud/bigtable/table.rb +2 -0
- data/lib/google/cloud/bigtable/table/list.rb +2 -2
- data/lib/google/cloud/bigtable/value_range.rb +24 -6
- data/lib/google/cloud/bigtable/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1f99712143906255ee1d2632c445d1c1bdacb1a407c5a63a3e26bbf4446212e
|
4
|
+
data.tar.gz: 8371b2372d45334f65a625271d78fe8ea5bf3dc8448cdbd0827908925b2a7d2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a3aa85a0322a4182e01152ded9445f0b5442a69a63a47c338a7137a2e170f2ad62a37badf7e2079e3e8ee75080a6ff0a0022314ae73021a01439833d585f3d5
|
7
|
+
data.tar.gz: 13e017d3992738213ca3ac3d50cdc91ce954c5326956f7b814f441f69fee876c8d97e922a2d85c931e7c620d0f51b37ed2c0b5b0ada8afeaf26e229751adec36
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,43 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 2.4.0 / 2021-03-10
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* Drop support for Ruby 2.4 and add support for Ruby 3.0
|
8
|
+
|
9
|
+
#### Documentation
|
10
|
+
|
11
|
+
* Add link to Garbage collection docs
|
12
|
+
|
13
|
+
### 2.3.0 / 2021-02-04
|
14
|
+
|
15
|
+
#### Features
|
16
|
+
|
17
|
+
* Add integer support to RowFilter#value and ValueRange
|
18
|
+
* Encode Integer arguments as 64-bit signed big-endian integer data
|
19
|
+
|
20
|
+
### 2.2.1 / 2021-01-13
|
21
|
+
|
22
|
+
#### Documentation
|
23
|
+
|
24
|
+
* Use consistent column family and field names in samples
|
25
|
+
|
26
|
+
### 2.2.0 / 2020-11-11
|
27
|
+
|
28
|
+
#### Features
|
29
|
+
|
30
|
+
* Add Backup-level IAM Policy support
|
31
|
+
* Add Backup#policy
|
32
|
+
* Add Backup#update_policy
|
33
|
+
* Add Backup#test_iam_permissions
|
34
|
+
|
35
|
+
### 2.1.0 / 2020-09-17
|
36
|
+
|
37
|
+
#### Features
|
38
|
+
|
39
|
+
* quota_project can be set via library configuration ([#7630](https://www.github.com/googleapis/google-cloud-ruby/issues/7630))
|
40
|
+
|
3
41
|
### 2.0.0 / 2020-08-06
|
4
42
|
|
5
43
|
This is a major update that removes the "low-level" client interface code, and
|
data/CONTRIBUTING.md
CHANGED
@@ -24,7 +24,7 @@ be able to accept your pull requests.
|
|
24
24
|
In order to use the google-cloud-bigtable console and run the project's tests,
|
25
25
|
there is a small amount of setup:
|
26
26
|
|
27
|
-
1. Install Ruby. google-cloud-bigtable requires Ruby 2.
|
27
|
+
1. Install Ruby. google-cloud-bigtable requires Ruby 2.5+. You may choose to
|
28
28
|
manage your Ruby and gem installations with [RVM](https://rvm.io/),
|
29
29
|
[rbenv](https://github.com/rbenv/rbenv), or
|
30
30
|
[chruby](https://github.com/postmodern/chruby).
|
@@ -45,7 +45,7 @@ there is a small amount of setup:
|
|
45
45
|
|
46
46
|
```sh
|
47
47
|
$ cd google-cloud-bigtable/
|
48
|
-
$ bundle
|
48
|
+
$ bundle install
|
49
49
|
```
|
50
50
|
|
51
51
|
## Console
|
data/LOGGING.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
To enable logging for this library, set the logger for the underlying
|
4
4
|
[gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. The logger
|
5
5
|
that you set may be a Ruby stdlib
|
6
|
-
[`Logger`](https://ruby-doc.org/stdlib
|
6
|
+
[`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as
|
7
7
|
shown below, or a
|
8
8
|
[`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
9
9
|
that will write logs to [Stackdriver
|
data/OVERVIEW.md
CHANGED
@@ -194,8 +194,8 @@ table = bigtable.table("my-instance", "my-table")
|
|
194
194
|
|
195
195
|
entry = table.new_mutation_entry("user-1")
|
196
196
|
entry.set_cell(
|
197
|
-
"
|
198
|
-
"
|
197
|
+
"cf1",
|
198
|
+
"field1",
|
199
199
|
"XYZ",
|
200
200
|
timestamp: (Time.now.to_f * 1000000).round(-3) # microseconds
|
201
201
|
).delete_cells("cf2", "field02")
|
@@ -245,8 +245,8 @@ table = bigtable.table("my-instance", "my-table")
|
|
245
245
|
predicate_filter = Google::Cloud::Bigtable::RowFilter.key("user-10")
|
246
246
|
on_match_mutations = Google::Cloud::Bigtable::MutationEntry.new
|
247
247
|
on_match_mutations.set_cell(
|
248
|
-
"
|
249
|
-
"
|
248
|
+
"cf1",
|
249
|
+
"field1",
|
250
250
|
"XYZ",
|
251
251
|
timestamp: (Time.now.to_f * 1000000).round(-3) # microseconds
|
252
252
|
).delete_cells("cf2", "field02")
|
@@ -166,6 +166,7 @@ Google::Cloud.configure.add_config! :bigtable do |config|
|
|
166
166
|
],
|
167
167
|
allow_nil: true
|
168
168
|
config.add_field! :scope, default_scopes, match: [String, Array]
|
169
|
+
config.add_field! :quota_project, nil, match: String
|
169
170
|
config.add_field! :timeout, nil, match: Integer
|
170
171
|
config.add_field! :emulator_host, default_emulator, match: String, allow_nil: true
|
171
172
|
config.add_field! :endpoint, "bigtable.googleapis.com", match: String
|
@@ -122,12 +122,12 @@ module Google
|
|
122
122
|
# app_profile.name
|
123
123
|
# end
|
124
124
|
#
|
125
|
-
def all
|
125
|
+
def all &block
|
126
126
|
return enum_for :all unless block_given?
|
127
127
|
|
128
128
|
results = self
|
129
129
|
loop do
|
130
|
-
results.each
|
130
|
+
results.each(&block)
|
131
131
|
break unless next?
|
132
132
|
grpc.next_page
|
133
133
|
results = self.class.from_grpc grpc, service
|
@@ -18,6 +18,7 @@
|
|
18
18
|
require "google/cloud/bigtable/backup/job"
|
19
19
|
require "google/cloud/bigtable/backup/list"
|
20
20
|
require "google/cloud/bigtable/convert"
|
21
|
+
require "google/cloud/bigtable/policy"
|
21
22
|
require "google/cloud/bigtable/table/restore_job"
|
22
23
|
|
23
24
|
|
@@ -206,6 +207,126 @@ module Google
|
|
206
207
|
state == :READY
|
207
208
|
end
|
208
209
|
|
210
|
+
##
|
211
|
+
# Gets the [Cloud IAM](https://cloud.google.com/iam/) access control
|
212
|
+
# policy for the backup.
|
213
|
+
#
|
214
|
+
# @see https://cloud.google.com/bigtable/docs/access-control
|
215
|
+
#
|
216
|
+
# @yield [policy] A block for updating the policy. The latest policy
|
217
|
+
# will be read from the Bigtable service and passed to the block. After
|
218
|
+
# the block completes, the modified policy will be written to the
|
219
|
+
# service.
|
220
|
+
# @yieldparam [Policy] policy the current Cloud IAM Policy for this
|
221
|
+
# backup.
|
222
|
+
#
|
223
|
+
# @return [Policy] The current Cloud IAM Policy for the backup.
|
224
|
+
#
|
225
|
+
# @example
|
226
|
+
# require "google/cloud/bigtable"
|
227
|
+
#
|
228
|
+
# bigtable = Google::Cloud::Bigtable.new
|
229
|
+
# instance = bigtable.instance("my-instance")
|
230
|
+
# cluster = instance.cluster("my-cluster")
|
231
|
+
#
|
232
|
+
# backup = cluster.backup("my-backup")
|
233
|
+
#
|
234
|
+
# policy = backup.policy
|
235
|
+
#
|
236
|
+
# @example Update the policy by passing a block.
|
237
|
+
# require "google/cloud/bigtable"
|
238
|
+
#
|
239
|
+
# bigtable = Google::Cloud::Bigtable.new
|
240
|
+
# instance = bigtable.instance("my-instance")
|
241
|
+
# cluster = instance.cluster("my-cluster")
|
242
|
+
#
|
243
|
+
# backup = cluster.backup("my-backup")
|
244
|
+
#
|
245
|
+
# backup.policy do |p|
|
246
|
+
# p.add("roles/owner", "user:owner@example.com")
|
247
|
+
# end # 2 API calls
|
248
|
+
#
|
249
|
+
def policy
|
250
|
+
ensure_service!
|
251
|
+
grpc = service.get_backup_policy instance_id, cluster_id, backup_id
|
252
|
+
policy = Policy.from_grpc grpc
|
253
|
+
return policy unless block_given?
|
254
|
+
yield policy
|
255
|
+
update_policy policy
|
256
|
+
end
|
257
|
+
|
258
|
+
##
|
259
|
+
# Updates the [Cloud IAM](https://cloud.google.com/iam/) access control
|
260
|
+
# policy for the backup. The policy should be read from {#policy}.
|
261
|
+
# See {Google::Cloud::Bigtable::Policy} for an explanation of the policy
|
262
|
+
# `etag` property and how to modify policies.
|
263
|
+
#
|
264
|
+
# You can also update the policy by passing a block to {#policy}, which
|
265
|
+
# will call this method internally after the block completes.
|
266
|
+
#
|
267
|
+
# @param new_policy [Policy] a new or modified Cloud IAM Policy for this
|
268
|
+
# backup
|
269
|
+
#
|
270
|
+
# @return [Policy] The policy returned by the API update operation.
|
271
|
+
#
|
272
|
+
# @example
|
273
|
+
# require "google/cloud/bigtable"
|
274
|
+
#
|
275
|
+
# bigtable = Google::Cloud::Bigtable.new
|
276
|
+
# instance = bigtable.instance("my-instance")
|
277
|
+
# cluster = instance.cluster("my-cluster")
|
278
|
+
#
|
279
|
+
# backup = cluster.backup("my-backup")
|
280
|
+
#
|
281
|
+
# policy = backup.policy
|
282
|
+
# policy.add("roles/owner", "user:owner@example.com")
|
283
|
+
# updated_policy = backup.update_policy(policy)
|
284
|
+
#
|
285
|
+
# puts updated_policy.roles
|
286
|
+
#
|
287
|
+
def update_policy new_policy
|
288
|
+
ensure_service!
|
289
|
+
grpc = service.set_backup_policy instance_id, cluster_id, backup_id, new_policy.to_grpc
|
290
|
+
Policy.from_grpc grpc
|
291
|
+
end
|
292
|
+
alias policy= update_policy
|
293
|
+
|
294
|
+
##
|
295
|
+
# Tests the specified permissions against the [Cloud
|
296
|
+
# IAM](https://cloud.google.com/iam/) access control policy.
|
297
|
+
#
|
298
|
+
# @see https://cloud.google.com/iam/docs/managing-policies Managing Policies
|
299
|
+
# @see https://cloud.google.com/bigtable/docs/access-control Access Control
|
300
|
+
#
|
301
|
+
# @param permissions [String, Array<String>] permissions The set of permissions to
|
302
|
+
# check access for. Permissions with wildcards (such as `*` or `bigtable.*`) are
|
303
|
+
# not allowed.
|
304
|
+
# See [Access Control](https://cloud.google.com/bigtable/docs/access-control).
|
305
|
+
#
|
306
|
+
# @return [Array<String>] The permissions that are configured for the policy.
|
307
|
+
#
|
308
|
+
# @example
|
309
|
+
# require "google/cloud/bigtable"
|
310
|
+
#
|
311
|
+
# bigtable = Google::Cloud::Bigtable.new
|
312
|
+
# instance = bigtable.instance("my-instance")
|
313
|
+
# cluster = instance.cluster("my-cluster")
|
314
|
+
#
|
315
|
+
# backup = cluster.backup("my-backup")
|
316
|
+
#
|
317
|
+
# permissions = backup.test_iam_permissions(
|
318
|
+
# "bigtable.backups.delete",
|
319
|
+
# "bigtable.backups.get"
|
320
|
+
# )
|
321
|
+
# permissions.include? "bigtable.backups.delete" #=> false
|
322
|
+
# permissions.include? "bigtable.backups.get" #=> true
|
323
|
+
#
|
324
|
+
def test_iam_permissions *permissions
|
325
|
+
ensure_service!
|
326
|
+
grpc = service.test_backup_permissions instance_id, cluster_id, backup_id, permissions.flatten
|
327
|
+
grpc.permissions.to_a
|
328
|
+
end
|
329
|
+
|
209
330
|
##
|
210
331
|
# Creates a new table by restoring from a completed backup.
|
211
332
|
#
|
@@ -124,12 +124,12 @@ module Google
|
|
124
124
|
# backup.backup_id
|
125
125
|
# end
|
126
126
|
#
|
127
|
-
def all
|
127
|
+
def all &block
|
128
128
|
return enum_for :all unless block_given?
|
129
129
|
|
130
130
|
results = self
|
131
131
|
loop do
|
132
|
-
results.each
|
132
|
+
results.each(&block)
|
133
133
|
break unless next?
|
134
134
|
grpc.next_page
|
135
135
|
results = self.class.from_grpc grpc, service
|
@@ -57,11 +57,12 @@ module Google
|
|
57
57
|
|
58
58
|
raise_if chunk.value_size.positive?, "Commit rows cannot have a non-zero value_size." if chunk.commit_row
|
59
59
|
|
60
|
-
|
60
|
+
case state
|
61
|
+
when NEW_ROW
|
61
62
|
process_new_row
|
62
|
-
|
63
|
+
when CELL_IN_PROGRESS
|
63
64
|
process_cell_in_progress
|
64
|
-
|
65
|
+
when ROW_IN_PROGRESS
|
65
66
|
process_row_in_progress
|
66
67
|
end
|
67
68
|
end
|
@@ -129,12 +129,12 @@ module Google
|
|
129
129
|
# puts cluster.cluster_id
|
130
130
|
# end
|
131
131
|
#
|
132
|
-
def all
|
132
|
+
def all &block
|
133
133
|
return enum_for :all unless block_given?
|
134
134
|
|
135
135
|
results = self
|
136
136
|
loop do
|
137
|
-
results.each
|
137
|
+
results.each(&block)
|
138
138
|
break unless results.next?
|
139
139
|
results = results.next
|
140
140
|
end
|
@@ -45,7 +45,11 @@ module Google
|
|
45
45
|
##
|
46
46
|
# The garbage collection rule to be used for the column family.
|
47
47
|
# Optional. The service default value will be used when not specified.
|
48
|
+
#
|
49
|
+
# @see https://cloud.google.com/bigtable/docs/garbage-collection Garbage collection
|
50
|
+
#
|
48
51
|
# @return [Google::Cloud::Bigtable::GcRule, nil]
|
52
|
+
#
|
49
53
|
attr_accessor :gc_rule
|
50
54
|
|
51
55
|
# @private
|
@@ -222,6 +222,8 @@ module Google
|
|
222
222
|
##
|
223
223
|
# Updates an existing column family in the table.
|
224
224
|
#
|
225
|
+
# @see https://cloud.google.com/bigtable/docs/garbage-collection Garbage collection
|
226
|
+
#
|
225
227
|
# @param name [String] Column family name.
|
226
228
|
# @param gc_rule [Google::Cloud::Bigtable::GcRule] The new garbage
|
227
229
|
# collection rule to be used for the column family. Optional. The
|
@@ -77,6 +77,18 @@ module Google
|
|
77
77
|
|
78
78
|
Google::Protobuf::Timestamp.new seconds: time.to_i, nanos: time.nsec
|
79
79
|
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# Converts an Integer to 64-bit signed big-endian integer data.
|
83
|
+
# Returns a string argument unchanged.
|
84
|
+
#
|
85
|
+
# @param value [String, Integer]
|
86
|
+
# @return [String]
|
87
|
+
#
|
88
|
+
def integer_to_signed_be_64 value
|
89
|
+
return [value].pack "q>" if value.is_a? Integer
|
90
|
+
value
|
91
|
+
end
|
80
92
|
end
|
81
93
|
end
|
82
94
|
end
|
@@ -28,6 +28,8 @@ module Google
|
|
28
28
|
# so it is possible for reads to return a cell even if it matches the
|
29
29
|
# active GC expression for its column family.
|
30
30
|
#
|
31
|
+
# @see https://cloud.google.com/bigtable/docs/garbage-collection Garbage collection
|
32
|
+
#
|
31
33
|
# GC Rule types:
|
32
34
|
# * `max_num_versions` - A garbage-collection rule that explicitly
|
33
35
|
# states the maximum number of cells to keep for all columns in a
|
@@ -509,8 +509,8 @@ module Google
|
|
509
509
|
#
|
510
510
|
# entry = table.new_mutation_entry("user-1")
|
511
511
|
# entry.set_cell(
|
512
|
-
# "
|
513
|
-
# "
|
512
|
+
# "cf1",
|
513
|
+
# "field1",
|
514
514
|
# "XYZ",
|
515
515
|
# timestamp: (Time.now.to_f * 1000000).round(-3) # microseconds
|
516
516
|
# ).delete_cells("cf2", "field02")
|
@@ -126,12 +126,12 @@ module Google
|
|
126
126
|
# puts instance.instance_id
|
127
127
|
# end
|
128
128
|
#
|
129
|
-
def all
|
129
|
+
def all &block
|
130
130
|
return enum_for :all unless block_given?
|
131
131
|
|
132
132
|
results = self
|
133
133
|
loop do
|
134
|
-
results.each
|
134
|
+
results.each(&block)
|
135
135
|
break unless results.next?
|
136
136
|
results = results.next
|
137
137
|
end
|
@@ -15,6 +15,8 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
|
18
|
+
require "google/cloud/bigtable/convert"
|
19
|
+
|
18
20
|
module Google
|
19
21
|
module Cloud
|
20
22
|
module Bigtable
|
@@ -84,8 +86,9 @@ module Google
|
|
84
86
|
# @param qualifier [String] Column qualifier name.
|
85
87
|
# The qualifier of the column into which new data should be written.
|
86
88
|
# Can be any byte string, including an empty string.
|
87
|
-
# @param value [String, Integer] Cell value data.
|
88
|
-
#
|
89
|
+
# @param value [String, Integer] Cell value data. The value to be written
|
90
|
+
# into the specified cell. If the argument is an Integer, it will be
|
91
|
+
# encoded as a 64-bit signed big-endian integer.
|
89
92
|
# @param timestamp [Integer] Timestamp value in microseconds.
|
90
93
|
# The timestamp of the cell into which new data should be written.
|
91
94
|
# Use -1 for current Bigtable server time.
|
@@ -104,15 +107,15 @@ module Google
|
|
104
107
|
# @example With timestamp.
|
105
108
|
# entry = Google::Cloud::Bigtable::MutationEntry.new("user-1")
|
106
109
|
# entry.set_cell(
|
107
|
-
# "
|
108
|
-
# "
|
110
|
+
# "cf1",
|
111
|
+
# "field1",
|
109
112
|
# "XYZ",
|
110
113
|
# timestamp: (Time.now.to_f * 1000000).round(-3) # microseconds
|
111
114
|
# )
|
112
115
|
#
|
113
116
|
def set_cell family, qualifier, value, timestamp: nil
|
114
117
|
# If value is integer, covert it to a 64-bit signed big-endian integer.
|
115
|
-
value =
|
118
|
+
value = Convert.integer_to_signed_be_64 value
|
116
119
|
options = {
|
117
120
|
family_name: family,
|
118
121
|
column_qualifier: qualifier,
|
@@ -156,14 +159,14 @@ module Google
|
|
156
159
|
#
|
157
160
|
# @example Without timestamp range.
|
158
161
|
# entry = Google::Cloud::Bigtable::MutationEntry.new("user-1")
|
159
|
-
# entry.delete_cells("
|
162
|
+
# entry.delete_cells("cf1", "field1")
|
160
163
|
#
|
161
164
|
# @example With timestamp range.
|
162
165
|
# entry = Google::Cloud::Bigtable::MutationEntry.new("user-1")
|
163
166
|
# timestamp_micros = (Time.now.to_f * 1000000).round(-3)
|
164
167
|
# entry.delete_cells(
|
165
168
|
# "cf1",
|
166
|
-
# "
|
169
|
+
# "field1",
|
167
170
|
# timestamp_from: timestamp_micros - 5000000,
|
168
171
|
# timestamp_to: timestamp_micros
|
169
172
|
# )
|
@@ -172,7 +175,7 @@ module Google
|
|
172
175
|
# timestamp_micros = (Time.now.to_f * 1000000).round(-3)
|
173
176
|
# entry.delete_cells(
|
174
177
|
# "cf1",
|
175
|
-
# "
|
178
|
+
# "field1",
|
176
179
|
# timestamp_from: timestamp_micros - 5000000
|
177
180
|
# )
|
178
181
|
#
|
@@ -201,7 +204,7 @@ module Google
|
|
201
204
|
#
|
202
205
|
# @example
|
203
206
|
# entry = Google::Cloud::Bigtable::MutationEntry.new("user-1")
|
204
|
-
# entry.delete_from_family("
|
207
|
+
# entry.delete_from_family("cf1")
|
205
208
|
#
|
206
209
|
def delete_from_family family
|
207
210
|
@mutations << Google::Cloud::Bigtable::V2::Mutation.new(delete_from_family: { family_name: family })
|
@@ -65,8 +65,8 @@ module Google
|
|
65
65
|
#
|
66
66
|
# entry = table.new_mutation_entry("user-1")
|
67
67
|
# entry.set_cell(
|
68
|
-
# "
|
69
|
-
# "
|
68
|
+
# "cf1",
|
69
|
+
# "field1",
|
70
70
|
# "XYZ",
|
71
71
|
# timestamp: (Time.now.to_f * 1000000).round(-3) # microseconds
|
72
72
|
# ).delete_cells("cf2", "field02")
|
@@ -219,8 +219,8 @@ module Google
|
|
219
219
|
# predicate_filter = Google::Cloud::Bigtable::RowFilter.key("user-10")
|
220
220
|
# on_match_mutations = Google::Cloud::Bigtable::MutationEntry.new
|
221
221
|
# on_match_mutations.set_cell(
|
222
|
-
# "
|
223
|
-
# "
|
222
|
+
# "cf1",
|
223
|
+
# "field1",
|
224
224
|
# "XYZ",
|
225
225
|
# timestamp: (Time.now.to_f * 1000000).round(-3) # microseconds
|
226
226
|
# ).delete_cells("cf2", "field02")
|
@@ -335,7 +335,8 @@ module Google
|
|
335
335
|
# end
|
336
336
|
#
|
337
337
|
class Response
|
338
|
-
attr_reader :index
|
338
|
+
attr_reader :index
|
339
|
+
attr_reader :status
|
339
340
|
|
340
341
|
##
|
341
342
|
# @private Creates a MutationEntry::Response object.
|
@@ -141,7 +141,8 @@ module Google
|
|
141
141
|
# Default value is false.
|
142
142
|
#
|
143
143
|
class SingleClusterRouting < RoutingPolicy
|
144
|
-
attr_reader :cluster_id
|
144
|
+
attr_reader :cluster_id
|
145
|
+
attr_reader :allow_transactional_writes
|
145
146
|
|
146
147
|
##
|
147
148
|
# Creates a new single-cluster routing policy.
|
@@ -155,6 +156,7 @@ module Google
|
|
155
156
|
# Default value is false.
|
156
157
|
#
|
157
158
|
def initialize cluster_id, allow_transactional_writes
|
159
|
+
super()
|
158
160
|
@cluster_id = cluster_id
|
159
161
|
@allow_transactional_writes = allow_transactional_writes
|
160
162
|
end
|
@@ -30,7 +30,11 @@ module Google
|
|
30
30
|
# Row cell built from data chunks.
|
31
31
|
#
|
32
32
|
class Cell
|
33
|
-
attr_reader :family
|
33
|
+
attr_reader :family
|
34
|
+
attr_reader :qualifier
|
35
|
+
attr_reader :value
|
36
|
+
attr_reader :labels
|
37
|
+
attr_reader :timestamp
|
34
38
|
|
35
39
|
##
|
36
40
|
# Creates a row cell instance.
|
@@ -15,6 +15,8 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
|
18
|
+
require "google/cloud/bigtable/convert"
|
19
|
+
|
18
20
|
module Google
|
19
21
|
module Cloud
|
20
22
|
module Bigtable
|
@@ -147,10 +149,13 @@ module Google
|
|
147
149
|
# will not match the new line character `\n`, which may be present in a
|
148
150
|
# binary value.
|
149
151
|
#
|
150
|
-
# @param regex [String] Regex to match cell value
|
152
|
+
# @param regex [String, Integer] Regex to match cell value, or an Integer
|
153
|
+
# value to be encoded as a 64-bit signed big-endian integer.
|
151
154
|
# @return [Google::Cloud::Bigtable::RowFilter::SimpleFilter]
|
152
155
|
#
|
153
156
|
def value regex
|
157
|
+
# If regex is integer, covert it to a 64-bit signed big-endian integer.
|
158
|
+
regex = Convert.integer_to_signed_be_64 regex
|
154
159
|
@grpc.value_regex_filter = regex
|
155
160
|
self
|
156
161
|
end
|
@@ -170,10 +170,10 @@ module Google
|
|
170
170
|
# @return [Boolean]
|
171
171
|
#
|
172
172
|
def start_key_read? range
|
173
|
-
start_key = if
|
174
|
-
range.start_key_closed
|
175
|
-
else
|
173
|
+
start_key = if range.start_key_closed.empty?
|
176
174
|
range.start_key_open
|
175
|
+
else
|
176
|
+
range.start_key_closed
|
177
177
|
end
|
178
178
|
|
179
179
|
start_key.empty? || last_key >= start_key
|
@@ -186,10 +186,10 @@ module Google
|
|
186
186
|
# @return [Boolean]
|
187
187
|
#
|
188
188
|
def end_key_read? range
|
189
|
-
end_key = if
|
190
|
-
range.end_key_closed
|
191
|
-
else
|
189
|
+
end_key = if range.end_key_closed.empty?
|
192
190
|
range.end_key_open
|
191
|
+
else
|
192
|
+
range.end_key_closed
|
193
193
|
end
|
194
194
|
|
195
195
|
end_key && end_key <= last_key
|
@@ -515,6 +515,47 @@ module Google
|
|
515
515
|
ignore_warnings: ignore_warnings
|
516
516
|
end
|
517
517
|
|
518
|
+
##
|
519
|
+
# Gets the access control policy for an backup resource. Returns an empty
|
520
|
+
# policy if an backup exists but does not have a policy set.
|
521
|
+
#
|
522
|
+
# @return [Google::Iam::V1::Policy]
|
523
|
+
#
|
524
|
+
def get_backup_policy instance_id, cluster_id, backup_id
|
525
|
+
tables.get_iam_policy resource: backup_path(instance_id, cluster_id, backup_id)
|
526
|
+
end
|
527
|
+
|
528
|
+
##
|
529
|
+
# Sets the access control policy on an backup resource. Replaces any
|
530
|
+
# existing policy.
|
531
|
+
#
|
532
|
+
# @param policy [Google::Iam::V1::Policy | Hash]
|
533
|
+
# REQUIRED: The complete policy to be applied to the +resource+. The size of
|
534
|
+
# the policy is limited to a few 10s of KB. An empty policy is valid
|
535
|
+
# for Cloud Bigtable, but certain Cloud Platform services (such as Projects)
|
536
|
+
# might reject an empty policy.
|
537
|
+
# Alternatively, provide a hash similar to `Google::Iam::V1::Policy`.
|
538
|
+
# @return [Google::Iam::V1::Policy]
|
539
|
+
#
|
540
|
+
def set_backup_policy instance_id, cluster_id, backup_id, policy
|
541
|
+
tables.set_iam_policy resource: backup_path(instance_id, cluster_id, backup_id), policy: policy
|
542
|
+
end
|
543
|
+
|
544
|
+
##
|
545
|
+
# Returns permissions that the caller has for the specified backup resource.
|
546
|
+
#
|
547
|
+
# @param permissions [Array<String>]
|
548
|
+
# The set of permissions to check for the +resource+. Permissions with
|
549
|
+
# wildcards (such as '*' or 'storage.*') are not allowed. For more
|
550
|
+
# information see
|
551
|
+
# [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
|
552
|
+
# @return [Google::Iam::V1::TestIamPermissionsResponse]
|
553
|
+
#
|
554
|
+
def test_backup_permissions instance_id, cluster_id, backup_id, permissions
|
555
|
+
tables.test_iam_permissions resource: backup_path(instance_id, cluster_id, backup_id),
|
556
|
+
permissions: permissions
|
557
|
+
end
|
558
|
+
|
518
559
|
##
|
519
560
|
# Gets the access control policy for an instance resource. Returns an empty
|
520
561
|
# policy if an instance exists but does not have a policy set.
|
@@ -155,6 +155,8 @@ module Google
|
|
155
155
|
# updated with the changes, and the updated column families will be
|
156
156
|
# returned.
|
157
157
|
#
|
158
|
+
# @see https://cloud.google.com/bigtable/docs/garbage-collection Garbage collection
|
159
|
+
#
|
158
160
|
# @yield [column_families] A block for modifying the table's column
|
159
161
|
# families. Applies multiple column modifications. Performs a series
|
160
162
|
# of column family modifications on the specified table. Either all or
|
@@ -114,12 +114,12 @@ module Google
|
|
114
114
|
# puts table.table_id
|
115
115
|
# end
|
116
116
|
#
|
117
|
-
def all
|
117
|
+
def all &block
|
118
118
|
return enum_for :all unless block_given?
|
119
119
|
|
120
120
|
results = self
|
121
121
|
loop do
|
122
|
-
results.each
|
122
|
+
results.each(&block)
|
123
123
|
break unless next?
|
124
124
|
grpc.next_page
|
125
125
|
results = self.class.from_grpc grpc, service
|
@@ -15,6 +15,8 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
|
18
|
+
require "google/cloud/bigtable/convert"
|
19
|
+
|
18
20
|
module Google
|
19
21
|
module Cloud
|
20
22
|
module Bigtable
|
@@ -65,7 +67,9 @@ module Google
|
|
65
67
|
##
|
66
68
|
# Sets the row range with the lower bound.
|
67
69
|
#
|
68
|
-
# @param value [String] The value. Required.
|
70
|
+
# @param value [String, Integer] The value. Required. If the argument
|
71
|
+
# is an Integer, it will be encoded as a 64-bit signed big-endian
|
72
|
+
# integer.
|
69
73
|
# @param inclusive [Boolean] Whether the value is an inclusive or
|
70
74
|
# exclusive lower bound. Default is `true`, an inclusive lower bound.
|
71
75
|
# @return [Google::Cloud::Bigtable::ValueRange]
|
@@ -87,6 +91,8 @@ module Google
|
|
87
91
|
# range = table.new_value_range.from("value-001", inclusive: false)
|
88
92
|
#
|
89
93
|
def from value, inclusive: true
|
94
|
+
# If value is integer, covert it to a 64-bit signed big-endian integer.
|
95
|
+
value = Convert.integer_to_signed_be_64 value
|
90
96
|
if inclusive
|
91
97
|
@grpc.start_value_closed = value
|
92
98
|
else
|
@@ -98,7 +104,9 @@ module Google
|
|
98
104
|
##
|
99
105
|
# Sets the value range with upper bound.
|
100
106
|
#
|
101
|
-
# @param value [String] value. Required
|
107
|
+
# @param value [String, Integer] value. Required. If the argument
|
108
|
+
# is an Integer, it will be encoded as a 64-bit signed big-endian
|
109
|
+
# integer.
|
102
110
|
# @param inclusive [Boolean] Whether the value is an inclusive or
|
103
111
|
# exclusive lower bound. Default is `false`, an exclusive lower bound.
|
104
112
|
# @return [Google::Cloud::Bigtable::ValueRange]
|
@@ -120,6 +128,8 @@ module Google
|
|
120
128
|
# range = table.new_value_range.to("value-010")
|
121
129
|
#
|
122
130
|
def to value, inclusive: false
|
131
|
+
# If value is integer, covert it to a 64-bit signed big-endian integer.
|
132
|
+
value = Convert.integer_to_signed_be_64 value
|
123
133
|
if inclusive
|
124
134
|
@grpc.end_value_closed = value
|
125
135
|
else
|
@@ -131,8 +141,12 @@ module Google
|
|
131
141
|
##
|
132
142
|
# Sets the value range with inclusive lower and upper bounds.
|
133
143
|
#
|
134
|
-
# @param from_value [String] Inclusive from value. Required
|
135
|
-
#
|
144
|
+
# @param from_value [String, Integer] Inclusive from value. Required.
|
145
|
+
# If the argument is an Integer, it will be encoded as a 64-bit
|
146
|
+
# signed big-endian integer.
|
147
|
+
# @param to_value [String, Integer] Inclusive to value. Required.
|
148
|
+
# If the argument is an Integer, it will be encoded as a 64-bit
|
149
|
+
# signed big-endian integer.
|
136
150
|
# @return [Google::Cloud::Bigtable::ValueRange]
|
137
151
|
# Range with inclusive from and to values.
|
138
152
|
#
|
@@ -151,8 +165,12 @@ module Google
|
|
151
165
|
##
|
152
166
|
# Set value range with an inclusive lower bound and an exclusive upper bound.
|
153
167
|
#
|
154
|
-
# @param from_value [String] Inclusive from value
|
155
|
-
#
|
168
|
+
# @param from_value [String, Integer] Inclusive from value. Required.
|
169
|
+
# If the argument is an Integer, it will be encoded as a 64-bit
|
170
|
+
# signed big-endian integer.
|
171
|
+
# @param to_value [String, Integer] Exclusive to value. Required.
|
172
|
+
# If the argument is an Integer, it will be encoded as a 64-bit
|
173
|
+
# signed big-endian integer.
|
156
174
|
# @return [Google::Cloud::Bigtable::ValueRange]
|
157
175
|
# Range with an inclusive from value and an exclusive to value.
|
158
176
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-bigtable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-cloud-bigtable-admin-v2
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.25.1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: 1.25.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: minitest
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -241,14 +241,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
241
241
|
requirements:
|
242
242
|
- - ">="
|
243
243
|
- !ruby/object:Gem::Version
|
244
|
-
version: '2.
|
244
|
+
version: '2.5'
|
245
245
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
246
246
|
requirements:
|
247
247
|
- - ">="
|
248
248
|
- !ruby/object:Gem::Version
|
249
249
|
version: '0'
|
250
250
|
requirements: []
|
251
|
-
rubygems_version: 3.
|
251
|
+
rubygems_version: 3.2.13
|
252
252
|
signing_key:
|
253
253
|
specification_version: 4
|
254
254
|
summary: API Client library for Cloud Bigtable API
|