google-cloud-bigtable 2.3.0 → 2.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +2 -1
- data/CHANGELOG.md +42 -0
- data/CONTRIBUTING.md +3 -4
- data/LOGGING.md +1 -1
- data/OVERVIEW.md +1 -1
- data/lib/google/cloud/bigtable/app_profile/list.rb +2 -2
- data/lib/google/cloud/bigtable/backup.rb +55 -4
- 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.rb +22 -2
- 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/encryption_info.rb +118 -0
- data/lib/google/cloud/bigtable/gc_rule.rb +2 -0
- data/lib/google/cloud/bigtable/instance.rb +1 -0
- data/lib/google/cloud/bigtable/instance/cluster_map.rb +61 -21
- data/lib/google/cloud/bigtable/instance/list.rb +2 -2
- data/lib/google/cloud/bigtable/mutation_operations.rb +2 -1
- data/lib/google/cloud/bigtable/policy.rb +2 -1
- data/lib/google/cloud/bigtable/project.rb +4 -3
- data/lib/google/cloud/bigtable/routing_policy.rb +3 -1
- data/lib/google/cloud/bigtable/row.rb +5 -1
- data/lib/google/cloud/bigtable/rows_reader.rb +6 -6
- data/lib/google/cloud/bigtable/service.rb +6 -3
- data/lib/google/cloud/bigtable/status.rb +4 -1
- data/lib/google/cloud/bigtable/table.rb +62 -19
- data/lib/google/cloud/bigtable/table/cluster_state.rb +43 -9
- data/lib/google/cloud/bigtable/table/list.rb +2 -2
- data/lib/google/cloud/bigtable/table/restore_job.rb +1 -1
- data/lib/google/cloud/bigtable/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68dcd0446d6056db7e6f26fbe0d9edea6748e76135ce7cbcc4ec3da4ed7cef28
|
4
|
+
data.tar.gz: fcb5b099fcee71414de91250901a0bf12385311d67731e3dee3265551b3d700d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb0a94391f397bac9dea00a4624aa721bc3e891b45a9994908af191f72ac6879bb60a4c0081a02d46437cc7f939eed44a2fe0bc89028f1fc6bcc4fd05dc69d6d
|
7
|
+
data.tar.gz: 3f8762093f07e17140f092c42a0230a92343647bf356858df6a1e04225a89d3b5b0c849478fc53cb917f525b64dad8c0034a83ce65c8de79f900854001f6cc1e
|
data/AUTHENTICATION.md
CHANGED
@@ -95,7 +95,8 @@ client = Google::Cloud::Bigtable.new
|
|
95
95
|
|
96
96
|
### Configuration
|
97
97
|
|
98
|
-
The **Project ID** and **Credentials JSON** can be configured
|
98
|
+
The **Project ID** and the path to the **Credentials JSON** file can be configured
|
99
|
+
instead of placing them in environment variables or providing them as arguments.
|
99
100
|
|
100
101
|
```ruby
|
101
102
|
require "google/cloud/bigtable"
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,47 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 2.6.1 / 2021-07-08
|
4
|
+
|
5
|
+
#### Documentation
|
6
|
+
|
7
|
+
* Update AUTHENTICATION.md in handwritten packages
|
8
|
+
|
9
|
+
### 2.6.0 / 2021-05-03
|
10
|
+
|
11
|
+
#### Features
|
12
|
+
|
13
|
+
* Add support for Backup restore to different Instance
|
14
|
+
* Add instance to Backup#restore
|
15
|
+
|
16
|
+
### 2.5.0 / 2021-04-20
|
17
|
+
|
18
|
+
#### Features
|
19
|
+
|
20
|
+
* Add CMEK support
|
21
|
+
* Add kms_key to ClusterMap#add
|
22
|
+
* Add Cluster#kms_key
|
23
|
+
* Add EncryptionInfo
|
24
|
+
* Add ClusterState#encryption_infos
|
25
|
+
* Add ENCRYPTION_VIEW support to Table
|
26
|
+
* Update docs in Table::ClusterState
|
27
|
+
* Add Backup#encryption_info
|
28
|
+
|
29
|
+
### 2.4.1 / 2021-04-01
|
30
|
+
|
31
|
+
#### Bug Fixes
|
32
|
+
|
33
|
+
* Update internal management of view states in Table
|
34
|
+
|
35
|
+
### 2.4.0 / 2021-03-10
|
36
|
+
|
37
|
+
#### Features
|
38
|
+
|
39
|
+
* Drop support for Ruby 2.4 and add support for Ruby 3.0
|
40
|
+
|
41
|
+
#### Documentation
|
42
|
+
|
43
|
+
* Add link to Garbage collection docs
|
44
|
+
|
3
45
|
### 2.3.0 / 2021-02-04
|
4
46
|
|
5
47
|
#### Features
|
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).
|
@@ -119,15 +119,14 @@ If you alter an example's title, you may encounter breaking tests.
|
|
119
119
|
### Bigtable Acceptance Tests
|
120
120
|
|
121
121
|
The Bigtable acceptance tests interact with the live service API. Follow the
|
122
|
-
instructions in the {file:AUTHENTICATION.md Authentication
|
122
|
+
instructions in the {file:AUTHENTICATION.md Authentication Guide} for enabling
|
123
123
|
the Bigtable API. Occasionally, some API features may not yet be generally
|
124
124
|
available, making it difficult for some contributors to successfully run the
|
125
125
|
entire acceptance test suite. However, please ensure that you do successfully
|
126
126
|
run acceptance tests for any code areas covered by your pull request.
|
127
127
|
|
128
128
|
To run the acceptance tests, first create and configure a project in the Google
|
129
|
-
Developers Console, as described in the {file:AUTHENTICATION.md Authentication
|
130
|
-
guide}. Be sure to download the JSON KEY file. Make note of the PROJECT_ID and
|
129
|
+
Developers Console, as described in the {file:AUTHENTICATION.md Authentication Guide}. Be sure to download the JSON KEY file. Make note of the PROJECT_ID and
|
131
130
|
the KEYFILE location on your system.
|
132
131
|
|
133
132
|
Before you can run the Bigtable acceptance tests, you must first create indexes
|
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
@@ -396,5 +396,5 @@ instance.delete
|
|
396
396
|
## Additional information
|
397
397
|
|
398
398
|
Google Bigtable can be configured to use an emulator or to enable gRPC's
|
399
|
-
logging. To learn more, see the {file:EMULATOR.md Emulator guide} and
|
399
|
+
logging. To learn more, see the {file:EMULATOR.md Emulator guide}} and
|
400
400
|
{file:LOGGING.md Logging guide}.
|
@@ -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,10 +18,10 @@
|
|
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/encryption_info"
|
21
22
|
require "google/cloud/bigtable/policy"
|
22
23
|
require "google/cloud/bigtable/table/restore_job"
|
23
24
|
|
24
|
-
|
25
25
|
module Google
|
26
26
|
module Cloud
|
27
27
|
module Bigtable
|
@@ -207,6 +207,27 @@ module Google
|
|
207
207
|
state == :READY
|
208
208
|
end
|
209
209
|
|
210
|
+
##
|
211
|
+
# The encryption information for the backup. See also {Instance::ClusterMap#add}.
|
212
|
+
#
|
213
|
+
# @return [Google::Cloud::Bigtable::EncryptionInfo] The encryption information for the backup.
|
214
|
+
#
|
215
|
+
# @example
|
216
|
+
# require "google/cloud/bigtable"
|
217
|
+
#
|
218
|
+
# bigtable = Google::Cloud::Bigtable.new
|
219
|
+
# instance = bigtable.instance("my-instance")
|
220
|
+
# cluster = instance.cluster("my-cluster")
|
221
|
+
#
|
222
|
+
# backup = cluster.backup("my-backup")
|
223
|
+
#
|
224
|
+
# encryption_info = backup.encryption_info
|
225
|
+
# encryption_info.encryption_type #=> :GOOGLE_DEFAULT_ENCRYPTION
|
226
|
+
#
|
227
|
+
def encryption_info
|
228
|
+
EncryptionInfo.from_grpc @grpc.encryption_info
|
229
|
+
end
|
230
|
+
|
210
231
|
##
|
211
232
|
# Gets the [Cloud IAM](https://cloud.google.com/iam/) access control
|
212
233
|
# policy for the backup.
|
@@ -328,9 +349,12 @@ module Google
|
|
328
349
|
end
|
329
350
|
|
330
351
|
##
|
331
|
-
# Creates a new table by restoring from a completed backup.
|
352
|
+
# Creates a new table by restoring data from a completed backup. The new table may be created in an instance
|
353
|
+
# different than that of the backup.
|
332
354
|
#
|
333
355
|
# @param table_id [String] The table ID for the new table. This table must not yet exist. Required.
|
356
|
+
# @param instance [Instance, String] The instance or the ID of the instance for the new table, if different from
|
357
|
+
# the instance of the backup. Optional.
|
334
358
|
#
|
335
359
|
# @return [Google::Cloud::Bigtable::Table::RestoreJob] The job representing the long-running, asynchronous
|
336
360
|
# processing of a backup restore table operation.
|
@@ -356,8 +380,35 @@ module Google
|
|
356
380
|
# optimized = job.optimize_table_operation_name
|
357
381
|
# end
|
358
382
|
#
|
359
|
-
|
360
|
-
|
383
|
+
# @example Create the table in a different instance.
|
384
|
+
# require "google/cloud/bigtable"
|
385
|
+
#
|
386
|
+
# bigtable = Google::Cloud::Bigtable.new
|
387
|
+
# instance = bigtable.instance("my-instance")
|
388
|
+
# cluster = instance.cluster("my-cluster")
|
389
|
+
#
|
390
|
+
# backup = cluster.backup("my-backup")
|
391
|
+
#
|
392
|
+
# table_instance = bigtable.instance("my-other-instance")
|
393
|
+
# job = backup.restore("my-new-table", instance: table_instance)
|
394
|
+
#
|
395
|
+
# job.wait_until_done!
|
396
|
+
# job.done? #=> true
|
397
|
+
#
|
398
|
+
# if job.error?
|
399
|
+
# status = job.error
|
400
|
+
# else
|
401
|
+
# table = job.table
|
402
|
+
# optimized = job.optimize_table_operation_name
|
403
|
+
# end
|
404
|
+
#
|
405
|
+
def restore table_id, instance: nil
|
406
|
+
table_instance_id = instance.respond_to?(:instance_id) ? instance.instance_id : instance
|
407
|
+
grpc = service.restore_table table_id,
|
408
|
+
instance_id,
|
409
|
+
cluster_id,
|
410
|
+
backup_id,
|
411
|
+
table_instance_id: table_instance_id
|
361
412
|
Table::RestoreJob.from_grpc grpc, service
|
362
413
|
end
|
363
414
|
|
@@ -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
|
@@ -168,8 +168,10 @@ module Google
|
|
168
168
|
##
|
169
169
|
# The type of storage used by this cluster to serve its
|
170
170
|
# parent instance's tables, unless explicitly overridden.
|
171
|
-
# Valid values are
|
172
|
-
#
|
171
|
+
# Valid values are:
|
172
|
+
#
|
173
|
+
# * `:SSD` - Flash (SSD) storage should be used.
|
174
|
+
# * `:HDD` - Magnetic drive (HDD) storage should be used.
|
173
175
|
#
|
174
176
|
# @return [Symbol]
|
175
177
|
#
|
@@ -197,6 +199,24 @@ module Google
|
|
197
199
|
@grpc.location
|
198
200
|
end
|
199
201
|
|
202
|
+
##
|
203
|
+
# The full name of the Cloud KMS encryption key for the cluster, if it is CMEK-protected, in the format
|
204
|
+
# `projects/{key_project_id}/locations/{location}/keyRings/{ring_name}/cryptoKeys/{key_name}`.
|
205
|
+
#
|
206
|
+
# The requirements for this key are:
|
207
|
+
#
|
208
|
+
# 1. The Cloud Bigtable service account associated with the project that contains this cluster must be granted
|
209
|
+
# the `cloudkms.cryptoKeyEncrypterDecrypter` role on the CMEK key.
|
210
|
+
# 2. Only regional keys can be used and the region of the CMEK key must match the region of the cluster.
|
211
|
+
# 3. All clusters within an instance must use the same CMEK key.
|
212
|
+
#
|
213
|
+
# @return [String, nil] The full name of the Cloud KMS encryption key, or `nil` if the cluster is not
|
214
|
+
# CMEK-protected.
|
215
|
+
#
|
216
|
+
def kms_key
|
217
|
+
@grpc.encryption_config&.kms_key_name
|
218
|
+
end
|
219
|
+
|
200
220
|
##
|
201
221
|
# Creates a new Cloud Bigtable Backup.
|
202
222
|
#
|
@@ -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
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
|
18
|
+
require "google/cloud/bigtable/status"
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module Bigtable
|
23
|
+
##
|
24
|
+
# # EncryptionInfo
|
25
|
+
#
|
26
|
+
# Encryption information for a given resource.
|
27
|
+
#
|
28
|
+
# See {Backup#encryption_info} and {Table::ClusterState#encryption_infos}.
|
29
|
+
#
|
30
|
+
# @example
|
31
|
+
# require "google/cloud/bigtable"
|
32
|
+
#
|
33
|
+
# bigtable = Google::Cloud::Bigtable.new
|
34
|
+
# instance = bigtable.instance("my-instance")
|
35
|
+
# cluster = instance.cluster("my-cluster")
|
36
|
+
#
|
37
|
+
# backup = cluster.backup("my-backup")
|
38
|
+
#
|
39
|
+
# encryption_info = backup.encryption_info
|
40
|
+
# encryption_info.encryption_type #=> :GOOGLE_DEFAULT_ENCRYPTION
|
41
|
+
#
|
42
|
+
# @example Retrieve a table with cluster states containing encryption info.
|
43
|
+
# require "google/cloud/bigtable"
|
44
|
+
#
|
45
|
+
# bigtable = Google::Cloud::Bigtable.new
|
46
|
+
#
|
47
|
+
# table = bigtable.table("my-instance", "my-table", view: :ENCRYPTION_VIEW, perform_lookup: true)
|
48
|
+
#
|
49
|
+
# table.cluster_states.each do |cs|
|
50
|
+
# puts cs.cluster_name
|
51
|
+
# puts cs.encryption_infos.first.encryption_type
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
class EncryptionInfo
|
55
|
+
# @private
|
56
|
+
#
|
57
|
+
# Creates a new EncryptionInfo instance.
|
58
|
+
def initialize grpc
|
59
|
+
@grpc = grpc
|
60
|
+
end
|
61
|
+
|
62
|
+
##
|
63
|
+
# The type of encryption used to protect the resource. Possible values:
|
64
|
+
#
|
65
|
+
# * `ENCRYPTION_TYPE_UNSPECIFIED` - Encryption type was not specified, though data at rest remains encrypted.
|
66
|
+
# * `GOOGLE_DEFAULT_ENCRYPTION` - The data backing the resource is encrypted at rest with a key that is
|
67
|
+
# fully managed by Google. No key version or status will be populated. This is the default state.
|
68
|
+
# * `CUSTOMER_MANAGED_ENCRYPTION` - The data backing the resource is encrypted at rest with a key that is
|
69
|
+
# managed by the customer. The in-use version of the key and its status are populated for CMEK-protected
|
70
|
+
# tables. CMEK-protected backups are pinned to the key version that was in use at the time the backup was
|
71
|
+
# taken. This key version is populated but its status is not tracked and is reported as `UNKNOWN`.
|
72
|
+
#
|
73
|
+
# See also {#encryption_status}, {#kms_key_version} and {Instance::ClusterMap#add}.
|
74
|
+
#
|
75
|
+
# @return [Symbol] The encryption type code as an uppercase symbol.
|
76
|
+
#
|
77
|
+
def encryption_type
|
78
|
+
@grpc.encryption_type
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# The status of encrypt/decrypt calls on underlying data for the resource. Regardless of status, the existing
|
83
|
+
# data is always encrypted at rest.
|
84
|
+
#
|
85
|
+
# See also {#encryption_type}, {#kms_key_version} and {Instance::ClusterMap#add}.
|
86
|
+
#
|
87
|
+
# @return [Google::Cloud::Bigtable::Status, nil] The encryption status object, or `nil` if not present.
|
88
|
+
#
|
89
|
+
def encryption_status
|
90
|
+
status_grpc = @grpc.encryption_status
|
91
|
+
Status.from_grpc status_grpc if status_grpc
|
92
|
+
end
|
93
|
+
|
94
|
+
##
|
95
|
+
# The version of the Cloud KMS key specified in the parent cluster that is in use for the data underlying the
|
96
|
+
# table.
|
97
|
+
#
|
98
|
+
# See also {#encryption_type}, {#encryption_status} and {Instance::ClusterMap#add}.
|
99
|
+
#
|
100
|
+
# @return [String, nil] The Cloud KMS key version, or `nil` if not present.
|
101
|
+
#
|
102
|
+
def kms_key_version
|
103
|
+
@grpc.kms_key_version unless @grpc.kms_key_version.empty?
|
104
|
+
end
|
105
|
+
|
106
|
+
# @private
|
107
|
+
#
|
108
|
+
# Creates a new EncryptionInfo instance from a Google::Cloud::Bigtable::Admin::V2::EncryptionInfo.
|
109
|
+
#
|
110
|
+
# @param grpc [Google::Cloud::Bigtable::Admin::V2::EncryptionInfo]
|
111
|
+
# @return [Google::Cloud::Bigtable::EncryptionInfo]
|
112
|
+
def self.from_grpc grpc
|
113
|
+
new grpc
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
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
|
@@ -520,6 +520,7 @@ module Google
|
|
520
520
|
def table table_id, view: nil, perform_lookup: nil, app_profile_id: nil
|
521
521
|
ensure_service!
|
522
522
|
|
523
|
+
view ||= :SCHEMA_VIEW
|
523
524
|
table = if perform_lookup
|
524
525
|
grpc = service.get_table instance_id, table_id, view: view
|
525
526
|
Table.from_grpc grpc, service, view: view
|
@@ -15,28 +15,31 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
|
18
|
+
require "google/cloud/bigtable/admin/v2"
|
19
|
+
|
18
20
|
module Google
|
19
21
|
module Cloud
|
20
22
|
module Bigtable
|
21
23
|
class Instance
|
22
24
|
##
|
23
|
-
# Instance::ClusterMap is a hash with cluster ID keys and cluster configuration values.
|
24
|
-
#
|
25
|
+
# Instance::ClusterMap is a hash with cluster ID keys and cluster configuration values. It is used to create a
|
26
|
+
# cluster.
|
25
27
|
#
|
26
28
|
# @example
|
29
|
+
# require "google/cloud/bigtable"
|
27
30
|
#
|
28
|
-
#
|
31
|
+
# bigtable = Google::Cloud::Bigtable.new
|
29
32
|
#
|
30
|
-
#
|
33
|
+
# job = bigtable.create_instance("my-instance") do |clusters|
|
34
|
+
# clusters.add("test-cluster", "us-east1-b", nodes: 3, storage_type: :SSD)
|
35
|
+
# end
|
31
36
|
#
|
32
|
-
#
|
33
|
-
# clusters.add("cluster-2", "us-east1-b")
|
37
|
+
# job.wait_until_done!
|
34
38
|
#
|
35
39
|
class ClusterMap < DelegateClass(::Hash)
|
36
40
|
# @private
|
37
41
|
#
|
38
|
-
# Creates a new Instance::ClusterMap with an hash of Cluster name and
|
39
|
-
# cluster grpc instances.
|
42
|
+
# Creates a new Instance::ClusterMap with an hash of Cluster name and cluster grpc instances.
|
40
43
|
def initialize value = {}
|
41
44
|
super value
|
42
45
|
end
|
@@ -45,24 +48,61 @@ module Google
|
|
45
48
|
# Adds a cluster to the cluster map.
|
46
49
|
#
|
47
50
|
# @param name [String] The unique identifier for the cluster.
|
48
|
-
# @param location [String]
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
# @param
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
# * `:
|
57
|
-
#
|
51
|
+
# @param location [String] The location where this cluster's nodes and storage reside. For best performance,
|
52
|
+
# clients should be located as close as possible to this cluster. Currently only zones are supported.
|
53
|
+
# @param nodes [Integer] Number of nodes for the cluster. When creating an instance of type `:DEVELOPMENT`,
|
54
|
+
# `nodes` must not be set.
|
55
|
+
# @param storage_type [Symbol] The type of storage used by this cluster to serve its parent instance's tables,
|
56
|
+
# unless explicitly overridden. Valid values are:
|
57
|
+
#
|
58
|
+
# * `:SSD` - Flash (SSD) storage should be used.
|
59
|
+
# * `:HDD` - Magnetic drive (HDD) storage should be used.
|
60
|
+
#
|
61
|
+
# If not set then default will set to `:STORAGE_TYPE_UNSPECIFIED`.
|
62
|
+
# @param kms_key [String] The full name of a Cloud KMS encryption key for a CMEK-protected cluster, in the
|
63
|
+
# format `projects/{key_project_id}/locations/{location}/keyRings/{ring_name}/cryptoKeys/{key_name}`.
|
64
|
+
#
|
65
|
+
# The requirements for this key are:
|
66
|
+
#
|
67
|
+
# 1. The Cloud Bigtable service account associated with the project that contains this cluster must be
|
68
|
+
# granted the `cloudkms.cryptoKeyEncrypterDecrypter` role on the CMEK key.
|
69
|
+
# 2. Only regional keys can be used and the region of the CMEK key must match the region of the cluster.
|
70
|
+
# 3. All clusters within an instance must use the same CMEK key.
|
71
|
+
#
|
72
|
+
# @example
|
73
|
+
# require "google/cloud/bigtable"
|
74
|
+
#
|
75
|
+
# bigtable = Google::Cloud::Bigtable.new
|
76
|
+
#
|
77
|
+
# job = bigtable.create_instance("my-instance") do |clusters|
|
78
|
+
# clusters.add("test-cluster", "us-east1-b", nodes: 3, storage_type: :SSD)
|
79
|
+
# end
|
80
|
+
#
|
81
|
+
# job.wait_until_done!
|
82
|
+
#
|
83
|
+
# @example With a Cloud KMS encryption key name for a CMEK-protected cluster:
|
84
|
+
# require "google/cloud/bigtable"
|
85
|
+
#
|
86
|
+
# bigtable = Google::Cloud::Bigtable.new
|
87
|
+
#
|
88
|
+
# kms_key_name = "projects/a/locations/b/keyRings/c/cryptoKeys/d"
|
89
|
+
# job = bigtable.create_instance("my-instance") do |clusters|
|
90
|
+
# clusters.add("test-cluster", "us-east1-b", kms_key: kms_key_name)
|
91
|
+
# end
|
58
92
|
#
|
59
|
-
#
|
93
|
+
# job.wait_until_done!
|
60
94
|
#
|
61
|
-
def add name, location, nodes: nil, storage_type: nil
|
95
|
+
def add name, location, nodes: nil, storage_type: nil, kms_key: nil
|
96
|
+
if kms_key
|
97
|
+
encryption_config = Google::Cloud::Bigtable::Admin::V2::Cluster::EncryptionConfig.new(
|
98
|
+
kms_key_name: kms_key
|
99
|
+
)
|
100
|
+
end
|
62
101
|
attrs = {
|
63
102
|
serve_nodes: nodes,
|
64
103
|
location: location,
|
65
|
-
default_storage_type: storage_type
|
104
|
+
default_storage_type: storage_type,
|
105
|
+
encryption_config: encryption_config
|
66
106
|
}.delete_if { |_, v| v.nil? }
|
67
107
|
|
68
108
|
self[name] = Google::Cloud::Bigtable::Admin::V2::Cluster.new attrs
|
@@ -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
|
@@ -316,18 +316,18 @@ module Google
|
|
316
316
|
#
|
317
317
|
# table = bigtable.table("my-instance", "my-table")
|
318
318
|
#
|
319
|
-
# @example
|
319
|
+
# @example Retrieve a table with a schema-only view.
|
320
320
|
# require "google/cloud/bigtable"
|
321
321
|
#
|
322
322
|
# bigtable = Google::Cloud::Bigtable.new
|
323
323
|
#
|
324
|
-
# table = bigtable.table("my-instance", "my-table", perform_lookup: true
|
324
|
+
# table = bigtable.table("my-instance", "my-table", perform_lookup: true)
|
325
325
|
# if table
|
326
326
|
# puts table.name
|
327
327
|
# puts table.column_families
|
328
328
|
# end
|
329
329
|
#
|
330
|
-
# @example
|
330
|
+
# @example Retrieve a table with all fields, cluster states, and column families.
|
331
331
|
# require "google/cloud/bigtable"
|
332
332
|
#
|
333
333
|
# bigtable = Google::Cloud::Bigtable.new
|
@@ -342,6 +342,7 @@ module Google
|
|
342
342
|
def table instance_id, table_id, view: nil, perform_lookup: nil, app_profile_id: nil
|
343
343
|
ensure_service!
|
344
344
|
|
345
|
+
view ||= :SCHEMA_VIEW
|
345
346
|
table = if perform_lookup
|
346
347
|
grpc = service.get_table instance_id, table_id, view: view
|
347
348
|
Table.from_grpc grpc, service, view: view
|
@@ -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.
|
@@ -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
|
@@ -752,17 +752,20 @@ module Google
|
|
752
752
|
# Create a new table by restoring from a completed backup.
|
753
753
|
#
|
754
754
|
# @param table_id [String] The table ID for the new table. This table must not yet exist.
|
755
|
-
# @param instance_id [String] The instance ID for the source backup. The table will be created in this instance
|
755
|
+
# @param instance_id [String] The instance ID for the source backup. The table will be created in this instance
|
756
|
+
# if table_instance_id is not provided.
|
756
757
|
# @param cluster_id [String] The cluster ID for the source backup.
|
757
758
|
# @param backup_id [String] The backup ID for the source backup.
|
759
|
+
# @param table_instance_id [String] The instance ID for the table, if different from instance_id. Optional.
|
758
760
|
#
|
759
761
|
# @return [Gapic::Operation] The {Google::Longrunning::Operation#metadata metadata} field type is
|
760
762
|
# {Google::Cloud::Bigtable::Admin::RestoreTableMetadata RestoreTableMetadata}. The
|
761
763
|
# {Google::Longrunning::Operation#response response} type is
|
762
764
|
# {Google::Cloud::Bigtable::Admin::V2::Table Table}, if successful.
|
763
765
|
#
|
764
|
-
def restore_table table_id, instance_id, cluster_id, backup_id
|
765
|
-
|
766
|
+
def restore_table table_id, instance_id, cluster_id, backup_id, table_instance_id: nil
|
767
|
+
table_instance_id ||= instance_id
|
768
|
+
tables.restore_table parent: instance_path(table_instance_id),
|
766
769
|
table_id: table_id,
|
767
770
|
backup: backup_path(instance_id, cluster_id, backup_id)
|
768
771
|
end
|
@@ -56,6 +56,14 @@ module Google
|
|
56
56
|
# The gRPC Service object.
|
57
57
|
attr_accessor :service
|
58
58
|
|
59
|
+
# @private
|
60
|
+
# The current gRPC resource, for testing only.
|
61
|
+
attr_accessor :grpc
|
62
|
+
|
63
|
+
# @private
|
64
|
+
# The current loaded_views, for testing only. See #check_view_and_load, below.
|
65
|
+
attr_reader :loaded_views
|
66
|
+
|
59
67
|
##
|
60
68
|
# @return [String] App profile ID for request routing.
|
61
69
|
#
|
@@ -64,10 +72,11 @@ module Google
|
|
64
72
|
# @private
|
65
73
|
#
|
66
74
|
# Creates a new Table instance.
|
67
|
-
def initialize grpc, service, view:
|
75
|
+
def initialize grpc, service, view:
|
68
76
|
@grpc = grpc
|
69
77
|
@service = service
|
70
|
-
|
78
|
+
raise ArgumentError, "view must not be nil" if view.nil?
|
79
|
+
@loaded_views = Set[view]
|
71
80
|
end
|
72
81
|
|
73
82
|
##
|
@@ -109,7 +118,8 @@ module Google
|
|
109
118
|
end
|
110
119
|
|
111
120
|
##
|
112
|
-
# Reloads table data
|
121
|
+
# Reloads table data with the provided `view`, or with `SCHEMA_VIEW`
|
122
|
+
# if none is provided. Previously loaded data is not retained.
|
113
123
|
#
|
114
124
|
# @param view [Symbol] Table view type.
|
115
125
|
# Default view type is `:SCHEMA_VIEW`.
|
@@ -123,22 +133,41 @@ module Google
|
|
123
133
|
# @return [Google::Cloud::Bigtable::Table]
|
124
134
|
#
|
125
135
|
def reload! view: nil
|
126
|
-
|
136
|
+
view ||= :SCHEMA_VIEW
|
127
137
|
@grpc = service.get_table instance_id, name, view: view
|
138
|
+
@loaded_views = Set[view]
|
128
139
|
self
|
129
140
|
end
|
130
141
|
|
131
142
|
##
|
132
|
-
#
|
143
|
+
# Returns an array of {Table::ClusterState} objects that map cluster ID
|
144
|
+
# to per-cluster table state.
|
145
|
+
#
|
133
146
|
# If it could not be determined whether or not the table has data in a
|
134
147
|
# particular cluster (for example, if its zone is unavailable), then
|
135
|
-
#
|
136
|
-
#
|
148
|
+
# the cluster state's `replication_state` will be `UNKNOWN`.
|
149
|
+
#
|
150
|
+
# Reloads the table with the `FULL` view type to retrieve the cluster states
|
151
|
+
# data, unless the table was previously loaded with view type `ENCRYPTION_VIEW`,
|
152
|
+
# `REPLICATION_VIEW` or `FULL`.
|
137
153
|
#
|
138
154
|
# @return [Array<Google::Cloud::Bigtable::Table::ClusterState>]
|
139
155
|
#
|
156
|
+
# @example Retrieve a table with cluster states.
|
157
|
+
# require "google/cloud/bigtable"
|
158
|
+
#
|
159
|
+
# bigtable = Google::Cloud::Bigtable.new
|
160
|
+
#
|
161
|
+
# table = bigtable.table("my-instance", "my-table", view: :FULL, perform_lookup: true)
|
162
|
+
#
|
163
|
+
# table.cluster_states.each do |cs|
|
164
|
+
# puts cs.cluster_name
|
165
|
+
# puts cs.replication_state
|
166
|
+
# puts cs.encryption_infos.first.encryption_type
|
167
|
+
# end
|
168
|
+
#
|
140
169
|
def cluster_states
|
141
|
-
check_view_and_load :REPLICATION_VIEW
|
170
|
+
check_view_and_load :FULL, skip_if: [:ENCRYPTION_VIEW, :REPLICATION_VIEW]
|
142
171
|
@grpc.cluster_states.map do |name, state_grpc|
|
143
172
|
ClusterState.from_grpc state_grpc, name
|
144
173
|
end
|
@@ -146,15 +175,19 @@ module Google
|
|
146
175
|
|
147
176
|
##
|
148
177
|
# Returns a frozen object containing the column families configured for
|
149
|
-
# the table, mapped by column family name.
|
150
|
-
#
|
151
|
-
#
|
178
|
+
# the table, mapped by column family name.
|
179
|
+
#
|
180
|
+
# Reloads the table if necessary to retrieve the column families data,
|
181
|
+
# since it is only available in a table with view type `SCHEMA_VIEW`
|
182
|
+
# or `FULL`. Previously loaded data is retained.
|
152
183
|
#
|
153
184
|
# Also accepts a block for making modifications to the table's column
|
154
185
|
# families. After the modifications are completed, the table will be
|
155
186
|
# updated with the changes, and the updated column families will be
|
156
187
|
# returned.
|
157
188
|
#
|
189
|
+
# @see https://cloud.google.com/bigtable/docs/garbage-collection Garbage collection
|
190
|
+
#
|
158
191
|
# @yield [column_families] A block for modifying the table's column
|
159
192
|
# families. Applies multiple column modifications. Performs a series
|
160
193
|
# of column family modifications on the specified table. Either all or
|
@@ -222,7 +255,10 @@ module Google
|
|
222
255
|
# The granularity (e.g. `MILLIS`, `MICROS`) at which timestamps are stored in
|
223
256
|
# this table. Timestamps not matching the granularity will be rejected.
|
224
257
|
# If unspecified at creation time, the value will be set to `MILLIS`.
|
225
|
-
#
|
258
|
+
#
|
259
|
+
# Reloads the table if necessary to retrieve the column families data,
|
260
|
+
# since it is only available in a table with view type `SCHEMA_VIEW`
|
261
|
+
# or `FULL`. Previously loaded data is retained.
|
226
262
|
#
|
227
263
|
# @return [Symbol]
|
228
264
|
#
|
@@ -437,7 +473,7 @@ module Google
|
|
437
473
|
}.delete_if { |_, v| v.nil? })
|
438
474
|
|
439
475
|
grpc = service.create_table instance_id, table_id, table, initial_splits: initial_splits
|
440
|
-
from_grpc grpc, service
|
476
|
+
from_grpc grpc, service, view: :SCHEMA_VIEW
|
441
477
|
end
|
442
478
|
|
443
479
|
##
|
@@ -623,7 +659,7 @@ module Google
|
|
623
659
|
# @param view [Symbol] View type.
|
624
660
|
# @return [Google::Cloud::Bigtable::Table]
|
625
661
|
#
|
626
|
-
def self.from_grpc grpc, service, view:
|
662
|
+
def self.from_grpc grpc, service, view:
|
627
663
|
new grpc, service, view: view
|
628
664
|
end
|
629
665
|
|
@@ -653,20 +689,24 @@ module Google
|
|
653
689
|
|
654
690
|
FIELDS_BY_VIEW = {
|
655
691
|
SCHEMA_VIEW: ["granularity", "column_families"],
|
692
|
+
ENCRYPTION_VIEW: ["cluster_states"],
|
656
693
|
REPLICATION_VIEW: ["cluster_states"],
|
657
694
|
FULL: ["granularity", "column_families", "cluster_states"]
|
658
695
|
}.freeze
|
659
696
|
|
660
697
|
# @private
|
661
698
|
#
|
662
|
-
# Checks and reloads table with expected view
|
663
|
-
# @param view [Symbol]
|
699
|
+
# Checks and reloads table with expected view. Performs additive updates to fields specified by the given view.
|
700
|
+
# @param view [Symbol] The view type to load. If already loaded, no load is performed.
|
701
|
+
# @param skip_if [Symbol] Additional satisfying view types. If already loaded, no load is performed.
|
664
702
|
#
|
665
|
-
def check_view_and_load view
|
703
|
+
def check_view_and_load view, skip_if: nil
|
666
704
|
ensure_service!
|
667
|
-
@loaded_views ||= Set.new [@view]
|
668
705
|
|
669
|
-
|
706
|
+
skip = Set.new skip_if
|
707
|
+
skip << view
|
708
|
+
skip << :FULL
|
709
|
+
return if (@loaded_views & skip).any?
|
670
710
|
|
671
711
|
grpc = service.get_table instance_id, table_id, view: view
|
672
712
|
@loaded_views << view
|
@@ -674,6 +714,9 @@ module Google
|
|
674
714
|
FIELDS_BY_VIEW[view].each do |field|
|
675
715
|
case grpc[field]
|
676
716
|
when Google::Protobuf::Map
|
717
|
+
# Special handling for column_families:
|
718
|
+
# Replace contents of existing Map since setting the new Map won't work.
|
719
|
+
# See https://github.com/protocolbuffers/protobuf/issues/4969
|
677
720
|
@grpc[field].clear
|
678
721
|
grpc[field].each { |k, v| @grpc[field][k] = v }
|
679
722
|
else
|
@@ -15,6 +15,8 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
|
18
|
+
require "google/cloud/bigtable/encryption_info"
|
19
|
+
|
18
20
|
module Google
|
19
21
|
module Cloud
|
20
22
|
module Bigtable
|
@@ -23,6 +25,20 @@ module Google
|
|
23
25
|
# Table::ClusterState is the state of a table's data in a particular cluster.
|
24
26
|
#
|
25
27
|
# @attr [String] cluster_name The name of the cluster.
|
28
|
+
#
|
29
|
+
# @example Retrieve a table with cluster states.
|
30
|
+
# require "google/cloud/bigtable"
|
31
|
+
#
|
32
|
+
# bigtable = Google::Cloud::Bigtable.new
|
33
|
+
#
|
34
|
+
# table = bigtable.table("my-instance", "my-table", view: :FULL, perform_lookup: true)
|
35
|
+
#
|
36
|
+
# table.cluster_states.each do |cs|
|
37
|
+
# puts cs.cluster_name
|
38
|
+
# puts cs.replication_state
|
39
|
+
# puts cs.encryption_infos.first.encryption_type
|
40
|
+
# end
|
41
|
+
#
|
26
42
|
class ClusterState
|
27
43
|
attr_reader :cluster_name
|
28
44
|
|
@@ -36,7 +52,7 @@ module Google
|
|
36
52
|
|
37
53
|
##
|
38
54
|
# The state of replication for the table in this cluster.
|
39
|
-
# Valid values
|
55
|
+
# Valid values include:
|
40
56
|
# * `:INITIALIZING` - The cluster was recently created.
|
41
57
|
# * `:PLANNED_MAINTENANCE` - The table is temporarily unable to serve.
|
42
58
|
# * `:UNPLANNED_MAINTENANCE` - The table is temporarily unable to serve.
|
@@ -45,6 +61,10 @@ module Google
|
|
45
61
|
# after a restore, and is being optimized for performance. When
|
46
62
|
# optimizations are complete, the table will transition to `READY`
|
47
63
|
# state.
|
64
|
+
# * `:STATE_NOT_KNOWN` - If replication state is not present in the object
|
65
|
+
# because the table view is not `REPLICATION_VIEW` or `FULL`.
|
66
|
+
# * `:UNKNOWN` - If it could not be determined whether or not the table
|
67
|
+
# has data in a particular cluster (for example, if its zone is unavailable.)
|
48
68
|
#
|
49
69
|
# @return [Symbol] The state of replication.
|
50
70
|
#
|
@@ -57,7 +77,8 @@ module Google
|
|
57
77
|
# over pre-existing data from other clusters before it can begin
|
58
78
|
# receiving live replication updates and serving.
|
59
79
|
#
|
60
|
-
# @return [Boolean] `true` if the
|
80
|
+
# @return [Boolean] `true` if the value of {#replication_state} is `INITIALIZING`,
|
81
|
+
# `false` otherwise.
|
61
82
|
#
|
62
83
|
def initializing?
|
63
84
|
replication_state == :INITIALIZING
|
@@ -67,8 +88,8 @@ module Google
|
|
67
88
|
# The table is temporarily unable to serve
|
68
89
|
# requests from this cluster due to planned internal maintenance.
|
69
90
|
#
|
70
|
-
# @return [Boolean] `true` if the
|
71
|
-
#
|
91
|
+
# @return [Boolean] `true` if the value of {#replication_state} is `PLANNED_MAINTENANCE`,
|
92
|
+
# `false` otherwise.
|
72
93
|
#
|
73
94
|
def planned_maintenance?
|
74
95
|
replication_state == :PLANNED_MAINTENANCE
|
@@ -78,8 +99,8 @@ module Google
|
|
78
99
|
# The table is temporarily unable to serve requests from this
|
79
100
|
# cluster due to unplanned or emergency maintenance.
|
80
101
|
#
|
81
|
-
# @return [Boolean] `true` if the
|
82
|
-
#
|
102
|
+
# @return [Boolean] `true` if the value of {#replication_state} is `UNPLANNED_MAINTENANCE`,
|
103
|
+
# `false` otherwise.
|
83
104
|
#
|
84
105
|
def unplanned_maintenance?
|
85
106
|
replication_state == :UNPLANNED_MAINTENANCE
|
@@ -90,7 +111,8 @@ module Google
|
|
90
111
|
# Depending on replication delay, reads may not immediately
|
91
112
|
# reflect the state of the table in other clusters.
|
92
113
|
#
|
93
|
-
# @return [Boolean] `true` if the
|
114
|
+
# @return [Boolean] `true` if the value of {#replication_state} is `READY`,
|
115
|
+
# `false` otherwise.
|
94
116
|
#
|
95
117
|
def ready?
|
96
118
|
replication_state == :READY
|
@@ -102,13 +124,25 @@ module Google
|
|
102
124
|
# optimizations are complete, the table will transition to `READY`
|
103
125
|
# state.
|
104
126
|
#
|
105
|
-
# @return [Boolean] `true` if the
|
106
|
-
#
|
127
|
+
# @return [Boolean] `true` if the value of {#replication_state} is `READY_OPTIMIZING`,
|
128
|
+
# `false` otherwise.
|
107
129
|
#
|
108
130
|
def ready_optimizing?
|
109
131
|
replication_state == :READY_OPTIMIZING
|
110
132
|
end
|
111
133
|
|
134
|
+
##
|
135
|
+
# The encryption info value objects for the table in this cluster. The encryption info
|
136
|
+
# is only present when the table view is `ENCRYPTION_VIEW` or `FULL`. See also
|
137
|
+
# {Instance::ClusterMap#add}.
|
138
|
+
#
|
139
|
+
# @return [Array<Google::Cloud::Bigtable::EncryptionInfo>] The array of encryption info
|
140
|
+
# value objects, or an empty array if none are present.
|
141
|
+
#
|
142
|
+
def encryption_infos
|
143
|
+
@grpc.encryption_info.map { |ei_grpc| Google::Cloud::Bigtable::EncryptionInfo.from_grpc ei_grpc }
|
144
|
+
end
|
145
|
+
|
112
146
|
# @private
|
113
147
|
# New Table::ClusterState from a Google::Cloud::Bigtable::Admin::V2::Table::ClusterState object.
|
114
148
|
# @param grpc [Google::Cloud::Bigtable::Admin::V2::Table::ClusterState]
|
@@ -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
|
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.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-08 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
|
@@ -197,6 +197,7 @@ files:
|
|
197
197
|
- lib/google/cloud/bigtable/column_range.rb
|
198
198
|
- lib/google/cloud/bigtable/convert.rb
|
199
199
|
- lib/google/cloud/bigtable/credentials.rb
|
200
|
+
- lib/google/cloud/bigtable/encryption_info.rb
|
200
201
|
- lib/google/cloud/bigtable/errors.rb
|
201
202
|
- lib/google/cloud/bigtable/gc_rule.rb
|
202
203
|
- lib/google/cloud/bigtable/instance.rb
|
@@ -241,14 +242,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
241
242
|
requirements:
|
242
243
|
- - ">="
|
243
244
|
- !ruby/object:Gem::Version
|
244
|
-
version: '2.
|
245
|
+
version: '2.5'
|
245
246
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
246
247
|
requirements:
|
247
248
|
- - ">="
|
248
249
|
- !ruby/object:Gem::Version
|
249
250
|
version: '0'
|
250
251
|
requirements: []
|
251
|
-
rubygems_version: 3.2.
|
252
|
+
rubygems_version: 3.2.17
|
252
253
|
signing_key:
|
253
254
|
specification_version: 4
|
254
255
|
summary: API Client library for Cloud Bigtable API
|