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.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +1 -1
  3. data/CHANGELOG.md +54 -0
  4. data/CONTRIBUTING.md +1 -1
  5. data/OVERVIEW.md +4 -4
  6. data/lib/google-cloud-bigtable.rb +30 -27
  7. data/lib/google/cloud/bigtable.rb +18 -26
  8. data/lib/google/cloud/bigtable/app_profile.rb +3 -3
  9. data/lib/google/cloud/bigtable/app_profile/list.rb +4 -2
  10. data/lib/google/cloud/bigtable/backup.rb +123 -2
  11. data/lib/google/cloud/bigtable/backup/list.rb +2 -2
  12. data/lib/google/cloud/bigtable/chunk_processor.rb +1 -1
  13. data/lib/google/cloud/bigtable/cluster.rb +2 -2
  14. data/lib/google/cloud/bigtable/cluster/list.rb +1 -1
  15. data/lib/google/cloud/bigtable/column_family.rb +2 -2
  16. data/lib/google/cloud/bigtable/column_family_map.rb +10 -10
  17. data/lib/google/cloud/bigtable/column_range.rb +2 -2
  18. data/lib/google/cloud/bigtable/convert.rb +12 -0
  19. data/lib/google/cloud/bigtable/credentials.rb +36 -2
  20. data/lib/google/cloud/bigtable/gc_rule.rb +7 -7
  21. data/lib/google/cloud/bigtable/instance.rb +8 -8
  22. data/lib/google/cloud/bigtable/instance/cluster_map.rb +1 -1
  23. data/lib/google/cloud/bigtable/instance/list.rb +1 -1
  24. data/lib/google/cloud/bigtable/longrunning_job.rb +2 -2
  25. data/lib/google/cloud/bigtable/mutation_entry.rb +22 -18
  26. data/lib/google/cloud/bigtable/mutation_operations.rb +6 -6
  27. data/lib/google/cloud/bigtable/project.rb +1 -1
  28. data/lib/google/cloud/bigtable/read_modify_write_rule.rb +2 -2
  29. data/lib/google/cloud/bigtable/read_operations.rb +2 -2
  30. data/lib/google/cloud/bigtable/routing_policy.rb +2 -2
  31. data/lib/google/cloud/bigtable/row_filter/chain_filter.rb +3 -3
  32. data/lib/google/cloud/bigtable/row_filter/condition_filter.rb +3 -3
  33. data/lib/google/cloud/bigtable/row_filter/interleave_filter.rb +3 -3
  34. data/lib/google/cloud/bigtable/row_filter/simple_filter.rb +9 -4
  35. data/lib/google/cloud/bigtable/row_range.rb +2 -2
  36. data/lib/google/cloud/bigtable/rows_mutator.rb +3 -3
  37. data/lib/google/cloud/bigtable/rows_reader.rb +10 -10
  38. data/lib/google/cloud/bigtable/sample_row_key.rb +2 -2
  39. data/lib/google/cloud/bigtable/service.rb +239 -281
  40. data/lib/google/cloud/bigtable/table.rb +5 -4
  41. data/lib/google/cloud/bigtable/table/cluster_state.rb +2 -2
  42. data/lib/google/cloud/bigtable/table/list.rb +1 -1
  43. data/lib/google/cloud/bigtable/value_range.rb +26 -8
  44. data/lib/google/cloud/bigtable/version.rb +1 -1
  45. metadata +12 -94
  46. data/lib/google/bigtable/admin/v2/bigtable_instance_admin_pb.rb +0 -145
  47. data/lib/google/bigtable/admin/v2/bigtable_instance_admin_services_pb.rb +0 -90
  48. data/lib/google/bigtable/admin/v2/bigtable_table_admin_pb.rb +0 -208
  49. data/lib/google/bigtable/admin/v2/bigtable_table_admin_services_pb.rb +0 -154
  50. data/lib/google/bigtable/admin/v2/common_pb.rb +0 -30
  51. data/lib/google/bigtable/admin/v2/instance_pb.rb +0 -74
  52. data/lib/google/bigtable/admin/v2/table_pb.rb +0 -127
  53. data/lib/google/bigtable/v2/bigtable_pb.rb +0 -113
  54. data/lib/google/bigtable/v2/bigtable_services_pb.rb +0 -68
  55. data/lib/google/bigtable/v2/data_pb.rb +0 -156
  56. data/lib/google/cloud/bigtable/admin.rb +0 -202
  57. data/lib/google/cloud/bigtable/admin/credentials.rb +0 -27
  58. data/lib/google/cloud/bigtable/admin/v2.rb +0 -223
  59. data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb +0 -1451
  60. data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client_config.json +0 -139
  61. data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb +0 -1734
  62. data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client_config.json +0 -163
  63. data/lib/google/cloud/bigtable/admin/v2/credentials.rb +0 -51
  64. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_instance_admin.rb +0 -297
  65. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_table_admin.rb +0 -587
  66. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/instance.rb +0 -193
  67. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/table.rb +0 -303
  68. data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/iam_policy.rb +0 -64
  69. data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/options.rb +0 -33
  70. data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/policy.rb +0 -151
  71. data/lib/google/cloud/bigtable/admin/v2/doc/google/longrunning/operations.rb +0 -51
  72. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/any.rb +0 -131
  73. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/duration.rb +0 -91
  74. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/empty.rb +0 -29
  75. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/field_mask.rb +0 -222
  76. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/timestamp.rb +0 -113
  77. data/lib/google/cloud/bigtable/admin/v2/doc/google/rpc/status.rb +0 -39
  78. data/lib/google/cloud/bigtable/admin/v2/doc/google/type/expr.rb +0 -45
  79. data/lib/google/cloud/bigtable/v2.rb +0 -146
  80. data/lib/google/cloud/bigtable/v2/bigtable_client.rb +0 -591
  81. data/lib/google/cloud/bigtable/v2/bigtable_client_config.json +0 -83
  82. data/lib/google/cloud/bigtable/v2/credentials.rb +0 -46
  83. data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/bigtable.rb +0 -290
  84. data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/data.rb +0 -493
  85. data/lib/google/cloud/bigtable/v2/doc/google/protobuf/any.rb +0 -131
  86. data/lib/google/cloud/bigtable/v2/doc/google/protobuf/wrappers.rb +0 -34
  87. data/lib/google/cloud/bigtable/v2/doc/google/rpc/status.rb +0 -39
@@ -1,146 +0,0 @@
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
- require "google/cloud/bigtable/v2/bigtable_client"
17
-
18
- module Google
19
- module Cloud
20
- module Bigtable
21
- # rubocop:disable LineLength
22
-
23
- ##
24
- # # Ruby Client for Cloud Bigtable API
25
- #
26
- # [Cloud Bigtable API][Product Documentation]:
27
- # API for reading and writing the contents of Bigtables associated with a
28
- # cloud project.
29
- # - [Product Documentation][]
30
- #
31
- # ## Quick Start
32
- # In order to use this library, you first need to go through the following
33
- # steps:
34
- #
35
- # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
36
- # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
37
- # 3. [Enable the Cloud Bigtable API.](https://console.cloud.google.com/apis/library/bigtable.googleapis.com)
38
- # 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-bigtable/latest/file.AUTHENTICATION.html)
39
- #
40
- # ### Installation
41
- # ```
42
- # $ gem install google-cloud-bigtable
43
- # ```
44
- #
45
- # ### Next Steps
46
- # - Read the [Cloud Bigtable API Product documentation][Product Documentation]
47
- # to learn more about the product and see How-to Guides.
48
- # - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
49
- # to see the full list of Cloud APIs that we cover.
50
- #
51
- # [Product Documentation]: https://cloud.google.com/bigtable
52
- #
53
- # ## Enabling Logging
54
- #
55
- # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
56
- # The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
57
- # or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
58
- # that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
59
- # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
60
- #
61
- # Configuring a Ruby stdlib logger:
62
- #
63
- # ```ruby
64
- # require "logger"
65
- #
66
- # module MyLogger
67
- # LOGGER = Logger.new $stderr, level: Logger::WARN
68
- # def logger
69
- # LOGGER
70
- # end
71
- # end
72
- #
73
- # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
74
- # module GRPC
75
- # extend MyLogger
76
- # end
77
- # ```
78
- #
79
- module V2
80
- # rubocop:enable LineLength
81
-
82
- ##
83
- # Service for reading from and writing to existing Bigtable tables.
84
- #
85
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
86
- # Provides the means for authenticating requests made by the client. This parameter can
87
- # be many types.
88
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
89
- # authenticating requests made by this client.
90
- # A `String` will be treated as the path to the keyfile to be used for the construction of
91
- # credentials for this client.
92
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
93
- # credentials for this client.
94
- # A `GRPC::Core::Channel` will be used to make calls through.
95
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
96
- # should already be composed with a `GRPC::Core::CallCredentials` object.
97
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
98
- # metadata for requests, generally, to give OAuth credentials.
99
- # @param scopes [Array<String>]
100
- # The OAuth scopes for this service. This parameter is ignored if
101
- # an updater_proc is supplied.
102
- # @param client_config [Hash]
103
- # A Hash for call options for each method. See
104
- # Google::Gax#construct_settings for the structure of
105
- # this data. Falls back to the default config if not specified
106
- # or the specified config is missing data points.
107
- # @param timeout [Numeric]
108
- # The default timeout, in seconds, for calls made through this client.
109
- # @param metadata [Hash]
110
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
111
- # @param service_address [String]
112
- # Override for the service hostname, or `nil` to leave as the default.
113
- # @param service_port [Integer]
114
- # Override for the service port, or `nil` to leave as the default.
115
- # @param exception_transformer [Proc]
116
- # An optional proc that intercepts any exceptions raised during an API call to inject
117
- # custom error handling.
118
- def self.new \
119
- credentials: nil,
120
- scopes: nil,
121
- client_config: nil,
122
- timeout: nil,
123
- metadata: nil,
124
- service_address: nil,
125
- service_port: nil,
126
- exception_transformer: nil,
127
- lib_name: nil,
128
- lib_version: nil
129
- kwargs = {
130
- credentials: credentials,
131
- scopes: scopes,
132
- client_config: client_config,
133
- timeout: timeout,
134
- metadata: metadata,
135
- exception_transformer: exception_transformer,
136
- lib_name: lib_name,
137
- service_address: service_address,
138
- service_port: service_port,
139
- lib_version: lib_version
140
- }.select { |_, v| v != nil }
141
- Google::Cloud::Bigtable::V2::BigtableClient.new(**kwargs)
142
- end
143
- end
144
- end
145
- end
146
- end
@@ -1,591 +0,0 @@
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
- # EDITING INSTRUCTIONS
16
- # This file was generated from the file
17
- # https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/bigtable.proto,
18
- # and updates to that file get reflected here through a refresh process.
19
- # For the short term, the refresh process will only be runnable by Google
20
- # engineers.
21
-
22
-
23
- require "json"
24
- require "pathname"
25
-
26
- require "google/gax"
27
-
28
- require "google/bigtable/v2/bigtable_pb"
29
- require "google/cloud/bigtable/v2/credentials"
30
- require "google/cloud/bigtable/version"
31
-
32
- module Google
33
- module Cloud
34
- module Bigtable
35
- module V2
36
- # Service for reading from and writing to existing Bigtable tables.
37
- #
38
- # @!attribute [r] bigtable_stub
39
- # @return [Google::Bigtable::V2::Bigtable::Stub]
40
- class BigtableClient
41
- # @private
42
- attr_reader :bigtable_stub
43
-
44
- # The default address of the service.
45
- SERVICE_ADDRESS = "bigtable.googleapis.com".freeze
46
-
47
- # The default port of the service.
48
- DEFAULT_SERVICE_PORT = 443
49
-
50
- # The default set of gRPC interceptors.
51
- GRPC_INTERCEPTORS = []
52
-
53
- DEFAULT_TIMEOUT = 30
54
-
55
- # The scopes needed to make gRPC calls to all of the methods defined in
56
- # this service.
57
- ALL_SCOPES = [
58
- "https://www.googleapis.com/auth/bigtable.data",
59
- "https://www.googleapis.com/auth/bigtable.data.readonly",
60
- "https://www.googleapis.com/auth/cloud-bigtable.data",
61
- "https://www.googleapis.com/auth/cloud-bigtable.data.readonly",
62
- "https://www.googleapis.com/auth/cloud-platform",
63
- "https://www.googleapis.com/auth/cloud-platform.read-only"
64
- ].freeze
65
-
66
-
67
- TABLE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
68
- "projects/{project}/instances/{instance}/tables/{table}"
69
- )
70
-
71
- private_constant :TABLE_PATH_TEMPLATE
72
-
73
- # Returns a fully-qualified table resource name string.
74
- # @param project [String]
75
- # @param instance [String]
76
- # @param table [String]
77
- # @return [String]
78
- def self.table_path project, instance, table
79
- TABLE_PATH_TEMPLATE.render(
80
- :"project" => project,
81
- :"instance" => instance,
82
- :"table" => table
83
- )
84
- end
85
-
86
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
87
- # Provides the means for authenticating requests made by the client. This parameter can
88
- # be many types.
89
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
90
- # authenticating requests made by this client.
91
- # A `String` will be treated as the path to the keyfile to be used for the construction of
92
- # credentials for this client.
93
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
94
- # credentials for this client.
95
- # A `GRPC::Core::Channel` will be used to make calls through.
96
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
97
- # should already be composed with a `GRPC::Core::CallCredentials` object.
98
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
99
- # metadata for requests, generally, to give OAuth credentials.
100
- # @param scopes [Array<String>]
101
- # The OAuth scopes for this service. This parameter is ignored if
102
- # an updater_proc is supplied.
103
- # @param client_config [Hash]
104
- # A Hash for call options for each method. See
105
- # Google::Gax#construct_settings for the structure of
106
- # this data. Falls back to the default config if not specified
107
- # or the specified config is missing data points.
108
- # @param timeout [Numeric]
109
- # The default timeout, in seconds, for calls made through this client.
110
- # @param metadata [Hash]
111
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
112
- # @param service_address [String]
113
- # Override for the service hostname, or `nil` to leave as the default.
114
- # @param service_port [Integer]
115
- # Override for the service port, or `nil` to leave as the default.
116
- # @param exception_transformer [Proc]
117
- # An optional proc that intercepts any exceptions raised during an API call to inject
118
- # custom error handling.
119
- def initialize \
120
- credentials: nil,
121
- scopes: ALL_SCOPES,
122
- client_config: {},
123
- timeout: DEFAULT_TIMEOUT,
124
- metadata: nil,
125
- service_address: nil,
126
- service_port: nil,
127
- exception_transformer: nil,
128
- lib_name: nil,
129
- lib_version: ""
130
- # These require statements are intentionally placed here to initialize
131
- # the gRPC module only when it's required.
132
- # See https://github.com/googleapis/toolkit/issues/446
133
- require "google/gax/grpc"
134
- require "google/bigtable/v2/bigtable_services_pb"
135
-
136
- credentials ||= Google::Cloud::Bigtable::V2::Credentials.default
137
-
138
- if credentials.is_a?(String) || credentials.is_a?(Hash)
139
- updater_proc = Google::Cloud::Bigtable::V2::Credentials.new(credentials).updater_proc
140
- end
141
- if credentials.is_a?(GRPC::Core::Channel)
142
- channel = credentials
143
- end
144
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
145
- chan_creds = credentials
146
- end
147
- if credentials.is_a?(Proc)
148
- updater_proc = credentials
149
- end
150
- if credentials.is_a?(Google::Auth::Credentials)
151
- updater_proc = credentials.updater_proc
152
- end
153
-
154
- package_version = Google::Cloud::Bigtable::VERSION
155
-
156
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
157
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
158
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
159
- google_api_client << " grpc/#{GRPC::VERSION}"
160
- google_api_client.freeze
161
-
162
- headers = { :"x-goog-api-client" => google_api_client }
163
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
164
- headers[:"x-goog-user-project"] = credentials.quota_project_id
165
- end
166
- headers.merge!(metadata) unless metadata.nil?
167
- client_config_file = Pathname.new(__dir__).join(
168
- "bigtable_client_config.json"
169
- )
170
- defaults = client_config_file.open do |f|
171
- Google::Gax.construct_settings(
172
- "google.bigtable.v2.Bigtable",
173
- JSON.parse(f.read),
174
- client_config,
175
- Google::Gax::Grpc::STATUS_CODE_NAMES,
176
- timeout,
177
- errors: Google::Gax::Grpc::API_ERRORS,
178
- metadata: headers
179
- )
180
- end
181
-
182
- # Allow overriding the service path/port in subclasses.
183
- service_path = service_address || self.class::SERVICE_ADDRESS
184
- port = service_port || self.class::DEFAULT_SERVICE_PORT
185
- interceptors = self.class::GRPC_INTERCEPTORS
186
- @bigtable_stub = Google::Gax::Grpc.create_stub(
187
- service_path,
188
- port,
189
- chan_creds: chan_creds,
190
- channel: channel,
191
- updater_proc: updater_proc,
192
- scopes: scopes,
193
- interceptors: interceptors,
194
- &Google::Bigtable::V2::Bigtable::Stub.method(:new)
195
- )
196
-
197
- @read_rows = Google::Gax.create_api_call(
198
- @bigtable_stub.method(:read_rows),
199
- defaults["read_rows"],
200
- exception_transformer: exception_transformer,
201
- params_extractor: proc do |request|
202
- {'table_name' => request.table_name}
203
- end
204
- )
205
- @sample_row_keys = Google::Gax.create_api_call(
206
- @bigtable_stub.method(:sample_row_keys),
207
- defaults["sample_row_keys"],
208
- exception_transformer: exception_transformer,
209
- params_extractor: proc do |request|
210
- {'table_name' => request.table_name}
211
- end
212
- )
213
- @mutate_row = Google::Gax.create_api_call(
214
- @bigtable_stub.method(:mutate_row),
215
- defaults["mutate_row"],
216
- exception_transformer: exception_transformer,
217
- params_extractor: proc do |request|
218
- {'table_name' => request.table_name}
219
- end
220
- )
221
- @mutate_rows = Google::Gax.create_api_call(
222
- @bigtable_stub.method(:mutate_rows),
223
- defaults["mutate_rows"],
224
- exception_transformer: exception_transformer,
225
- params_extractor: proc do |request|
226
- {'table_name' => request.table_name}
227
- end
228
- )
229
- @check_and_mutate_row = Google::Gax.create_api_call(
230
- @bigtable_stub.method(:check_and_mutate_row),
231
- defaults["check_and_mutate_row"],
232
- exception_transformer: exception_transformer,
233
- params_extractor: proc do |request|
234
- {'table_name' => request.table_name}
235
- end
236
- )
237
- @read_modify_write_row = Google::Gax.create_api_call(
238
- @bigtable_stub.method(:read_modify_write_row),
239
- defaults["read_modify_write_row"],
240
- exception_transformer: exception_transformer,
241
- params_extractor: proc do |request|
242
- {'table_name' => request.table_name}
243
- end
244
- )
245
- end
246
-
247
- # Service calls
248
-
249
- # Streams back the contents of all requested rows in key order, optionally
250
- # applying the same Reader filter to each. Depending on their size,
251
- # rows and cells may be broken up across multiple responses, but
252
- # atomicity of each row will still be preserved. See the
253
- # ReadRowsResponse documentation for details.
254
- #
255
- # @param table_name [String]
256
- # Required. The unique name of the table from which to read.
257
- # Values are of the form
258
- # `projects/<project>/instances/<instance>/tables/<table>`.
259
- # @param app_profile_id [String]
260
- # This value specifies routing for replication. If not specified, the
261
- # "default" application profile will be used.
262
- # @param rows [Google::Bigtable::V2::RowSet | Hash]
263
- # The row keys and/or ranges to read. If not specified, reads from all rows.
264
- # A hash of the same form as `Google::Bigtable::V2::RowSet`
265
- # can also be provided.
266
- # @param filter [Google::Bigtable::V2::RowFilter | Hash]
267
- # The filter to apply to the contents of the specified row(s). If unset,
268
- # reads the entirety of each row.
269
- # A hash of the same form as `Google::Bigtable::V2::RowFilter`
270
- # can also be provided.
271
- # @param rows_limit [Integer]
272
- # The read will terminate after committing to N rows' worth of results. The
273
- # default (zero) is to return all results.
274
- # @param options [Google::Gax::CallOptions]
275
- # Overrides the default settings for this call, e.g, timeout,
276
- # retries, etc.
277
- # @return [Enumerable<Google::Bigtable::V2::ReadRowsResponse>]
278
- # An enumerable of Google::Bigtable::V2::ReadRowsResponse instances.
279
- #
280
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
281
- # @example
282
- # require "google/cloud/bigtable/v2"
283
- #
284
- # bigtable_client = Google::Cloud::Bigtable::V2.new
285
- # formatted_table_name = Google::Cloud::Bigtable::V2::BigtableClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
286
- # bigtable_client.read_rows(formatted_table_name).each do |element|
287
- # # Process element.
288
- # end
289
-
290
- def read_rows \
291
- table_name,
292
- app_profile_id: nil,
293
- rows: nil,
294
- filter: nil,
295
- rows_limit: nil,
296
- options: nil
297
- req = {
298
- table_name: table_name,
299
- app_profile_id: app_profile_id,
300
- rows: rows,
301
- filter: filter,
302
- rows_limit: rows_limit
303
- }.delete_if { |_, v| v.nil? }
304
- req = Google::Gax::to_proto(req, Google::Bigtable::V2::ReadRowsRequest)
305
- @read_rows.call(req, options)
306
- end
307
-
308
- # Returns a sample of row keys in the table. The returned row keys will
309
- # delimit contiguous sections of the table of approximately equal size,
310
- # which can be used to break up the data for distributed tasks like
311
- # mapreduces.
312
- #
313
- # @param table_name [String]
314
- # Required. The unique name of the table from which to sample row keys.
315
- # Values are of the form
316
- # `projects/<project>/instances/<instance>/tables/<table>`.
317
- # @param app_profile_id [String]
318
- # This value specifies routing for replication. If not specified, the
319
- # "default" application profile will be used.
320
- # @param options [Google::Gax::CallOptions]
321
- # Overrides the default settings for this call, e.g, timeout,
322
- # retries, etc.
323
- # @return [Enumerable<Google::Bigtable::V2::SampleRowKeysResponse>]
324
- # An enumerable of Google::Bigtable::V2::SampleRowKeysResponse instances.
325
- #
326
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
327
- # @example
328
- # require "google/cloud/bigtable/v2"
329
- #
330
- # bigtable_client = Google::Cloud::Bigtable::V2.new
331
- # formatted_table_name = Google::Cloud::Bigtable::V2::BigtableClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
332
- # bigtable_client.sample_row_keys(formatted_table_name).each do |element|
333
- # # Process element.
334
- # end
335
-
336
- def sample_row_keys \
337
- table_name,
338
- app_profile_id: nil,
339
- options: nil
340
- req = {
341
- table_name: table_name,
342
- app_profile_id: app_profile_id
343
- }.delete_if { |_, v| v.nil? }
344
- req = Google::Gax::to_proto(req, Google::Bigtable::V2::SampleRowKeysRequest)
345
- @sample_row_keys.call(req, options)
346
- end
347
-
348
- # Mutates a row atomically. Cells already present in the row are left
349
- # unchanged unless explicitly changed by `mutation`.
350
- #
351
- # @param table_name [String]
352
- # Required. The unique name of the table to which the mutation should be applied.
353
- # Values are of the form
354
- # `projects/<project>/instances/<instance>/tables/<table>`.
355
- # @param row_key [String]
356
- # Required. The key of the row to which the mutation should be applied.
357
- # @param mutations [Array<Google::Bigtable::V2::Mutation | Hash>]
358
- # Required. Changes to be atomically applied to the specified row. Entries are applied
359
- # in order, meaning that earlier mutations can be masked by later ones.
360
- # Must contain at least one entry and at most 100000.
361
- # A hash of the same form as `Google::Bigtable::V2::Mutation`
362
- # can also be provided.
363
- # @param app_profile_id [String]
364
- # This value specifies routing for replication. If not specified, the
365
- # "default" application profile will be used.
366
- # @param options [Google::Gax::CallOptions]
367
- # Overrides the default settings for this call, e.g, timeout,
368
- # retries, etc.
369
- # @yield [result, operation] Access the result along with the RPC operation
370
- # @yieldparam result [Google::Bigtable::V2::MutateRowResponse]
371
- # @yieldparam operation [GRPC::ActiveCall::Operation]
372
- # @return [Google::Bigtable::V2::MutateRowResponse]
373
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
374
- # @example
375
- # require "google/cloud/bigtable/v2"
376
- #
377
- # bigtable_client = Google::Cloud::Bigtable::V2.new
378
- # formatted_table_name = Google::Cloud::Bigtable::V2::BigtableClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
379
- #
380
- # # TODO: Initialize `row_key`:
381
- # row_key = ''
382
- #
383
- # # TODO: Initialize `mutations`:
384
- # mutations = []
385
- # response = bigtable_client.mutate_row(formatted_table_name, row_key, mutations)
386
-
387
- def mutate_row \
388
- table_name,
389
- row_key,
390
- mutations,
391
- app_profile_id: nil,
392
- options: nil,
393
- &block
394
- req = {
395
- table_name: table_name,
396
- row_key: row_key,
397
- mutations: mutations,
398
- app_profile_id: app_profile_id
399
- }.delete_if { |_, v| v.nil? }
400
- req = Google::Gax::to_proto(req, Google::Bigtable::V2::MutateRowRequest)
401
- @mutate_row.call(req, options, &block)
402
- end
403
-
404
- # Mutates multiple rows in a batch. Each individual row is mutated
405
- # atomically as in MutateRow, but the entire batch is not executed
406
- # atomically.
407
- #
408
- # @param table_name [String]
409
- # Required. The unique name of the table to which the mutations should be applied.
410
- # @param entries [Array<Google::Bigtable::V2::MutateRowsRequest::Entry | Hash>]
411
- # Required. The row keys and corresponding mutations to be applied in bulk.
412
- # Each entry is applied as an atomic mutation, but the entries may be
413
- # applied in arbitrary order (even between entries for the same row).
414
- # At least one entry must be specified, and in total the entries can
415
- # contain at most 100000 mutations.
416
- # A hash of the same form as `Google::Bigtable::V2::MutateRowsRequest::Entry`
417
- # can also be provided.
418
- # @param app_profile_id [String]
419
- # This value specifies routing for replication. If not specified, the
420
- # "default" application profile will be used.
421
- # @param options [Google::Gax::CallOptions]
422
- # Overrides the default settings for this call, e.g, timeout,
423
- # retries, etc.
424
- # @return [Enumerable<Google::Bigtable::V2::MutateRowsResponse>]
425
- # An enumerable of Google::Bigtable::V2::MutateRowsResponse instances.
426
- #
427
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
428
- # @example
429
- # require "google/cloud/bigtable/v2"
430
- #
431
- # bigtable_client = Google::Cloud::Bigtable::V2.new
432
- # formatted_table_name = Google::Cloud::Bigtable::V2::BigtableClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
433
- #
434
- # # TODO: Initialize `entries`:
435
- # entries = []
436
- # bigtable_client.mutate_rows(formatted_table_name, entries).each do |element|
437
- # # Process element.
438
- # end
439
-
440
- def mutate_rows \
441
- table_name,
442
- entries,
443
- app_profile_id: nil,
444
- options: nil
445
- req = {
446
- table_name: table_name,
447
- entries: entries,
448
- app_profile_id: app_profile_id
449
- }.delete_if { |_, v| v.nil? }
450
- req = Google::Gax::to_proto(req, Google::Bigtable::V2::MutateRowsRequest)
451
- @mutate_rows.call(req, options)
452
- end
453
-
454
- # Mutates a row atomically based on the output of a predicate Reader filter.
455
- #
456
- # @param table_name [String]
457
- # Required. The unique name of the table to which the conditional mutation should be
458
- # applied.
459
- # Values are of the form
460
- # `projects/<project>/instances/<instance>/tables/<table>`.
461
- # @param row_key [String]
462
- # Required. The key of the row to which the conditional mutation should be applied.
463
- # @param app_profile_id [String]
464
- # This value specifies routing for replication. If not specified, the
465
- # "default" application profile will be used.
466
- # @param predicate_filter [Google::Bigtable::V2::RowFilter | Hash]
467
- # The filter to be applied to the contents of the specified row. Depending
468
- # on whether or not any results are yielded, either `true_mutations` or
469
- # `false_mutations` will be executed. If unset, checks that the row contains
470
- # any values at all.
471
- # A hash of the same form as `Google::Bigtable::V2::RowFilter`
472
- # can also be provided.
473
- # @param true_mutations [Array<Google::Bigtable::V2::Mutation | Hash>]
474
- # Changes to be atomically applied to the specified row if `predicate_filter`
475
- # yields at least one cell when applied to `row_key`. Entries are applied in
476
- # order, meaning that earlier mutations can be masked by later ones.
477
- # Must contain at least one entry if `false_mutations` is empty, and at most
478
- # 100000.
479
- # A hash of the same form as `Google::Bigtable::V2::Mutation`
480
- # can also be provided.
481
- # @param false_mutations [Array<Google::Bigtable::V2::Mutation | Hash>]
482
- # Changes to be atomically applied to the specified row if `predicate_filter`
483
- # does not yield any cells when applied to `row_key`. Entries are applied in
484
- # order, meaning that earlier mutations can be masked by later ones.
485
- # Must contain at least one entry if `true_mutations` is empty, and at most
486
- # 100000.
487
- # A hash of the same form as `Google::Bigtable::V2::Mutation`
488
- # can also be provided.
489
- # @param options [Google::Gax::CallOptions]
490
- # Overrides the default settings for this call, e.g, timeout,
491
- # retries, etc.
492
- # @yield [result, operation] Access the result along with the RPC operation
493
- # @yieldparam result [Google::Bigtable::V2::CheckAndMutateRowResponse]
494
- # @yieldparam operation [GRPC::ActiveCall::Operation]
495
- # @return [Google::Bigtable::V2::CheckAndMutateRowResponse]
496
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
497
- # @example
498
- # require "google/cloud/bigtable/v2"
499
- #
500
- # bigtable_client = Google::Cloud::Bigtable::V2.new
501
- # formatted_table_name = Google::Cloud::Bigtable::V2::BigtableClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
502
- #
503
- # # TODO: Initialize `row_key`:
504
- # row_key = ''
505
- # response = bigtable_client.check_and_mutate_row(formatted_table_name, row_key)
506
-
507
- def check_and_mutate_row \
508
- table_name,
509
- row_key,
510
- app_profile_id: nil,
511
- predicate_filter: nil,
512
- true_mutations: nil,
513
- false_mutations: nil,
514
- options: nil,
515
- &block
516
- req = {
517
- table_name: table_name,
518
- row_key: row_key,
519
- app_profile_id: app_profile_id,
520
- predicate_filter: predicate_filter,
521
- true_mutations: true_mutations,
522
- false_mutations: false_mutations
523
- }.delete_if { |_, v| v.nil? }
524
- req = Google::Gax::to_proto(req, Google::Bigtable::V2::CheckAndMutateRowRequest)
525
- @check_and_mutate_row.call(req, options, &block)
526
- end
527
-
528
- # Modifies a row atomically on the server. The method reads the latest
529
- # existing timestamp and value from the specified columns and writes a new
530
- # entry based on pre-defined read/modify/write rules. The new value for the
531
- # timestamp is the greater of the existing timestamp or the current server
532
- # time. The method returns the new contents of all modified cells.
533
- #
534
- # @param table_name [String]
535
- # Required. The unique name of the table to which the read/modify/write rules should be
536
- # applied.
537
- # Values are of the form
538
- # `projects/<project>/instances/<instance>/tables/<table>`.
539
- # @param row_key [String]
540
- # Required. The key of the row to which the read/modify/write rules should be applied.
541
- # @param rules [Array<Google::Bigtable::V2::ReadModifyWriteRule | Hash>]
542
- # Required. Rules specifying how the specified row's contents are to be transformed
543
- # into writes. Entries are applied in order, meaning that earlier rules will
544
- # affect the results of later ones.
545
- # A hash of the same form as `Google::Bigtable::V2::ReadModifyWriteRule`
546
- # can also be provided.
547
- # @param app_profile_id [String]
548
- # This value specifies routing for replication. If not specified, the
549
- # "default" application profile will be used.
550
- # @param options [Google::Gax::CallOptions]
551
- # Overrides the default settings for this call, e.g, timeout,
552
- # retries, etc.
553
- # @yield [result, operation] Access the result along with the RPC operation
554
- # @yieldparam result [Google::Bigtable::V2::ReadModifyWriteRowResponse]
555
- # @yieldparam operation [GRPC::ActiveCall::Operation]
556
- # @return [Google::Bigtable::V2::ReadModifyWriteRowResponse]
557
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
558
- # @example
559
- # require "google/cloud/bigtable/v2"
560
- #
561
- # bigtable_client = Google::Cloud::Bigtable::V2.new
562
- # formatted_table_name = Google::Cloud::Bigtable::V2::BigtableClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
563
- #
564
- # # TODO: Initialize `row_key`:
565
- # row_key = ''
566
- #
567
- # # TODO: Initialize `rules`:
568
- # rules = []
569
- # response = bigtable_client.read_modify_write_row(formatted_table_name, row_key, rules)
570
-
571
- def read_modify_write_row \
572
- table_name,
573
- row_key,
574
- rules,
575
- app_profile_id: nil,
576
- options: nil,
577
- &block
578
- req = {
579
- table_name: table_name,
580
- row_key: row_key,
581
- rules: rules,
582
- app_profile_id: app_profile_id
583
- }.delete_if { |_, v| v.nil? }
584
- req = Google::Gax::to_proto(req, Google::Bigtable::V2::ReadModifyWriteRowRequest)
585
- @read_modify_write_row.call(req, options, &block)
586
- end
587
- end
588
- end
589
- end
590
- end
591
- end