google-cloud-pubsub 2.3.2 → 2.4.0

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: 2d44dfbd212a70cfa64b25b0278a651c84c386414119644b9f92c8a2041c5c6c
4
- data.tar.gz: 84b93c12184314f5157b913ae4769ca1d21e0070a3a78490012da5639bcd68cb
3
+ metadata.gz: a4148f77602c7b9031ed772a14735b25414034684472928fb5244a3c07c2c080
4
+ data.tar.gz: 247fd6d4697c8e4f04858487441a3552f30ebe3010720861a1e2c9e8198de219
5
5
  SHA512:
6
- metadata.gz: 2fd9a8b1cfab5e94add3c5433c17ee59a37eabf97aac952a6fdc6c5d5f0618d06ca9063a2ef96c3e2d4355a43a51ff9f2d40cd953cc77a9e2f0e6c615c307428
7
- data.tar.gz: daf39d392c2262faf7a2d5cc2db95ce145197c62e158fa4ce6acfa943a8ad6166002c26b4fd7c240dae1d3ddd1919de7ad3ae9018b61ff4d087740285f02ba99
6
+ metadata.gz: c926ed2d0bca88e81a0545e86ca4fdd916df9d24f1108e4e74cf9140c0a835b79fb6fc207074d62a920de0958e69071235d0c8874970aae9db3657e24c36b2e1
7
+ data.tar.gz: 3f719066bf2ffc015b88dd0ffc5f13c38d853c2e54603daa6190905420a87b4aeb9372e4d1bcb37d68863ac38151d147d465ec3891333608718ede84123dca92
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release History
2
2
 
3
+ ### 2.4.0 / 2021-03-10
4
+
5
+ #### Features
6
+
7
+ * Drop support for Ruby 2.4 and add support for Ruby 3.0
8
+
3
9
  ### 2.3.2 / 2021-02-08
4
10
 
5
11
  #### Bug Fixes
data/CONTRIBUTING.md CHANGED
@@ -24,7 +24,7 @@ be able to accept your pull requests.
24
24
  In order to use the google-cloud-pubsub console and run the project's tests,
25
25
  there is a small amount of setup:
26
26
 
27
- 1. Install Ruby. google-cloud-pubsub requires Ruby 2.4+. You may choose to
27
+ 1. Install Ruby. google-cloud-pubsub requires Ruby 2.5+. You may choose to
28
28
  manage your Ruby and gem installations with [RVM](https://rvm.io/),
29
29
  [rbenv](https://github.com/rbenv/rbenv), or
30
30
  [chruby](https://github.com/postmodern/chruby).
data/LOGGING.md CHANGED
@@ -3,7 +3,7 @@
3
3
  To enable logging for this library, set the logger for the underlying
4
4
  [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. The logger
5
5
  that you set may be a Ruby stdlib
6
- [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as
6
+ [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as
7
7
  shown below, or a
8
8
  [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
9
9
  that will write logs to [Stackdriver
@@ -59,8 +59,12 @@ module Google
59
59
  class AsyncPublisher
60
60
  include MonitorMixin
61
61
 
62
- attr_reader :topic_name, :max_bytes, :max_messages, :interval,
63
- :publish_threads, :callback_threads
62
+ attr_reader :topic_name
63
+ attr_reader :max_bytes
64
+ attr_reader :max_messages
65
+ attr_reader :interval
66
+ attr_reader :publish_threads
67
+ attr_reader :callback_threads
64
68
  ##
65
69
  # @private Implementation accessors
66
70
  attr_reader :service, :batch, :publish_thread_pool,
@@ -303,7 +307,7 @@ module Google
303
307
 
304
308
  def publish_batches! stop: nil
305
309
  @batches.reject! { |_ordering_key, batch| batch.empty? }
306
- @batches.values.each do |batch|
310
+ @batches.each_value do |batch|
307
311
  ready = batch.publish! stop: stop
308
312
  publish_batch_async @topic_name, batch if ready
309
313
  end
@@ -25,7 +25,8 @@ module Google
25
25
  class Batch
26
26
  include MonitorMixin
27
27
 
28
- attr_reader :items, :ordering_key
28
+ attr_reader :items
29
+ attr_reader :ordering_key
29
30
 
30
31
  def initialize publisher, ordering_key
31
32
  # init MonitorMixin
@@ -14,7 +14,7 @@
14
14
 
15
15
 
16
16
  require "googleauth"
17
- require "google/cloud/pubsub/v1/publisher/credentials.rb"
17
+ require "google/cloud/pubsub/v1/publisher/credentials"
18
18
 
19
19
  module Google
20
20
  module Cloud
@@ -68,7 +68,8 @@ module Google
68
68
  # end
69
69
  #
70
70
  class Policy
71
- attr_reader :etag, :roles
71
+ attr_reader :etag
72
+ attr_reader :roles
72
73
 
73
74
  ##
74
75
  # @private Creates a Policy object.
@@ -167,7 +168,7 @@ module Google
167
168
  role: role_name,
168
169
  members: roles[role_name]
169
170
  )
170
- end
171
+ end.compact
171
172
  )
172
173
  end
173
174
 
@@ -49,7 +49,8 @@ module Google
49
49
  # sub.retry_policy.maximum_backoff #=> 300
50
50
  #
51
51
  class RetryPolicy
52
- attr_reader :minimum_backoff, :maximum_backoff
52
+ attr_reader :minimum_backoff
53
+ attr_reader :maximum_backoff
53
54
 
54
55
  ##
55
56
  # Creates a new, immutable RetryPolicy value object.
@@ -26,7 +26,10 @@ module Google
26
26
  ##
27
27
  # @private Represents the Pub/Sub service API, including IAM mixins.
28
28
  class Service
29
- attr_accessor :project, :credentials, :host, :timeout
29
+ attr_accessor :project
30
+ attr_accessor :credentials
31
+ attr_accessor :host
32
+ attr_accessor :timeout
30
33
  ###
31
34
  # The same client_id is used across all streaming pull connections that are created by this client. This is
32
35
  # intentional, as it indicates to the server that any guarantees, such as message ordering, made for a stream
@@ -125,12 +125,12 @@ module Google
125
125
  # puts snapshot.name
126
126
  # end
127
127
  #
128
- def all request_limit: nil
128
+ def all request_limit: nil, &block
129
129
  request_limit = request_limit.to_i if request_limit
130
130
  return enum_for :all, request_limit: request_limit unless block_given?
131
131
  results = self
132
132
  loop do
133
- results.each { |r| yield r }
133
+ results.each(&block)
134
134
  if request_limit
135
135
  request_limit -= 1
136
136
  break if request_limit.negative?
@@ -64,8 +64,13 @@ module Google
64
64
  class Subscriber
65
65
  include MonitorMixin
66
66
 
67
- attr_reader :subscription_name, :callback, :deadline, :streams, :message_ordering, :callback_threads,
68
- :push_threads
67
+ attr_reader :subscription_name
68
+ attr_reader :callback
69
+ attr_reader :deadline
70
+ attr_reader :streams
71
+ attr_reader :message_ordering
72
+ attr_reader :callback_threads
73
+ attr_reader :push_threads
69
74
 
70
75
  ##
71
76
  # @private Implementation attributes.
@@ -30,8 +30,12 @@ module Google
30
30
 
31
31
  include MonitorMixin
32
32
 
33
- attr_reader :stream, :limit, :bytesize, :extension, :max_duration_per_lease_extension,
34
- :use_legacy_flow_control
33
+ attr_reader :stream
34
+ attr_reader :limit
35
+ attr_reader :bytesize
36
+ attr_reader :extension
37
+ attr_reader :max_duration_per_lease_extension
38
+ attr_reader :use_legacy_flow_control
35
39
 
36
40
  def initialize stream, limit:, bytesize:, extension:, max_duration_per_lease_extension:,
37
41
  use_legacy_flow_control:
@@ -58,7 +58,7 @@ module Google
58
58
  @paused = nil
59
59
  @pause_cond = new_cond
60
60
 
61
- @inventory = Inventory.new self, @subscriber.stream_inventory
61
+ @inventory = Inventory.new self, **@subscriber.stream_inventory
62
62
 
63
63
  @sequencer = Sequencer.new(&method(:perform_callback_async)) if subscriber.message_ordering
64
64
 
@@ -25,7 +25,8 @@ module Google
25
25
  class TimedUnaryBuffer
26
26
  include MonitorMixin
27
27
 
28
- attr_reader :max_bytes, :interval
28
+ attr_reader :max_bytes
29
+ attr_reader :interval
29
30
 
30
31
  def initialize subscriber, max_bytes: 500_000, interval: 1.0
31
32
  super() # to init MonitorMixin
@@ -138,7 +139,7 @@ module Google
138
139
  end
139
140
 
140
141
  groups = prev_reg.each_pair.group_by { |_ack_id, delay| delay }
141
- req_hash = Hash[groups.map { |k, v| [k, v.map(&:first)] }]
142
+ req_hash = groups.transform_values { |v| v.map(&:first) }
142
143
 
143
144
  requests = { acknowledge: [] }
144
145
  ack_ids = Array(req_hash.delete(:ack)) # ack has no deadline set
@@ -215,11 +216,9 @@ module Google
215
216
 
216
217
  def add_future pool
217
218
  Concurrent::Promises.future_on pool do
218
- begin
219
- yield
220
- rescue StandardError => e
221
- error! e
222
- end
219
+ yield
220
+ rescue StandardError => e
221
+ error! e
223
222
  end
224
223
  end
225
224
  end
@@ -130,12 +130,12 @@ module Google
130
130
  # puts subscription.name
131
131
  # end
132
132
  #
133
- def all request_limit: nil
133
+ def all request_limit: nil, &block
134
134
  request_limit = request_limit.to_i if request_limit
135
135
  return enum_for :all, request_limit: request_limit unless block_given?
136
136
  results = self
137
137
  loop do
138
- results.each { |r| yield r }
138
+ results.each(&block)
139
139
  if request_limit
140
140
  request_limit -= 1
141
141
  break if request_limit.negative?
@@ -677,7 +677,7 @@ module Google
677
677
  def publish_async data = nil, attributes = nil, ordering_key: nil, **extra_attrs, &callback
678
678
  ensure_service!
679
679
 
680
- @async_publisher ||= AsyncPublisher.new name, service, @async_opts
680
+ @async_publisher ||= AsyncPublisher.new name, service, **@async_opts
681
681
  @async_publisher.publish data, attributes, ordering_key: ordering_key, **extra_attrs, &callback
682
682
  end
683
683
 
@@ -693,7 +693,7 @@ module Google
693
693
  # {Subscription#listen}, and {Message#ordering_key}.
694
694
  #
695
695
  def enable_message_ordering!
696
- @async_publisher ||= AsyncPublisher.new name, service, @async_opts
696
+ @async_publisher ||= AsyncPublisher.new name, service, **@async_opts
697
697
  @async_publisher.enable_message_ordering!
698
698
  end
699
699
 
@@ -709,7 +709,7 @@ module Google
709
709
  # @return [Boolean]
710
710
  #
711
711
  def message_ordering?
712
- @async_publisher ||= AsyncPublisher.new name, service, @async_opts
712
+ @async_publisher ||= AsyncPublisher.new name, service, **@async_opts
713
713
  @async_publisher.message_ordering?
714
714
  end
715
715
 
@@ -722,7 +722,7 @@ module Google
722
722
  # @return [boolean] `true` when resumed, `false` otherwise.
723
723
  #
724
724
  def resume_publish ordering_key
725
- @async_publisher ||= AsyncPublisher.new name, service, @async_opts
725
+ @async_publisher ||= AsyncPublisher.new name, service, **@async_opts
726
726
  @async_publisher.resume_publish ordering_key
727
727
  end
728
728
 
@@ -124,12 +124,12 @@ module Google
124
124
  # puts topic.name
125
125
  # end
126
126
  #
127
- def all request_limit: nil
127
+ def all request_limit: nil, &block
128
128
  request_limit = request_limit.to_i if request_limit
129
129
  return enum_for :all, request_limit: request_limit unless block_given?
130
130
  results = self
131
131
  loop do
132
- results.each { |r| yield r }
132
+ results.each(&block)
133
133
  if request_limit
134
134
  request_limit -= 1
135
135
  break if request_limit.negative?
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module PubSub
19
- VERSION = "2.3.2".freeze
19
+ VERSION = "2.4.0".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: 2.3.2
4
+ version: 2.4.0
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: 2021-02-10 00:00:00.000000000 Z
12
+ date: 2021-03-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby
@@ -73,14 +73,14 @@ dependencies:
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: 1.24.0
76
+ version: 1.25.1
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: 1.24.0
83
+ version: 1.25.1
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: minitest
86
86
  requirement: !ruby/object:Gem::Requirement
@@ -252,14 +252,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
252
252
  requirements:
253
253
  - - ">="
254
254
  - !ruby/object:Gem::Version
255
- version: '2.4'
255
+ version: '2.5'
256
256
  required_rubygems_version: !ruby/object:Gem::Requirement
257
257
  requirements:
258
258
  - - ">="
259
259
  - !ruby/object:Gem::Version
260
260
  version: '0'
261
261
  requirements: []
262
- rubygems_version: 3.2.6
262
+ rubygems_version: 3.2.13
263
263
  signing_key:
264
264
  specification_version: 4
265
265
  summary: API Client library for Google Cloud Pub/Sub