google-cloud-pubsub 0.37.0 → 0.37.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff2481f99b8def0df9c9203a64569dc317907152518da6b522d63314524ebea5
4
- data.tar.gz: 8773411fca063ab56c81d94951406866747f9137f4c9d9e9860b011412a0bae3
3
+ metadata.gz: 9ca95d3d409fb3fd3061e5e9bb0e34eed7d8efdd3677c4de6e34dbed26499eae
4
+ data.tar.gz: e7a16095e21f9a166461cbecbc4c95a4895421762da8c644a866cbce95a0e19b
5
5
  SHA512:
6
- metadata.gz: 47976e8e93c6a68707a24f26b92110fca18eef669c41c86f93cf9d746c55596abbddde9f067a42b47c68c6472d5655616380f0e334623872455d5932b97ffd9c
7
- data.tar.gz: ebf63bd135e128d19f56c9ece11aad5f1fc8cf2489fa7b8c726ccc68e98632ee4751c28079d9dfc17379dbf40cf9871a44b9d1c03d50dc0b1a6c9215de45f25d
6
+ metadata.gz: 2ad6bd6779827fcd87e613832f7a47cc73331615dcd3564d223776cea9d8469890829a7c2f8dd5bd989f1ffb5147c2fc8197086ce3e32994d40786c38141e1d7
7
+ data.tar.gz: f056480612e86fac7b2339067dae67c6d393cfc0864d30dcba8a492f3db25d6e6e269385d00dd5e85fd9de22d00cc577227b557e18aa4f3fe5f0244d1416c0d2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release History
2
2
 
3
+ ### 0.37.1 / 2019-07-09
4
+
5
+ * Add IAM GetPolicyOptions in the lower-level interface.
6
+ * Support overriding service host and port in the low-level interface.
7
+ * Fixed race in TimedUnaryBuffer.
8
+
3
9
  ### 0.37.0 / 2019-06-17
4
10
 
5
11
  * Add Topic#persistence_regions
@@ -14,6 +14,7 @@
14
14
 
15
15
 
16
16
  require "concurrent"
17
+ require "monitor"
17
18
 
18
19
  module Google
19
20
  module Cloud
@@ -22,9 +23,13 @@ module Google
22
23
  ##
23
24
  # @private
24
25
  class TimedUnaryBuffer
26
+ include MonitorMixin
27
+
25
28
  attr_reader :max_bytes, :interval
26
29
 
27
30
  def initialize subscriber, max_bytes: 10000000, interval: 1.0
31
+ super() # to init MonitorMixin
32
+
28
33
  @subscriber = subscriber
29
34
  @max_bytes = max_bytes
30
35
  @interval = interval
@@ -42,9 +47,11 @@ module Google
42
47
  def acknowledge ack_ids
43
48
  return if ack_ids.empty?
44
49
 
45
- ack_ids.each do |ack_id|
46
- # ack has no deadline set, use :ack indicate it is an ack
47
- @register[ack_id] = :ack
50
+ synchronize do
51
+ ack_ids.each do |ack_id|
52
+ # ack has no deadline set, use :ack indicate it is an ack
53
+ @register[ack_id] = :ack
54
+ end
48
55
  end
49
56
 
50
57
  true
@@ -53,8 +60,10 @@ module Google
53
60
  def modify_ack_deadline deadline, ack_ids
54
61
  return if ack_ids.empty?
55
62
 
56
- ack_ids.each do |ack_id|
57
- @register[ack_id] = deadline
63
+ synchronize do
64
+ ack_ids.each do |ack_id|
65
+ @register[ack_id] = deadline
66
+ end
58
67
  end
59
68
 
60
69
  true
@@ -63,9 +72,11 @@ module Google
63
72
  def renew_lease deadline, ack_ids
64
73
  return if ack_ids.empty?
65
74
 
66
- ack_ids.each do |ack_id|
67
- # Do not overwrite pending actions when renewing leased messages.
68
- @register[ack_id] ||= deadline
75
+ synchronize do
76
+ ack_ids.each do |ack_id|
77
+ # Don't overwrite pending actions when renewing leased messages.
78
+ @register[ack_id] ||= deadline
79
+ end
69
80
  end
70
81
 
71
82
  true
@@ -120,10 +131,13 @@ module Google
120
131
  private
121
132
 
122
133
  def flush_requests!
123
- return {} if @register.empty?
124
-
125
- prev_reg = @register
126
- @register = Concurrent::Map.new
134
+ prev_reg =
135
+ synchronize do
136
+ return {} if @register.empty?
137
+ reg = @register
138
+ @register = Concurrent::Map.new
139
+ reg
140
+ end
127
141
 
128
142
  groups = prev_reg.each_pair.group_by { |_ack_id, delay| delay }
129
143
  req_hash = Hash[groups.map { |k, v| [k, v.map(&:first)] }]
@@ -0,0 +1,21 @@
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ module Google
17
+ module Iam
18
+ module V1
19
+ end
20
+ end
21
+ end
@@ -146,6 +146,10 @@ module Google
146
146
  # The default timeout, in seconds, for calls made through this client.
147
147
  # @param metadata [Hash]
148
148
  # Default metadata to be sent with each request. This can be overridden on a per call basis.
149
+ # @param service_address [String]
150
+ # Override for the service hostname, or `nil` to leave as the default.
151
+ # @param service_port [Integer]
152
+ # Override for the service port, or `nil` to leave as the default.
149
153
  # @param exception_transformer [Proc]
150
154
  # An optional proc that intercepts any exceptions raised during an API call to inject
151
155
  # custom error handling.
@@ -155,6 +159,8 @@ module Google
155
159
  client_config: {},
156
160
  timeout: DEFAULT_TIMEOUT,
157
161
  metadata: nil,
162
+ service_address: nil,
163
+ service_port: nil,
158
164
  exception_transformer: nil,
159
165
  lib_name: nil,
160
166
  lib_version: ""
@@ -211,8 +217,8 @@ module Google
211
217
  end
212
218
 
213
219
  # Allow overriding the service path/port in subclasses.
214
- service_path = self.class::SERVICE_ADDRESS
215
- port = self.class::DEFAULT_SERVICE_PORT
220
+ service_path = service_address || self.class::SERVICE_ADDRESS
221
+ port = service_port || self.class::DEFAULT_SERVICE_PORT
216
222
  interceptors = self.class::GRPC_INTERCEPTORS
217
223
  @iam_policy_stub = Google::Gax::Grpc.create_stub(
218
224
  service_path,
@@ -698,6 +704,11 @@ module Google
698
704
  # @param resource [String]
699
705
  # REQUIRED: The resource for which the policy is being requested.
700
706
  # See the operation documentation for the appropriate value for this field.
707
+ # @param options_ [Google::Iam::V1::GetPolicyOptions | Hash]
708
+ # OPTIONAL: A `GetPolicyOptions` object for specifying options to
709
+ # `GetIamPolicy`. This field is only used by Cloud IAM.
710
+ # A hash of the same form as `Google::Iam::V1::GetPolicyOptions`
711
+ # can also be provided.
701
712
  # @param options [Google::Gax::CallOptions]
702
713
  # Overrides the default settings for this call, e.g, timeout,
703
714
  # retries, etc.
@@ -715,10 +726,12 @@ module Google
715
726
 
716
727
  def get_iam_policy \
717
728
  resource,
729
+ options_: nil,
718
730
  options: nil,
719
731
  &block
720
732
  req = {
721
- resource: resource
733
+ resource: resource,
734
+ options: options_
722
735
  }.delete_if { |_, v| v.nil? }
723
736
  req = Google::Gax::to_proto(req, Google::Iam::V1::GetIamPolicyRequest)
724
737
  @get_iam_policy.call(req, options, &block)
@@ -170,6 +170,10 @@ module Google
170
170
  # The default timeout, in seconds, for calls made through this client.
171
171
  # @param metadata [Hash]
172
172
  # Default metadata to be sent with each request. This can be overridden on a per call basis.
173
+ # @param service_address [String]
174
+ # Override for the service hostname, or `nil` to leave as the default.
175
+ # @param service_port [Integer]
176
+ # Override for the service port, or `nil` to leave as the default.
173
177
  # @param exception_transformer [Proc]
174
178
  # An optional proc that intercepts any exceptions raised during an API call to inject
175
179
  # custom error handling.
@@ -179,6 +183,8 @@ module Google
179
183
  client_config: {},
180
184
  timeout: DEFAULT_TIMEOUT,
181
185
  metadata: nil,
186
+ service_address: nil,
187
+ service_port: nil,
182
188
  exception_transformer: nil,
183
189
  lib_name: nil,
184
190
  lib_version: ""
@@ -234,8 +240,8 @@ module Google
234
240
  end
235
241
 
236
242
  # Allow overriding the service path/port in subclasses.
237
- service_path = self.class::SERVICE_ADDRESS
238
- port = self.class::DEFAULT_SERVICE_PORT
243
+ service_path = service_address || self.class::SERVICE_ADDRESS
244
+ port = service_port || self.class::DEFAULT_SERVICE_PORT
239
245
  interceptors = self.class::GRPC_INTERCEPTORS
240
246
  @iam_policy_stub = Google::Gax::Grpc.create_stub(
241
247
  service_path,
@@ -1274,6 +1280,11 @@ module Google
1274
1280
  # @param resource [String]
1275
1281
  # REQUIRED: The resource for which the policy is being requested.
1276
1282
  # See the operation documentation for the appropriate value for this field.
1283
+ # @param options_ [Google::Iam::V1::GetPolicyOptions | Hash]
1284
+ # OPTIONAL: A `GetPolicyOptions` object for specifying options to
1285
+ # `GetIamPolicy`. This field is only used by Cloud IAM.
1286
+ # A hash of the same form as `Google::Iam::V1::GetPolicyOptions`
1287
+ # can also be provided.
1277
1288
  # @param options [Google::Gax::CallOptions]
1278
1289
  # Overrides the default settings for this call, e.g, timeout,
1279
1290
  # retries, etc.
@@ -1291,10 +1302,12 @@ module Google
1291
1302
 
1292
1303
  def get_iam_policy \
1293
1304
  resource,
1305
+ options_: nil,
1294
1306
  options: nil,
1295
1307
  &block
1296
1308
  req = {
1297
- resource: resource
1309
+ resource: resource,
1310
+ options: options_
1298
1311
  }.delete_if { |_, v| v.nil? }
1299
1312
  req = Google::Gax::to_proto(req, Google::Iam::V1::GetIamPolicyRequest)
1300
1313
  @get_iam_policy.call(req, options, &block)
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module PubSub
19
- VERSION = "0.37.0".freeze
19
+ VERSION = "0.37.1".freeze
20
20
  end
21
21
 
22
22
  Pubsub = PubSub unless const_defined? :Pubsub
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-pubsub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.37.0
4
+ version: 0.37.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-06-18 00:00:00.000000000 Z
12
+ date: 2019-07-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '1.3'
34
+ version: '1.7'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '1.3'
41
+ version: '1.7'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: googleapis-common-protos
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -272,6 +272,7 @@ files:
272
272
  - lib/google/cloud/pubsub/v1.rb
273
273
  - lib/google/cloud/pubsub/v1/credentials.rb
274
274
  - lib/google/cloud/pubsub/v1/doc/google/iam/v1/iam_policy.rb
275
+ - lib/google/cloud/pubsub/v1/doc/google/iam/v1/options.rb
275
276
  - lib/google/cloud/pubsub/v1/doc/google/iam/v1/policy.rb
276
277
  - lib/google/cloud/pubsub/v1/doc/google/protobuf/duration.rb
277
278
  - lib/google/cloud/pubsub/v1/doc/google/protobuf/empty.rb