google-cloud-spanner 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/google/cloud/spanner/admin/database/v1/database_admin_client.rb +1 -0
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client.rb +1 -0
- data/lib/google/cloud/spanner/batch_snapshot.rb +2 -3
- data/lib/google/cloud/spanner/client.rb +4 -4
- data/lib/google/cloud/spanner/credentials.rb +2 -16
- data/lib/google/cloud/spanner/database/list.rb +1 -1
- data/lib/google/cloud/spanner/instance.rb +1 -1
- data/lib/google/cloud/spanner/instance/config/list.rb +1 -1
- data/lib/google/cloud/spanner/instance/list.rb +1 -1
- data/lib/google/cloud/spanner/project.rb +3 -3
- data/lib/google/cloud/spanner/v1/credentials.rb +41 -0
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/empty.rb +28 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/mutation.rb +2 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/spanner.rb +6 -11
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/type.rb +110 -0
- data/lib/google/cloud/spanner/v1/spanner_client.rb +135 -66
- data/lib/google/cloud/spanner/v1/spanner_client_config.json +1 -1
- data/lib/google/cloud/spanner/version.rb +1 -1
- metadata +19 -3
- data/lib/google/cloud/spanner/v1/doc/overview.rb +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3ee5ad839567f029c785341f244eb62658f9091b21c80726d01818e9dc3a101
|
4
|
+
data.tar.gz: 0053e507b34ab229c633a813fdf06cd178b59ede0837cfe80eb5585441b05bac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dff7a09f65d4365463441c63a743983ea7df392f7d42e7cdaf854890318a6b6b5067a193fbf292ac48e001e6a1eaa9df0d55b99193baa77178b9382479c8f7e4
|
7
|
+
data.tar.gz: da5288b36a9b8dc7c1dc26d6b92d51198f0acdea029ad2c9519f45671cb3f251d04e7b78562f1e87545ba825aa17e940d73a87b7b52fdd77b792630abbe6d17b
|
@@ -33,8 +33,7 @@ module Google
|
|
33
33
|
# request can then be executed independently over each partition while
|
34
34
|
# observing the same snapshot of the database. A BatchSnapshot can also be
|
35
35
|
# shared across multiple processes/machines by passing around its
|
36
|
-
# serialized value and then recreating the transaction using
|
37
|
-
# {BatchClient#dump}.
|
36
|
+
# serialized value and then recreating the transaction using {#dump}.
|
38
37
|
#
|
39
38
|
# Unlike locking read-write transactions, BatchSnapshot will never abort.
|
40
39
|
# They can fail if the chosen read timestamp is garbage collected; however
|
@@ -291,7 +290,7 @@ module Google
|
|
291
290
|
end
|
292
291
|
|
293
292
|
##
|
294
|
-
# Execute the partition to return a {
|
293
|
+
# Execute the partition to return a {Results}. The result returned
|
295
294
|
# could be zero or more rows. The row metadata may be absent if no rows
|
296
295
|
# are returned.
|
297
296
|
#
|
@@ -701,10 +701,10 @@ module Google
|
|
701
701
|
# accepts only mutations and makes a single API request.
|
702
702
|
#
|
703
703
|
# **Note:** This method does not feature replay protection present in
|
704
|
-
# {
|
705
|
-
#
|
706
|
-
#
|
707
|
-
#
|
704
|
+
# {#transaction}. This method makes a single RPC, whereas {#transaction}
|
705
|
+
# requires two RPCs (one of which may be performed in advance), and so
|
706
|
+
# this method may be appropriate for latency sensitive and/or high
|
707
|
+
# throughput blind changes.
|
708
708
|
#
|
709
709
|
# @yield [commit] The block for mutating the data.
|
710
710
|
# @yieldparam [Google::Cloud::Spanner::Commit] commit The Commit object.
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
|
16
|
-
require "
|
16
|
+
require "google/cloud/spanner/v1/credentials"
|
17
17
|
|
18
18
|
module Google
|
19
19
|
module Cloud
|
@@ -37,21 +37,7 @@ module Google
|
|
37
37
|
#
|
38
38
|
# spanner.project_id #=> "my-project"
|
39
39
|
#
|
40
|
-
class Credentials < Google::
|
41
|
-
SCOPE = %w[https://www.googleapis.com/auth/cloud-platform
|
42
|
-
https://www.googleapis.com/auth/spanner.data].freeze
|
43
|
-
PATH_ENV_VARS = %w[SPANNER_CREDENTIALS
|
44
|
-
SPANNER_KEYFILE
|
45
|
-
GOOGLE_CLOUD_CREDENTIALS
|
46
|
-
GOOGLE_CLOUD_KEYFILE
|
47
|
-
GCLOUD_KEYFILE].freeze
|
48
|
-
JSON_ENV_VARS = %w[SPANNER_CREDENTIALS_JSON
|
49
|
-
SPANNER_KEYFILE_JSON
|
50
|
-
GOOGLE_CLOUD_CREDENTIALS_JSON
|
51
|
-
GOOGLE_CLOUD_KEYFILE_JSON
|
52
|
-
GCLOUD_KEYFILE_JSON].freeze
|
53
|
-
DEFAULT_PATHS = \
|
54
|
-
["~/.config/gcloud/application_default_credentials.json"].freeze
|
40
|
+
class Credentials < Google::Cloud::Spanner::V1::Credentials
|
55
41
|
end
|
56
42
|
end
|
57
43
|
end
|
@@ -150,7 +150,7 @@ module Google
|
|
150
150
|
end)
|
151
151
|
databases.instance_variable_set :@instance_id, instance_id
|
152
152
|
token = grpc.next_page_token
|
153
|
-
token = nil if token == ""
|
153
|
+
token = nil if token == "".freeze
|
154
154
|
databases.instance_variable_set :@token, token
|
155
155
|
databases.instance_variable_set :@service, service
|
156
156
|
databases.instance_variable_set :@max, max
|
@@ -245,7 +245,7 @@ module Google
|
|
245
245
|
# puts database.database_id
|
246
246
|
# end
|
247
247
|
#
|
248
|
-
# @example Retrieve all: (See {Instance::Config::List
|
248
|
+
# @example Retrieve all: (See {Instance::Config::List#all})
|
249
249
|
# require "google/cloud/spanner"
|
250
250
|
#
|
251
251
|
# spanner = Google::Cloud::Spanner.new
|
@@ -149,7 +149,7 @@ module Google
|
|
149
149
|
Instance::Config.from_grpc config
|
150
150
|
end)
|
151
151
|
token = grpc.next_page_token
|
152
|
-
token = nil if token == ""
|
152
|
+
token = nil if token == "".freeze
|
153
153
|
configs.instance_variable_set :@token, token
|
154
154
|
configs.instance_variable_set :@service, service
|
155
155
|
configs.instance_variable_set :@max, max
|
@@ -146,7 +146,7 @@ module Google
|
|
146
146
|
Instance.from_grpc instance, service
|
147
147
|
end)
|
148
148
|
token = grpc.next_page_token
|
149
|
-
token = nil if token == ""
|
149
|
+
token = nil if token == "".freeze
|
150
150
|
instances.instance_variable_set :@token, token
|
151
151
|
instances.instance_variable_set :@service, service
|
152
152
|
instances.instance_variable_set :@max, max
|
@@ -115,7 +115,7 @@ module Google
|
|
115
115
|
# puts instance.instance_id
|
116
116
|
# end
|
117
117
|
#
|
118
|
-
# @example Retrieve all: (See {Instance::Config::List
|
118
|
+
# @example Retrieve all: (See {Instance::Config::List#all})
|
119
119
|
# require "google/cloud/spanner"
|
120
120
|
#
|
121
121
|
# spanner = Google::Cloud::Spanner.new
|
@@ -249,7 +249,7 @@ module Google
|
|
249
249
|
# puts config.instance_config_id
|
250
250
|
# end
|
251
251
|
#
|
252
|
-
# @example Retrieve all: (See {Instance::Config::List
|
252
|
+
# @example Retrieve all: (See {Instance::Config::List#all})
|
253
253
|
# require "google/cloud/spanner"
|
254
254
|
#
|
255
255
|
# spanner = Google::Cloud::Spanner.new
|
@@ -318,7 +318,7 @@ module Google
|
|
318
318
|
# puts database.database_id
|
319
319
|
# end
|
320
320
|
#
|
321
|
-
# @example Retrieve all: (See {Instance::Config::List
|
321
|
+
# @example Retrieve all: (See {Instance::Config::List#all})
|
322
322
|
# require "google/cloud/spanner"
|
323
323
|
#
|
324
324
|
# spanner = Google::Cloud::Spanner.new
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright 2018 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
|
+
require "googleauth"
|
16
|
+
|
17
|
+
module Google
|
18
|
+
module Cloud
|
19
|
+
module Spanner
|
20
|
+
module V1
|
21
|
+
class Credentials < Google::Auth::Credentials
|
22
|
+
SCOPE = [
|
23
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
24
|
+
"https://www.googleapis.com/auth/spanner.data"
|
25
|
+
].freeze
|
26
|
+
PATH_ENV_VARS = %w(SPANNER_CREDENTIALS
|
27
|
+
SPANNER_KEYFILE
|
28
|
+
GOOGLE_CLOUD_CREDENTIALS
|
29
|
+
GOOGLE_CLOUD_KEYFILE
|
30
|
+
GCLOUD_KEYFILE)
|
31
|
+
JSON_ENV_VARS = %w(SPANNER_CREDENTIALS_JSON
|
32
|
+
SPANNER_KEYFILE_JSON
|
33
|
+
GOOGLE_CLOUD_CREDENTIALS_JSON
|
34
|
+
GOOGLE_CLOUD_KEYFILE_JSON
|
35
|
+
GCLOUD_KEYFILE_JSON)
|
36
|
+
DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Copyright 2018 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
|
+
module Google
|
16
|
+
module Protobuf
|
17
|
+
# A generic empty message that you can re-use to avoid defining duplicated
|
18
|
+
# empty messages in your APIs. A typical example is to use it as the request
|
19
|
+
# or the response type of an API method. For instance:
|
20
|
+
#
|
21
|
+
# service Foo {
|
22
|
+
# rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
23
|
+
# }
|
24
|
+
#
|
25
|
+
# The JSON representation for +Empty+ is empty JSON object +{}+.
|
26
|
+
class Empty; end
|
27
|
+
end
|
28
|
+
end
|
@@ -73,6 +73,8 @@ module Google
|
|
73
73
|
# @!attribute [rw] key_set
|
74
74
|
# @return [Google::Spanner::V1::KeySet]
|
75
75
|
# Required. The primary keys of the rows within {Google::Spanner::V1::Mutation::Delete#table table} to delete.
|
76
|
+
# Delete is idempotent. The transaction will succeed even if some or all
|
77
|
+
# rows do not exist.
|
76
78
|
class Delete; end
|
77
79
|
end
|
78
80
|
end
|
@@ -14,17 +14,6 @@
|
|
14
14
|
|
15
15
|
module Google
|
16
16
|
module Spanner
|
17
|
-
##
|
18
|
-
# # Cloud Spanner API Contents
|
19
|
-
#
|
20
|
-
# | Class | Description |
|
21
|
-
# | ----- | ----------- |
|
22
|
-
# | [SpannerClient][] | Cloud Spanner API |
|
23
|
-
# | [Data Types][] | Data types for Google::Cloud::Spanner::V1 |
|
24
|
-
#
|
25
|
-
# [SpannerClient]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-spanner/latest/google/spanner/v1/spannerclient
|
26
|
-
# [Data Types]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-spanner/latest/google/spanner/v1/datatypes
|
27
|
-
#
|
28
17
|
module V1
|
29
18
|
# The request for {Google::Spanner::V1::Spanner::CreateSession CreateSession}.
|
30
19
|
# @!attribute [rw] database
|
@@ -188,11 +177,17 @@ module Google
|
|
188
177
|
# PartitionReadRequest.
|
189
178
|
# @!attribute [rw] partition_size_bytes
|
190
179
|
# @return [Integer]
|
180
|
+
# **Note:** This hint is currently ignored by PartitionQuery and
|
181
|
+
# PartitionRead requests.
|
182
|
+
#
|
191
183
|
# The desired data size for each partition generated. The default for this
|
192
184
|
# option is currently 1 GiB. This is only a hint. The actual size of each
|
193
185
|
# partition may be smaller or larger than this size request.
|
194
186
|
# @!attribute [rw] max_partitions
|
195
187
|
# @return [Integer]
|
188
|
+
# **Note:** This hint is currently ignored by PartitionQuery and
|
189
|
+
# PartitionRead requests.
|
190
|
+
#
|
196
191
|
# The desired maximum number of partitions to return. For example, this may
|
197
192
|
# be set to the number of workers available. The default for this option
|
198
193
|
# is currently 10,000. The maximum value is currently 200,000. This is only
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# Copyright 2018 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
|
+
module Google
|
16
|
+
module Spanner
|
17
|
+
module V1
|
18
|
+
# +Type+ indicates the type of a Cloud Spanner value, as might be stored in a
|
19
|
+
# table cell or returned from an SQL query.
|
20
|
+
# @!attribute [rw] code
|
21
|
+
# @return [Google::Spanner::V1::TypeCode]
|
22
|
+
# Required. The {Google::Spanner::V1::TypeCode TypeCode} for this type.
|
23
|
+
# @!attribute [rw] array_element_type
|
24
|
+
# @return [Google::Spanner::V1::Type]
|
25
|
+
# If {Google::Spanner::V1::Type#code code} == {Google::Spanner::V1::TypeCode::ARRAY ARRAY}, then +array_element_type+
|
26
|
+
# is the type of the array elements.
|
27
|
+
# @!attribute [rw] struct_type
|
28
|
+
# @return [Google::Spanner::V1::StructType]
|
29
|
+
# If {Google::Spanner::V1::Type#code code} == {Google::Spanner::V1::TypeCode::STRUCT STRUCT}, then +struct_type+
|
30
|
+
# provides type information for the struct's fields.
|
31
|
+
class Type; end
|
32
|
+
|
33
|
+
# +StructType+ defines the fields of a {Google::Spanner::V1::TypeCode::STRUCT STRUCT} type.
|
34
|
+
# @!attribute [rw] fields
|
35
|
+
# @return [Array<Google::Spanner::V1::StructType::Field>]
|
36
|
+
# The list of fields that make up this struct. Order is
|
37
|
+
# significant, because values of this struct type are represented as
|
38
|
+
# lists, where the order of field values matches the order of
|
39
|
+
# fields in the {Google::Spanner::V1::StructType StructType}. In turn, the order of fields
|
40
|
+
# matches the order of columns in a read request, or the order of
|
41
|
+
# fields in the +SELECT+ clause of a query.
|
42
|
+
class StructType
|
43
|
+
# Message representing a single field of a struct.
|
44
|
+
# @!attribute [rw] name
|
45
|
+
# @return [String]
|
46
|
+
# The name of the field. For reads, this is the column name. For
|
47
|
+
# SQL queries, it is the column alias (e.g., +"Word"+ in the
|
48
|
+
# query +"SELECT 'hello' AS Word"+), or the column name (e.g.,
|
49
|
+
# +"ColName"+ in the query +"SELECT ColName FROM Table"+). Some
|
50
|
+
# columns might have an empty name (e.g., !"SELECT
|
51
|
+
# UPPER(ColName)"+). Note that a query result can contain
|
52
|
+
# multiple fields with the same name.
|
53
|
+
# @!attribute [rw] type
|
54
|
+
# @return [Google::Spanner::V1::Type]
|
55
|
+
# The type of the field.
|
56
|
+
class Field; end
|
57
|
+
end
|
58
|
+
|
59
|
+
# +TypeCode+ is used as part of {Google::Spanner::V1::Type Type} to
|
60
|
+
# indicate the type of a Cloud Spanner value.
|
61
|
+
#
|
62
|
+
# Each legal value of a type can be encoded to or decoded from a JSON
|
63
|
+
# value, using the encodings described below. All Cloud Spanner values can
|
64
|
+
# be +null+, regardless of type; +null+s are always encoded as a JSON
|
65
|
+
# +null+.
|
66
|
+
module TypeCode
|
67
|
+
# Not specified.
|
68
|
+
TYPE_CODE_UNSPECIFIED = 0
|
69
|
+
|
70
|
+
# Encoded as JSON +true+ or +false+.
|
71
|
+
BOOL = 1
|
72
|
+
|
73
|
+
# Encoded as +string+, in decimal format.
|
74
|
+
INT64 = 2
|
75
|
+
|
76
|
+
# Encoded as +number+, or the strings +"NaN"+, +"Infinity"+, or
|
77
|
+
# +"-Infinity"+.
|
78
|
+
FLOAT64 = 3
|
79
|
+
|
80
|
+
# Encoded as +string+ in RFC 3339 timestamp format. The time zone
|
81
|
+
# must be present, and must be +"Z"+.
|
82
|
+
#
|
83
|
+
# If the schema has the column option
|
84
|
+
# +allow_commit_timestamp=true+, the placeholder string
|
85
|
+
# +"spanner.commit_timestamp()"+ can be used to instruct the system
|
86
|
+
# to insert the commit timestamp associated with the transaction
|
87
|
+
# commit.
|
88
|
+
TIMESTAMP = 4
|
89
|
+
|
90
|
+
# Encoded as +string+ in RFC 3339 date format.
|
91
|
+
DATE = 5
|
92
|
+
|
93
|
+
# Encoded as +string+.
|
94
|
+
STRING = 6
|
95
|
+
|
96
|
+
# Encoded as a base64-encoded +string+, as described in RFC 4648,
|
97
|
+
# section 4.
|
98
|
+
BYTES = 7
|
99
|
+
|
100
|
+
# Encoded as +list+, where the list elements are represented
|
101
|
+
# according to {Google::Spanner::V1::Type#array_element_type array_element_type}.
|
102
|
+
ARRAY = 8
|
103
|
+
|
104
|
+
# Encoded as +list+, where list element +i+ is represented according
|
105
|
+
# to [struct_type.fields[i]][google.spanner.v1.StructType.fields].
|
106
|
+
STRUCT = 9
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -25,7 +25,7 @@ require "pathname"
|
|
25
25
|
require "google/gax"
|
26
26
|
|
27
27
|
require "google/spanner/v1/spanner_pb"
|
28
|
-
require "google/cloud/spanner/credentials"
|
28
|
+
require "google/cloud/spanner/v1/credentials"
|
29
29
|
|
30
30
|
module Google
|
31
31
|
module Cloud
|
@@ -47,6 +47,9 @@ module Google
|
|
47
47
|
# The default port of the service.
|
48
48
|
DEFAULT_SERVICE_PORT = 443
|
49
49
|
|
50
|
+
# The default set of gRPC interceptors.
|
51
|
+
GRPC_INTERCEPTORS = []
|
52
|
+
|
50
53
|
DEFAULT_TIMEOUT = 30
|
51
54
|
|
52
55
|
PAGE_DESCRIPTORS = {
|
@@ -62,7 +65,6 @@ module Google
|
|
62
65
|
# this service.
|
63
66
|
ALL_SCOPES = [
|
64
67
|
"https://www.googleapis.com/auth/cloud-platform",
|
65
|
-
"https://www.googleapis.com/auth/spanner.admin",
|
66
68
|
"https://www.googleapis.com/auth/spanner.data"
|
67
69
|
].freeze
|
68
70
|
|
@@ -131,11 +133,18 @@ module Google
|
|
131
133
|
# or the specified config is missing data points.
|
132
134
|
# @param timeout [Numeric]
|
133
135
|
# The default timeout, in seconds, for calls made through this client.
|
136
|
+
# @param metadata [Hash]
|
137
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
138
|
+
# @param exception_transformer [Proc]
|
139
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
140
|
+
# custom error handling.
|
134
141
|
def initialize \
|
135
142
|
credentials: nil,
|
136
143
|
scopes: ALL_SCOPES,
|
137
144
|
client_config: {},
|
138
145
|
timeout: DEFAULT_TIMEOUT,
|
146
|
+
metadata: nil,
|
147
|
+
exception_transformer: nil,
|
139
148
|
lib_name: nil,
|
140
149
|
lib_version: ""
|
141
150
|
# These require statements are intentionally placed here to initialize
|
@@ -144,10 +153,10 @@ module Google
|
|
144
153
|
require "google/gax/grpc"
|
145
154
|
require "google/spanner/v1/spanner_services_pb"
|
146
155
|
|
147
|
-
credentials ||= Google::Cloud::Spanner::Credentials.default
|
156
|
+
credentials ||= Google::Cloud::Spanner::V1::Credentials.default
|
148
157
|
|
149
158
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
150
|
-
updater_proc = Google::Cloud::Spanner::Credentials.new(credentials).updater_proc
|
159
|
+
updater_proc = Google::Cloud::Spanner::V1::Credentials.new(credentials).updater_proc
|
151
160
|
end
|
152
161
|
if credentials.is_a?(GRPC::Core::Channel)
|
153
162
|
channel = credentials
|
@@ -171,6 +180,7 @@ module Google
|
|
171
180
|
google_api_client.freeze
|
172
181
|
|
173
182
|
headers = { :"x-goog-api-client" => google_api_client }
|
183
|
+
headers.merge!(metadata) unless metadata.nil?
|
174
184
|
client_config_file = Pathname.new(__dir__).join(
|
175
185
|
"spanner_client_config.json"
|
176
186
|
)
|
@@ -183,13 +193,14 @@ module Google
|
|
183
193
|
timeout,
|
184
194
|
page_descriptors: PAGE_DESCRIPTORS,
|
185
195
|
errors: Google::Gax::Grpc::API_ERRORS,
|
186
|
-
|
196
|
+
metadata: headers
|
187
197
|
)
|
188
198
|
end
|
189
199
|
|
190
200
|
# Allow overriding the service path/port in subclasses.
|
191
201
|
service_path = self.class::SERVICE_ADDRESS
|
192
202
|
port = self.class::DEFAULT_SERVICE_PORT
|
203
|
+
interceptors = self.class::GRPC_INTERCEPTORS
|
193
204
|
@spanner_stub = Google::Gax::Grpc.create_stub(
|
194
205
|
service_path,
|
195
206
|
port,
|
@@ -197,60 +208,74 @@ module Google
|
|
197
208
|
channel: channel,
|
198
209
|
updater_proc: updater_proc,
|
199
210
|
scopes: scopes,
|
211
|
+
interceptors: interceptors,
|
200
212
|
&Google::Spanner::V1::Spanner::Stub.method(:new)
|
201
213
|
)
|
202
214
|
|
203
215
|
@create_session = Google::Gax.create_api_call(
|
204
216
|
@spanner_stub.method(:create_session),
|
205
|
-
defaults["create_session"]
|
217
|
+
defaults["create_session"],
|
218
|
+
exception_transformer: exception_transformer
|
206
219
|
)
|
207
220
|
@get_session = Google::Gax.create_api_call(
|
208
221
|
@spanner_stub.method(:get_session),
|
209
|
-
defaults["get_session"]
|
222
|
+
defaults["get_session"],
|
223
|
+
exception_transformer: exception_transformer
|
210
224
|
)
|
211
225
|
@list_sessions = Google::Gax.create_api_call(
|
212
226
|
@spanner_stub.method(:list_sessions),
|
213
|
-
defaults["list_sessions"]
|
227
|
+
defaults["list_sessions"],
|
228
|
+
exception_transformer: exception_transformer
|
214
229
|
)
|
215
230
|
@delete_session = Google::Gax.create_api_call(
|
216
231
|
@spanner_stub.method(:delete_session),
|
217
|
-
defaults["delete_session"]
|
232
|
+
defaults["delete_session"],
|
233
|
+
exception_transformer: exception_transformer
|
218
234
|
)
|
219
235
|
@execute_sql = Google::Gax.create_api_call(
|
220
236
|
@spanner_stub.method(:execute_sql),
|
221
|
-
defaults["execute_sql"]
|
237
|
+
defaults["execute_sql"],
|
238
|
+
exception_transformer: exception_transformer
|
222
239
|
)
|
223
240
|
@execute_streaming_sql = Google::Gax.create_api_call(
|
224
241
|
@spanner_stub.method(:execute_streaming_sql),
|
225
|
-
defaults["execute_streaming_sql"]
|
242
|
+
defaults["execute_streaming_sql"],
|
243
|
+
exception_transformer: exception_transformer
|
226
244
|
)
|
227
245
|
@read = Google::Gax.create_api_call(
|
228
246
|
@spanner_stub.method(:read),
|
229
|
-
defaults["read"]
|
247
|
+
defaults["read"],
|
248
|
+
exception_transformer: exception_transformer
|
230
249
|
)
|
231
250
|
@streaming_read = Google::Gax.create_api_call(
|
232
251
|
@spanner_stub.method(:streaming_read),
|
233
|
-
defaults["streaming_read"]
|
252
|
+
defaults["streaming_read"],
|
253
|
+
exception_transformer: exception_transformer
|
234
254
|
)
|
235
255
|
@begin_transaction = Google::Gax.create_api_call(
|
236
256
|
@spanner_stub.method(:begin_transaction),
|
237
|
-
defaults["begin_transaction"]
|
257
|
+
defaults["begin_transaction"],
|
258
|
+
exception_transformer: exception_transformer
|
238
259
|
)
|
239
260
|
@commit = Google::Gax.create_api_call(
|
240
261
|
@spanner_stub.method(:commit),
|
241
|
-
defaults["commit"]
|
262
|
+
defaults["commit"],
|
263
|
+
exception_transformer: exception_transformer
|
242
264
|
)
|
243
265
|
@rollback = Google::Gax.create_api_call(
|
244
266
|
@spanner_stub.method(:rollback),
|
245
|
-
defaults["rollback"]
|
267
|
+
defaults["rollback"],
|
268
|
+
exception_transformer: exception_transformer
|
246
269
|
)
|
247
270
|
@partition_query = Google::Gax.create_api_call(
|
248
271
|
@spanner_stub.method(:partition_query),
|
249
|
-
defaults["partition_query"]
|
272
|
+
defaults["partition_query"],
|
273
|
+
exception_transformer: exception_transformer
|
250
274
|
)
|
251
275
|
@partition_read = Google::Gax.create_api_call(
|
252
276
|
@spanner_stub.method(:partition_read),
|
253
|
-
defaults["partition_read"]
|
277
|
+
defaults["partition_read"],
|
278
|
+
exception_transformer: exception_transformer
|
254
279
|
)
|
255
280
|
end
|
256
281
|
|
@@ -285,25 +310,29 @@ module Google
|
|
285
310
|
# @param options [Google::Gax::CallOptions]
|
286
311
|
# Overrides the default settings for this call, e.g, timeout,
|
287
312
|
# retries, etc.
|
313
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
314
|
+
# @yieldparam result [Google::Spanner::V1::Session]
|
315
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
288
316
|
# @return [Google::Spanner::V1::Session]
|
289
317
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
290
318
|
# @example
|
291
|
-
# require "google/cloud/spanner
|
319
|
+
# require "google/cloud/spanner"
|
292
320
|
#
|
293
|
-
# spanner_client = Google::Cloud::Spanner
|
321
|
+
# spanner_client = Google::Cloud::Spanner.new(version: :v1)
|
294
322
|
# formatted_database = Google::Cloud::Spanner::V1::SpannerClient.database_path("[PROJECT]", "[INSTANCE]", "[DATABASE]")
|
295
323
|
# response = spanner_client.create_session(formatted_database)
|
296
324
|
|
297
325
|
def create_session \
|
298
326
|
database,
|
299
327
|
session: nil,
|
300
|
-
options: nil
|
328
|
+
options: nil,
|
329
|
+
&block
|
301
330
|
req = {
|
302
331
|
database: database,
|
303
332
|
session: session
|
304
333
|
}.delete_if { |_, v| v.nil? }
|
305
334
|
req = Google::Gax::to_proto(req, Google::Spanner::V1::CreateSessionRequest)
|
306
|
-
@create_session.call(req, options)
|
335
|
+
@create_session.call(req, options, &block)
|
307
336
|
end
|
308
337
|
|
309
338
|
# Gets a session. Returns +NOT_FOUND+ if the session does not exist.
|
@@ -315,23 +344,27 @@ module Google
|
|
315
344
|
# @param options [Google::Gax::CallOptions]
|
316
345
|
# Overrides the default settings for this call, e.g, timeout,
|
317
346
|
# retries, etc.
|
347
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
348
|
+
# @yieldparam result [Google::Spanner::V1::Session]
|
349
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
318
350
|
# @return [Google::Spanner::V1::Session]
|
319
351
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
320
352
|
# @example
|
321
|
-
# require "google/cloud/spanner
|
353
|
+
# require "google/cloud/spanner"
|
322
354
|
#
|
323
|
-
# spanner_client = Google::Cloud::Spanner
|
355
|
+
# spanner_client = Google::Cloud::Spanner.new(version: :v1)
|
324
356
|
# formatted_name = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
|
325
357
|
# response = spanner_client.get_session(formatted_name)
|
326
358
|
|
327
359
|
def get_session \
|
328
360
|
name,
|
329
|
-
options: nil
|
361
|
+
options: nil,
|
362
|
+
&block
|
330
363
|
req = {
|
331
364
|
name: name
|
332
365
|
}.delete_if { |_, v| v.nil? }
|
333
366
|
req = Google::Gax::to_proto(req, Google::Spanner::V1::GetSessionRequest)
|
334
|
-
@get_session.call(req, options)
|
367
|
+
@get_session.call(req, options, &block)
|
335
368
|
end
|
336
369
|
|
337
370
|
# Lists all sessions in a given database.
|
@@ -358,6 +391,9 @@ module Google
|
|
358
391
|
# @param options [Google::Gax::CallOptions]
|
359
392
|
# Overrides the default settings for this call, e.g, timeout,
|
360
393
|
# retries, etc.
|
394
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
395
|
+
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Spanner::V1::Session>]
|
396
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
361
397
|
# @return [Google::Gax::PagedEnumerable<Google::Spanner::V1::Session>]
|
362
398
|
# An enumerable of Google::Spanner::V1::Session instances.
|
363
399
|
# See Google::Gax::PagedEnumerable documentation for other
|
@@ -365,9 +401,9 @@ module Google
|
|
365
401
|
# object.
|
366
402
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
367
403
|
# @example
|
368
|
-
# require "google/cloud/spanner
|
404
|
+
# require "google/cloud/spanner"
|
369
405
|
#
|
370
|
-
# spanner_client = Google::Cloud::Spanner
|
406
|
+
# spanner_client = Google::Cloud::Spanner.new(version: :v1)
|
371
407
|
# formatted_database = Google::Cloud::Spanner::V1::SpannerClient.database_path("[PROJECT]", "[INSTANCE]", "[DATABASE]")
|
372
408
|
#
|
373
409
|
# # Iterate over all results.
|
@@ -387,14 +423,15 @@ module Google
|
|
387
423
|
database,
|
388
424
|
page_size: nil,
|
389
425
|
filter: nil,
|
390
|
-
options: nil
|
426
|
+
options: nil,
|
427
|
+
&block
|
391
428
|
req = {
|
392
429
|
database: database,
|
393
430
|
page_size: page_size,
|
394
431
|
filter: filter
|
395
432
|
}.delete_if { |_, v| v.nil? }
|
396
433
|
req = Google::Gax::to_proto(req, Google::Spanner::V1::ListSessionsRequest)
|
397
|
-
@list_sessions.call(req, options)
|
434
|
+
@list_sessions.call(req, options, &block)
|
398
435
|
end
|
399
436
|
|
400
437
|
# Ends a session, releasing server resources associated with it.
|
@@ -404,22 +441,26 @@ module Google
|
|
404
441
|
# @param options [Google::Gax::CallOptions]
|
405
442
|
# Overrides the default settings for this call, e.g, timeout,
|
406
443
|
# retries, etc.
|
444
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
445
|
+
# @yieldparam result []
|
446
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
407
447
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
408
448
|
# @example
|
409
|
-
# require "google/cloud/spanner
|
449
|
+
# require "google/cloud/spanner"
|
410
450
|
#
|
411
|
-
# spanner_client = Google::Cloud::Spanner
|
451
|
+
# spanner_client = Google::Cloud::Spanner.new(version: :v1)
|
412
452
|
# formatted_name = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
|
413
453
|
# spanner_client.delete_session(formatted_name)
|
414
454
|
|
415
455
|
def delete_session \
|
416
456
|
name,
|
417
|
-
options: nil
|
457
|
+
options: nil,
|
458
|
+
&block
|
418
459
|
req = {
|
419
460
|
name: name
|
420
461
|
}.delete_if { |_, v| v.nil? }
|
421
462
|
req = Google::Gax::to_proto(req, Google::Spanner::V1::DeleteSessionRequest)
|
422
|
-
@delete_session.call(req, options)
|
463
|
+
@delete_session.call(req, options, &block)
|
423
464
|
nil
|
424
465
|
end
|
425
466
|
|
@@ -491,12 +532,15 @@ module Google
|
|
491
532
|
# @param options [Google::Gax::CallOptions]
|
492
533
|
# Overrides the default settings for this call, e.g, timeout,
|
493
534
|
# retries, etc.
|
535
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
536
|
+
# @yieldparam result [Google::Spanner::V1::ResultSet]
|
537
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
494
538
|
# @return [Google::Spanner::V1::ResultSet]
|
495
539
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
496
540
|
# @example
|
497
|
-
# require "google/cloud/spanner
|
541
|
+
# require "google/cloud/spanner"
|
498
542
|
#
|
499
|
-
# spanner_client = Google::Cloud::Spanner
|
543
|
+
# spanner_client = Google::Cloud::Spanner.new(version: :v1)
|
500
544
|
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
|
501
545
|
#
|
502
546
|
# # TODO: Initialize +sql+:
|
@@ -512,7 +556,8 @@ module Google
|
|
512
556
|
resume_token: nil,
|
513
557
|
query_mode: nil,
|
514
558
|
partition_token: nil,
|
515
|
-
options: nil
|
559
|
+
options: nil,
|
560
|
+
&block
|
516
561
|
req = {
|
517
562
|
session: session,
|
518
563
|
sql: sql,
|
@@ -524,7 +569,7 @@ module Google
|
|
524
569
|
partition_token: partition_token
|
525
570
|
}.delete_if { |_, v| v.nil? }
|
526
571
|
req = Google::Gax::to_proto(req, Google::Spanner::V1::ExecuteSqlRequest)
|
527
|
-
@execute_sql.call(req, options)
|
572
|
+
@execute_sql.call(req, options, &block)
|
528
573
|
end
|
529
574
|
|
530
575
|
# Like {Google::Spanner::V1::Spanner::ExecuteSql ExecuteSql}, except returns the result
|
@@ -594,9 +639,9 @@ module Google
|
|
594
639
|
#
|
595
640
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
596
641
|
# @example
|
597
|
-
# require "google/cloud/spanner
|
642
|
+
# require "google/cloud/spanner"
|
598
643
|
#
|
599
|
-
# spanner_client = Google::Cloud::Spanner
|
644
|
+
# spanner_client = Google::Cloud::Spanner.new(version: :v1)
|
600
645
|
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
|
601
646
|
#
|
602
647
|
# # TODO: Initialize +sql+:
|
@@ -693,12 +738,15 @@ module Google
|
|
693
738
|
# @param options [Google::Gax::CallOptions]
|
694
739
|
# Overrides the default settings for this call, e.g, timeout,
|
695
740
|
# retries, etc.
|
741
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
742
|
+
# @yieldparam result [Google::Spanner::V1::ResultSet]
|
743
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
696
744
|
# @return [Google::Spanner::V1::ResultSet]
|
697
745
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
698
746
|
# @example
|
699
|
-
# require "google/cloud/spanner
|
747
|
+
# require "google/cloud/spanner"
|
700
748
|
#
|
701
|
-
# spanner_client = Google::Cloud::Spanner
|
749
|
+
# spanner_client = Google::Cloud::Spanner.new(version: :v1)
|
702
750
|
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
|
703
751
|
#
|
704
752
|
# # TODO: Initialize +table+:
|
@@ -721,7 +769,8 @@ module Google
|
|
721
769
|
limit: nil,
|
722
770
|
resume_token: nil,
|
723
771
|
partition_token: nil,
|
724
|
-
options: nil
|
772
|
+
options: nil,
|
773
|
+
&block
|
725
774
|
req = {
|
726
775
|
session: session,
|
727
776
|
table: table,
|
@@ -734,7 +783,7 @@ module Google
|
|
734
783
|
partition_token: partition_token
|
735
784
|
}.delete_if { |_, v| v.nil? }
|
736
785
|
req = Google::Gax::to_proto(req, Google::Spanner::V1::ReadRequest)
|
737
|
-
@read.call(req, options)
|
786
|
+
@read.call(req, options, &block)
|
738
787
|
end
|
739
788
|
|
740
789
|
# Like {Google::Spanner::V1::Spanner::Read Read}, except returns the result set as a
|
@@ -798,9 +847,9 @@ module Google
|
|
798
847
|
#
|
799
848
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
800
849
|
# @example
|
801
|
-
# require "google/cloud/spanner
|
850
|
+
# require "google/cloud/spanner"
|
802
851
|
#
|
803
|
-
# spanner_client = Google::Cloud::Spanner
|
852
|
+
# spanner_client = Google::Cloud::Spanner.new(version: :v1)
|
804
853
|
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
|
805
854
|
#
|
806
855
|
# # TODO: Initialize +table+:
|
@@ -855,12 +904,15 @@ module Google
|
|
855
904
|
# @param options [Google::Gax::CallOptions]
|
856
905
|
# Overrides the default settings for this call, e.g, timeout,
|
857
906
|
# retries, etc.
|
907
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
908
|
+
# @yieldparam result [Google::Spanner::V1::Transaction]
|
909
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
858
910
|
# @return [Google::Spanner::V1::Transaction]
|
859
911
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
860
912
|
# @example
|
861
|
-
# require "google/cloud/spanner
|
913
|
+
# require "google/cloud/spanner"
|
862
914
|
#
|
863
|
-
# spanner_client = Google::Cloud::Spanner
|
915
|
+
# spanner_client = Google::Cloud::Spanner.new(version: :v1)
|
864
916
|
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
|
865
917
|
#
|
866
918
|
# # TODO: Initialize +options_+:
|
@@ -870,13 +922,14 @@ module Google
|
|
870
922
|
def begin_transaction \
|
871
923
|
session,
|
872
924
|
options_,
|
873
|
-
options: nil
|
925
|
+
options: nil,
|
926
|
+
&block
|
874
927
|
req = {
|
875
928
|
session: session,
|
876
929
|
options: options_
|
877
930
|
}.delete_if { |_, v| v.nil? }
|
878
931
|
req = Google::Gax::to_proto(req, Google::Spanner::V1::BeginTransactionRequest)
|
879
|
-
@begin_transaction.call(req, options)
|
932
|
+
@begin_transaction.call(req, options, &block)
|
880
933
|
end
|
881
934
|
|
882
935
|
# Commits a transaction. The request includes the mutations to be
|
@@ -913,12 +966,15 @@ module Google
|
|
913
966
|
# @param options [Google::Gax::CallOptions]
|
914
967
|
# Overrides the default settings for this call, e.g, timeout,
|
915
968
|
# retries, etc.
|
969
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
970
|
+
# @yieldparam result [Google::Spanner::V1::CommitResponse]
|
971
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
916
972
|
# @return [Google::Spanner::V1::CommitResponse]
|
917
973
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
918
974
|
# @example
|
919
|
-
# require "google/cloud/spanner
|
975
|
+
# require "google/cloud/spanner"
|
920
976
|
#
|
921
|
-
# spanner_client = Google::Cloud::Spanner
|
977
|
+
# spanner_client = Google::Cloud::Spanner.new(version: :v1)
|
922
978
|
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
|
923
979
|
#
|
924
980
|
# # TODO: Initialize +mutations+:
|
@@ -930,7 +986,8 @@ module Google
|
|
930
986
|
mutations,
|
931
987
|
transaction_id: nil,
|
932
988
|
single_use_transaction: nil,
|
933
|
-
options: nil
|
989
|
+
options: nil,
|
990
|
+
&block
|
934
991
|
req = {
|
935
992
|
session: session,
|
936
993
|
mutations: mutations,
|
@@ -938,7 +995,7 @@ module Google
|
|
938
995
|
single_use_transaction: single_use_transaction
|
939
996
|
}.delete_if { |_, v| v.nil? }
|
940
997
|
req = Google::Gax::to_proto(req, Google::Spanner::V1::CommitRequest)
|
941
|
-
@commit.call(req, options)
|
998
|
+
@commit.call(req, options, &block)
|
942
999
|
end
|
943
1000
|
|
944
1001
|
# Rolls back a transaction, releasing any locks it holds. It is a good
|
@@ -957,11 +1014,14 @@ module Google
|
|
957
1014
|
# @param options [Google::Gax::CallOptions]
|
958
1015
|
# Overrides the default settings for this call, e.g, timeout,
|
959
1016
|
# retries, etc.
|
1017
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
1018
|
+
# @yieldparam result []
|
1019
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
960
1020
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
961
1021
|
# @example
|
962
|
-
# require "google/cloud/spanner
|
1022
|
+
# require "google/cloud/spanner"
|
963
1023
|
#
|
964
|
-
# spanner_client = Google::Cloud::Spanner
|
1024
|
+
# spanner_client = Google::Cloud::Spanner.new(version: :v1)
|
965
1025
|
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
|
966
1026
|
#
|
967
1027
|
# # TODO: Initialize +transaction_id+:
|
@@ -971,13 +1031,14 @@ module Google
|
|
971
1031
|
def rollback \
|
972
1032
|
session,
|
973
1033
|
transaction_id,
|
974
|
-
options: nil
|
1034
|
+
options: nil,
|
1035
|
+
&block
|
975
1036
|
req = {
|
976
1037
|
session: session,
|
977
1038
|
transaction_id: transaction_id
|
978
1039
|
}.delete_if { |_, v| v.nil? }
|
979
1040
|
req = Google::Gax::to_proto(req, Google::Spanner::V1::RollbackRequest)
|
980
|
-
@rollback.call(req, options)
|
1041
|
+
@rollback.call(req, options, &block)
|
981
1042
|
nil
|
982
1043
|
end
|
983
1044
|
|
@@ -1039,12 +1100,15 @@ module Google
|
|
1039
1100
|
# @param options [Google::Gax::CallOptions]
|
1040
1101
|
# Overrides the default settings for this call, e.g, timeout,
|
1041
1102
|
# retries, etc.
|
1103
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
1104
|
+
# @yieldparam result [Google::Spanner::V1::PartitionResponse]
|
1105
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1042
1106
|
# @return [Google::Spanner::V1::PartitionResponse]
|
1043
1107
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1044
1108
|
# @example
|
1045
|
-
# require "google/cloud/spanner
|
1109
|
+
# require "google/cloud/spanner"
|
1046
1110
|
#
|
1047
|
-
# spanner_client = Google::Cloud::Spanner
|
1111
|
+
# spanner_client = Google::Cloud::Spanner.new(version: :v1)
|
1048
1112
|
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
|
1049
1113
|
#
|
1050
1114
|
# # TODO: Initialize +sql+:
|
@@ -1058,7 +1122,8 @@ module Google
|
|
1058
1122
|
params: nil,
|
1059
1123
|
param_types: nil,
|
1060
1124
|
partition_options: nil,
|
1061
|
-
options: nil
|
1125
|
+
options: nil,
|
1126
|
+
&block
|
1062
1127
|
req = {
|
1063
1128
|
session: session,
|
1064
1129
|
sql: sql,
|
@@ -1068,7 +1133,7 @@ module Google
|
|
1068
1133
|
partition_options: partition_options
|
1069
1134
|
}.delete_if { |_, v| v.nil? }
|
1070
1135
|
req = Google::Gax::to_proto(req, Google::Spanner::V1::PartitionQueryRequest)
|
1071
|
-
@partition_query.call(req, options)
|
1136
|
+
@partition_query.call(req, options, &block)
|
1072
1137
|
end
|
1073
1138
|
|
1074
1139
|
# Creates a set of partition tokens that can be used to execute a read
|
@@ -1113,12 +1178,15 @@ module Google
|
|
1113
1178
|
# @param options [Google::Gax::CallOptions]
|
1114
1179
|
# Overrides the default settings for this call, e.g, timeout,
|
1115
1180
|
# retries, etc.
|
1181
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
1182
|
+
# @yieldparam result [Google::Spanner::V1::PartitionResponse]
|
1183
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1116
1184
|
# @return [Google::Spanner::V1::PartitionResponse]
|
1117
1185
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1118
1186
|
# @example
|
1119
|
-
# require "google/cloud/spanner
|
1187
|
+
# require "google/cloud/spanner"
|
1120
1188
|
#
|
1121
|
-
# spanner_client = Google::Cloud::Spanner
|
1189
|
+
# spanner_client = Google::Cloud::Spanner.new(version: :v1)
|
1122
1190
|
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
|
1123
1191
|
#
|
1124
1192
|
# # TODO: Initialize +table+:
|
@@ -1136,7 +1204,8 @@ module Google
|
|
1136
1204
|
index: nil,
|
1137
1205
|
columns: nil,
|
1138
1206
|
partition_options: nil,
|
1139
|
-
options: nil
|
1207
|
+
options: nil,
|
1208
|
+
&block
|
1140
1209
|
req = {
|
1141
1210
|
session: session,
|
1142
1211
|
table: table,
|
@@ -1147,7 +1216,7 @@ module Google
|
|
1147
1216
|
partition_options: partition_options
|
1148
1217
|
}.delete_if { |_, v| v.nil? }
|
1149
1218
|
req = Google::Gax::to_proto(req, Google::Spanner::V1::PartitionReadRequest)
|
1150
|
-
@partition_read.call(req, options)
|
1219
|
+
@partition_read.call(req, options, &block)
|
1151
1220
|
end
|
1152
1221
|
end
|
1153
1222
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-spanner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Moore
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-08-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -137,6 +137,20 @@ dependencies:
|
|
137
137
|
- - "~>"
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '1.1'
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: redcarpet
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - "~>"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '3.0'
|
147
|
+
type: :development
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - "~>"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '3.0'
|
140
154
|
- !ruby/object:Gem::Dependency
|
141
155
|
name: rubocop
|
142
156
|
requirement: !ruby/object:Gem::Requirement
|
@@ -255,7 +269,9 @@ files:
|
|
255
269
|
- lib/google/cloud/spanner/status.rb
|
256
270
|
- lib/google/cloud/spanner/transaction.rb
|
257
271
|
- lib/google/cloud/spanner/v1.rb
|
272
|
+
- lib/google/cloud/spanner/v1/credentials.rb
|
258
273
|
- lib/google/cloud/spanner/v1/doc/google/protobuf/duration.rb
|
274
|
+
- lib/google/cloud/spanner/v1/doc/google/protobuf/empty.rb
|
259
275
|
- lib/google/cloud/spanner/v1/doc/google/protobuf/struct.rb
|
260
276
|
- lib/google/cloud/spanner/v1/doc/google/protobuf/timestamp.rb
|
261
277
|
- lib/google/cloud/spanner/v1/doc/google/spanner/v1/keys.rb
|
@@ -264,7 +280,7 @@ files:
|
|
264
280
|
- lib/google/cloud/spanner/v1/doc/google/spanner/v1/result_set.rb
|
265
281
|
- lib/google/cloud/spanner/v1/doc/google/spanner/v1/spanner.rb
|
266
282
|
- lib/google/cloud/spanner/v1/doc/google/spanner/v1/transaction.rb
|
267
|
-
- lib/google/cloud/spanner/v1/doc/
|
283
|
+
- lib/google/cloud/spanner/v1/doc/google/spanner/v1/type.rb
|
268
284
|
- lib/google/cloud/spanner/v1/spanner_client.rb
|
269
285
|
- lib/google/cloud/spanner/v1/spanner_client_config.json
|
270
286
|
- lib/google/cloud/spanner/version.rb
|
@@ -1,55 +0,0 @@
|
|
1
|
-
# Copyright 2018 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
|
-
module Google
|
16
|
-
module Cloud
|
17
|
-
# rubocop:disable LineLength
|
18
|
-
|
19
|
-
##
|
20
|
-
# # Ruby Client for Cloud Spanner API ([GA](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
21
|
-
#
|
22
|
-
# [Cloud Spanner API][Product Documentation]:
|
23
|
-
# Cloud Spanner is a managed, mission-critical, globally consistent and
|
24
|
-
# scalable relational database service.
|
25
|
-
# - [Product Documentation][]
|
26
|
-
#
|
27
|
-
# ## Quick Start
|
28
|
-
# In order to use this library, you first need to go through the following
|
29
|
-
# steps:
|
30
|
-
#
|
31
|
-
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
32
|
-
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
33
|
-
# 3. [Enable the Cloud Spanner API.](https://console.cloud.google.com/apis/api/spanner)
|
34
|
-
# 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
35
|
-
#
|
36
|
-
# ### Installation
|
37
|
-
# ```
|
38
|
-
# $ gem install google-cloud-spanner
|
39
|
-
# ```
|
40
|
-
#
|
41
|
-
# ### Next Steps
|
42
|
-
# - Read the [Cloud Spanner API Product documentation][Product Documentation]
|
43
|
-
# to learn more about the product and see How-to Guides.
|
44
|
-
# - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
|
45
|
-
# to see the full list of Cloud APIs that we cover.
|
46
|
-
#
|
47
|
-
# [Product Documentation]: https://cloud.google.com/spanner
|
48
|
-
#
|
49
|
-
#
|
50
|
-
module Spanner
|
51
|
-
module V1
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|