google-cloud-pubsub 2.3.2 → 2.4.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 +6 -0
- data/CONTRIBUTING.md +1 -1
- data/LOGGING.md +1 -1
- data/lib/google/cloud/pubsub/async_publisher.rb +7 -3
- data/lib/google/cloud/pubsub/async_publisher/batch.rb +2 -1
- data/lib/google/cloud/pubsub/credentials.rb +1 -1
- data/lib/google/cloud/pubsub/policy.rb +3 -2
- data/lib/google/cloud/pubsub/retry_policy.rb +2 -1
- data/lib/google/cloud/pubsub/service.rb +4 -1
- data/lib/google/cloud/pubsub/snapshot/list.rb +2 -2
- data/lib/google/cloud/pubsub/subscriber.rb +7 -2
- data/lib/google/cloud/pubsub/subscriber/inventory.rb +6 -2
- data/lib/google/cloud/pubsub/subscriber/stream.rb +1 -1
- data/lib/google/cloud/pubsub/subscriber/timed_unary_buffer.rb +6 -7
- data/lib/google/cloud/pubsub/subscription/list.rb +2 -2
- data/lib/google/cloud/pubsub/topic.rb +4 -4
- data/lib/google/cloud/pubsub/topic/list.rb +2 -2
- data/lib/google/cloud/pubsub/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4148f77602c7b9031ed772a14735b25414034684472928fb5244a3c07c2c080
|
4
|
+
data.tar.gz: 247fd6d4697c8e4f04858487441a3552f30ebe3010720861a1e2c9e8198de219
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c926ed2d0bca88e81a0545e86ca4fdd916df9d24f1108e4e74cf9140c0a835b79fb6fc207074d62a920de0958e69071235d0c8874970aae9db3657e24c36b2e1
|
7
|
+
data.tar.gz: 3f719066bf2ffc015b88dd0ffc5f13c38d853c2e54603daa6190905420a87b4aeb9372e4d1bcb37d68863ac38151d147d465ec3891333608718ede84123dca92
|
data/CHANGELOG.md
CHANGED
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.
|
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
|
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
|
63
|
-
|
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.
|
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
|
@@ -68,7 +68,8 @@ module Google
|
|
68
68
|
# end
|
69
69
|
#
|
70
70
|
class Policy
|
71
|
-
attr_reader :etag
|
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
|
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
|
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
|
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
|
68
|
-
|
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
|
34
|
-
|
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,
|
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
|
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 =
|
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
|
-
|
219
|
-
|
220
|
-
|
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
|
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,
|
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,
|
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,
|
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,
|
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
|
132
|
+
results.each(&block)
|
133
133
|
if request_limit
|
134
134
|
request_limit -= 1
|
135
135
|
break if request_limit.negative?
|
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.
|
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-
|
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.
|
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.
|
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.
|
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.
|
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
|