google-cloud-bigtable 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/google/bigtable/admin/v2/bigtable_instance_admin_pb.rb +24 -24
- data/lib/google/bigtable/admin/v2/bigtable_instance_admin_services_pb.rb +59 -59
- data/lib/google/bigtable/admin/v2/bigtable_table_admin_pb.rb +33 -33
- data/lib/google/bigtable/admin/v2/bigtable_table_admin_services_pb.rb +124 -124
- data/lib/google/bigtable/admin/v2/common_pb.rb +4 -4
- data/lib/google/bigtable/admin/v2/instance_pb.rb +10 -10
- data/lib/google/bigtable/admin/v2/table_pb.rb +18 -18
- data/lib/google/bigtable/v2/bigtable_pb.rb +17 -17
- data/lib/google/bigtable/v2/bigtable_services_pb.rb +39 -39
- data/lib/google/bigtable/v2/data_pb.rb +21 -21
- data/lib/google/cloud/bigtable/app_profile/list.rb +2 -2
- 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/cluster.rb +99 -0
- data/lib/google/cloud/bigtable/cluster/list.rb +1 -1
- data/lib/google/cloud/bigtable/column_family_map.rb +1 -1
- data/lib/google/cloud/bigtable/instance/list.rb +1 -1
- data/lib/google/cloud/bigtable/longrunning_job.rb +11 -0
- data/lib/google/cloud/bigtable/service.rb +79 -0
- data/lib/google/cloud/bigtable/table/cluster_state.rb +25 -4
- data/lib/google/cloud/bigtable/table/list.rb +1 -1
- data/lib/google/cloud/bigtable/table/restore_job.rb +117 -0
- data/lib/google/cloud/bigtable/version.rb +1 -1
- metadata +7 -3
@@ -21,6 +21,8 @@ module Google
|
|
21
21
|
class Table
|
22
22
|
##
|
23
23
|
# Table::ClusterState is the state of a table's data in a particular cluster.
|
24
|
+
#
|
25
|
+
# @attr [String] cluster_name The name of the cluster.
|
24
26
|
class ClusterState
|
25
27
|
attr_reader :cluster_name
|
26
28
|
|
@@ -39,6 +41,10 @@ module Google
|
|
39
41
|
# * `:PLANNED_MAINTENANCE` - The table is temporarily unable to serve.
|
40
42
|
# * `:UNPLANNED_MAINTENANCE` - The table is temporarily unable to serve.
|
41
43
|
# * `:READY` - The table can serve.
|
44
|
+
# * `:READY_OPTIMIZING` - The table is fully created and ready for use
|
45
|
+
# after a restore, and is being optimized for performance. When
|
46
|
+
# optimizations are complete, the table will transition to `READY`
|
47
|
+
# state.
|
42
48
|
#
|
43
49
|
# @return [Symbol] The state of replication.
|
44
50
|
#
|
@@ -51,7 +57,7 @@ module Google
|
|
51
57
|
# over pre-existing data from other clusters before it can begin
|
52
58
|
# receiving live replication updates and serving.
|
53
59
|
#
|
54
|
-
# @return [Boolean] `true` if the cluster is initializing.
|
60
|
+
# @return [Boolean] `true` if the table in this cluster is initializing.
|
55
61
|
#
|
56
62
|
def initializing?
|
57
63
|
replication_state == :INITIALIZING
|
@@ -61,7 +67,8 @@ module Google
|
|
61
67
|
# The table is temporarily unable to serve
|
62
68
|
# requests from this cluster due to planned internal maintenance.
|
63
69
|
#
|
64
|
-
# @return [Boolean] `true` if the cluster is in planned
|
70
|
+
# @return [Boolean] `true` if the table in this cluster is in planned
|
71
|
+
# maintenance.
|
65
72
|
#
|
66
73
|
def planned_maintenance?
|
67
74
|
replication_state == :PLANNED_MAINTENANCE
|
@@ -71,7 +78,8 @@ module Google
|
|
71
78
|
# The table is temporarily unable to serve requests from this
|
72
79
|
# cluster due to unplanned or emergency maintenance.
|
73
80
|
#
|
74
|
-
# @return [Boolean] `true` if the cluster is in unplanned
|
81
|
+
# @return [Boolean] `true` if the table in this cluster is in unplanned
|
82
|
+
# maintenance.
|
75
83
|
#
|
76
84
|
def unplanned_maintenance?
|
77
85
|
replication_state == :UNPLANNED_MAINTENANCE
|
@@ -82,12 +90,25 @@ module Google
|
|
82
90
|
# Depending on replication delay, reads may not immediately
|
83
91
|
# reflect the state of the table in other clusters.
|
84
92
|
#
|
85
|
-
# @return [Boolean] `true` if the cluster is ready.
|
93
|
+
# @return [Boolean] `true` if the table in this cluster is ready.
|
86
94
|
#
|
87
95
|
def ready?
|
88
96
|
replication_state == :READY
|
89
97
|
end
|
90
98
|
|
99
|
+
##
|
100
|
+
# The table is fully created and ready for use after a
|
101
|
+
# restore, and is being optimized for performance. When
|
102
|
+
# optimizations are complete, the table will transition to `READY`
|
103
|
+
# state.
|
104
|
+
#
|
105
|
+
# @return [Boolean] `true` if the table in this cluster is being
|
106
|
+
# optimized.
|
107
|
+
#
|
108
|
+
def ready_optimizing?
|
109
|
+
replication_state == :READY_OPTIMIZING
|
110
|
+
end
|
111
|
+
|
91
112
|
# @private
|
92
113
|
# New Table::ClusterState from a Google::Bigtable::Admin::V2::Table::ClusterState object.
|
93
114
|
# @param grpc [Google::Bigtable::Admin::V2::Table::ClusterState]
|
@@ -94,7 +94,7 @@ module Google
|
|
94
94
|
# @yield [table] The block for accessing each table instance.
|
95
95
|
# @yieldparam [Table] table The table instance object.
|
96
96
|
#
|
97
|
-
# @return [Enumerator]
|
97
|
+
# @return [Enumerator,nil] An enumerator is returned if no block is given, otherwise `nil`.
|
98
98
|
#
|
99
99
|
# @example Iterating each table by passing a block:
|
100
100
|
# require "google/cloud/bigtable"
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# Copyright 2020 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
|
16
|
+
module Google
|
17
|
+
module Cloud
|
18
|
+
module Bigtable
|
19
|
+
class Table
|
20
|
+
##
|
21
|
+
# # RestoreJob
|
22
|
+
#
|
23
|
+
# A resource representing the long-running, asynchronous processing of a backup restore operation. The
|
24
|
+
# job can be refreshed to retrieve the table object once the operation has been completed.
|
25
|
+
#
|
26
|
+
# See {Backup#restore}.
|
27
|
+
#
|
28
|
+
# @see https://cloud.google.com/bigtable/docs/reference/admin/rpc/google.longrunning#google.longrunning.Operation
|
29
|
+
# Long-running Operation
|
30
|
+
#
|
31
|
+
# @example
|
32
|
+
# require "google/cloud/bigtable"
|
33
|
+
#
|
34
|
+
# bigtable = Google::Cloud::Bigtable.new
|
35
|
+
# instance = bigtable.instance("my-instance")
|
36
|
+
# cluster = instance.cluster("my-cluster")
|
37
|
+
#
|
38
|
+
# backup = cluster.backup("my-backup")
|
39
|
+
#
|
40
|
+
# job = backup.restore("my-new-table")
|
41
|
+
#
|
42
|
+
# job.wait_until_done!
|
43
|
+
# job.done? #=> true
|
44
|
+
#
|
45
|
+
# if job.error?
|
46
|
+
# status = job.error
|
47
|
+
# else
|
48
|
+
# table = job.table
|
49
|
+
# optimized = job.optimize_table_operation_name
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
class RestoreJob < LongrunningJob
|
53
|
+
##
|
54
|
+
# The optimize table operation name from operation metadata.
|
55
|
+
#
|
56
|
+
# @return [String, nil] The optimize table operation name, or `nil` if the optimize table operation is not
|
57
|
+
# complete.
|
58
|
+
#
|
59
|
+
# @example
|
60
|
+
# require "google/cloud/bigtable"
|
61
|
+
#
|
62
|
+
# bigtable = Google::Cloud::Bigtable.new
|
63
|
+
# instance = bigtable.instance("my-instance")
|
64
|
+
# cluster = instance.cluster("my-cluster")
|
65
|
+
#
|
66
|
+
# backup = cluster.backup("my-backup")
|
67
|
+
#
|
68
|
+
# job = backup.restore("my-new-table")
|
69
|
+
#
|
70
|
+
# job.wait_until_done!
|
71
|
+
# job.done? #=> true
|
72
|
+
#
|
73
|
+
# if job.error?
|
74
|
+
# status = job.error
|
75
|
+
# else
|
76
|
+
# table = job.table
|
77
|
+
# optimized = job.optimize_table_operation_name
|
78
|
+
# end
|
79
|
+
#
|
80
|
+
def optimize_table_operation_name
|
81
|
+
metadata.optimize_table_operation_name
|
82
|
+
end
|
83
|
+
|
84
|
+
##
|
85
|
+
# Gets the table object from operation results.
|
86
|
+
#
|
87
|
+
# @return [Google::Cloud::Bigtable::Table, nil] The table instance, or `nil` if the operation is not complete.
|
88
|
+
#
|
89
|
+
# @example
|
90
|
+
# require "google/cloud/bigtable"
|
91
|
+
#
|
92
|
+
# bigtable = Google::Cloud::Bigtable.new
|
93
|
+
# instance = bigtable.instance("my-instance")
|
94
|
+
# cluster = instance.cluster("my-cluster")
|
95
|
+
#
|
96
|
+
# backup = cluster.backup("my-backup")
|
97
|
+
#
|
98
|
+
# job = backup.restore("my-new-table")
|
99
|
+
#
|
100
|
+
# job.wait_until_done!
|
101
|
+
# job.done? #=> true
|
102
|
+
#
|
103
|
+
# if job.error?
|
104
|
+
# status = job.error
|
105
|
+
# else
|
106
|
+
# table = job.table
|
107
|
+
# optimized = job.optimize_table_operation_name
|
108
|
+
# end
|
109
|
+
#
|
110
|
+
def table
|
111
|
+
Table.from_grpc results, service if results
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
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: 1.
|
4
|
+
version: 1.3.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: 2020-
|
11
|
+
date: 2020-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-cloud-core
|
@@ -258,6 +258,9 @@ files:
|
|
258
258
|
- lib/google/cloud/bigtable/app_profile.rb
|
259
259
|
- lib/google/cloud/bigtable/app_profile/job.rb
|
260
260
|
- lib/google/cloud/bigtable/app_profile/list.rb
|
261
|
+
- lib/google/cloud/bigtable/backup.rb
|
262
|
+
- lib/google/cloud/bigtable/backup/job.rb
|
263
|
+
- lib/google/cloud/bigtable/backup/list.rb
|
261
264
|
- lib/google/cloud/bigtable/chunk_processor.rb
|
262
265
|
- lib/google/cloud/bigtable/cluster.rb
|
263
266
|
- lib/google/cloud/bigtable/cluster/job.rb
|
@@ -296,6 +299,7 @@ files:
|
|
296
299
|
- lib/google/cloud/bigtable/table.rb
|
297
300
|
- lib/google/cloud/bigtable/table/cluster_state.rb
|
298
301
|
- lib/google/cloud/bigtable/table/list.rb
|
302
|
+
- lib/google/cloud/bigtable/table/restore_job.rb
|
299
303
|
- lib/google/cloud/bigtable/v2.rb
|
300
304
|
- lib/google/cloud/bigtable/v2/bigtable_client.rb
|
301
305
|
- lib/google/cloud/bigtable/v2/bigtable_client_config.json
|
@@ -326,7 +330,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
326
330
|
- !ruby/object:Gem::Version
|
327
331
|
version: '0'
|
328
332
|
requirements: []
|
329
|
-
rubygems_version: 3.
|
333
|
+
rubygems_version: 3.1.3
|
330
334
|
signing_key:
|
331
335
|
specification_version: 4
|
332
336
|
summary: API Client library for Cloud Bigtable API
|