google-cloud-spanner 2.25.0 → 2.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/google/cloud/spanner/admin/database.rb +21 -9
- data/lib/google/cloud/spanner/admin/instance.rb +21 -9
- data/lib/google/cloud/spanner/pool.rb +2 -2
- data/lib/google/cloud/spanner/project.rb +9 -0
- data/lib/google/cloud/spanner/service.rb +15 -2
- data/lib/google/cloud/spanner/version.rb +1 -1
- data/lib/google/cloud/spanner.rb +4 -2
- data/lib/google-cloud-spanner.rb +3 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cafab317421fcff06f127fb2d156c722f67b8e5d1914ae68d3e0ec8b56db4f76
|
4
|
+
data.tar.gz: 26820cba11c9d0a94d5dbaaff4c28ea0581c25ef3d7a9876d39ef5ca42fe5edc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58624fe569f909d5923f897fc02c6865c4861dd289ec5b1f58aead9ae01b87968ebd7b5e23d0305e4661011fd4bc2e3479cc08c08ef0c19b320daa2e68300fca
|
7
|
+
data.tar.gz: c011acec4ad559505de0b89e77dae6d2046f7e00768a421f4bd347ff25a3b8ee35673f1714037528e1d13572e054486ded0fd666d253df9b322a2c90ef19a1bf
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 2.26.0 (2025-03-24)
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* Support setting the universe domain ([#144](https://github.com/googleapis/ruby-spanner/issues/144))
|
8
|
+
#### Bug Fixes
|
9
|
+
|
10
|
+
* Corrected algorithm that releases stale sessions in the pool ([#156](https://github.com/googleapis/ruby-spanner/issues/156))
|
11
|
+
|
3
12
|
### 2.25.0 (2025-01-29)
|
4
13
|
|
5
14
|
#### Features
|
@@ -85,6 +85,7 @@ module Google
|
|
85
85
|
#
|
86
86
|
def self.database_admin project_id: nil,
|
87
87
|
credentials: nil,
|
88
|
+
universe_domain: nil,
|
88
89
|
scope: nil,
|
89
90
|
timeout: nil,
|
90
91
|
endpoint: nil,
|
@@ -93,14 +94,23 @@ module Google
|
|
93
94
|
emulator_host: nil,
|
94
95
|
lib_name: nil,
|
95
96
|
lib_version: nil
|
96
|
-
project_id
|
97
|
-
scope
|
98
|
-
timeout
|
97
|
+
project_id ||= project || default_project_id
|
98
|
+
scope ||= configure.scope
|
99
|
+
timeout ||= configure.timeout
|
99
100
|
emulator_host ||= configure.emulator_host
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
101
|
+
# TODO: This logic is part of UniverseDomainConcerns in gapic-common
|
102
|
+
# but is being copied here because we need to determine the host up
|
103
|
+
# front in order to build a gRPC channel. We should refactor this
|
104
|
+
# somehow to allow this logic to live where it is supposed to.
|
105
|
+
universe_domain ||= configure.universe_domain || ENV["GOOGLE_CLOUD_UNIVERSE_DOMAIN"] || "googleapis.com"
|
106
|
+
endpoint ||= emulator_host || configure.endpoint
|
107
|
+
endpoint ||=
|
108
|
+
Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client::DEFAULT_ENDPOINT_TEMPLATE.sub(
|
109
|
+
Gapic::UniverseDomainConcerns::ENDPOINT_SUBSTITUTION, universe_domain
|
110
|
+
)
|
111
|
+
credentials ||= keyfile
|
112
|
+
lib_name ||= configure.lib_name
|
113
|
+
lib_version ||= configure.lib_version
|
104
114
|
|
105
115
|
if emulator_host
|
106
116
|
credentials = :this_channel_is_insecure
|
@@ -121,10 +131,11 @@ module Google
|
|
121
131
|
configure.quota_project ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
122
132
|
|
123
133
|
Admin::Database::V1::DatabaseAdmin::Client.new do |config|
|
134
|
+
config.universe_domain = universe_domain
|
124
135
|
config.credentials = channel endpoint, credentials
|
125
136
|
config.quota_project = configure.quota_project
|
126
137
|
config.timeout = timeout if timeout
|
127
|
-
config.endpoint = endpoint
|
138
|
+
config.endpoint = endpoint
|
128
139
|
config.lib_name = lib_name_with_prefix lib_name, lib_version
|
129
140
|
config.lib_version = Google::Cloud::Spanner::VERSION
|
130
141
|
config.metadata = { "google-cloud-resource-prefix" => "projects/#{project_id}" }
|
@@ -290,7 +301,7 @@ module Google
|
|
290
301
|
class Configuration
|
291
302
|
extend ::Gapic::Config
|
292
303
|
|
293
|
-
config_attr :endpoint,
|
304
|
+
config_attr :endpoint, nil, ::String
|
294
305
|
config_attr :credentials, nil do |value|
|
295
306
|
allowed = [::String, ::Hash, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
296
307
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
@@ -307,6 +318,7 @@ module Google
|
|
307
318
|
config_attr :query_options, nil, ::Hash, nil
|
308
319
|
config_attr :metadata, nil, ::Hash, nil
|
309
320
|
config_attr :retry_policy, nil, ::Hash, nil
|
321
|
+
config_attr :universe_domain, nil, ::String, nil
|
310
322
|
|
311
323
|
# @private
|
312
324
|
def initialize parent_config = nil
|
@@ -85,6 +85,7 @@ module Google
|
|
85
85
|
#
|
86
86
|
def self.instance_admin project_id: nil,
|
87
87
|
credentials: nil,
|
88
|
+
universe_domain: nil,
|
88
89
|
scope: nil,
|
89
90
|
timeout: nil,
|
90
91
|
endpoint: nil,
|
@@ -93,14 +94,23 @@ module Google
|
|
93
94
|
emulator_host: nil,
|
94
95
|
lib_name: nil,
|
95
96
|
lib_version: nil
|
96
|
-
project_id
|
97
|
-
scope
|
98
|
-
timeout
|
97
|
+
project_id ||= project || default_project_id
|
98
|
+
scope ||= configure.scope
|
99
|
+
timeout ||= configure.timeout
|
99
100
|
emulator_host ||= configure.emulator_host
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
101
|
+
# TODO: This logic is part of UniverseDomainConcerns in gapic-common
|
102
|
+
# but is being copied here because we need to determine the host up
|
103
|
+
# front in order to build a gRPC channel. We should refactor this
|
104
|
+
# somehow to allow this logic to live where it is supposed to.
|
105
|
+
universe_domain ||= configure.universe_domain || ENV["GOOGLE_CLOUD_UNIVERSE_DOMAIN"] || "googleapis.com"
|
106
|
+
endpoint ||= emulator_host || configure.endpoint
|
107
|
+
endpoint ||=
|
108
|
+
Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client::DEFAULT_ENDPOINT_TEMPLATE.sub(
|
109
|
+
Gapic::UniverseDomainConcerns::ENDPOINT_SUBSTITUTION, universe_domain
|
110
|
+
)
|
111
|
+
credentials ||= keyfile
|
112
|
+
lib_name ||= configure.lib_name
|
113
|
+
lib_version ||= configure.lib_version
|
104
114
|
|
105
115
|
if emulator_host
|
106
116
|
credentials = :this_channel_is_insecure
|
@@ -121,10 +131,11 @@ module Google
|
|
121
131
|
configure.quota_project ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
122
132
|
|
123
133
|
Admin::Instance::V1::InstanceAdmin::Client.new do |config|
|
134
|
+
config.universe_domain = universe_domain
|
124
135
|
config.credentials = channel endpoint, credentials
|
125
136
|
config.quota_project = configure.quota_project
|
126
137
|
config.timeout = timeout if timeout
|
127
|
-
config.endpoint = endpoint
|
138
|
+
config.endpoint = endpoint
|
128
139
|
config.lib_name = lib_name_with_prefix lib_name, lib_version
|
129
140
|
config.lib_version = Google::Cloud::Spanner::VERSION
|
130
141
|
config.metadata = { "google-cloud-resource-prefix" => "projects/#{project_id}" }
|
@@ -290,7 +301,7 @@ module Google
|
|
290
301
|
class Configuration
|
291
302
|
extend ::Gapic::Config
|
292
303
|
|
293
|
-
config_attr :endpoint,
|
304
|
+
config_attr :endpoint, nil, ::String
|
294
305
|
config_attr :credentials, nil do |value|
|
295
306
|
allowed = [::String, ::Hash, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
296
307
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
@@ -307,6 +318,7 @@ module Google
|
|
307
318
|
config_attr :query_options, nil, ::Hash, nil
|
308
319
|
config_attr :metadata, nil, ::Hash, nil
|
309
320
|
config_attr :retry_policy, nil, ::Hash, nil
|
321
|
+
config_attr :universe_domain, nil, ::String, nil
|
310
322
|
|
311
323
|
# @private
|
312
324
|
def initialize parent_config = nil
|
@@ -136,10 +136,10 @@ module Google
|
|
136
136
|
|
137
137
|
@mutex.synchronize do
|
138
138
|
available_count = sessions_available.count
|
139
|
-
release_count =
|
139
|
+
release_count = available_count - @min
|
140
140
|
release_count = 0 if release_count.negative?
|
141
141
|
|
142
|
-
to_keepalive
|
142
|
+
to_keepalive = sessions_available.select do |x|
|
143
143
|
x.idle_since? @keepalive
|
144
144
|
end
|
145
145
|
|
@@ -95,6 +95,15 @@ module Google
|
|
95
95
|
end
|
96
96
|
alias project project_id
|
97
97
|
|
98
|
+
##
|
99
|
+
# The universe domain the client is connected to
|
100
|
+
#
|
101
|
+
# @return [String]
|
102
|
+
#
|
103
|
+
def universe_domain
|
104
|
+
service.universe_domain
|
105
|
+
end
|
106
|
+
|
98
107
|
##
|
99
108
|
# Retrieves the list of Cloud Spanner instances for the project.
|
100
109
|
#
|
@@ -38,6 +38,8 @@ module Google
|
|
38
38
|
attr_accessor :quota_project
|
39
39
|
attr_accessor :enable_leader_aware_routing
|
40
40
|
|
41
|
+
attr_reader :universe_domain
|
42
|
+
|
41
43
|
RST_STREAM_INTERNAL_ERROR = "Received RST_STREAM".freeze
|
42
44
|
EOS_INTERNAL_ERROR = "Received unexpected EOS on DATA frame from server".freeze
|
43
45
|
|
@@ -45,11 +47,19 @@ module Google
|
|
45
47
|
# Creates a new Service instance.
|
46
48
|
def initialize project, credentials, quota_project: nil,
|
47
49
|
host: nil, timeout: nil, lib_name: nil, lib_version: nil,
|
48
|
-
enable_leader_aware_routing: nil
|
50
|
+
enable_leader_aware_routing: nil, universe_domain: nil
|
49
51
|
@project = project
|
50
52
|
@credentials = credentials
|
51
53
|
@quota_project = quota_project || (credentials.quota_project_id if credentials.respond_to? :quota_project_id)
|
52
|
-
|
54
|
+
# TODO: This logic is part of UniverseDomainConcerns in gapic-common
|
55
|
+
# but is being copied here because we need to determine the host up
|
56
|
+
# front in order to build a gRPC channel. We should refactor this
|
57
|
+
# somehow to allow this logic to live where it is supposed to.
|
58
|
+
@universe_domain = universe_domain || ENV["GOOGLE_CLOUD_UNIVERSE_DOMAIN"] || "googleapis.com"
|
59
|
+
@host = host ||
|
60
|
+
Google::Cloud::Spanner::V1::Spanner::Client::DEFAULT_ENDPOINT_TEMPLATE.sub(
|
61
|
+
Gapic::UniverseDomainConcerns::ENDPOINT_SUBSTITUTION, @universe_domain
|
62
|
+
)
|
53
63
|
@timeout = timeout
|
54
64
|
@lib_name = lib_name
|
55
65
|
@lib_version = lib_version
|
@@ -80,6 +90,7 @@ module Google
|
|
80
90
|
config.quota_project = @quota_project
|
81
91
|
config.timeout = timeout if timeout
|
82
92
|
config.endpoint = host if host
|
93
|
+
config.universe_domain = @universe_domain
|
83
94
|
config.lib_name = lib_name_with_prefix
|
84
95
|
config.lib_version = Google::Cloud::Spanner::VERSION
|
85
96
|
config.metadata = { "google-cloud-resource-prefix" => "projects/#{@project}" }
|
@@ -95,6 +106,7 @@ module Google
|
|
95
106
|
config.quota_project = @quota_project
|
96
107
|
config.timeout = timeout if timeout
|
97
108
|
config.endpoint = host if host
|
109
|
+
config.universe_domain = @universe_domain
|
98
110
|
config.lib_name = lib_name_with_prefix
|
99
111
|
config.lib_version = Google::Cloud::Spanner::VERSION
|
100
112
|
config.metadata = { "google-cloud-resource-prefix" => "projects/#{@project}" }
|
@@ -110,6 +122,7 @@ module Google
|
|
110
122
|
config.quota_project = @quota_project
|
111
123
|
config.timeout = timeout if timeout
|
112
124
|
config.endpoint = host if host
|
125
|
+
config.universe_domain = @universe_domain
|
113
126
|
config.lib_name = lib_name_with_prefix
|
114
127
|
config.lib_version = Google::Cloud::Spanner::VERSION
|
115
128
|
config.metadata = { "google-cloud-resource-prefix" => "projects/#{@project}" }
|
data/lib/google/cloud/spanner.rb
CHANGED
@@ -84,6 +84,7 @@ module Google
|
|
84
84
|
# with version.
|
85
85
|
# @param enable_leader_aware_routing [Boolean] Specifies whether Leader
|
86
86
|
# Aware Routing should be enabled. Defaults to true.
|
87
|
+
# @param universe_domain [String] A custom universe domain. Optional.
|
87
88
|
#
|
88
89
|
# @return [Google::Cloud::Spanner::Project]
|
89
90
|
#
|
@@ -95,7 +96,7 @@ module Google
|
|
95
96
|
def self.new project_id: nil, credentials: nil, scope: nil, timeout: nil,
|
96
97
|
endpoint: nil, project: nil, keyfile: nil,
|
97
98
|
emulator_host: nil, lib_name: nil, lib_version: nil,
|
98
|
-
enable_leader_aware_routing: true
|
99
|
+
enable_leader_aware_routing: true, universe_domain: nil
|
99
100
|
project_id ||= project || default_project_id
|
100
101
|
scope ||= configure.scope
|
101
102
|
timeout ||= configure.timeout
|
@@ -104,6 +105,7 @@ module Google
|
|
104
105
|
credentials ||= keyfile
|
105
106
|
lib_name ||= configure.lib_name
|
106
107
|
lib_version ||= configure.lib_version
|
108
|
+
universe_domain ||= configure.universe_domain
|
107
109
|
|
108
110
|
if emulator_host
|
109
111
|
credentials = :this_channel_is_insecure
|
@@ -125,7 +127,7 @@ module Google
|
|
125
127
|
Spanner::Service.new(
|
126
128
|
project_id, credentials, quota_project: configure.quota_project,
|
127
129
|
host: endpoint, timeout: timeout, lib_name: lib_name,
|
128
|
-
lib_version: lib_version,
|
130
|
+
lib_version: lib_version, universe_domain: universe_domain,
|
129
131
|
enable_leader_aware_routing: enable_leader_aware_routing
|
130
132
|
),
|
131
133
|
query_options: configure.query_options
|
data/lib/google-cloud-spanner.rb
CHANGED
@@ -139,10 +139,8 @@ module Google
|
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
|
-
# rubocop:disable Metrics/BlockLength
|
143
|
-
|
144
142
|
# Set the default spanner configuration
|
145
|
-
Google::Cloud.configure.add_config! :spanner do |config|
|
143
|
+
Google::Cloud.configure.add_config! :spanner do |config| # rubocop:disable Metrics/BlockLength
|
146
144
|
default_project = Google::Cloud::Config.deferred do
|
147
145
|
ENV["SPANNER_PROJECT"]
|
148
146
|
end
|
@@ -181,11 +179,10 @@ Google::Cloud.configure.add_config! :spanner do |config|
|
|
181
179
|
config.add_field! :scope, default_scopes, match: [String, Array]
|
182
180
|
config.add_field! :quota_project, nil, match: String
|
183
181
|
config.add_field! :timeout, nil, match: Integer
|
184
|
-
config.add_field! :endpoint,
|
182
|
+
config.add_field! :endpoint, nil, match: String
|
185
183
|
config.add_field! :emulator_host, default_emulator, match: String, allow_nil: true
|
186
184
|
config.add_field! :lib_name, nil, match: String, allow_nil: true
|
187
185
|
config.add_field! :lib_version, nil, match: String, allow_nil: true
|
188
186
|
config.add_field! :query_options, default_query_options, match: Hash, allow_nil: true
|
187
|
+
config.add_field! :universe_domain, nil, match: String, allow_nil: true
|
189
188
|
end
|
190
|
-
|
191
|
-
# rubocop:enable Metrics/BlockLength
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-spanner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.26.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Moore
|
8
8
|
- Chris Smith
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bigdecimal
|
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
182
|
- !ruby/object:Gem::Version
|
183
183
|
version: '0'
|
184
184
|
requirements: []
|
185
|
-
rubygems_version: 3.6.
|
185
|
+
rubygems_version: 3.6.5
|
186
186
|
specification_version: 4
|
187
187
|
summary: API Client library for Google Cloud Spanner API
|
188
188
|
test_files: []
|