google-cloud-spanner 1.9.0 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +33 -12
- data/CHANGELOG.md +8 -0
- data/lib/google/cloud/spanner/admin/database/v1/database_admin_client.rb +52 -25
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/longrunning/operations.rb +1 -1
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/any.rb +2 -1
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/longrunning/operations.rb +1 -1
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/any.rb +2 -1
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/field_mask.rb +18 -26
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client.rb +56 -26
- data/lib/google/cloud/spanner/pool.rb +14 -7
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/any.rb +2 -1
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/timestamp.rb +15 -13
- data/lib/google/cloud/spanner/v1/spanner_client.rb +56 -14
- data/lib/google/cloud/spanner/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01e57b593ae2ee535ca3c1a3a6432fac3cb89a20a7281b65b4ac27c1218af892
|
4
|
+
data.tar.gz: c662c62580697337783a77d9af59e25465e14f083fb13ce50ff3fefb66cc9df3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf84f31f5fd21b4a458fda2b236d1204be4c6113d9ec7617a77e2a8a7db9c5eef66f90d985a1ecbc43eeb4f9846967d95f500eeb61d2851fa8e3b010f71e6760
|
7
|
+
data.tar.gz: 0516eb395fc8602ab97eafbf935e4dd51d3583fdac8c0ba9ed35eb7dbb15d5c1b2f41ddab90ddeac7a9a55c4dc630b8fa2874dfc71a60d55922268c65e9f9a21
|
data/AUTHENTICATION.md
CHANGED
@@ -2,20 +2,39 @@
|
|
2
2
|
|
3
3
|
In general, the google-cloud-spanner library uses [Service
|
4
4
|
Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts)
|
5
|
-
credentials to connect to Google Cloud services. When running
|
5
|
+
credentials to connect to Google Cloud services. When running within [Google
|
6
|
+
Cloud Platform environments](#google-cloud-platform-environments)
|
6
7
|
the credentials will be discovered automatically. When running on other
|
7
8
|
environments, the Service Account credentials can be specified by providing the
|
8
9
|
path to the [JSON
|
9
10
|
keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) for
|
10
|
-
the account (or the JSON itself) in environment
|
11
|
-
SDK credentials can also
|
12
|
-
recommended during development.
|
11
|
+
the account (or the JSON itself) in [environment
|
12
|
+
variables](#environment-variables). Additionally, Cloud SDK credentials can also
|
13
|
+
be discovered automatically, but this is only recommended during development.
|
14
|
+
|
15
|
+
## Quickstart
|
16
|
+
|
17
|
+
1. [Create a service account and credentials](#creating-a-service-account).
|
18
|
+
2. Set the [environment variable](#environment-variables).
|
19
|
+
|
20
|
+
```sh
|
21
|
+
export SPANNER_CREDENTIALS=/path/to/json`
|
22
|
+
```
|
23
|
+
|
24
|
+
3. Initialize the client.
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
require "google/cloud/spanner"
|
28
|
+
|
29
|
+
client = Google::Cloud::Spanner.new
|
30
|
+
```
|
13
31
|
|
14
32
|
## Project and Credential Lookup
|
15
33
|
|
16
|
-
The google-cloud-spanner library aims to make authentication
|
17
|
-
possible, and provides several mechanisms to configure your system
|
18
|
-
providing **Project ID** and **Service Account Credentials** directly in
|
34
|
+
The google-cloud-spanner library aims to make authentication
|
35
|
+
as simple as possible, and provides several mechanisms to configure your system
|
36
|
+
without providing **Project ID** and **Service Account Credentials** directly in
|
37
|
+
code.
|
19
38
|
|
20
39
|
**Project ID** is discovered in the following order:
|
21
40
|
|
@@ -23,6 +42,7 @@ providing **Project ID** and **Service Account Credentials** directly in code.
|
|
23
42
|
2. Specify project ID in configuration
|
24
43
|
3. Discover project ID in environment variables
|
25
44
|
4. Discover GCE project ID
|
45
|
+
5. Discover project ID in credentials JSON
|
26
46
|
|
27
47
|
**Credentials** are discovered in the following order:
|
28
48
|
|
@@ -73,12 +93,12 @@ environment variable, or the **Credentials JSON** itself can be stored for
|
|
73
93
|
environments such as Docker containers where writing files is difficult or not
|
74
94
|
encouraged.
|
75
95
|
|
76
|
-
The environment variables that
|
96
|
+
The environment variables that google-cloud-spanner checks for project ID are:
|
77
97
|
|
78
98
|
1. `SPANNER_PROJECT`
|
79
99
|
2. `GOOGLE_CLOUD_PROJECT`
|
80
100
|
|
81
|
-
The environment variables that
|
101
|
+
The environment variables that google-cloud-spanner checks for credentials are configured on {Google::Cloud::Spanner::V1::Credentials}:
|
82
102
|
|
83
103
|
1. `SPANNER_CREDENTIALS` - Path to JSON file, or JSON contents
|
84
104
|
2. `SPANNER_KEYFILE` - Path to JSON file, or JSON contents
|
@@ -92,7 +112,7 @@ require "google/cloud/spanner"
|
|
92
112
|
ENV["SPANNER_PROJECT"] = "my-project-id"
|
93
113
|
ENV["SPANNER_CREDENTIALS"] = "path/to/keyfile.json"
|
94
114
|
|
95
|
-
|
115
|
+
client = Google::Cloud::Spanner.new
|
96
116
|
```
|
97
117
|
|
98
118
|
### Configuration
|
@@ -107,7 +127,7 @@ Google::Cloud::Spanner.configure do |config|
|
|
107
127
|
config.credentials = "path/to/keyfile.json"
|
108
128
|
end
|
109
129
|
|
110
|
-
|
130
|
+
client = Google::Cloud::Spanner.new
|
111
131
|
```
|
112
132
|
|
113
133
|
### Cloud SDK
|
@@ -140,7 +160,8 @@ Google Cloud requires a **Project ID** and **Service Account Credentials** to
|
|
140
160
|
connect to the APIs. You will use the **Project ID** and **JSON key file** to
|
141
161
|
connect to most services with google-cloud-spanner.
|
142
162
|
|
143
|
-
If you are not running this client
|
163
|
+
If you are not running this client within [Google Cloud Platform
|
164
|
+
environments](#google-cloud-platform-environments), you need a Google
|
144
165
|
Developers service account.
|
145
166
|
|
146
167
|
1. Visit the [Google Developers Console][dev-console].
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 1.9.1 / 2019-04-30
|
4
|
+
|
5
|
+
* Fix Spanner session limit bug.
|
6
|
+
* Update AUTHENTICATION.md guide.
|
7
|
+
* Update documentation for common types.
|
8
|
+
* Update generated documentation.
|
9
|
+
* Extract gRPC header values from request.
|
10
|
+
|
3
11
|
### 1.9.0 / 2019-03-08
|
4
12
|
|
5
13
|
* Spanner Batch DML.
|
@@ -81,28 +81,17 @@ module Google
|
|
81
81
|
self::GRPC_INTERCEPTORS = DatabaseAdminClient::GRPC_INTERCEPTORS
|
82
82
|
end
|
83
83
|
|
84
|
-
INSTANCE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
85
|
-
"projects/{project}/instances/{instance}"
|
86
|
-
)
|
87
|
-
|
88
|
-
private_constant :INSTANCE_PATH_TEMPLATE
|
89
|
-
|
90
84
|
DATABASE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
91
85
|
"projects/{project}/instances/{instance}/databases/{database}"
|
92
86
|
)
|
93
87
|
|
94
88
|
private_constant :DATABASE_PATH_TEMPLATE
|
95
89
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
INSTANCE_PATH_TEMPLATE.render(
|
102
|
-
:"project" => project,
|
103
|
-
:"instance" => instance
|
104
|
-
)
|
105
|
-
end
|
90
|
+
INSTANCE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
91
|
+
"projects/{project}/instances/{instance}"
|
92
|
+
)
|
93
|
+
|
94
|
+
private_constant :INSTANCE_PATH_TEMPLATE
|
106
95
|
|
107
96
|
# Returns a fully-qualified database resource name string.
|
108
97
|
# @param project [String]
|
@@ -117,6 +106,17 @@ module Google
|
|
117
106
|
)
|
118
107
|
end
|
119
108
|
|
109
|
+
# Returns a fully-qualified instance resource name string.
|
110
|
+
# @param project [String]
|
111
|
+
# @param instance [String]
|
112
|
+
# @return [String]
|
113
|
+
def self.instance_path project, instance
|
114
|
+
INSTANCE_PATH_TEMPLATE.render(
|
115
|
+
:"project" => project,
|
116
|
+
:"instance" => instance
|
117
|
+
)
|
118
|
+
end
|
119
|
+
|
120
120
|
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
121
121
|
# Provides the means for authenticating requests made by the client. This parameter can
|
122
122
|
# be many types.
|
@@ -232,47 +232,74 @@ module Google
|
|
232
232
|
@list_databases = Google::Gax.create_api_call(
|
233
233
|
@database_admin_stub.method(:list_databases),
|
234
234
|
defaults["list_databases"],
|
235
|
-
exception_transformer: exception_transformer
|
235
|
+
exception_transformer: exception_transformer,
|
236
|
+
params_extractor: proc do |request|
|
237
|
+
{'parent' => request.parent}
|
238
|
+
end
|
236
239
|
)
|
237
240
|
@create_database = Google::Gax.create_api_call(
|
238
241
|
@database_admin_stub.method(:create_database),
|
239
242
|
defaults["create_database"],
|
240
|
-
exception_transformer: exception_transformer
|
243
|
+
exception_transformer: exception_transformer,
|
244
|
+
params_extractor: proc do |request|
|
245
|
+
{'parent' => request.parent}
|
246
|
+
end
|
241
247
|
)
|
242
248
|
@get_database = Google::Gax.create_api_call(
|
243
249
|
@database_admin_stub.method(:get_database),
|
244
250
|
defaults["get_database"],
|
245
|
-
exception_transformer: exception_transformer
|
251
|
+
exception_transformer: exception_transformer,
|
252
|
+
params_extractor: proc do |request|
|
253
|
+
{'name' => request.name}
|
254
|
+
end
|
246
255
|
)
|
247
256
|
@update_database_ddl = Google::Gax.create_api_call(
|
248
257
|
@database_admin_stub.method(:update_database_ddl),
|
249
258
|
defaults["update_database_ddl"],
|
250
|
-
exception_transformer: exception_transformer
|
259
|
+
exception_transformer: exception_transformer,
|
260
|
+
params_extractor: proc do |request|
|
261
|
+
{'database' => request.database}
|
262
|
+
end
|
251
263
|
)
|
252
264
|
@drop_database = Google::Gax.create_api_call(
|
253
265
|
@database_admin_stub.method(:drop_database),
|
254
266
|
defaults["drop_database"],
|
255
|
-
exception_transformer: exception_transformer
|
267
|
+
exception_transformer: exception_transformer,
|
268
|
+
params_extractor: proc do |request|
|
269
|
+
{'database' => request.database}
|
270
|
+
end
|
256
271
|
)
|
257
272
|
@get_database_ddl = Google::Gax.create_api_call(
|
258
273
|
@database_admin_stub.method(:get_database_ddl),
|
259
274
|
defaults["get_database_ddl"],
|
260
|
-
exception_transformer: exception_transformer
|
275
|
+
exception_transformer: exception_transformer,
|
276
|
+
params_extractor: proc do |request|
|
277
|
+
{'database' => request.database}
|
278
|
+
end
|
261
279
|
)
|
262
280
|
@set_iam_policy = Google::Gax.create_api_call(
|
263
281
|
@database_admin_stub.method(:set_iam_policy),
|
264
282
|
defaults["set_iam_policy"],
|
265
|
-
exception_transformer: exception_transformer
|
283
|
+
exception_transformer: exception_transformer,
|
284
|
+
params_extractor: proc do |request|
|
285
|
+
{'resource' => request.resource}
|
286
|
+
end
|
266
287
|
)
|
267
288
|
@get_iam_policy = Google::Gax.create_api_call(
|
268
289
|
@database_admin_stub.method(:get_iam_policy),
|
269
290
|
defaults["get_iam_policy"],
|
270
|
-
exception_transformer: exception_transformer
|
291
|
+
exception_transformer: exception_transformer,
|
292
|
+
params_extractor: proc do |request|
|
293
|
+
{'resource' => request.resource}
|
294
|
+
end
|
271
295
|
)
|
272
296
|
@test_iam_permissions = Google::Gax.create_api_call(
|
273
297
|
@database_admin_stub.method(:test_iam_permissions),
|
274
298
|
defaults["test_iam_permissions"],
|
275
|
-
exception_transformer: exception_transformer
|
299
|
+
exception_transformer: exception_transformer,
|
300
|
+
params_extractor: proc do |request|
|
301
|
+
{'resource' => request.resource}
|
302
|
+
end
|
276
303
|
)
|
277
304
|
end
|
278
305
|
|
@@ -31,7 +31,7 @@ module Google
|
|
31
31
|
# @!attribute [rw] done
|
32
32
|
# @return [true, false]
|
33
33
|
# If the value is `false`, it means the operation is still in progress.
|
34
|
-
# If true
|
34
|
+
# If `true`, the operation is completed, and either `error` or `response` is
|
35
35
|
# available.
|
36
36
|
# @!attribute [rw] error
|
37
37
|
# @return [Google::Rpc::Status]
|
@@ -97,7 +97,8 @@ module Google
|
|
97
97
|
# @!attribute [rw] type_url
|
98
98
|
# @return [String]
|
99
99
|
# A URL/resource name that uniquely identifies the type of the serialized
|
100
|
-
# protocol buffer message.
|
100
|
+
# protocol buffer message. This string must contain at least
|
101
|
+
# one "/" character. The last segment of the URL's path must represent
|
101
102
|
# the fully qualified name of the type (as in
|
102
103
|
# `path/google.protobuf.Duration`). The name should be in a canonical form
|
103
104
|
# (e.g., leading "." is not accepted).
|
@@ -31,7 +31,7 @@ module Google
|
|
31
31
|
# @!attribute [rw] done
|
32
32
|
# @return [true, false]
|
33
33
|
# If the value is `false`, it means the operation is still in progress.
|
34
|
-
# If true
|
34
|
+
# If `true`, the operation is completed, and either `error` or `response` is
|
35
35
|
# available.
|
36
36
|
# @!attribute [rw] error
|
37
37
|
# @return [Google::Rpc::Status]
|
@@ -97,7 +97,8 @@ module Google
|
|
97
97
|
# @!attribute [rw] type_url
|
98
98
|
# @return [String]
|
99
99
|
# A URL/resource name that uniquely identifies the type of the serialized
|
100
|
-
# protocol buffer message.
|
100
|
+
# protocol buffer message. This string must contain at least
|
101
|
+
# one "/" character. The last segment of the URL's path must represent
|
101
102
|
# the fully qualified name of the type (as in
|
102
103
|
# `path/google.protobuf.Duration`). The name should be in a canonical form
|
103
104
|
# (e.g., leading "." is not accepted).
|
@@ -83,57 +83,49 @@ module Google
|
|
83
83
|
# describe the updated values, the API ignores the values of all
|
84
84
|
# fields not covered by the mask.
|
85
85
|
#
|
86
|
-
# If a repeated field is specified for an update operation,
|
87
|
-
#
|
88
|
-
#
|
89
|
-
# string.
|
86
|
+
# If a repeated field is specified for an update operation, new values will
|
87
|
+
# be appended to the existing repeated field in the target resource. Note that
|
88
|
+
# a repeated field is only allowed in the last position of a `paths` string.
|
90
89
|
#
|
91
90
|
# If a sub-message is specified in the last position of the field mask for an
|
92
|
-
# update operation, then the existing sub-message
|
93
|
-
#
|
91
|
+
# update operation, then new value will be merged into the existing sub-message
|
92
|
+
# in the target resource.
|
93
|
+
#
|
94
|
+
# For example, given the target message:
|
94
95
|
#
|
95
96
|
# f {
|
96
97
|
# b {
|
97
|
-
# d
|
98
|
-
# x
|
98
|
+
# d: 1
|
99
|
+
# x: 2
|
99
100
|
# }
|
100
|
-
# c
|
101
|
+
# c: [1]
|
101
102
|
# }
|
102
103
|
#
|
103
104
|
# And an update message:
|
104
105
|
#
|
105
106
|
# f {
|
106
107
|
# b {
|
107
|
-
# d
|
108
|
+
# d: 10
|
108
109
|
# }
|
110
|
+
# c: [2]
|
109
111
|
# }
|
110
112
|
#
|
111
113
|
# then if the field mask is:
|
112
114
|
#
|
113
|
-
# paths: "f.b"
|
115
|
+
# paths: ["f.b", "f.c"]
|
114
116
|
#
|
115
117
|
# then the result will be:
|
116
118
|
#
|
117
119
|
# f {
|
118
120
|
# b {
|
119
|
-
# d
|
121
|
+
# d: 10
|
122
|
+
# x: 2
|
120
123
|
# }
|
121
|
-
# c
|
124
|
+
# c: [1, 2]
|
122
125
|
# }
|
123
126
|
#
|
124
|
-
#
|
125
|
-
#
|
126
|
-
# paths: "f.b.d"
|
127
|
-
#
|
128
|
-
# then the result would be:
|
129
|
-
#
|
130
|
-
# f {
|
131
|
-
# b {
|
132
|
-
# d : 10
|
133
|
-
# x : 2
|
134
|
-
# }
|
135
|
-
# c : 1
|
136
|
-
# }
|
127
|
+
# An implementation may provide options to override this default behavior for
|
128
|
+
# repeated and message fields.
|
137
129
|
#
|
138
130
|
# In order to reset a field's value to the default, the field must
|
139
131
|
# be in the mask and set to the default value in the provided resource.
|
@@ -101,11 +101,11 @@ module Google
|
|
101
101
|
self::GRPC_INTERCEPTORS = InstanceAdminClient::GRPC_INTERCEPTORS
|
102
102
|
end
|
103
103
|
|
104
|
-
|
105
|
-
"projects/{project}"
|
104
|
+
INSTANCE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
105
|
+
"projects/{project}/instances/{instance}"
|
106
106
|
)
|
107
107
|
|
108
|
-
private_constant :
|
108
|
+
private_constant :INSTANCE_PATH_TEMPLATE
|
109
109
|
|
110
110
|
INSTANCE_CONFIG_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
111
111
|
"projects/{project}/instanceConfigs/{instance_config}"
|
@@ -113,18 +113,20 @@ module Google
|
|
113
113
|
|
114
114
|
private_constant :INSTANCE_CONFIG_PATH_TEMPLATE
|
115
115
|
|
116
|
-
|
117
|
-
"projects/{project}
|
116
|
+
PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
117
|
+
"projects/{project}"
|
118
118
|
)
|
119
119
|
|
120
|
-
private_constant :
|
120
|
+
private_constant :PROJECT_PATH_TEMPLATE
|
121
121
|
|
122
|
-
# Returns a fully-qualified
|
122
|
+
# Returns a fully-qualified instance resource name string.
|
123
123
|
# @param project [String]
|
124
|
+
# @param instance [String]
|
124
125
|
# @return [String]
|
125
|
-
def self.
|
126
|
-
|
127
|
-
:"project" => project
|
126
|
+
def self.instance_path project, instance
|
127
|
+
INSTANCE_PATH_TEMPLATE.render(
|
128
|
+
:"project" => project,
|
129
|
+
:"instance" => instance
|
128
130
|
)
|
129
131
|
end
|
130
132
|
|
@@ -139,14 +141,12 @@ module Google
|
|
139
141
|
)
|
140
142
|
end
|
141
143
|
|
142
|
-
# Returns a fully-qualified
|
144
|
+
# Returns a fully-qualified project resource name string.
|
143
145
|
# @param project [String]
|
144
|
-
# @param instance [String]
|
145
146
|
# @return [String]
|
146
|
-
def self.
|
147
|
-
|
148
|
-
:"project" => project
|
149
|
-
:"instance" => instance
|
147
|
+
def self.project_path project
|
148
|
+
PROJECT_PATH_TEMPLATE.render(
|
149
|
+
:"project" => project
|
150
150
|
)
|
151
151
|
end
|
152
152
|
|
@@ -265,52 +265,82 @@ module Google
|
|
265
265
|
@list_instance_configs = Google::Gax.create_api_call(
|
266
266
|
@instance_admin_stub.method(:list_instance_configs),
|
267
267
|
defaults["list_instance_configs"],
|
268
|
-
exception_transformer: exception_transformer
|
268
|
+
exception_transformer: exception_transformer,
|
269
|
+
params_extractor: proc do |request|
|
270
|
+
{'parent' => request.parent}
|
271
|
+
end
|
269
272
|
)
|
270
273
|
@get_instance_config = Google::Gax.create_api_call(
|
271
274
|
@instance_admin_stub.method(:get_instance_config),
|
272
275
|
defaults["get_instance_config"],
|
273
|
-
exception_transformer: exception_transformer
|
276
|
+
exception_transformer: exception_transformer,
|
277
|
+
params_extractor: proc do |request|
|
278
|
+
{'name' => request.name}
|
279
|
+
end
|
274
280
|
)
|
275
281
|
@list_instances = Google::Gax.create_api_call(
|
276
282
|
@instance_admin_stub.method(:list_instances),
|
277
283
|
defaults["list_instances"],
|
278
|
-
exception_transformer: exception_transformer
|
284
|
+
exception_transformer: exception_transformer,
|
285
|
+
params_extractor: proc do |request|
|
286
|
+
{'parent' => request.parent}
|
287
|
+
end
|
279
288
|
)
|
280
289
|
@get_instance = Google::Gax.create_api_call(
|
281
290
|
@instance_admin_stub.method(:get_instance),
|
282
291
|
defaults["get_instance"],
|
283
|
-
exception_transformer: exception_transformer
|
292
|
+
exception_transformer: exception_transformer,
|
293
|
+
params_extractor: proc do |request|
|
294
|
+
{'name' => request.name}
|
295
|
+
end
|
284
296
|
)
|
285
297
|
@create_instance = Google::Gax.create_api_call(
|
286
298
|
@instance_admin_stub.method(:create_instance),
|
287
299
|
defaults["create_instance"],
|
288
|
-
exception_transformer: exception_transformer
|
300
|
+
exception_transformer: exception_transformer,
|
301
|
+
params_extractor: proc do |request|
|
302
|
+
{'parent' => request.parent}
|
303
|
+
end
|
289
304
|
)
|
290
305
|
@update_instance = Google::Gax.create_api_call(
|
291
306
|
@instance_admin_stub.method(:update_instance),
|
292
307
|
defaults["update_instance"],
|
293
|
-
exception_transformer: exception_transformer
|
308
|
+
exception_transformer: exception_transformer,
|
309
|
+
params_extractor: proc do |request|
|
310
|
+
{'instance.name' => request.instance.name}
|
311
|
+
end
|
294
312
|
)
|
295
313
|
@delete_instance = Google::Gax.create_api_call(
|
296
314
|
@instance_admin_stub.method(:delete_instance),
|
297
315
|
defaults["delete_instance"],
|
298
|
-
exception_transformer: exception_transformer
|
316
|
+
exception_transformer: exception_transformer,
|
317
|
+
params_extractor: proc do |request|
|
318
|
+
{'name' => request.name}
|
319
|
+
end
|
299
320
|
)
|
300
321
|
@set_iam_policy = Google::Gax.create_api_call(
|
301
322
|
@instance_admin_stub.method(:set_iam_policy),
|
302
323
|
defaults["set_iam_policy"],
|
303
|
-
exception_transformer: exception_transformer
|
324
|
+
exception_transformer: exception_transformer,
|
325
|
+
params_extractor: proc do |request|
|
326
|
+
{'resource' => request.resource}
|
327
|
+
end
|
304
328
|
)
|
305
329
|
@get_iam_policy = Google::Gax.create_api_call(
|
306
330
|
@instance_admin_stub.method(:get_iam_policy),
|
307
331
|
defaults["get_iam_policy"],
|
308
|
-
exception_transformer: exception_transformer
|
332
|
+
exception_transformer: exception_transformer,
|
333
|
+
params_extractor: proc do |request|
|
334
|
+
{'resource' => request.resource}
|
335
|
+
end
|
309
336
|
)
|
310
337
|
@test_iam_permissions = Google::Gax.create_api_call(
|
311
338
|
@instance_admin_stub.method(:test_iam_permissions),
|
312
339
|
defaults["test_iam_permissions"],
|
313
|
-
exception_transformer: exception_transformer
|
340
|
+
exception_transformer: exception_transformer,
|
341
|
+
params_extractor: proc do |request|
|
342
|
+
{'resource' => request.resource}
|
343
|
+
end
|
314
344
|
)
|
315
345
|
end
|
316
346
|
|
@@ -71,7 +71,6 @@ module Google
|
|
71
71
|
return write_transaction.session if write_transaction
|
72
72
|
|
73
73
|
if can_allocate_more_sessions?
|
74
|
-
@new_sessions_in_process += 1
|
75
74
|
action = :new
|
76
75
|
break
|
77
76
|
end
|
@@ -127,7 +126,6 @@ module Google
|
|
127
126
|
end
|
128
127
|
|
129
128
|
if can_allocate_more_sessions?
|
130
|
-
@new_sessions_in_process += 1
|
131
129
|
action = :new
|
132
130
|
break
|
133
131
|
end
|
@@ -204,7 +202,7 @@ module Google
|
|
204
202
|
# init the thread pool
|
205
203
|
@thread_pool = Concurrent::FixedThreadPool.new @threads
|
206
204
|
# init the queues
|
207
|
-
@new_sessions_in_process =
|
205
|
+
@new_sessions_in_process = 0
|
208
206
|
@all_sessions = []
|
209
207
|
@session_queue = []
|
210
208
|
@transaction_queue = []
|
@@ -241,15 +239,24 @@ module Google
|
|
241
239
|
end
|
242
240
|
|
243
241
|
def new_session!
|
244
|
-
session = @client.create_new_session
|
245
|
-
|
246
242
|
@mutex.synchronize do
|
247
|
-
|
248
|
-
|
243
|
+
@new_sessions_in_process += 1
|
244
|
+
end
|
245
|
+
|
246
|
+
begin
|
247
|
+
session = @client.create_new_session
|
248
|
+
rescue StandardError => e
|
249
|
+
@mutex.synchronize do
|
250
|
+
@new_sessions_in_process -= 1
|
251
|
+
end
|
252
|
+
raise e
|
253
|
+
end
|
249
254
|
|
255
|
+
@mutex.synchronize do
|
250
256
|
@new_sessions_in_process -= 1
|
251
257
|
all_sessions << session
|
252
258
|
end
|
259
|
+
|
253
260
|
session
|
254
261
|
end
|
255
262
|
|
@@ -97,7 +97,8 @@ module Google
|
|
97
97
|
# @!attribute [rw] type_url
|
98
98
|
# @return [String]
|
99
99
|
# A URL/resource name that uniquely identifies the type of the serialized
|
100
|
-
# protocol buffer message.
|
100
|
+
# protocol buffer message. This string must contain at least
|
101
|
+
# one "/" character. The last segment of the URL's path must represent
|
101
102
|
# the fully qualified name of the type (as in
|
102
103
|
# `path/google.protobuf.Duration`). The name should be in a canonical form
|
103
104
|
# (e.g., leading "." is not accepted).
|
@@ -15,17 +15,19 @@
|
|
15
15
|
|
16
16
|
module Google
|
17
17
|
module Protobuf
|
18
|
-
# A Timestamp represents a point in time independent of any time zone
|
19
|
-
#
|
20
|
-
# nanosecond resolution
|
21
|
-
#
|
22
|
-
# backwards to year one.
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
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.
|
29
31
|
#
|
30
32
|
# = Examples
|
31
33
|
#
|
@@ -86,12 +88,12 @@ module Google
|
|
86
88
|
# 01:30 UTC on January 15, 2017.
|
87
89
|
#
|
88
90
|
# In JavaScript, one can convert a Date object to this format using the
|
89
|
-
# standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
|
91
|
+
# standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
90
92
|
# method. In Python, a standard `datetime.datetime` object can be converted
|
91
93
|
# to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
|
92
94
|
# with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
|
93
95
|
# can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
94
|
-
# http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime
|
96
|
+
# http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
|
95
97
|
# ) to obtain a formatter capable of generating timestamps in this format.
|
96
98
|
# @!attribute [rw] seconds
|
97
99
|
# @return [Integer]
|
@@ -217,72 +217,114 @@ module Google
|
|
217
217
|
@create_session = Google::Gax.create_api_call(
|
218
218
|
@spanner_stub.method(:create_session),
|
219
219
|
defaults["create_session"],
|
220
|
-
exception_transformer: exception_transformer
|
220
|
+
exception_transformer: exception_transformer,
|
221
|
+
params_extractor: proc do |request|
|
222
|
+
{'database' => request.database}
|
223
|
+
end
|
221
224
|
)
|
222
225
|
@get_session = Google::Gax.create_api_call(
|
223
226
|
@spanner_stub.method(:get_session),
|
224
227
|
defaults["get_session"],
|
225
|
-
exception_transformer: exception_transformer
|
228
|
+
exception_transformer: exception_transformer,
|
229
|
+
params_extractor: proc do |request|
|
230
|
+
{'name' => request.name}
|
231
|
+
end
|
226
232
|
)
|
227
233
|
@list_sessions = Google::Gax.create_api_call(
|
228
234
|
@spanner_stub.method(:list_sessions),
|
229
235
|
defaults["list_sessions"],
|
230
|
-
exception_transformer: exception_transformer
|
236
|
+
exception_transformer: exception_transformer,
|
237
|
+
params_extractor: proc do |request|
|
238
|
+
{'database' => request.database}
|
239
|
+
end
|
231
240
|
)
|
232
241
|
@delete_session = Google::Gax.create_api_call(
|
233
242
|
@spanner_stub.method(:delete_session),
|
234
243
|
defaults["delete_session"],
|
235
|
-
exception_transformer: exception_transformer
|
244
|
+
exception_transformer: exception_transformer,
|
245
|
+
params_extractor: proc do |request|
|
246
|
+
{'name' => request.name}
|
247
|
+
end
|
236
248
|
)
|
237
249
|
@execute_sql = Google::Gax.create_api_call(
|
238
250
|
@spanner_stub.method(:execute_sql),
|
239
251
|
defaults["execute_sql"],
|
240
|
-
exception_transformer: exception_transformer
|
252
|
+
exception_transformer: exception_transformer,
|
253
|
+
params_extractor: proc do |request|
|
254
|
+
{'session' => request.session}
|
255
|
+
end
|
241
256
|
)
|
242
257
|
@execute_streaming_sql = Google::Gax.create_api_call(
|
243
258
|
@spanner_stub.method(:execute_streaming_sql),
|
244
259
|
defaults["execute_streaming_sql"],
|
245
|
-
exception_transformer: exception_transformer
|
260
|
+
exception_transformer: exception_transformer,
|
261
|
+
params_extractor: proc do |request|
|
262
|
+
{'session' => request.session}
|
263
|
+
end
|
246
264
|
)
|
247
265
|
@execute_batch_dml = Google::Gax.create_api_call(
|
248
266
|
@spanner_stub.method(:execute_batch_dml),
|
249
267
|
defaults["execute_batch_dml"],
|
250
|
-
exception_transformer: exception_transformer
|
268
|
+
exception_transformer: exception_transformer,
|
269
|
+
params_extractor: proc do |request|
|
270
|
+
{'session' => request.session}
|
271
|
+
end
|
251
272
|
)
|
252
273
|
@read = Google::Gax.create_api_call(
|
253
274
|
@spanner_stub.method(:read),
|
254
275
|
defaults["read"],
|
255
|
-
exception_transformer: exception_transformer
|
276
|
+
exception_transformer: exception_transformer,
|
277
|
+
params_extractor: proc do |request|
|
278
|
+
{'session' => request.session}
|
279
|
+
end
|
256
280
|
)
|
257
281
|
@streaming_read = Google::Gax.create_api_call(
|
258
282
|
@spanner_stub.method(:streaming_read),
|
259
283
|
defaults["streaming_read"],
|
260
|
-
exception_transformer: exception_transformer
|
284
|
+
exception_transformer: exception_transformer,
|
285
|
+
params_extractor: proc do |request|
|
286
|
+
{'session' => request.session}
|
287
|
+
end
|
261
288
|
)
|
262
289
|
@begin_transaction = Google::Gax.create_api_call(
|
263
290
|
@spanner_stub.method(:begin_transaction),
|
264
291
|
defaults["begin_transaction"],
|
265
|
-
exception_transformer: exception_transformer
|
292
|
+
exception_transformer: exception_transformer,
|
293
|
+
params_extractor: proc do |request|
|
294
|
+
{'session' => request.session}
|
295
|
+
end
|
266
296
|
)
|
267
297
|
@commit = Google::Gax.create_api_call(
|
268
298
|
@spanner_stub.method(:commit),
|
269
299
|
defaults["commit"],
|
270
|
-
exception_transformer: exception_transformer
|
300
|
+
exception_transformer: exception_transformer,
|
301
|
+
params_extractor: proc do |request|
|
302
|
+
{'session' => request.session}
|
303
|
+
end
|
271
304
|
)
|
272
305
|
@rollback = Google::Gax.create_api_call(
|
273
306
|
@spanner_stub.method(:rollback),
|
274
307
|
defaults["rollback"],
|
275
|
-
exception_transformer: exception_transformer
|
308
|
+
exception_transformer: exception_transformer,
|
309
|
+
params_extractor: proc do |request|
|
310
|
+
{'session' => request.session}
|
311
|
+
end
|
276
312
|
)
|
277
313
|
@partition_query = Google::Gax.create_api_call(
|
278
314
|
@spanner_stub.method(:partition_query),
|
279
315
|
defaults["partition_query"],
|
280
|
-
exception_transformer: exception_transformer
|
316
|
+
exception_transformer: exception_transformer,
|
317
|
+
params_extractor: proc do |request|
|
318
|
+
{'session' => request.session}
|
319
|
+
end
|
281
320
|
)
|
282
321
|
@partition_read = Google::Gax.create_api_call(
|
283
322
|
@spanner_stub.method(:partition_read),
|
284
323
|
defaults["partition_read"],
|
285
|
-
exception_transformer: exception_transformer
|
324
|
+
exception_transformer: exception_transformer,
|
325
|
+
params_extractor: proc do |request|
|
326
|
+
{'session' => request.session}
|
327
|
+
end
|
286
328
|
)
|
287
329
|
end
|
288
330
|
|
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.9.
|
4
|
+
version: 1.9.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: 2019-
|
12
|
+
date: 2019-04-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -333,8 +333,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
333
333
|
- !ruby/object:Gem::Version
|
334
334
|
version: '0'
|
335
335
|
requirements: []
|
336
|
-
|
337
|
-
rubygems_version: 2.7.6
|
336
|
+
rubygems_version: 3.0.3
|
338
337
|
signing_key:
|
339
338
|
specification_version: 4
|
340
339
|
summary: API Client library for Google Cloud Spanner API
|