google-cloud-bigtable 1.3.0 → 2.3.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/CONTRIBUTING.md +1 -1
- data/OVERVIEW.md +4 -4
- 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 +4 -2
- data/lib/google/cloud/bigtable/backup.rb +123 -2
- data/lib/google/cloud/bigtable/backup/list.rb +2 -2
- data/lib/google/cloud/bigtable/chunk_processor.rb +1 -1
- data/lib/google/cloud/bigtable/cluster.rb +2 -2
- data/lib/google/cloud/bigtable/cluster/list.rb +1 -1
- data/lib/google/cloud/bigtable/column_family.rb +2 -2
- data/lib/google/cloud/bigtable/column_family_map.rb +10 -10
- data/lib/google/cloud/bigtable/column_range.rb +2 -2
- data/lib/google/cloud/bigtable/convert.rb +12 -0
- 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 +8 -8
- data/lib/google/cloud/bigtable/instance/cluster_map.rb +1 -1
- data/lib/google/cloud/bigtable/instance/list.rb +1 -1
- data/lib/google/cloud/bigtable/longrunning_job.rb +2 -2
- data/lib/google/cloud/bigtable/mutation_entry.rb +22 -18
- data/lib/google/cloud/bigtable/mutation_operations.rb +6 -6
- 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 +9 -4
- 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 +239 -281
- data/lib/google/cloud/bigtable/table.rb +5 -4
- data/lib/google/cloud/bigtable/table/cluster_state.rb +2 -2
- data/lib/google/cloud/bigtable/table/list.rb +1 -1
- data/lib/google/cloud/bigtable/value_range.rb +26 -8
- data/lib/google/cloud/bigtable/version.rb +1 -1
- metadata +12 -94
- 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 -208
- data/lib/google/bigtable/admin/v2/bigtable_table_admin_services_pb.rb +0 -154
- data/lib/google/bigtable/admin/v2/common_pb.rb +0 -30
- data/lib/google/bigtable/admin/v2/instance_pb.rb +0 -74
- data/lib/google/bigtable/admin/v2/table_pb.rb +0 -127
- 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 -223
- 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 -1734
- data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client_config.json +0 -163
- 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 -587
- 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 -303
- 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
@@ -137,8 +137,8 @@ module Google
|
|
137
137
|
end
|
138
138
|
|
139
139
|
# @private
|
140
|
-
# New Snapshot::List from a
|
141
|
-
# @param grpc [
|
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
142
|
# @param service [Google::Cloud::Bigtable::Service]
|
143
143
|
# @return [Array<Google::Cloud::Bigtable::Backup>]
|
144
144
|
def self.from_grpc grpc, service
|
@@ -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
|
@@ -366,9 +366,9 @@ module Google
|
|
366
366
|
# @private
|
367
367
|
#
|
368
368
|
# Creates a new Cluster instance from a
|
369
|
-
# Google::Bigtable::Admin::V2::Cluster.
|
369
|
+
# Google::Cloud::Bigtable::Admin::V2::Cluster.
|
370
370
|
#
|
371
|
-
# @param grpc [Google::Bigtable::Admin::V2::Cluster]
|
371
|
+
# @param grpc [Google::Cloud::Bigtable::Admin::V2::Cluster]
|
372
372
|
# @param service [Google::Cloud::Bigtable::Service]
|
373
373
|
# @return [Google::Cloud::Bigtable::Cluster]
|
374
374
|
def self.from_grpc grpc, service
|
@@ -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
|
#
|
@@ -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
|
@@ -56,7 +56,7 @@ module Google
|
|
56
56
|
# @param family [String] Column family name.
|
57
57
|
#
|
58
58
|
def initialize family
|
59
|
-
@grpc = Google::Bigtable::V2::ColumnRange.new family_name: family
|
59
|
+
@grpc = Google::Cloud::Bigtable::V2::ColumnRange.new family_name: family
|
60
60
|
end
|
61
61
|
|
62
62
|
##
|
@@ -183,7 +183,7 @@ module Google
|
|
183
183
|
|
184
184
|
# @private
|
185
185
|
#
|
186
|
-
# @return [Google::Bigtable::V2::ColumnRange]
|
186
|
+
# @return [Google::Cloud::Bigtable::V2::ColumnRange]
|
187
187
|
#
|
188
188
|
def to_grpc
|
189
189
|
@grpc
|
@@ -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
|
@@ -13,12 +13,46 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
|
16
|
-
require "google/cloud/bigtable/v2/credentials"
|
16
|
+
require "google/cloud/bigtable/v2/bigtable/credentials"
|
17
17
|
|
18
18
|
module Google
|
19
19
|
module Cloud
|
20
20
|
module Bigtable
|
21
|
-
|
21
|
+
##
|
22
|
+
# # Credentials
|
23
|
+
#
|
24
|
+
# Represents the authentication and authorization used to connect to the
|
25
|
+
# Bigtable API.
|
26
|
+
#
|
27
|
+
# @example
|
28
|
+
# require "google/cloud/bigtable"
|
29
|
+
#
|
30
|
+
# keyfile = "/path/to/keyfile.json"
|
31
|
+
# creds = Google::Cloud::Bigtable::Credentials.new keyfile
|
32
|
+
#
|
33
|
+
# bigtable = Google::Cloud::Bigtable.new(
|
34
|
+
# project_id: "my-project",
|
35
|
+
# credentials: creds
|
36
|
+
# )
|
37
|
+
#
|
38
|
+
# bigtable.project_id #=> "my-project"
|
39
|
+
#
|
40
|
+
class Credentials < Google::Cloud::Bigtable::V2::Bigtable::Credentials
|
41
|
+
self.scope = [
|
42
|
+
"https://www.googleapis.com/auth/bigtable.admin",
|
43
|
+
"https://www.googleapis.com/auth/bigtable.admin.cluster",
|
44
|
+
"https://www.googleapis.com/auth/bigtable.admin.instance",
|
45
|
+
"https://www.googleapis.com/auth/bigtable.admin.table",
|
46
|
+
"https://www.googleapis.com/auth/bigtable.data",
|
47
|
+
"https://www.googleapis.com/auth/bigtable.data.readonly",
|
48
|
+
"https://www.googleapis.com/auth/cloud-bigtable.admin",
|
49
|
+
"https://www.googleapis.com/auth/cloud-bigtable.admin.cluster",
|
50
|
+
"https://www.googleapis.com/auth/cloud-bigtable.admin.table",
|
51
|
+
"https://www.googleapis.com/auth/cloud-bigtable.data",
|
52
|
+
"https://www.googleapis.com/auth/cloud-bigtable.data.readonly",
|
53
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
54
|
+
"https://www.googleapis.com/auth/cloud-platform.read-only"
|
55
|
+
]
|
22
56
|
end
|
23
57
|
end
|
24
58
|
end
|
@@ -66,10 +66,10 @@ module Google
|
|
66
66
|
# @private
|
67
67
|
# Creates a new GC Rule instance.
|
68
68
|
#
|
69
|
-
# @param grpc [Google::Bigtable::Admin::V2::GcRule | nil]
|
69
|
+
# @param grpc [Google::Cloud::Bigtable::Admin::V2::GcRule | nil]
|
70
70
|
#
|
71
71
|
def initialize grpc = nil
|
72
|
-
@grpc = grpc || Google::Bigtable::Admin::V2::GcRule.new
|
72
|
+
@grpc = grpc || Google::Cloud::Bigtable::Admin::V2::GcRule.new
|
73
73
|
end
|
74
74
|
|
75
75
|
##
|
@@ -146,7 +146,7 @@ module Google
|
|
146
146
|
# List of GcRule with nested rules.
|
147
147
|
#
|
148
148
|
def intersection= rules
|
149
|
-
@grpc.intersection = Google::Bigtable::Admin::V2::GcRule::Intersection.new rules: rules.map(&:to_grpc)
|
149
|
+
@grpc.intersection = Google::Cloud::Bigtable::Admin::V2::GcRule::Intersection.new rules: rules.map(&:to_grpc)
|
150
150
|
end
|
151
151
|
|
152
152
|
##
|
@@ -186,7 +186,7 @@ module Google
|
|
186
186
|
# List of GcRule with nested rules.
|
187
187
|
#
|
188
188
|
def union= rules
|
189
|
-
@grpc.union = Google::Bigtable::Admin::V2::GcRule::Union.new rules: rules.map(&:to_grpc)
|
189
|
+
@grpc.union = Google::Cloud::Bigtable::Admin::V2::GcRule::Union.new rules: rules.map(&:to_grpc)
|
190
190
|
end
|
191
191
|
|
192
192
|
##
|
@@ -314,7 +314,7 @@ module Google
|
|
314
314
|
|
315
315
|
# @private
|
316
316
|
# Get gRPC instance of GC Rule
|
317
|
-
# @return [Google::Bigtable::Admin::V2::GcRule]
|
317
|
+
# @return [Google::Cloud::Bigtable::Admin::V2::GcRule]
|
318
318
|
def to_grpc
|
319
319
|
@grpc
|
320
320
|
end
|
@@ -322,8 +322,8 @@ module Google
|
|
322
322
|
# @private
|
323
323
|
#
|
324
324
|
# Creates a new GcRule instance from a
|
325
|
-
# Google::Bigtable::Admin::V2::GcRule.
|
326
|
-
# @param grpc [Google::Bigtable::Admin::V2::GcRule]
|
325
|
+
# Google::Cloud::Bigtable::Admin::V2::GcRule.
|
326
|
+
# @param grpc [Google::Cloud::Bigtable::Admin::V2::GcRule]
|
327
327
|
# @return [Google::Cloud::Bigtable::GcRule]
|
328
328
|
def self.from_grpc grpc
|
329
329
|
new grpc
|
@@ -431,7 +431,7 @@ module Google
|
|
431
431
|
location: location
|
432
432
|
}.delete_if { |_, v| v.nil? }
|
433
433
|
|
434
|
-
cluster = Google::Bigtable::Admin::V2::Cluster.new attrs
|
434
|
+
cluster = Google::Cloud::Bigtable::Admin::V2::Cluster.new attrs
|
435
435
|
grpc = service.create_cluster instance_id, cluster_id, cluster
|
436
436
|
Cluster::Job.from_grpc grpc, service
|
437
437
|
end
|
@@ -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")
|
@@ -566,7 +566,7 @@ module Google
|
|
566
566
|
# * Tablet 3 : `[customer_1, customer_2) => {"customer_1"}`
|
567
567
|
# * Tablet 4 : `[customer_2, other) => {"customer_2"}`
|
568
568
|
# * Tablet 5 : `[other, ) => {"other", "zz"}`
|
569
|
-
# A hash in the form of `Google::Bigtable::Admin::V2::CreateTableRequest::Split`
|
569
|
+
# A hash in the form of `Google::Cloud::Bigtable::Admin::V2::CreateTableRequest::Split`
|
570
570
|
# can also be provided.
|
571
571
|
# @yield [column_families] A block for adding column families.
|
572
572
|
# @yieldparam [Google::Cloud::Bigtable::ColumnFamilyMap] column_families
|
@@ -709,7 +709,7 @@ module Google
|
|
709
709
|
def create_app_profile name, routing_policy, description: nil, etag: nil, ignore_warnings: false
|
710
710
|
ensure_service!
|
711
711
|
routing_policy_grpc = routing_policy.to_grpc
|
712
|
-
if routing_policy_grpc.is_a? Google::Bigtable::Admin::V2::AppProfile::MultiClusterRoutingUseAny
|
712
|
+
if routing_policy_grpc.is_a? Google::Cloud::Bigtable::Admin::V2::AppProfile::MultiClusterRoutingUseAny
|
713
713
|
multi_cluster_routing = routing_policy_grpc
|
714
714
|
else
|
715
715
|
single_cluster_routing = routing_policy_grpc
|
@@ -725,7 +725,7 @@ module Google
|
|
725
725
|
grpc = service.create_app_profile(
|
726
726
|
instance_id,
|
727
727
|
name,
|
728
|
-
Google::Bigtable::Admin::V2::AppProfile.new(app_profile_attrs),
|
728
|
+
Google::Cloud::Bigtable::Admin::V2::AppProfile.new(app_profile_attrs),
|
729
729
|
ignore_warnings: ignore_warnings
|
730
730
|
)
|
731
731
|
AppProfile.from_grpc grpc, service
|
@@ -909,9 +909,9 @@ module Google
|
|
909
909
|
# @private
|
910
910
|
#
|
911
911
|
# Creates a new Instance instance from a
|
912
|
-
# Google::Bigtable::Admin::V2::Instance.
|
912
|
+
# Google::Cloud::Bigtable::Admin::V2::Instance.
|
913
913
|
#
|
914
|
-
# @param grpc [Google::Bigtable::Admin::V2::Instance]
|
914
|
+
# @param grpc [Google::Cloud::Bigtable::Admin::V2::Instance]
|
915
915
|
# @param service [Google::Cloud::Bigtable::Service]
|
916
916
|
# @return [Google::Cloud::Bigtable::Instance]
|
917
917
|
#
|
@@ -138,7 +138,7 @@ module Google
|
|
138
138
|
end
|
139
139
|
|
140
140
|
# @private
|
141
|
-
# New Instance::List from a Google::Bigtable::Admin::V2::Instance object.
|
141
|
+
# New Instance::List from a Google::Cloud::Bigtable::Admin::V2::Instance object.
|
142
142
|
def self.from_grpc grpc, service
|
143
143
|
instances = List.new(Array(grpc.instances).map do |instance|
|
144
144
|
Instance.from_grpc instance, service
|
@@ -29,7 +29,7 @@ module Google
|
|
29
29
|
#
|
30
30
|
class LongrunningJob
|
31
31
|
# @private
|
32
|
-
# The
|
32
|
+
# The Gapic::Operation gRPC object.
|
33
33
|
attr_accessor :grpc
|
34
34
|
|
35
35
|
# @private
|
@@ -109,7 +109,7 @@ module Google
|
|
109
109
|
end
|
110
110
|
|
111
111
|
# @private
|
112
|
-
# New BasicJob from a
|
112
|
+
# New BasicJob from a Gapic::Operation object.
|
113
113
|
def self.from_grpc grpc, service
|
114
114
|
new.tap do |job|
|
115
115
|
job.grpc = grpc
|
@@ -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
|
@@ -59,7 +61,7 @@ module Google
|
|
59
61
|
|
60
62
|
# @private
|
61
63
|
# mutations gRPC list
|
62
|
-
# @return [Array<Google::Bigtable::V2::Mutation>]
|
64
|
+
# @return [Array<Google::Cloud::Bigtable::V2::Mutation>]
|
63
65
|
attr_accessor :mutations
|
64
66
|
|
65
67
|
##
|
@@ -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,
|
@@ -123,7 +126,7 @@ module Google
|
|
123
126
|
options[:timestamp_micros] = timestamp
|
124
127
|
@retryable = timestamp != -1
|
125
128
|
end
|
126
|
-
@mutations << Google::Bigtable::V2::Mutation.new(set_cell: options)
|
129
|
+
@mutations << Google::Cloud::Bigtable::V2::Mutation.new(set_cell: options)
|
127
130
|
self
|
128
131
|
end
|
129
132
|
|
@@ -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,19 +175,20 @@ 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
|
#
|
179
182
|
def delete_cells family, qualifier, timestamp_from: nil, timestamp_to: nil
|
180
|
-
grpc = Google::Bigtable::V2::Mutation::DeleteFromColumn.new
|
183
|
+
grpc = Google::Cloud::Bigtable::V2::Mutation::DeleteFromColumn.new \
|
184
|
+
family_name: family, column_qualifier: qualifier
|
181
185
|
if timestamp_from || timestamp_to
|
182
|
-
time_range = Google::Bigtable::V2::TimestampRange.new
|
186
|
+
time_range = Google::Cloud::Bigtable::V2::TimestampRange.new
|
183
187
|
time_range.start_timestamp_micros = timestamp_from if timestamp_from
|
184
188
|
time_range.end_timestamp_micros = timestamp_to if timestamp_to
|
185
189
|
grpc.time_range = time_range
|
186
190
|
end
|
187
|
-
@mutations << Google::Bigtable::V2::Mutation.new(delete_from_column: grpc)
|
191
|
+
@mutations << Google::Cloud::Bigtable::V2::Mutation.new(delete_from_column: grpc)
|
188
192
|
self
|
189
193
|
end
|
190
194
|
|
@@ -200,10 +204,10 @@ module Google
|
|
200
204
|
#
|
201
205
|
# @example
|
202
206
|
# entry = Google::Cloud::Bigtable::MutationEntry.new("user-1")
|
203
|
-
# entry.delete_from_family("
|
207
|
+
# entry.delete_from_family("cf1")
|
204
208
|
#
|
205
209
|
def delete_from_family family
|
206
|
-
@mutations << Google::Bigtable::V2::Mutation.new(delete_from_family: { family_name: family })
|
210
|
+
@mutations << Google::Cloud::Bigtable::V2::Mutation.new(delete_from_family: { family_name: family })
|
207
211
|
self
|
208
212
|
end
|
209
213
|
|
@@ -219,7 +223,7 @@ module Google
|
|
219
223
|
# entry.delete_from_row
|
220
224
|
#
|
221
225
|
def delete_from_row
|
222
|
-
@mutations << Google::Bigtable::V2::Mutation.new(delete_from_row: {})
|
226
|
+
@mutations << Google::Cloud::Bigtable::V2::Mutation.new(delete_from_row: {})
|
223
227
|
self
|
224
228
|
end
|
225
229
|
|
@@ -245,10 +249,10 @@ module Google
|
|
245
249
|
#
|
246
250
|
# Convert mutation entry to gRPC protobuf object.
|
247
251
|
#
|
248
|
-
# @return [Google::Bigtable::V2::MutateRowsRequest::Entry]
|
252
|
+
# @return [Google::Cloud::Bigtable::V2::MutateRowsRequest::Entry]
|
249
253
|
#
|
250
254
|
def to_grpc
|
251
|
-
Google::Bigtable::V2::MutateRowsRequest::Entry.new row_key: @row_key, mutations: @mutations
|
255
|
+
Google::Cloud::Bigtable::V2::MutateRowsRequest::Entry.new row_key: @row_key, mutations: @mutations
|
252
256
|
end
|
253
257
|
end
|
254
258
|
end
|