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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 833d4009bf7801aeea418cc20c01957beb3aa7717eae7660aef91c4afc1b09c5
4
- data.tar.gz: 95a806973acd438380803a215e1fdfb3d06846b66363ee541419ebe7f54cb507
3
+ metadata.gz: 248e897a1ecfff6e758a718695514e575d1322fcbac828a6541397444b16e9b8
4
+ data.tar.gz: 99fcdb65b38064cb3d29b1b635bacaca9faee59e6d444b7f808c63e8153fb5f2
5
5
  SHA512:
6
- metadata.gz: 7f8ba6fe01b55f0eae24961447f829ca02bb8f709ee11b75d8ec985314f673d714ebc4f71528a74da3c34911777da9cd95895c667cc74334b55fb8b786689db6
7
- data.tar.gz: 131d9b4c4f58215ce1808eb721b4f8a01086df6a6b207503629d86a2200ceb8b871894b5d93d0246a69e72b87d9c2a665baf4ee02e5d278f263daef72a473c4d
6
+ metadata.gz: 33d0e17401be95b707762eab720867f38e568736bb5b1690c684e0afcab2f8e20ecadffe2010bb4f39e68bb93f5a16f80c6859524abd18d2adb3d848445f9c51
7
+ data.tar.gz: a4d2d734c852ba5f49aae0034364c70b7f1ea66ce111ce4e723fbf34a1a48bb57ab7ecba19e49359a89d40f693c4aed242703d6c0ad18307b868e9f3c9a23a47
@@ -55,32 +55,10 @@ code.
55
55
 
56
56
  ### Google Cloud Platform environments
57
57
 
58
- While running on Google Cloud Platform environments such as Google Compute
59
- Engine, Google App Engine and Google Kubernetes Engine, no extra work is needed.
60
- The **Project ID** and **Credentials** and are discovered automatically. Code
61
- should be written as if already authenticated. Just be sure when you [set up the
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
 
@@ -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
@@ -19,7 +19,7 @@ module Google
19
19
  module Cloud
20
20
  module Bigtable
21
21
  # @private
22
- # # RowsMutator
22
+ # # ChunkProcessor
23
23
  #
24
24
  # Read a chunk of data and merge it based on states and build rows and cells
25
25
  #
@@ -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
- client.mutate_row path, entry.row_key, entry.mutations, app_profile_id: @app_profile_id
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 = client.read_modify_write_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 = client.check_and_mutate_row(
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 = client.sample_row_keys path, app_profile_id: @app_profile_id
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.client.mutate_rows @table.path, entries, app_profile_id: @table.app_profile_id
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.client.read_rows(
79
- @table.path,
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
  #
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Bigtable
19
- VERSION = "0.7.0".freeze
19
+ VERSION = "0.8.0".freeze
20
20
  end
21
21
  end
22
22
  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: 0.7.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-10-22 00:00:00.000000000 Z
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