google-cloud-bigtable 1.1.0 → 2.0.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/TROUBLESHOOTING.md +2 -8
- data/lib/google-cloud-bigtable.rb +29 -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 +6 -4
- data/lib/google/cloud/bigtable/backup.rb +324 -0
- data/lib/google/cloud/bigtable/backup/job.rb +87 -0
- data/lib/google/cloud/bigtable/backup/list.rb +167 -0
- data/lib/google/cloud/bigtable/chunk_processor.rb +1 -1
- data/lib/google/cloud/bigtable/cluster.rb +101 -2
- data/lib/google/cloud/bigtable/cluster/list.rb +2 -2
- data/lib/google/cloud/bigtable/column_family.rb +2 -2
- data/lib/google/cloud/bigtable/column_family_map.rb +11 -11
- data/lib/google/cloud/bigtable/column_range.rb +2 -2
- 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 +6 -6
- data/lib/google/cloud/bigtable/instance/cluster_map.rb +1 -1
- data/lib/google/cloud/bigtable/instance/list.rb +2 -2
- data/lib/google/cloud/bigtable/longrunning_job.rb +13 -2
- data/lib/google/cloud/bigtable/mutation_entry.rb +10 -9
- data/lib/google/cloud/bigtable/mutation_operations.rb +2 -2
- 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 +3 -3
- 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 +241 -245
- data/lib/google/cloud/bigtable/table.rb +5 -4
- data/lib/google/cloud/bigtable/table/cluster_state.rb +27 -6
- data/lib/google/cloud/bigtable/table/list.rb +2 -2
- data/lib/google/cloud/bigtable/table/restore_job.rb +117 -0
- data/lib/google/cloud/bigtable/value_range.rb +2 -2
- data/lib/google/cloud/bigtable/version.rb +1 -1
- metadata +18 -96
- data/lib/google/bigtable/admin/v2/bigtable_instance_admin_pb.rb +0 -142
- data/lib/google/bigtable/admin/v2/bigtable_instance_admin_services_pb.rb +0 -87
- data/lib/google/bigtable/admin/v2/bigtable_table_admin_pb.rb +0 -141
- data/lib/google/bigtable/admin/v2/bigtable_table_admin_services_pb.rb +0 -127
- data/lib/google/bigtable/admin/v2/common_pb.rb +0 -25
- data/lib/google/bigtable/admin/v2/instance_pb.rb +0 -73
- data/lib/google/bigtable/admin/v2/table_pb.rb +0 -89
- 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 -222
- data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb +0 -1441
- 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 -1245
- data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client_config.json +0 -133
- 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 -290
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_table_admin.rb +0 -359
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/instance.rb +0 -195
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/table.rb +0 -210
- 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 -588
- 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
@@ -1,113 +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
|
-
module Google
|
17
|
-
module Protobuf
|
18
|
-
# A Timestamp represents a point in time independent of any time zone or local
|
19
|
-
# calendar, encoded as a count of seconds and fractions of seconds at
|
20
|
-
# nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
21
|
-
# January 1, 1970, in the proleptic Gregorian calendar which extends the
|
22
|
-
# Gregorian calendar backwards to year one.
|
23
|
-
#
|
24
|
-
# All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
25
|
-
# second table is needed for interpretation, using a [24-hour linear
|
26
|
-
# smear](https://developers.google.com/time/smear).
|
27
|
-
#
|
28
|
-
# The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
29
|
-
# restricting to that range, we ensure that we can convert to and from [RFC
|
30
|
-
# 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
31
|
-
#
|
32
|
-
# = Examples
|
33
|
-
#
|
34
|
-
# Example 1: Compute Timestamp from POSIX `time()`.
|
35
|
-
#
|
36
|
-
# Timestamp timestamp;
|
37
|
-
# timestamp.set_seconds(time(NULL));
|
38
|
-
# timestamp.set_nanos(0);
|
39
|
-
#
|
40
|
-
# Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
41
|
-
#
|
42
|
-
# struct timeval tv;
|
43
|
-
# gettimeofday(&tv, NULL);
|
44
|
-
#
|
45
|
-
# Timestamp timestamp;
|
46
|
-
# timestamp.set_seconds(tv.tv_sec);
|
47
|
-
# timestamp.set_nanos(tv.tv_usec * 1000);
|
48
|
-
#
|
49
|
-
# Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
50
|
-
#
|
51
|
-
# FILETIME ft;
|
52
|
-
# GetSystemTimeAsFileTime(&ft);
|
53
|
-
# UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
54
|
-
#
|
55
|
-
# // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
56
|
-
# // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
57
|
-
# Timestamp timestamp;
|
58
|
-
# timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
59
|
-
# timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
60
|
-
#
|
61
|
-
# Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
62
|
-
#
|
63
|
-
# long millis = System.currentTimeMillis();
|
64
|
-
#
|
65
|
-
# Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
66
|
-
# .setNanos((int) ((millis % 1000) * 1000000)).build();
|
67
|
-
#
|
68
|
-
#
|
69
|
-
# Example 5: Compute Timestamp from current time in Python.
|
70
|
-
#
|
71
|
-
# timestamp = Timestamp()
|
72
|
-
# timestamp.GetCurrentTime()
|
73
|
-
#
|
74
|
-
# = JSON Mapping
|
75
|
-
#
|
76
|
-
# In JSON format, the Timestamp type is encoded as a string in the
|
77
|
-
# [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
78
|
-
# format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z"
|
79
|
-
# where \\{year} is always expressed using four digits while \\{month}, \\{day},
|
80
|
-
# \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional
|
81
|
-
# seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
82
|
-
# are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
83
|
-
# is required. A proto3 JSON serializer should always use UTC (as indicated by
|
84
|
-
# "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
85
|
-
# able to accept both UTC and other timezones (as indicated by an offset).
|
86
|
-
#
|
87
|
-
# For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
88
|
-
# 01:30 UTC on January 15, 2017.
|
89
|
-
#
|
90
|
-
# In JavaScript, one can convert a Date object to this format using the
|
91
|
-
# standard
|
92
|
-
# [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
93
|
-
# method. In Python, a standard `datetime.datetime` object can be converted
|
94
|
-
# to this format using
|
95
|
-
# [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
96
|
-
# the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
97
|
-
# the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
98
|
-
# http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
|
99
|
-
# ) to obtain a formatter capable of generating timestamps in this format.
|
100
|
-
# @!attribute [rw] seconds
|
101
|
-
# @return [Integer]
|
102
|
-
# Represents seconds of UTC time since Unix epoch
|
103
|
-
# 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
104
|
-
# 9999-12-31T23:59:59Z inclusive.
|
105
|
-
# @!attribute [rw] nanos
|
106
|
-
# @return [Integer]
|
107
|
-
# Non-negative fractions of a second at nanosecond resolution. Negative
|
108
|
-
# second values with fractions must still have non-negative nanos values
|
109
|
-
# that count forward in time. Must be from 0 to 999,999,999
|
110
|
-
# inclusive.
|
111
|
-
class Timestamp; end
|
112
|
-
end
|
113
|
-
end
|
@@ -1,39 +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
|
-
module Google
|
17
|
-
module Rpc
|
18
|
-
# The `Status` type defines a logical error model that is suitable for
|
19
|
-
# different programming environments, including REST APIs and RPC APIs. It is
|
20
|
-
# used by [gRPC](https://github.com/grpc). Each `Status` message contains
|
21
|
-
# three pieces of data: error code, error message, and error details.
|
22
|
-
#
|
23
|
-
# You can find out more about this error model and how to work with it in the
|
24
|
-
# [API Design Guide](https://cloud.google.com/apis/design/errors).
|
25
|
-
# @!attribute [rw] code
|
26
|
-
# @return [Integer]
|
27
|
-
# The status code, which should be an enum value of {Google::Rpc::Code}.
|
28
|
-
# @!attribute [rw] message
|
29
|
-
# @return [String]
|
30
|
-
# A developer-facing error message, which should be in English. Any
|
31
|
-
# user-facing error message should be localized and sent in the
|
32
|
-
# {Google::Rpc::Status#details} field, or localized by the client.
|
33
|
-
# @!attribute [rw] details
|
34
|
-
# @return [Array<Google::Protobuf::Any>]
|
35
|
-
# A list of messages that carry the error details. There is a common set of
|
36
|
-
# message types for APIs to use.
|
37
|
-
class Status; end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,45 +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
|
-
module Google
|
17
|
-
module Type
|
18
|
-
# Represents an expression text. Example:
|
19
|
-
#
|
20
|
-
# title: "User account presence"
|
21
|
-
# description: "Determines whether the request has a user account"
|
22
|
-
# expression: "size(request.user) > 0"
|
23
|
-
# @!attribute [rw] expression
|
24
|
-
# @return [String]
|
25
|
-
# Textual representation of an expression in
|
26
|
-
# Common Expression Language syntax.
|
27
|
-
#
|
28
|
-
# The application context of the containing message determines which
|
29
|
-
# well-known feature set of CEL is supported.
|
30
|
-
# @!attribute [rw] title
|
31
|
-
# @return [String]
|
32
|
-
# An optional title for the expression, i.e. a short string describing
|
33
|
-
# its purpose. This can be used e.g. in UIs which allow to enter the
|
34
|
-
# expression.
|
35
|
-
# @!attribute [rw] description
|
36
|
-
# @return [String]
|
37
|
-
# An optional description of the expression. This is a longer text which
|
38
|
-
# describes the expression, e.g. when hovered over it in a UI.
|
39
|
-
# @!attribute [rw] location
|
40
|
-
# @return [String]
|
41
|
-
# An optional string indicating the location of the expression for error
|
42
|
-
# reporting, e.g. a file name and a position in the file.
|
43
|
-
class Expr; end
|
44
|
-
end
|
45
|
-
end
|
@@ -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 ([GA](https://github.com/googleapis/google-cloud-ruby#versioning))
|
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,588 +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
|
-
headers.merge!(metadata) unless metadata.nil?
|
164
|
-
client_config_file = Pathname.new(__dir__).join(
|
165
|
-
"bigtable_client_config.json"
|
166
|
-
)
|
167
|
-
defaults = client_config_file.open do |f|
|
168
|
-
Google::Gax.construct_settings(
|
169
|
-
"google.bigtable.v2.Bigtable",
|
170
|
-
JSON.parse(f.read),
|
171
|
-
client_config,
|
172
|
-
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
173
|
-
timeout,
|
174
|
-
errors: Google::Gax::Grpc::API_ERRORS,
|
175
|
-
metadata: headers
|
176
|
-
)
|
177
|
-
end
|
178
|
-
|
179
|
-
# Allow overriding the service path/port in subclasses.
|
180
|
-
service_path = service_address || self.class::SERVICE_ADDRESS
|
181
|
-
port = service_port || self.class::DEFAULT_SERVICE_PORT
|
182
|
-
interceptors = self.class::GRPC_INTERCEPTORS
|
183
|
-
@bigtable_stub = Google::Gax::Grpc.create_stub(
|
184
|
-
service_path,
|
185
|
-
port,
|
186
|
-
chan_creds: chan_creds,
|
187
|
-
channel: channel,
|
188
|
-
updater_proc: updater_proc,
|
189
|
-
scopes: scopes,
|
190
|
-
interceptors: interceptors,
|
191
|
-
&Google::Bigtable::V2::Bigtable::Stub.method(:new)
|
192
|
-
)
|
193
|
-
|
194
|
-
@read_rows = Google::Gax.create_api_call(
|
195
|
-
@bigtable_stub.method(:read_rows),
|
196
|
-
defaults["read_rows"],
|
197
|
-
exception_transformer: exception_transformer,
|
198
|
-
params_extractor: proc do |request|
|
199
|
-
{'table_name' => request.table_name}
|
200
|
-
end
|
201
|
-
)
|
202
|
-
@sample_row_keys = Google::Gax.create_api_call(
|
203
|
-
@bigtable_stub.method(:sample_row_keys),
|
204
|
-
defaults["sample_row_keys"],
|
205
|
-
exception_transformer: exception_transformer,
|
206
|
-
params_extractor: proc do |request|
|
207
|
-
{'table_name' => request.table_name}
|
208
|
-
end
|
209
|
-
)
|
210
|
-
@mutate_row = Google::Gax.create_api_call(
|
211
|
-
@bigtable_stub.method(:mutate_row),
|
212
|
-
defaults["mutate_row"],
|
213
|
-
exception_transformer: exception_transformer,
|
214
|
-
params_extractor: proc do |request|
|
215
|
-
{'table_name' => request.table_name}
|
216
|
-
end
|
217
|
-
)
|
218
|
-
@mutate_rows = Google::Gax.create_api_call(
|
219
|
-
@bigtable_stub.method(:mutate_rows),
|
220
|
-
defaults["mutate_rows"],
|
221
|
-
exception_transformer: exception_transformer,
|
222
|
-
params_extractor: proc do |request|
|
223
|
-
{'table_name' => request.table_name}
|
224
|
-
end
|
225
|
-
)
|
226
|
-
@check_and_mutate_row = Google::Gax.create_api_call(
|
227
|
-
@bigtable_stub.method(:check_and_mutate_row),
|
228
|
-
defaults["check_and_mutate_row"],
|
229
|
-
exception_transformer: exception_transformer,
|
230
|
-
params_extractor: proc do |request|
|
231
|
-
{'table_name' => request.table_name}
|
232
|
-
end
|
233
|
-
)
|
234
|
-
@read_modify_write_row = Google::Gax.create_api_call(
|
235
|
-
@bigtable_stub.method(:read_modify_write_row),
|
236
|
-
defaults["read_modify_write_row"],
|
237
|
-
exception_transformer: exception_transformer,
|
238
|
-
params_extractor: proc do |request|
|
239
|
-
{'table_name' => request.table_name}
|
240
|
-
end
|
241
|
-
)
|
242
|
-
end
|
243
|
-
|
244
|
-
# Service calls
|
245
|
-
|
246
|
-
# Streams back the contents of all requested rows in key order, optionally
|
247
|
-
# applying the same Reader filter to each. Depending on their size,
|
248
|
-
# rows and cells may be broken up across multiple responses, but
|
249
|
-
# atomicity of each row will still be preserved. See the
|
250
|
-
# ReadRowsResponse documentation for details.
|
251
|
-
#
|
252
|
-
# @param table_name [String]
|
253
|
-
# Required. The unique name of the table from which to read.
|
254
|
-
# Values are of the form
|
255
|
-
# `projects/<project>/instances/<instance>/tables/<table>`.
|
256
|
-
# @param app_profile_id [String]
|
257
|
-
# This value specifies routing for replication. If not specified, the
|
258
|
-
# "default" application profile will be used.
|
259
|
-
# @param rows [Google::Bigtable::V2::RowSet | Hash]
|
260
|
-
# The row keys and/or ranges to read. If not specified, reads from all rows.
|
261
|
-
# A hash of the same form as `Google::Bigtable::V2::RowSet`
|
262
|
-
# can also be provided.
|
263
|
-
# @param filter [Google::Bigtable::V2::RowFilter | Hash]
|
264
|
-
# The filter to apply to the contents of the specified row(s). If unset,
|
265
|
-
# reads the entirety of each row.
|
266
|
-
# A hash of the same form as `Google::Bigtable::V2::RowFilter`
|
267
|
-
# can also be provided.
|
268
|
-
# @param rows_limit [Integer]
|
269
|
-
# The read will terminate after committing to N rows' worth of results. The
|
270
|
-
# default (zero) is to return all results.
|
271
|
-
# @param options [Google::Gax::CallOptions]
|
272
|
-
# Overrides the default settings for this call, e.g, timeout,
|
273
|
-
# retries, etc.
|
274
|
-
# @return [Enumerable<Google::Bigtable::V2::ReadRowsResponse>]
|
275
|
-
# An enumerable of Google::Bigtable::V2::ReadRowsResponse instances.
|
276
|
-
#
|
277
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
278
|
-
# @example
|
279
|
-
# require "google/cloud/bigtable/v2"
|
280
|
-
#
|
281
|
-
# bigtable_client = Google::Cloud::Bigtable::V2.new
|
282
|
-
# formatted_table_name = Google::Cloud::Bigtable::V2::BigtableClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
|
283
|
-
# bigtable_client.read_rows(formatted_table_name).each do |element|
|
284
|
-
# # Process element.
|
285
|
-
# end
|
286
|
-
|
287
|
-
def read_rows \
|
288
|
-
table_name,
|
289
|
-
app_profile_id: nil,
|
290
|
-
rows: nil,
|
291
|
-
filter: nil,
|
292
|
-
rows_limit: nil,
|
293
|
-
options: nil
|
294
|
-
req = {
|
295
|
-
table_name: table_name,
|
296
|
-
app_profile_id: app_profile_id,
|
297
|
-
rows: rows,
|
298
|
-
filter: filter,
|
299
|
-
rows_limit: rows_limit
|
300
|
-
}.delete_if { |_, v| v.nil? }
|
301
|
-
req = Google::Gax::to_proto(req, Google::Bigtable::V2::ReadRowsRequest)
|
302
|
-
@read_rows.call(req, options)
|
303
|
-
end
|
304
|
-
|
305
|
-
# Returns a sample of row keys in the table. The returned row keys will
|
306
|
-
# delimit contiguous sections of the table of approximately equal size,
|
307
|
-
# which can be used to break up the data for distributed tasks like
|
308
|
-
# mapreduces.
|
309
|
-
#
|
310
|
-
# @param table_name [String]
|
311
|
-
# Required. The unique name of the table from which to sample row keys.
|
312
|
-
# Values are of the form
|
313
|
-
# `projects/<project>/instances/<instance>/tables/<table>`.
|
314
|
-
# @param app_profile_id [String]
|
315
|
-
# This value specifies routing for replication. If not specified, the
|
316
|
-
# "default" application profile will be used.
|
317
|
-
# @param options [Google::Gax::CallOptions]
|
318
|
-
# Overrides the default settings for this call, e.g, timeout,
|
319
|
-
# retries, etc.
|
320
|
-
# @return [Enumerable<Google::Bigtable::V2::SampleRowKeysResponse>]
|
321
|
-
# An enumerable of Google::Bigtable::V2::SampleRowKeysResponse instances.
|
322
|
-
#
|
323
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
324
|
-
# @example
|
325
|
-
# require "google/cloud/bigtable/v2"
|
326
|
-
#
|
327
|
-
# bigtable_client = Google::Cloud::Bigtable::V2.new
|
328
|
-
# formatted_table_name = Google::Cloud::Bigtable::V2::BigtableClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
|
329
|
-
# bigtable_client.sample_row_keys(formatted_table_name).each do |element|
|
330
|
-
# # Process element.
|
331
|
-
# end
|
332
|
-
|
333
|
-
def sample_row_keys \
|
334
|
-
table_name,
|
335
|
-
app_profile_id: nil,
|
336
|
-
options: nil
|
337
|
-
req = {
|
338
|
-
table_name: table_name,
|
339
|
-
app_profile_id: app_profile_id
|
340
|
-
}.delete_if { |_, v| v.nil? }
|
341
|
-
req = Google::Gax::to_proto(req, Google::Bigtable::V2::SampleRowKeysRequest)
|
342
|
-
@sample_row_keys.call(req, options)
|
343
|
-
end
|
344
|
-
|
345
|
-
# Mutates a row atomically. Cells already present in the row are left
|
346
|
-
# unchanged unless explicitly changed by `mutation`.
|
347
|
-
#
|
348
|
-
# @param table_name [String]
|
349
|
-
# Required. The unique name of the table to which the mutation should be applied.
|
350
|
-
# Values are of the form
|
351
|
-
# `projects/<project>/instances/<instance>/tables/<table>`.
|
352
|
-
# @param row_key [String]
|
353
|
-
# Required. The key of the row to which the mutation should be applied.
|
354
|
-
# @param mutations [Array<Google::Bigtable::V2::Mutation | Hash>]
|
355
|
-
# Required. Changes to be atomically applied to the specified row. Entries are applied
|
356
|
-
# in order, meaning that earlier mutations can be masked by later ones.
|
357
|
-
# Must contain at least one entry and at most 100000.
|
358
|
-
# A hash of the same form as `Google::Bigtable::V2::Mutation`
|
359
|
-
# can also be provided.
|
360
|
-
# @param app_profile_id [String]
|
361
|
-
# This value specifies routing for replication. If not specified, the
|
362
|
-
# "default" application profile will be used.
|
363
|
-
# @param options [Google::Gax::CallOptions]
|
364
|
-
# Overrides the default settings for this call, e.g, timeout,
|
365
|
-
# retries, etc.
|
366
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
367
|
-
# @yieldparam result [Google::Bigtable::V2::MutateRowResponse]
|
368
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
369
|
-
# @return [Google::Bigtable::V2::MutateRowResponse]
|
370
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
371
|
-
# @example
|
372
|
-
# require "google/cloud/bigtable/v2"
|
373
|
-
#
|
374
|
-
# bigtable_client = Google::Cloud::Bigtable::V2.new
|
375
|
-
# formatted_table_name = Google::Cloud::Bigtable::V2::BigtableClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
|
376
|
-
#
|
377
|
-
# # TODO: Initialize `row_key`:
|
378
|
-
# row_key = ''
|
379
|
-
#
|
380
|
-
# # TODO: Initialize `mutations`:
|
381
|
-
# mutations = []
|
382
|
-
# response = bigtable_client.mutate_row(formatted_table_name, row_key, mutations)
|
383
|
-
|
384
|
-
def mutate_row \
|
385
|
-
table_name,
|
386
|
-
row_key,
|
387
|
-
mutations,
|
388
|
-
app_profile_id: nil,
|
389
|
-
options: nil,
|
390
|
-
&block
|
391
|
-
req = {
|
392
|
-
table_name: table_name,
|
393
|
-
row_key: row_key,
|
394
|
-
mutations: mutations,
|
395
|
-
app_profile_id: app_profile_id
|
396
|
-
}.delete_if { |_, v| v.nil? }
|
397
|
-
req = Google::Gax::to_proto(req, Google::Bigtable::V2::MutateRowRequest)
|
398
|
-
@mutate_row.call(req, options, &block)
|
399
|
-
end
|
400
|
-
|
401
|
-
# Mutates multiple rows in a batch. Each individual row is mutated
|
402
|
-
# atomically as in MutateRow, but the entire batch is not executed
|
403
|
-
# atomically.
|
404
|
-
#
|
405
|
-
# @param table_name [String]
|
406
|
-
# Required. The unique name of the table to which the mutations should be applied.
|
407
|
-
# @param entries [Array<Google::Bigtable::V2::MutateRowsRequest::Entry | Hash>]
|
408
|
-
# Required. The row keys and corresponding mutations to be applied in bulk.
|
409
|
-
# Each entry is applied as an atomic mutation, but the entries may be
|
410
|
-
# applied in arbitrary order (even between entries for the same row).
|
411
|
-
# At least one entry must be specified, and in total the entries can
|
412
|
-
# contain at most 100000 mutations.
|
413
|
-
# A hash of the same form as `Google::Bigtable::V2::MutateRowsRequest::Entry`
|
414
|
-
# can also be provided.
|
415
|
-
# @param app_profile_id [String]
|
416
|
-
# This value specifies routing for replication. If not specified, the
|
417
|
-
# "default" application profile will be used.
|
418
|
-
# @param options [Google::Gax::CallOptions]
|
419
|
-
# Overrides the default settings for this call, e.g, timeout,
|
420
|
-
# retries, etc.
|
421
|
-
# @return [Enumerable<Google::Bigtable::V2::MutateRowsResponse>]
|
422
|
-
# An enumerable of Google::Bigtable::V2::MutateRowsResponse instances.
|
423
|
-
#
|
424
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
425
|
-
# @example
|
426
|
-
# require "google/cloud/bigtable/v2"
|
427
|
-
#
|
428
|
-
# bigtable_client = Google::Cloud::Bigtable::V2.new
|
429
|
-
# formatted_table_name = Google::Cloud::Bigtable::V2::BigtableClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
|
430
|
-
#
|
431
|
-
# # TODO: Initialize `entries`:
|
432
|
-
# entries = []
|
433
|
-
# bigtable_client.mutate_rows(formatted_table_name, entries).each do |element|
|
434
|
-
# # Process element.
|
435
|
-
# end
|
436
|
-
|
437
|
-
def mutate_rows \
|
438
|
-
table_name,
|
439
|
-
entries,
|
440
|
-
app_profile_id: nil,
|
441
|
-
options: nil
|
442
|
-
req = {
|
443
|
-
table_name: table_name,
|
444
|
-
entries: entries,
|
445
|
-
app_profile_id: app_profile_id
|
446
|
-
}.delete_if { |_, v| v.nil? }
|
447
|
-
req = Google::Gax::to_proto(req, Google::Bigtable::V2::MutateRowsRequest)
|
448
|
-
@mutate_rows.call(req, options)
|
449
|
-
end
|
450
|
-
|
451
|
-
# Mutates a row atomically based on the output of a predicate Reader filter.
|
452
|
-
#
|
453
|
-
# @param table_name [String]
|
454
|
-
# Required. The unique name of the table to which the conditional mutation should be
|
455
|
-
# applied.
|
456
|
-
# Values are of the form
|
457
|
-
# `projects/<project>/instances/<instance>/tables/<table>`.
|
458
|
-
# @param row_key [String]
|
459
|
-
# Required. The key of the row to which the conditional mutation should be applied.
|
460
|
-
# @param app_profile_id [String]
|
461
|
-
# This value specifies routing for replication. If not specified, the
|
462
|
-
# "default" application profile will be used.
|
463
|
-
# @param predicate_filter [Google::Bigtable::V2::RowFilter | Hash]
|
464
|
-
# The filter to be applied to the contents of the specified row. Depending
|
465
|
-
# on whether or not any results are yielded, either `true_mutations` or
|
466
|
-
# `false_mutations` will be executed. If unset, checks that the row contains
|
467
|
-
# any values at all.
|
468
|
-
# A hash of the same form as `Google::Bigtable::V2::RowFilter`
|
469
|
-
# can also be provided.
|
470
|
-
# @param true_mutations [Array<Google::Bigtable::V2::Mutation | Hash>]
|
471
|
-
# Changes to be atomically applied to the specified row if `predicate_filter`
|
472
|
-
# yields at least one cell when applied to `row_key`. Entries are applied in
|
473
|
-
# order, meaning that earlier mutations can be masked by later ones.
|
474
|
-
# Must contain at least one entry if `false_mutations` is empty, and at most
|
475
|
-
# 100000.
|
476
|
-
# A hash of the same form as `Google::Bigtable::V2::Mutation`
|
477
|
-
# can also be provided.
|
478
|
-
# @param false_mutations [Array<Google::Bigtable::V2::Mutation | Hash>]
|
479
|
-
# Changes to be atomically applied to the specified row if `predicate_filter`
|
480
|
-
# does not yield any cells when applied to `row_key`. Entries are applied in
|
481
|
-
# order, meaning that earlier mutations can be masked by later ones.
|
482
|
-
# Must contain at least one entry if `true_mutations` is empty, and at most
|
483
|
-
# 100000.
|
484
|
-
# A hash of the same form as `Google::Bigtable::V2::Mutation`
|
485
|
-
# can also be provided.
|
486
|
-
# @param options [Google::Gax::CallOptions]
|
487
|
-
# Overrides the default settings for this call, e.g, timeout,
|
488
|
-
# retries, etc.
|
489
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
490
|
-
# @yieldparam result [Google::Bigtable::V2::CheckAndMutateRowResponse]
|
491
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
492
|
-
# @return [Google::Bigtable::V2::CheckAndMutateRowResponse]
|
493
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
494
|
-
# @example
|
495
|
-
# require "google/cloud/bigtable/v2"
|
496
|
-
#
|
497
|
-
# bigtable_client = Google::Cloud::Bigtable::V2.new
|
498
|
-
# formatted_table_name = Google::Cloud::Bigtable::V2::BigtableClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
|
499
|
-
#
|
500
|
-
# # TODO: Initialize `row_key`:
|
501
|
-
# row_key = ''
|
502
|
-
# response = bigtable_client.check_and_mutate_row(formatted_table_name, row_key)
|
503
|
-
|
504
|
-
def check_and_mutate_row \
|
505
|
-
table_name,
|
506
|
-
row_key,
|
507
|
-
app_profile_id: nil,
|
508
|
-
predicate_filter: nil,
|
509
|
-
true_mutations: nil,
|
510
|
-
false_mutations: nil,
|
511
|
-
options: nil,
|
512
|
-
&block
|
513
|
-
req = {
|
514
|
-
table_name: table_name,
|
515
|
-
row_key: row_key,
|
516
|
-
app_profile_id: app_profile_id,
|
517
|
-
predicate_filter: predicate_filter,
|
518
|
-
true_mutations: true_mutations,
|
519
|
-
false_mutations: false_mutations
|
520
|
-
}.delete_if { |_, v| v.nil? }
|
521
|
-
req = Google::Gax::to_proto(req, Google::Bigtable::V2::CheckAndMutateRowRequest)
|
522
|
-
@check_and_mutate_row.call(req, options, &block)
|
523
|
-
end
|
524
|
-
|
525
|
-
# Modifies a row atomically on the server. The method reads the latest
|
526
|
-
# existing timestamp and value from the specified columns and writes a new
|
527
|
-
# entry based on pre-defined read/modify/write rules. The new value for the
|
528
|
-
# timestamp is the greater of the existing timestamp or the current server
|
529
|
-
# time. The method returns the new contents of all modified cells.
|
530
|
-
#
|
531
|
-
# @param table_name [String]
|
532
|
-
# Required. The unique name of the table to which the read/modify/write rules should be
|
533
|
-
# applied.
|
534
|
-
# Values are of the form
|
535
|
-
# `projects/<project>/instances/<instance>/tables/<table>`.
|
536
|
-
# @param row_key [String]
|
537
|
-
# Required. The key of the row to which the read/modify/write rules should be applied.
|
538
|
-
# @param rules [Array<Google::Bigtable::V2::ReadModifyWriteRule | Hash>]
|
539
|
-
# Required. Rules specifying how the specified row's contents are to be transformed
|
540
|
-
# into writes. Entries are applied in order, meaning that earlier rules will
|
541
|
-
# affect the results of later ones.
|
542
|
-
# A hash of the same form as `Google::Bigtable::V2::ReadModifyWriteRule`
|
543
|
-
# can also be provided.
|
544
|
-
# @param app_profile_id [String]
|
545
|
-
# This value specifies routing for replication. If not specified, the
|
546
|
-
# "default" application profile will be used.
|
547
|
-
# @param options [Google::Gax::CallOptions]
|
548
|
-
# Overrides the default settings for this call, e.g, timeout,
|
549
|
-
# retries, etc.
|
550
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
551
|
-
# @yieldparam result [Google::Bigtable::V2::ReadModifyWriteRowResponse]
|
552
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
553
|
-
# @return [Google::Bigtable::V2::ReadModifyWriteRowResponse]
|
554
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
555
|
-
# @example
|
556
|
-
# require "google/cloud/bigtable/v2"
|
557
|
-
#
|
558
|
-
# bigtable_client = Google::Cloud::Bigtable::V2.new
|
559
|
-
# formatted_table_name = Google::Cloud::Bigtable::V2::BigtableClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
|
560
|
-
#
|
561
|
-
# # TODO: Initialize `row_key`:
|
562
|
-
# row_key = ''
|
563
|
-
#
|
564
|
-
# # TODO: Initialize `rules`:
|
565
|
-
# rules = []
|
566
|
-
# response = bigtable_client.read_modify_write_row(formatted_table_name, row_key, rules)
|
567
|
-
|
568
|
-
def read_modify_write_row \
|
569
|
-
table_name,
|
570
|
-
row_key,
|
571
|
-
rules,
|
572
|
-
app_profile_id: nil,
|
573
|
-
options: nil,
|
574
|
-
&block
|
575
|
-
req = {
|
576
|
-
table_name: table_name,
|
577
|
-
row_key: row_key,
|
578
|
-
rules: rules,
|
579
|
-
app_profile_id: app_profile_id
|
580
|
-
}.delete_if { |_, v| v.nil? }
|
581
|
-
req = Google::Gax::to_proto(req, Google::Bigtable::V2::ReadModifyWriteRowRequest)
|
582
|
-
@read_modify_write_row.call(req, options, &block)
|
583
|
-
end
|
584
|
-
end
|
585
|
-
end
|
586
|
-
end
|
587
|
-
end
|
588
|
-
end
|