google-cloud-bigtable 0.7.0 → 0.8.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 +4 -26
- data/CHANGELOG.md +24 -0
- data/lib/google/cloud/bigtable/chunk_processor.rb +1 -1
- data/lib/google/cloud/bigtable/column_family.rb +0 -8
- data/lib/google/cloud/bigtable/mutation_operations.rb +3 -38
- data/lib/google/cloud/bigtable/read_operations.rb +1 -1
- data/lib/google/cloud/bigtable/rows_mutator.rb +1 -5
- data/lib/google/cloud/bigtable/rows_reader.rb +3 -2
- data/lib/google/cloud/bigtable/service.rb +42 -14
- data/lib/google/cloud/bigtable/table.rb +0 -9
- data/lib/google/cloud/bigtable/version.rb +1 -1
- metadata +42 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 248e897a1ecfff6e758a718695514e575d1322fcbac828a6541397444b16e9b8
|
4
|
+
data.tar.gz: 99fcdb65b38064cb3d29b1b635bacaca9faee59e6d444b7f808c63e8153fb5f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33d0e17401be95b707762eab720867f38e568736bb5b1690c684e0afcab2f8e20ecadffe2010bb4f39e68bb93f5a16f80c6859524abd18d2adb3d848445f9c51
|
7
|
+
data.tar.gz: a4d2d734c852ba5f49aae0034364c70b7f1ea66ce111ce4e723fbf34a1a48bb57ab7ecba19e49359a89d40f693c4aed242703d6c0ad18307b868e9f3c9a23a47
|
data/AUTHENTICATION.md
CHANGED
@@ -55,32 +55,10 @@ code.
|
|
55
55
|
|
56
56
|
### Google Cloud Platform environments
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
should be written as if already authenticated.
|
62
|
-
GCE instance][gce-how-to], you add the correct scopes for the APIs you want to
|
63
|
-
access. For example:
|
64
|
-
|
65
|
-
* **All APIs**
|
66
|
-
* `https://www.googleapis.com/auth/cloud-platform`
|
67
|
-
* `https://www.googleapis.com/auth/cloud-platform.read-only`
|
68
|
-
* **BigQuery**
|
69
|
-
* `https://www.googleapis.com/auth/bigquery`
|
70
|
-
* `https://www.googleapis.com/auth/bigquery.insertdata`
|
71
|
-
* **Compute Engine**
|
72
|
-
* `https://www.googleapis.com/auth/compute`
|
73
|
-
* **Datastore**
|
74
|
-
* `https://www.googleapis.com/auth/datastore`
|
75
|
-
* `https://www.googleapis.com/auth/userinfo.email`
|
76
|
-
* **DNS**
|
77
|
-
* `https://www.googleapis.com/auth/ndev.clouddns.readwrite`
|
78
|
-
* **Pub/Sub**
|
79
|
-
* `https://www.googleapis.com/auth/pubsub`
|
80
|
-
* **Storage**
|
81
|
-
* `https://www.googleapis.com/auth/devstorage.full_control`
|
82
|
-
* `https://www.googleapis.com/auth/devstorage.read_only`
|
83
|
-
* `https://www.googleapis.com/auth/devstorage.read_write`
|
58
|
+
When running on Google Cloud Platform (GCP), including Google Compute Engine (GCE),
|
59
|
+
Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud Functions
|
60
|
+
(GCF) and Cloud Run, the **Project ID** and **Credentials** and are discovered
|
61
|
+
automatically. Code should be written as if already authenticated.
|
84
62
|
|
85
63
|
### Environment Variables
|
86
64
|
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 0.8.0 / 2019-11-01
|
4
|
+
|
5
|
+
#### ⚠ BREAKING CHANGES
|
6
|
+
|
7
|
+
* The following methods now raise Google::Cloud::Error instead of
|
8
|
+
Google::Gax::GaxError and/or GRPC::BadStatus:
|
9
|
+
* Table#mutate_row
|
10
|
+
* Table#read_modify_write_row
|
11
|
+
* Table#check_and_mutate_row
|
12
|
+
* Table#sample_row_keys
|
13
|
+
|
14
|
+
#### Features
|
15
|
+
|
16
|
+
* Raise Google::Cloud::Error from Table#mutate_row, Table#read_modify_write_row,
|
17
|
+
Table#check_and_mutate_row, and Table#sample_row_keys.
|
18
|
+
|
19
|
+
#### Bug Fixes
|
20
|
+
|
21
|
+
* Update minimum runtime dependencies
|
22
|
+
|
23
|
+
#### Documentation
|
24
|
+
|
25
|
+
* Update the list of GCP environments for automatic authentication
|
26
|
+
|
3
27
|
### 0.7.0 / 2019-10-22
|
4
28
|
|
5
29
|
#### Features
|
@@ -52,14 +52,6 @@ module Google
|
|
52
52
|
@gc_rule = gc_rule
|
53
53
|
end
|
54
54
|
|
55
|
-
# @private
|
56
|
-
# @return [Google::Bigtable::Admin::V2::ColumnFamily]
|
57
|
-
def to_grpc
|
58
|
-
grpc = Google::Bigtable::Admin::V2::ColumnFamily.new
|
59
|
-
grpc.gc_rule = gc_rule.to_grpc if gc_rule
|
60
|
-
grpc
|
61
|
-
end
|
62
|
-
|
63
55
|
# @private
|
64
56
|
#
|
65
57
|
# Create a new ColumnFamily instance from a {Google::Bigtable::Admin::V2::ColumnFamily}.
|
@@ -76,7 +76,7 @@ module Google
|
|
76
76
|
# table.mutate_row(entry)
|
77
77
|
#
|
78
78
|
def mutate_row entry
|
79
|
-
|
79
|
+
service.mutate_row path, entry.row_key, entry.mutations, app_profile_id: @app_profile_id
|
80
80
|
true
|
81
81
|
end
|
82
82
|
|
@@ -158,7 +158,7 @@ module Google
|
|
158
158
|
# puts row.cells
|
159
159
|
#
|
160
160
|
def read_modify_write_row key, rules
|
161
|
-
res_row =
|
161
|
+
res_row = service.read_modify_write_row(
|
162
162
|
path,
|
163
163
|
key,
|
164
164
|
Array(rules).map(&:to_grpc),
|
@@ -243,7 +243,7 @@ module Google
|
|
243
243
|
def check_and_mutate_row key, predicate, on_match: nil, otherwise: nil
|
244
244
|
true_mutations = on_match.mutations if on_match
|
245
245
|
false_mutations = otherwise.mutations if otherwise
|
246
|
-
response =
|
246
|
+
response = service.check_and_mutate_row(
|
247
247
|
path,
|
248
248
|
key,
|
249
249
|
predicate_filter: predicate.to_grpc,
|
@@ -254,41 +254,6 @@ module Google
|
|
254
254
|
response.predicate_matched
|
255
255
|
end
|
256
256
|
|
257
|
-
##
|
258
|
-
# Read sample row keys.
|
259
|
-
#
|
260
|
-
# Returns a sample of row keys in the table. The returned row keys will
|
261
|
-
# delimit contiguous sections of the table of approximately equal size. The
|
262
|
-
# sections can be used to break up the data for distributed tasks like
|
263
|
-
# MapReduces.
|
264
|
-
#
|
265
|
-
# @yieldreturn [Google::Cloud::Bigtable::SampleRowKey]
|
266
|
-
# @return [:yields: sample_row_key]
|
267
|
-
# Yield block for each processed SampleRowKey.
|
268
|
-
#
|
269
|
-
# @example
|
270
|
-
# require "google/cloud/bigtable"
|
271
|
-
#
|
272
|
-
# bigtable = Google::Cloud::Bigtable.new
|
273
|
-
# table = bigtable.table("my-instance", "my-table")
|
274
|
-
#
|
275
|
-
# table.sample_row_keys.each do |sample_row_key|
|
276
|
-
# p sample_row_key.key # user00116
|
277
|
-
# p sample_row_key.offset # 805306368
|
278
|
-
# end
|
279
|
-
#
|
280
|
-
def sample_row_keys
|
281
|
-
return enum_for :sample_row_keys unless block_given?
|
282
|
-
|
283
|
-
response = client.sample_row_keys(
|
284
|
-
path,
|
285
|
-
app_profile_id: @app_profile_id
|
286
|
-
)
|
287
|
-
response.each do |grpc|
|
288
|
-
yield SampleRowKey.from_grpc grpc
|
289
|
-
end
|
290
|
-
end
|
291
|
-
|
292
257
|
##
|
293
258
|
# Create an instance of mutation_entry
|
294
259
|
#
|
@@ -60,7 +60,7 @@ module Google
|
|
60
60
|
def sample_row_keys
|
61
61
|
return enum_for :sample_row_keys unless block_given?
|
62
62
|
|
63
|
-
response =
|
63
|
+
response = service.sample_row_keys path, app_profile_id: @app_profile_id
|
64
64
|
response.each do |grpc|
|
65
65
|
yield SampleRowKey.from_grpc grpc
|
66
66
|
end
|
@@ -83,14 +83,10 @@ module Google
|
|
83
83
|
# @return [Array<Google::Bigtable::V2::MutateRowsResponse::Entry>]
|
84
84
|
#
|
85
85
|
def mutate_rows entries
|
86
|
-
response = @table.
|
86
|
+
response = @table.service.mutate_rows @table.path, entries, app_profile_id: @table.app_profile_id
|
87
87
|
response.each_with_object [] do |res, statuses|
|
88
88
|
statuses.concat res.entries
|
89
89
|
end
|
90
|
-
rescue Google::Gax::GaxError => e
|
91
|
-
raise Google::Cloud::Error.from_error(e.cause)
|
92
|
-
rescue GRPC::BadStatus => e
|
93
|
-
raise Google::Cloud::Error.from_error(e)
|
94
90
|
end
|
95
91
|
|
96
92
|
##
|
@@ -75,8 +75,9 @@ module Google
|
|
75
75
|
# Array of row or yield block for each processed row.
|
76
76
|
#
|
77
77
|
def read rows: nil, filter: nil, rows_limit: nil
|
78
|
-
response = @table.
|
79
|
-
@table.
|
78
|
+
response = @table.service.read_rows(
|
79
|
+
@table.instance_id,
|
80
|
+
@table.table_id,
|
80
81
|
rows: rows,
|
81
82
|
filter: filter,
|
82
83
|
rows_limit: rows_limit,
|
@@ -640,6 +640,48 @@ module Google
|
|
640
640
|
end
|
641
641
|
end
|
642
642
|
|
643
|
+
def read_rows instance_id, table_id, app_profile_id: nil, rows: nil, filter: nil, rows_limit: nil
|
644
|
+
# execute is not used because error handling is in ReadOperations#read_rows
|
645
|
+
client.read_rows table_path(instance_id, table_id),
|
646
|
+
rows: rows,
|
647
|
+
filter: filter,
|
648
|
+
rows_limit: rows_limit,
|
649
|
+
app_profile_id: app_profile_id
|
650
|
+
end
|
651
|
+
|
652
|
+
def sample_row_keys table_name, app_profile_id: nil
|
653
|
+
execute do
|
654
|
+
client.sample_row_keys table_name, app_profile_id: app_profile_id
|
655
|
+
end
|
656
|
+
end
|
657
|
+
|
658
|
+
def mutate_row table_name, row_key, mutations, app_profile_id: nil
|
659
|
+
execute do
|
660
|
+
client.mutate_row table_name, row_key, mutations, app_profile_id: app_profile_id
|
661
|
+
end
|
662
|
+
end
|
663
|
+
|
664
|
+
def mutate_rows table_name, entries, app_profile_id: nil
|
665
|
+
execute do
|
666
|
+
client.mutate_rows table_name, entries, app_profile_id: app_profile_id
|
667
|
+
end
|
668
|
+
end
|
669
|
+
|
670
|
+
def check_and_mutate_row table_name, row_key, app_profile_id: nil, predicate_filter: nil, true_mutations: nil,
|
671
|
+
false_mutations: nil
|
672
|
+
execute do
|
673
|
+
client.check_and_mutate_row table_name, row_key, app_profile_id: app_profile_id,
|
674
|
+
predicate_filter: predicate_filter, true_mutations: true_mutations,
|
675
|
+
false_mutations: false_mutations
|
676
|
+
end
|
677
|
+
end
|
678
|
+
|
679
|
+
def read_modify_write_row table_name, row_key, rules, app_profile_id: nil
|
680
|
+
execute do
|
681
|
+
client.read_modify_write_row table_name, row_key, rules, app_profile_id: app_profile_id
|
682
|
+
end
|
683
|
+
end
|
684
|
+
|
643
685
|
##
|
644
686
|
# Executes the API call and wrap errors to {Google::Cloud::Error}.
|
645
687
|
#
|
@@ -714,20 +756,6 @@ module Google
|
|
714
756
|
Admin::V2::BigtableTableAdminClient.table_path project_id, instance_id, table_id
|
715
757
|
end
|
716
758
|
|
717
|
-
##
|
718
|
-
# Creates a formatted snapshot path.
|
719
|
-
#
|
720
|
-
# @param instance_id [String]
|
721
|
-
# @param cluster_id [String]
|
722
|
-
# @param snapshot_id [String]
|
723
|
-
# @return [String]
|
724
|
-
# Formatted snapshot path
|
725
|
-
# +projects/<project>/instances/<instance>/clusters/<cluster>/snapshots/<snapshot>+
|
726
|
-
#
|
727
|
-
def snapshot_path instance_id, cluster_id, snapshot_id
|
728
|
-
Admin::V2::BigtableTableAdminClient.snapshot_path project_id, instance_id, cluster_id, snapshot_id
|
729
|
-
end
|
730
|
-
|
731
759
|
##
|
732
760
|
# Creates a formatted app profile path.
|
733
761
|
#
|
@@ -424,15 +424,6 @@ module Google
|
|
424
424
|
status
|
425
425
|
end
|
426
426
|
|
427
|
-
# @private
|
428
|
-
# Gets the data client instance.
|
429
|
-
#
|
430
|
-
# @return [Google::Cloud::Bigtable::V2::BigtableClient]
|
431
|
-
#
|
432
|
-
def client
|
433
|
-
service.client
|
434
|
-
end
|
435
|
-
|
436
427
|
##
|
437
428
|
# Deletes all rows.
|
438
429
|
#
|
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: 0.
|
4
|
+
version: 0.8.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: 2019-
|
11
|
+
date: 2019-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-cloud-core
|
@@ -38,6 +38,46 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: googleapis-common-protos
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.3.9
|
48
|
+
- - "<"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '2.0'
|
51
|
+
type: :runtime
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: 1.3.9
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '2.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: googleapis-common-protos-types
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 1.0.4
|
68
|
+
- - "<"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '2.0'
|
71
|
+
type: :runtime
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.0.4
|
78
|
+
- - "<"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '2.0'
|
41
81
|
- !ruby/object:Gem::Dependency
|
42
82
|
name: grpc-google-iam-v1
|
43
83
|
requirement: !ruby/object:Gem::Requirement
|