google-cloud-bigtable 2.4.0 → 2.4.1

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: f1f99712143906255ee1d2632c445d1c1bdacb1a407c5a63a3e26bbf4446212e
4
- data.tar.gz: 8371b2372d45334f65a625271d78fe8ea5bf3dc8448cdbd0827908925b2a7d2d
3
+ metadata.gz: 1d2ceaa917a67e31cae160f8cfb03ecb1617aebf24c634d89a3f5805589d3f46
4
+ data.tar.gz: c2c614ffbd788256c15037c22ff9f7fd09208399a49ee85149e9515e0976f0f9
5
5
  SHA512:
6
- metadata.gz: 0a3aa85a0322a4182e01152ded9445f0b5442a69a63a47c338a7137a2e170f2ad62a37badf7e2079e3e8ee75080a6ff0a0022314ae73021a01439833d585f3d5
7
- data.tar.gz: 13e017d3992738213ca3ac3d50cdc91ce954c5326956f7b814f441f69fee876c8d97e922a2d85c931e7c620d0f51b37ed2c0b5b0ada8afeaf26e229751adec36
6
+ metadata.gz: 6e019a7ad97017938d2960b52951dda90911d5f84c6d3c95cd09abd0086d35b68f8f4139d5626c92065928eec8493758aa0fb6d6185cf89a149eadde53c54675
7
+ data.tar.gz: f3eeec0098bd030dad2a8cd07b08dae4d58d02753ead572d552eaf7543a93776ca48576bb7c37199a7cd181f6f23e98f989778a0f7ee8e9e614522f97fbf23e8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release History
2
2
 
3
+ ### 2.4.1 / 2021-04-01
4
+
5
+ #### Bug Fixes
6
+
7
+ * Update internal management of view states in Table
8
+
3
9
  ### 2.4.0 / 2021-03-10
4
10
 
5
11
  #### Features
@@ -520,6 +520,7 @@ module Google
520
520
  def table table_id, view: nil, perform_lookup: nil, app_profile_id: nil
521
521
  ensure_service!
522
522
 
523
+ view ||= :SCHEMA_VIEW
523
524
  table = if perform_lookup
524
525
  grpc = service.get_table instance_id, table_id, view: view
525
526
  Table.from_grpc grpc, service, view: view
@@ -316,18 +316,18 @@ module Google
316
316
  #
317
317
  # table = bigtable.table("my-instance", "my-table")
318
318
  #
319
- # @example Get a table with schema-only view.
319
+ # @example Retrieve a table with a schema-only view.
320
320
  # require "google/cloud/bigtable"
321
321
  #
322
322
  # bigtable = Google::Cloud::Bigtable.new
323
323
  #
324
- # table = bigtable.table("my-instance", "my-table", perform_lookup: true, view: :SCHEMA_VIEW)
324
+ # table = bigtable.table("my-instance", "my-table", perform_lookup: true)
325
325
  # if table
326
326
  # puts table.name
327
327
  # puts table.column_families
328
328
  # end
329
329
  #
330
- # @example Get a table with all fields, cluster states, and column families.
330
+ # @example Retrieve a table with all fields, cluster states, and column families.
331
331
  # require "google/cloud/bigtable"
332
332
  #
333
333
  # bigtable = Google::Cloud::Bigtable.new
@@ -342,6 +342,7 @@ module Google
342
342
  def table instance_id, table_id, view: nil, perform_lookup: nil, app_profile_id: nil
343
343
  ensure_service!
344
344
 
345
+ view ||= :SCHEMA_VIEW
345
346
  table = if perform_lookup
346
347
  grpc = service.get_table instance_id, table_id, view: view
347
348
  Table.from_grpc grpc, service, view: view
@@ -56,6 +56,14 @@ module Google
56
56
  # The gRPC Service object.
57
57
  attr_accessor :service
58
58
 
59
+ # @private
60
+ # The current gRPC resource, for testing only.
61
+ attr_accessor :grpc
62
+
63
+ # @private
64
+ # The current loaded_views, for testing only. See #check_view_and_load, below.
65
+ attr_reader :loaded_views
66
+
59
67
  ##
60
68
  # @return [String] App profile ID for request routing.
61
69
  #
@@ -64,10 +72,11 @@ module Google
64
72
  # @private
65
73
  #
66
74
  # Creates a new Table instance.
67
- def initialize grpc, service, view: nil
75
+ def initialize grpc, service, view:
68
76
  @grpc = grpc
69
77
  @service = service
70
- @view = view || :SCHEMA_VIEW
78
+ raise ArgumentError, "view must not be nil" if view.nil?
79
+ @loaded_views = Set[view]
71
80
  end
72
81
 
73
82
  ##
@@ -109,7 +118,8 @@ module Google
109
118
  end
110
119
 
111
120
  ##
112
- # Reloads table data.
121
+ # Reloads table data with the provided `view`, or with `SCHEMA_VIEW`
122
+ # if none is provided. Previously loaded data is not retained.
113
123
  #
114
124
  # @param view [Symbol] Table view type.
115
125
  # Default view type is `:SCHEMA_VIEW`.
@@ -123,8 +133,9 @@ module Google
123
133
  # @return [Google::Cloud::Bigtable::Table]
124
134
  #
125
135
  def reload! view: nil
126
- @view = view || :SCHEMA_VIEW
136
+ view ||= :SCHEMA_VIEW
127
137
  @grpc = service.get_table instance_id, name, view: view
138
+ @loaded_views = Set[view]
128
139
  self
129
140
  end
130
141
 
@@ -133,7 +144,10 @@ module Google
133
144
  # If it could not be determined whether or not the table has data in a
134
145
  # particular cluster (for example, if its zone is unavailable), then
135
146
  # there will be an entry for the cluster with UNKNOWN `replication_status`.
136
- # Views: `FULL`.
147
+ #
148
+ # Reloads the table if necessary to retrieve the cluster states data,
149
+ # since it is only available in a table with view type `REPLICATION_VIEW`
150
+ # or `FULL`. Previously loaded data is retained.
137
151
  #
138
152
  # @return [Array<Google::Cloud::Bigtable::Table::ClusterState>]
139
153
  #
@@ -146,9 +160,11 @@ module Google
146
160
 
147
161
  ##
148
162
  # Returns a frozen object containing the column families configured for
149
- # the table, mapped by column family name. Reloads the table if
150
- # necessary to retrieve the column families data, since it is only
151
- # available in a table with view type `SCHEMA_VIEW` or `FULL`.
163
+ # the table, mapped by column family name.
164
+ #
165
+ # Reloads the table if necessary to retrieve the column families data,
166
+ # since it is only available in a table with view type `SCHEMA_VIEW`
167
+ # or `FULL`. Previously loaded data is retained.
152
168
  #
153
169
  # Also accepts a block for making modifications to the table's column
154
170
  # families. After the modifications are completed, the table will be
@@ -224,7 +240,10 @@ module Google
224
240
  # The granularity (e.g. `MILLIS`, `MICROS`) at which timestamps are stored in
225
241
  # this table. Timestamps not matching the granularity will be rejected.
226
242
  # If unspecified at creation time, the value will be set to `MILLIS`.
227
- # Views: `SCHEMA_VIEW`, `FULL`.
243
+ #
244
+ # Reloads the table if necessary to retrieve the column families data,
245
+ # since it is only available in a table with view type `SCHEMA_VIEW`
246
+ # or `FULL`. Previously loaded data is retained.
228
247
  #
229
248
  # @return [Symbol]
230
249
  #
@@ -439,7 +458,7 @@ module Google
439
458
  }.delete_if { |_, v| v.nil? })
440
459
 
441
460
  grpc = service.create_table instance_id, table_id, table, initial_splits: initial_splits
442
- from_grpc grpc, service
461
+ from_grpc grpc, service, view: :SCHEMA_VIEW
443
462
  end
444
463
 
445
464
  ##
@@ -625,7 +644,7 @@ module Google
625
644
  # @param view [Symbol] View type.
626
645
  # @return [Google::Cloud::Bigtable::Table]
627
646
  #
628
- def self.from_grpc grpc, service, view: nil
647
+ def self.from_grpc grpc, service, view:
629
648
  new grpc, service, view: view
630
649
  end
631
650
 
@@ -666,7 +685,6 @@ module Google
666
685
  #
667
686
  def check_view_and_load view
668
687
  ensure_service!
669
- @loaded_views ||= Set.new [@view]
670
688
 
671
689
  return if @loaded_views.include?(view) || @loaded_views.include?(:FULL)
672
690
 
@@ -108,7 +108,7 @@ module Google
108
108
  # end
109
109
  #
110
110
  def table
111
- Table.from_grpc results, service if results
111
+ Table.from_grpc results, service, view: :NAME_ONLY if results
112
112
  end
113
113
  end
114
114
  end
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Bigtable
19
- VERSION = "2.4.0".freeze
19
+ VERSION = "2.4.1".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: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-11 00:00:00.000000000 Z
11
+ date: 2021-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-bigtable-admin-v2