google-cloud-bigtable 1.2.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +1 -1
- data/CHANGELOG.md +54 -0
- data/TROUBLESHOOTING.md +2 -8
- data/lib/google-cloud-bigtable.rb +30 -27
- data/lib/google/cloud/bigtable.rb +18 -26
- data/lib/google/cloud/bigtable/app_profile.rb +3 -3
- data/lib/google/cloud/bigtable/app_profile/list.rb +6 -4
- data/lib/google/cloud/bigtable/backup.rb +324 -0
- data/lib/google/cloud/bigtable/backup/job.rb +87 -0
- data/lib/google/cloud/bigtable/backup/list.rb +167 -0
- data/lib/google/cloud/bigtable/chunk_processor.rb +1 -1
- data/lib/google/cloud/bigtable/cluster.rb +101 -2
- data/lib/google/cloud/bigtable/cluster/list.rb +2 -2
- data/lib/google/cloud/bigtable/column_family.rb +2 -2
- data/lib/google/cloud/bigtable/column_family_map.rb +11 -11
- data/lib/google/cloud/bigtable/column_range.rb +2 -2
- data/lib/google/cloud/bigtable/credentials.rb +36 -2
- data/lib/google/cloud/bigtable/gc_rule.rb +7 -7
- data/lib/google/cloud/bigtable/instance.rb +6 -6
- data/lib/google/cloud/bigtable/instance/cluster_map.rb +1 -1
- data/lib/google/cloud/bigtable/instance/list.rb +2 -2
- data/lib/google/cloud/bigtable/longrunning_job.rb +13 -2
- data/lib/google/cloud/bigtable/mutation_entry.rb +10 -9
- data/lib/google/cloud/bigtable/mutation_operations.rb +2 -2
- data/lib/google/cloud/bigtable/project.rb +1 -1
- data/lib/google/cloud/bigtable/read_modify_write_rule.rb +2 -2
- data/lib/google/cloud/bigtable/read_operations.rb +2 -2
- data/lib/google/cloud/bigtable/routing_policy.rb +2 -2
- data/lib/google/cloud/bigtable/row_filter/chain_filter.rb +3 -3
- data/lib/google/cloud/bigtable/row_filter/condition_filter.rb +3 -3
- data/lib/google/cloud/bigtable/row_filter/interleave_filter.rb +3 -3
- data/lib/google/cloud/bigtable/row_filter/simple_filter.rb +3 -3
- data/lib/google/cloud/bigtable/row_range.rb +2 -2
- data/lib/google/cloud/bigtable/rows_mutator.rb +3 -3
- data/lib/google/cloud/bigtable/rows_reader.rb +10 -10
- data/lib/google/cloud/bigtable/sample_row_key.rb +2 -2
- data/lib/google/cloud/bigtable/service.rb +241 -245
- data/lib/google/cloud/bigtable/table.rb +5 -4
- data/lib/google/cloud/bigtable/table/cluster_state.rb +27 -6
- data/lib/google/cloud/bigtable/table/list.rb +2 -2
- data/lib/google/cloud/bigtable/table/restore_job.rb +117 -0
- data/lib/google/cloud/bigtable/value_range.rb +2 -2
- data/lib/google/cloud/bigtable/version.rb +1 -1
- metadata +18 -96
- data/lib/google/bigtable/admin/v2/bigtable_instance_admin_pb.rb +0 -145
- data/lib/google/bigtable/admin/v2/bigtable_instance_admin_services_pb.rb +0 -90
- data/lib/google/bigtable/admin/v2/bigtable_table_admin_pb.rb +0 -144
- data/lib/google/bigtable/admin/v2/bigtable_table_admin_services_pb.rb +0 -128
- data/lib/google/bigtable/admin/v2/common_pb.rb +0 -25
- data/lib/google/bigtable/admin/v2/instance_pb.rb +0 -75
- data/lib/google/bigtable/admin/v2/table_pb.rb +0 -91
- data/lib/google/bigtable/v2/bigtable_pb.rb +0 -113
- data/lib/google/bigtable/v2/bigtable_services_pb.rb +0 -68
- data/lib/google/bigtable/v2/data_pb.rb +0 -156
- data/lib/google/cloud/bigtable/admin.rb +0 -202
- data/lib/google/cloud/bigtable/admin/credentials.rb +0 -27
- data/lib/google/cloud/bigtable/admin/v2.rb +0 -222
- data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb +0 -1451
- data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client_config.json +0 -139
- data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb +0 -1257
- data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client_config.json +0 -133
- data/lib/google/cloud/bigtable/admin/v2/credentials.rb +0 -51
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_instance_admin.rb +0 -297
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_table_admin.rb +0 -367
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/instance.rb +0 -193
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/table.rb +0 -200
- data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/iam_policy.rb +0 -64
- data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/options.rb +0 -33
- data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/policy.rb +0 -151
- data/lib/google/cloud/bigtable/admin/v2/doc/google/longrunning/operations.rb +0 -51
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/bigtable/admin/v2/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/bigtable/admin/v2/doc/google/type/expr.rb +0 -45
- data/lib/google/cloud/bigtable/v2.rb +0 -146
- data/lib/google/cloud/bigtable/v2/bigtable_client.rb +0 -591
- data/lib/google/cloud/bigtable/v2/bigtable_client_config.json +0 -83
- data/lib/google/cloud/bigtable/v2/credentials.rb +0 -46
- data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/bigtable.rb +0 -290
- data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/data.rb +0 -493
- data/lib/google/cloud/bigtable/v2/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/bigtable/v2/doc/google/protobuf/wrappers.rb +0 -34
- data/lib/google/cloud/bigtable/v2/doc/google/rpc/status.rb +0 -39
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 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
|
+
module Google
|
19
|
+
module Cloud
|
20
|
+
module Bigtable
|
21
|
+
class Backup
|
22
|
+
##
|
23
|
+
# # Job
|
24
|
+
#
|
25
|
+
# A resource representing the long-running, asynchronous processing of an backup create operation. The job can
|
26
|
+
# be refreshed to retrieve the backup object once the operation has been completed.
|
27
|
+
#
|
28
|
+
# See {Cluster#create_backup}.
|
29
|
+
#
|
30
|
+
# @see https://cloud.google.com/bigtable/docs/reference/admin/rpc/google.longrunning#google.longrunning.Operation
|
31
|
+
# Long-running Operation
|
32
|
+
#
|
33
|
+
# @example
|
34
|
+
# require "google/cloud/bigtable"
|
35
|
+
#
|
36
|
+
# bigtable = Google::Cloud::Bigtable.new
|
37
|
+
# instance = bigtable.instance("my-instance")
|
38
|
+
# cluster = instance.cluster("my-cluster")
|
39
|
+
# table = instance.table("my-table")
|
40
|
+
#
|
41
|
+
# expire_time = Time.now + 60 * 60 * 7
|
42
|
+
# job = cluster.create_backup(table, "my-backup", expire_time)
|
43
|
+
#
|
44
|
+
# job.wait_until_done!
|
45
|
+
# job.done? #=> true
|
46
|
+
#
|
47
|
+
# if job.error?
|
48
|
+
# status = job.error
|
49
|
+
# else
|
50
|
+
# backup = job.backup
|
51
|
+
# end
|
52
|
+
#
|
53
|
+
class Job < LongrunningJob
|
54
|
+
##
|
55
|
+
# Get the backup object from operation results.
|
56
|
+
#
|
57
|
+
# @return [Google::Cloud::Bigtable::Backup, nil] The backup instance, or `nil` if the operation is not
|
58
|
+
# complete.
|
59
|
+
#
|
60
|
+
# @example
|
61
|
+
# require "google/cloud/bigtable"
|
62
|
+
#
|
63
|
+
# bigtable = Google::Cloud::Bigtable.new
|
64
|
+
# instance = bigtable.instance("my-instance")
|
65
|
+
# cluster = instance.cluster("my-cluster")
|
66
|
+
# table = instance.table("my-table")
|
67
|
+
#
|
68
|
+
# expire_time = Time.now + 60 * 60 * 7
|
69
|
+
# job = cluster.create_backup(table, "my-backup", expire_time)
|
70
|
+
#
|
71
|
+
# job.wait_until_done!
|
72
|
+
# job.done? #=> true
|
73
|
+
#
|
74
|
+
# if job.error?
|
75
|
+
# status = job.error
|
76
|
+
# else
|
77
|
+
# backup = job.backup
|
78
|
+
# end
|
79
|
+
#
|
80
|
+
def backup
|
81
|
+
Backup.from_grpc results, service if results
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,167 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 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
|
+
module Google
|
19
|
+
module Cloud
|
20
|
+
module Bigtable
|
21
|
+
class Backup
|
22
|
+
##
|
23
|
+
# Backup::List is a special-case array with additional values.
|
24
|
+
class List < DelegateClass(::Array)
|
25
|
+
# @private
|
26
|
+
# The gRPC Service object.
|
27
|
+
attr_accessor :service
|
28
|
+
|
29
|
+
# @private
|
30
|
+
# The gRPC page enumerable object.
|
31
|
+
attr_accessor :grpc
|
32
|
+
|
33
|
+
# @private
|
34
|
+
# Creates a new Backup::List with an array of backups.
|
35
|
+
def initialize arr = []
|
36
|
+
super arr
|
37
|
+
end
|
38
|
+
|
39
|
+
##
|
40
|
+
# Whether there is a next page of backups.
|
41
|
+
#
|
42
|
+
# @return [Boolean]
|
43
|
+
#
|
44
|
+
# @example
|
45
|
+
# require "google/cloud/bigtable"
|
46
|
+
#
|
47
|
+
# bigtable = Google::Cloud::Bigtable.new
|
48
|
+
#
|
49
|
+
# instance = bigtable.instance("my-instance")
|
50
|
+
# cluster = instance.cluster("my-cluster")
|
51
|
+
#
|
52
|
+
# backups = cluster.backups
|
53
|
+
#
|
54
|
+
# if backups.next?
|
55
|
+
# next_backups = backups.next
|
56
|
+
# end
|
57
|
+
#
|
58
|
+
def next?
|
59
|
+
grpc.next_page?
|
60
|
+
end
|
61
|
+
|
62
|
+
##
|
63
|
+
# Retrieves the next page of backups.
|
64
|
+
#
|
65
|
+
# @return [Backup::List] The list of backups.
|
66
|
+
#
|
67
|
+
# @example
|
68
|
+
# require "google/cloud/bigtable"
|
69
|
+
#
|
70
|
+
# bigtable = Google::Cloud::Bigtable.new
|
71
|
+
#
|
72
|
+
# instance = bigtable.instance("my-instance")
|
73
|
+
# cluster = instance.cluster("my-cluster")
|
74
|
+
#
|
75
|
+
# backups = cluster.backups
|
76
|
+
#
|
77
|
+
# if backups.next?
|
78
|
+
# next_backups = backups.next
|
79
|
+
# end
|
80
|
+
#
|
81
|
+
def next
|
82
|
+
ensure_grpc!
|
83
|
+
|
84
|
+
return nil unless next?
|
85
|
+
grpc.next_page
|
86
|
+
self.class.from_grpc grpc, service
|
87
|
+
end
|
88
|
+
|
89
|
+
##
|
90
|
+
# Retrieves remaining results by repeatedly invoking {#next} until {#next?} returns `false`. Calls the given
|
91
|
+
# block once for each result, which is passed as the argument to the block.
|
92
|
+
#
|
93
|
+
# An enumerator is returned if no block is given.
|
94
|
+
#
|
95
|
+
# This method will make repeated API calls until all remaining results are retrieved (unlike `#each`, for
|
96
|
+
# example, which merely iterates over the results returned by a single API call). Use with caution.
|
97
|
+
#
|
98
|
+
# @yield [backup] The block for accessing each backup.
|
99
|
+
# @yieldparam [Backup] backup The backup object.
|
100
|
+
#
|
101
|
+
# @return [Enumerator,nil] An enumerator is returned if no block is given, otherwise `nil`.
|
102
|
+
#
|
103
|
+
# @example Iterating each backup by passing a block:
|
104
|
+
# require "google/cloud/bigtable"
|
105
|
+
#
|
106
|
+
# bigtable = Google::Cloud::Bigtable.new
|
107
|
+
#
|
108
|
+
# instance = bigtable.instance("my-instance")
|
109
|
+
# cluster = instance.cluster("my-cluster")
|
110
|
+
#
|
111
|
+
# cluster.backups.all do |backup|
|
112
|
+
# puts backup.backup_id
|
113
|
+
# end
|
114
|
+
#
|
115
|
+
# @example Using the enumerator by not passing a block:
|
116
|
+
# require "google/cloud/bigtable"
|
117
|
+
#
|
118
|
+
# bigtable = Google::Cloud::Bigtable.new
|
119
|
+
#
|
120
|
+
# instance = bigtable.instance("my-instance")
|
121
|
+
# cluster = instance.cluster("my-cluster")
|
122
|
+
#
|
123
|
+
# all_backup_ids = cluster.backups.all.map do |backup|
|
124
|
+
# backup.backup_id
|
125
|
+
# end
|
126
|
+
#
|
127
|
+
def all
|
128
|
+
return enum_for :all unless block_given?
|
129
|
+
|
130
|
+
results = self
|
131
|
+
loop do
|
132
|
+
results.each { |r| yield r }
|
133
|
+
break unless next?
|
134
|
+
grpc.next_page
|
135
|
+
results = self.class.from_grpc grpc, service
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
# @private
|
140
|
+
# New Snapshot::List from a Gapic::PagedEnumerable<Google::Cloud::Bigtable::Admin::V2::Backup> object.
|
141
|
+
# @param grpc [Gapic::PagedEnumerable<Google::Cloud::Bigtable::Admin::V2::Backup> ]
|
142
|
+
# @param service [Google::Cloud::Bigtable::Service]
|
143
|
+
# @return [Array<Google::Cloud::Bigtable::Backup>]
|
144
|
+
def self.from_grpc grpc, service
|
145
|
+
backups = List.new(
|
146
|
+
Array(grpc.response.backups).map do |backup|
|
147
|
+
Backup.from_grpc backup, service
|
148
|
+
end
|
149
|
+
)
|
150
|
+
backups.grpc = grpc
|
151
|
+
backups.service = service
|
152
|
+
backups
|
153
|
+
end
|
154
|
+
|
155
|
+
protected
|
156
|
+
|
157
|
+
# @private
|
158
|
+
#
|
159
|
+
# Raises an error if an active gRPC call is not available.
|
160
|
+
def ensure_grpc!
|
161
|
+
raise "Must have active gRPC call" unless grpc
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
@@ -49,7 +49,7 @@ module Google
|
|
49
49
|
##
|
50
50
|
# Process chunk and build full row with cells
|
51
51
|
#
|
52
|
-
# @param chunk [Google::Bigtable::V2::ReadRowsResponse::CellChunk]
|
52
|
+
# @param chunk [Google::Cloud::Bigtable::V2::ReadRowsResponse::CellChunk]
|
53
53
|
#
|
54
54
|
def process chunk
|
55
55
|
self.chunk = chunk
|
@@ -15,6 +15,7 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
|
18
|
+
require "google/cloud/bigtable/backup"
|
18
19
|
require "google/cloud/bigtable/cluster/list"
|
19
20
|
require "google/cloud/bigtable/cluster/job"
|
20
21
|
|
@@ -196,6 +197,104 @@ module Google
|
|
196
197
|
@grpc.location
|
197
198
|
end
|
198
199
|
|
200
|
+
##
|
201
|
+
# Creates a new Cloud Bigtable Backup.
|
202
|
+
#
|
203
|
+
# @param source_table [Table, String] The table object, or the name of the table,
|
204
|
+
# from which the backup is to be created. The table needs to be in the same
|
205
|
+
# instance as the backup. Required.
|
206
|
+
# @param backup_id [String] The id of the backup to be created. This string must
|
207
|
+
# be between 1 and 50 characters in length and match the regex
|
208
|
+
# `[_a-zA-Z0-9][-_.a-zA-Z0-9]*`. Required.
|
209
|
+
# @param expire_time [Time] The expiration time of the backup, with microseconds
|
210
|
+
# granularity that must be at least 6 hours and at most 30 days
|
211
|
+
# from the time the request is received. Once the `expire_time`
|
212
|
+
# has passed, Cloud Bigtable will delete the backup and free the
|
213
|
+
# resources used by the backup. Required.
|
214
|
+
# @return [Google::Cloud::Bigtable::Backup::Job]
|
215
|
+
# The job representing the long-running, asynchronous processing of
|
216
|
+
# a backup create operation.
|
217
|
+
#
|
218
|
+
# @example
|
219
|
+
# require "google/cloud/bigtable"
|
220
|
+
#
|
221
|
+
# bigtable = Google::Cloud::Bigtable.new
|
222
|
+
# instance = bigtable.instance("my-instance")
|
223
|
+
# cluster = instance.cluster("my-cluster")
|
224
|
+
# table = instance.table("my-table")
|
225
|
+
#
|
226
|
+
# expire_time = Time.now + 60 * 60 * 7
|
227
|
+
# job = cluster.create_backup(table, "my-backup", expire_time)
|
228
|
+
#
|
229
|
+
# job.wait_until_done!
|
230
|
+
# job.done? #=> true
|
231
|
+
#
|
232
|
+
# if job.error?
|
233
|
+
# status = job.error
|
234
|
+
# else
|
235
|
+
# backup = job.backup
|
236
|
+
# end
|
237
|
+
#
|
238
|
+
def create_backup source_table, backup_id, expire_time
|
239
|
+
source_table_id = source_table.respond_to?(:name) ? source_table.name : source_table
|
240
|
+
grpc = service.create_backup instance_id: instance_id,
|
241
|
+
cluster_id: cluster_id,
|
242
|
+
backup_id: backup_id,
|
243
|
+
source_table_id: source_table_id,
|
244
|
+
expire_time: expire_time
|
245
|
+
Backup::Job.from_grpc grpc, service
|
246
|
+
end
|
247
|
+
|
248
|
+
##
|
249
|
+
# Gets a backup in the cluster.
|
250
|
+
#
|
251
|
+
# @param backup_id [String] The unique ID of the requested backup.
|
252
|
+
#
|
253
|
+
# @return [Google::Cloud::Bigtable::Backup, nil] The backup object, or `nil` if not found in the service.
|
254
|
+
#
|
255
|
+
# @example
|
256
|
+
# require "google/cloud/bigtable"
|
257
|
+
#
|
258
|
+
# bigtable = Google::Cloud::Bigtable.new
|
259
|
+
#
|
260
|
+
# instance = bigtable.instance("my-instance")
|
261
|
+
# cluster = instance.cluster("my-cluster")
|
262
|
+
#
|
263
|
+
# backup = cluster.backup("my-backup")
|
264
|
+
#
|
265
|
+
# if backup
|
266
|
+
# puts backup.backup_id
|
267
|
+
# end
|
268
|
+
#
|
269
|
+
def backup backup_id
|
270
|
+
grpc = service.get_backup instance_id, cluster_id, backup_id
|
271
|
+
Backup.from_grpc grpc, service
|
272
|
+
rescue Google::Cloud::NotFoundError
|
273
|
+
nil
|
274
|
+
end
|
275
|
+
|
276
|
+
##
|
277
|
+
# Lists all backups in the cluster.
|
278
|
+
#
|
279
|
+
# @return [Array<Google::Cloud::Bigtable::Backup>] (See {Google::Cloud::Bigtable::Backup::List})
|
280
|
+
#
|
281
|
+
# @example
|
282
|
+
# require "google/cloud/bigtable"
|
283
|
+
#
|
284
|
+
# bigtable = Google::Cloud::Bigtable.new
|
285
|
+
#
|
286
|
+
# instance = bigtable.instance("my-instance")
|
287
|
+
# cluster = instance.cluster("my-cluster")
|
288
|
+
#
|
289
|
+
# cluster.backups.all do |backup|
|
290
|
+
# puts backup.backup_id
|
291
|
+
# end
|
292
|
+
#
|
293
|
+
def backups
|
294
|
+
grpc = service.list_backups instance_id, cluster_id
|
295
|
+
Backup::List.from_grpc grpc, service
|
296
|
+
end
|
297
|
+
|
199
298
|
##
|
200
299
|
# Updates the cluster.
|
201
300
|
#
|
@@ -267,9 +366,9 @@ module Google
|
|
267
366
|
# @private
|
268
367
|
#
|
269
368
|
# Creates a new Cluster instance from a
|
270
|
-
# Google::Bigtable::Admin::V2::Cluster.
|
369
|
+
# Google::Cloud::Bigtable::Admin::V2::Cluster.
|
271
370
|
#
|
272
|
-
# @param grpc [Google::Bigtable::Admin::V2::Cluster]
|
371
|
+
# @param grpc [Google::Cloud::Bigtable::Admin::V2::Cluster]
|
273
372
|
# @param service [Google::Cloud::Bigtable::Service]
|
274
373
|
# @return [Google::Cloud::Bigtable::Cluster]
|
275
374
|
def self.from_grpc grpc, service
|
@@ -109,7 +109,7 @@ module Google
|
|
109
109
|
# @yield [cluster] The block for accessing each cluster.
|
110
110
|
# @yieldparam [Cluster] cluster The cluster object.
|
111
111
|
#
|
112
|
-
# @return [Enumerator]
|
112
|
+
# @return [Enumerator,nil] An enumerator is returned if no block is given, otherwise `nil`.
|
113
113
|
#
|
114
114
|
# @example Iterating each cluster by passing a block:
|
115
115
|
# require "google/cloud/bigtable"
|
@@ -142,7 +142,7 @@ module Google
|
|
142
142
|
|
143
143
|
# @private
|
144
144
|
#
|
145
|
-
# New Cluster::List from a Google::Bigtable::Admin::V2::ListClustersResponse object.
|
145
|
+
# New Cluster::List from a Google::Cloud::Bigtable::Admin::V2::ListClustersResponse object.
|
146
146
|
def self.from_grpc grpc, service, instance_id: nil
|
147
147
|
clusters = List.new(Array(grpc.clusters).map do |cluster|
|
148
148
|
Cluster.from_grpc cluster, service
|
@@ -56,9 +56,9 @@ module Google
|
|
56
56
|
|
57
57
|
# @private
|
58
58
|
#
|
59
|
-
# Create a new ColumnFamily instance from a {Google::Bigtable::Admin::V2::ColumnFamily}.
|
59
|
+
# Create a new ColumnFamily instance from a {Google::Cloud::Bigtable::Admin::V2::ColumnFamily}.
|
60
60
|
#
|
61
|
-
# @param grpc [Google::Bigtable::Admin::V2::ColumnFamily]
|
61
|
+
# @param grpc [Google::Cloud::Bigtable::Admin::V2::ColumnFamily]
|
62
62
|
# @param name [String] Column family name
|
63
63
|
# @return [Google::Cloud::Bigtable::ColumnFamily]
|
64
64
|
#
|
@@ -117,7 +117,7 @@ module Google
|
|
117
117
|
# @yieldparam [String] name the column family name.
|
118
118
|
# @yieldparam [ColumnFamily] column_family the column family object.
|
119
119
|
#
|
120
|
-
# @return [Enumerator]
|
120
|
+
# @return [Enumerator,nil] An enumerator is returned if no block is given, otherwise `nil`.
|
121
121
|
#
|
122
122
|
def each
|
123
123
|
return enum_for :each unless block_given?
|
@@ -211,7 +211,7 @@ module Google
|
|
211
211
|
warn "The positional gc_rule argument is deprecated. Use the named gc_rule argument instead."
|
212
212
|
end
|
213
213
|
|
214
|
-
column_family = Google::Bigtable::Admin::V2::ColumnFamily.new
|
214
|
+
column_family = Google::Cloud::Bigtable::Admin::V2::ColumnFamily.new
|
215
215
|
column_family.gc_rule = gc_rule.to_grpc if gc_rule
|
216
216
|
@column_families[name] = column_family
|
217
217
|
|
@@ -248,7 +248,7 @@ module Google
|
|
248
248
|
def update name, gc_rule: nil
|
249
249
|
raise ArgumentError, "column family #{name.inspect} does not exist" unless @column_families.has_key? name
|
250
250
|
|
251
|
-
column_family = Google::Bigtable::Admin::V2::ColumnFamily.new
|
251
|
+
column_family = Google::Cloud::Bigtable::Admin::V2::ColumnFamily.new
|
252
252
|
column_family.gc_rule = gc_rule.to_grpc if gc_rule
|
253
253
|
@column_families[name] = column_family
|
254
254
|
|
@@ -299,7 +299,7 @@ module Google
|
|
299
299
|
#
|
300
300
|
# @param comparison_map [Google::Protobuf::Map] The map to compare the
|
301
301
|
# current map against for building the modification entries.
|
302
|
-
# @return [Array<Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification>]
|
302
|
+
# @return [Array<Google::Cloud::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification>]
|
303
303
|
#
|
304
304
|
def modifications comparison_map = nil
|
305
305
|
comparison_map ||= empty_map
|
@@ -352,7 +352,7 @@ module Google
|
|
352
352
|
##
|
353
353
|
# Create an empty Google::Protobuf::Map suitable for column_families.
|
354
354
|
def empty_map
|
355
|
-
Google::Bigtable::Admin::V2::Table.new.column_families
|
355
|
+
Google::Cloud::Bigtable::Admin::V2::Table.new.column_families
|
356
356
|
end
|
357
357
|
|
358
358
|
##
|
@@ -362,13 +362,13 @@ module Google
|
|
362
362
|
#
|
363
363
|
# @param comparison_map [Google::Protobuf::Map] The map to compare the
|
364
364
|
# current map against for building the modification entries.
|
365
|
-
# @return [Array<Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification>]
|
365
|
+
# @return [Array<Google::Cloud::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification>]
|
366
366
|
#
|
367
367
|
def created_modifications comparison_map
|
368
368
|
added_keys = @column_families.keys - comparison_map.keys
|
369
369
|
|
370
370
|
added_keys.map do |name|
|
371
|
-
Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest:: \
|
371
|
+
Google::Cloud::Bigtable::Admin::V2::ModifyColumnFamiliesRequest:: \
|
372
372
|
Modification.new(
|
373
373
|
id: name,
|
374
374
|
create: @column_families[name]
|
@@ -383,7 +383,7 @@ module Google
|
|
383
383
|
#
|
384
384
|
# @param comparison_map [Google::Protobuf::Map] The map to compare the
|
385
385
|
# current map against for building the modification entries.
|
386
|
-
# @return [Array<Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification>]
|
386
|
+
# @return [Array<Google::Cloud::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification>]
|
387
387
|
#
|
388
388
|
def updated_modifications comparison_map
|
389
389
|
possibly_updated_keys = @column_families.keys & comparison_map.keys
|
@@ -392,7 +392,7 @@ module Google
|
|
392
392
|
end
|
393
393
|
|
394
394
|
updated_keys.map do |name|
|
395
|
-
Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest:: \
|
395
|
+
Google::Cloud::Bigtable::Admin::V2::ModifyColumnFamiliesRequest:: \
|
396
396
|
Modification.new(
|
397
397
|
id: name,
|
398
398
|
update: @column_families[name]
|
@@ -407,13 +407,13 @@ module Google
|
|
407
407
|
#
|
408
408
|
# @param comparison_map [Google::Protobuf::Map] The map to compare the
|
409
409
|
# current map against for building the modification entries.
|
410
|
-
# @return [Array<Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification>]
|
410
|
+
# @return [Array<Google::Cloud::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification>]
|
411
411
|
#
|
412
412
|
def dropped_modifications comparison_map
|
413
413
|
dropped_keys = comparison_map.keys - @column_families.keys
|
414
414
|
|
415
415
|
dropped_keys.map do |name|
|
416
|
-
Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest:: \
|
416
|
+
Google::Cloud::Bigtable::Admin::V2::ModifyColumnFamiliesRequest:: \
|
417
417
|
Modification.new(
|
418
418
|
id: name,
|
419
419
|
drop: true
|