google-cloud-pubsub 1.3.1 → 1.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: f26c2a38c13ef273ff8229e9dadb5d8aba0801d5c29b48259565034a047f8aed
4
- data.tar.gz: de65d5a0bc5f33f08e59746c355ede1aa56ecccddcfc316450008a9f4f2803d9
3
+ metadata.gz: 2ba8847f393a5fc464ab63f9d6bca1a7e501c8457afa477486a9bd9c44e6d126
4
+ data.tar.gz: '034684fa844d264673c7e79ea17deeea9edc329de16376863e736a5f0825c256'
5
5
  SHA512:
6
- metadata.gz: d97089f6027ead3a45ef47f728b6f9453be23b22edba0e01419a89d549045b262f2ea6ba5c10faa49d4743a33b36dcb2f556bdfd57e307f8bb41499c2a23f030
7
- data.tar.gz: dc4246d15947e550dc362e68ef7713fed3a272d7eb2ac86e0642f6b717a1143c41f9c23069536176ede2668a93eaeea6496c6bf4224f7d7586a3df29e3b234a4
6
+ metadata.gz: 8a0e87a57f3fbb1522fd4cf5d93d1c0e03e10ecc5cd2c65b2f0ecfc8aabda230370f6118e9f52c9aadc4763ada09ff6bd0128539fa6469f68d22a327292f3403
7
+ data.tar.gz: b18e4d310dbfa486b4b40ed4a6bd657c484c4416517b890bc65889644f928d523b8c447b9b0d3b15980cc80673a9fc2ec3927a6eaff9dd742038f999ac51cee0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Release History
2
2
 
3
+ ### 1.4.0 / 2020-03-11
4
+
5
+ #### Features
6
+
7
+ * Rename Subscriber inventory methods and params
8
+ * Rename Subscriber#inventory_limit to #max_outstanding_messages
9
+ * Rename Subscriber#bytesize to #max_outstanding_bytes
10
+ * Rename Subscriber#extension to #max_total_lease_duration
11
+ * Add deprecated aliases for the original methods
12
+ * Support separate project setting for quota/billing
13
+
14
+ #### Documentation
15
+
16
+ * Update documentation in the lower-level client
17
+
3
18
  ### 1.3.1 / 2020-02-18
4
19
 
5
20
  #### Bug Fixes
@@ -82,11 +82,7 @@ module Google
82
82
  @subscription_name = subscription_name
83
83
  @deadline = deadline || 60
84
84
  @streams = streams || 2
85
- @inventory = inventory
86
- @inventory = { limit: @inventory } unless inventory.is_a? Hash
87
- @inventory[:limit] = Integer(@inventory[:limit] || 1000)
88
- @inventory[:bytesize] = Integer(@inventory[:bytesize] || 100_000_000)
89
- @inventory[:extension] = Integer(@inventory[:extension] || 3600)
85
+ coerce_inventory inventory
90
86
  @message_ordering = message_ordering
91
87
  @callback_threads = Integer(threads[:callback] || 8)
92
88
  @push_threads = Integer(threads[:push] || 4)
@@ -283,31 +279,37 @@ module Google
283
279
 
284
280
  ##
285
281
  # The number of received messages to be collected by subscriber. Default is 1,000.
286
- def inventory_limit
287
- @inventory[:limit]
282
+ def max_outstanding_messages
283
+ @inventory[:max_outstanding_messages]
288
284
  end
289
- # @deprecated Use {#inventory_limit}.
290
- alias inventory inventory_limit
285
+ # @deprecated Use {#max_outstanding_messages}.
286
+ alias inventory_limit max_outstanding_messages
287
+ # @deprecated Use {#max_outstanding_messages}.
288
+ alias inventory max_outstanding_messages
291
289
 
292
290
  ##
293
- # The total bytesize of received messages to be collected by subscriber. Default is 100,000,000 (100MB).
294
- def inventory_bytesize
295
- @inventory[:bytesize]
291
+ # The total byte size of received messages to be collected by subscriber. Default is 100,000,000 (100MB).
292
+ def max_outstanding_bytes
293
+ @inventory[:max_outstanding_bytes]
296
294
  end
295
+ # @deprecated Use {#max_outstanding_bytes}.
296
+ alias inventory_bytesize max_outstanding_bytes
297
297
 
298
298
  ##
299
299
  # The number of seconds that received messages can be held awaiting processing. Default is 3,600 (1 hour).
300
- def inventory_extension
301
- @inventory[:extension]
300
+ def max_total_lease_duration
301
+ @inventory[:max_total_lease_duration]
302
302
  end
303
+ # @deprecated Use {#max_total_lease_duration}.
304
+ alias inventory_extension max_total_lease_duration
303
305
 
304
306
  ##
305
307
  # @private
306
308
  def stream_inventory
307
309
  {
308
- limit: @inventory[:limit].fdiv(@streams).ceil,
309
- bytesize: @inventory[:bytesize].fdiv(@streams).ceil,
310
- extension: @inventory[:extension]
310
+ limit: @inventory[:max_outstanding_messages].fdiv(@streams).ceil,
311
+ bytesize: @inventory[:max_outstanding_bytes].fdiv(@streams).ceil,
312
+ extension: @inventory[:max_total_lease_duration]
311
313
  }
312
314
  end
313
315
 
@@ -335,6 +337,22 @@ module Google
335
337
 
336
338
  protected
337
339
 
340
+ def coerce_inventory inventory
341
+ @inventory = inventory
342
+ if @inventory.is_a? Hash
343
+ @inventory = @inventory.dup
344
+ # Support deprecated field names
345
+ @inventory[:max_outstanding_messages] ||= @inventory.delete :limit
346
+ @inventory[:max_outstanding_bytes] ||= @inventory.delete :bytesize
347
+ @inventory[:max_total_lease_duration] ||= @inventory.delete :extension
348
+ else
349
+ @inventory = { max_outstanding_messages: @inventory }
350
+ end
351
+ @inventory[:max_outstanding_messages] = Integer(@inventory[:max_outstanding_messages] || 1000)
352
+ @inventory[:max_outstanding_bytes] = Integer(@inventory[:max_outstanding_bytes] || 100_000_000)
353
+ @inventory[:max_total_lease_duration] = Integer(@inventory[:max_total_lease_duration] || 3600)
354
+ end
355
+
338
356
  def default_error_callbacks
339
357
  # This is memoized to reduce calls to the configuration.
340
358
  @default_error_callbacks ||= begin
@@ -693,11 +693,12 @@ module Google
693
693
  #
694
694
  # Hash keys and values may include the following:
695
695
  #
696
- # * `:limit` (Integer) The number of received messages to be collected by subscriber. Default is 1,000.
697
- # * `:bytesize` (Integer) The total bytesize of received messages to be collected by subscriber. Default is
698
- # 100,000,000 (100MB).
699
- # * `:extension` (Integer) The number of seconds that received messages can be held awaiting processing.
700
- # Default is 3,600 (1 hour).
696
+ # * `:max_outstanding_messages` [Integer] The number of received messages to be collected by subscriber.
697
+ # Default is 1,000. (Note: replaces `:limit`, which is deprecated.)
698
+ # * `:max_outstanding_bytes` [Integer] The total byte size of received messages to be collected by
699
+ # subscriber. Default is 100,000,000 (100MB). (Note: replaces `:bytesize`, which is deprecated.)
700
+ # * `:max_total_lease_duration` [Integer] The number of seconds that received messages can be held awaiting
701
+ # processing. Default is 3,600 (1 hour). (Note: replaces `:extension`, which is deprecated.)
701
702
  # @param [Hash] threads The number of threads to create to handle
702
703
  # concurrent calls by each stream opened by the subscriber. Optional.
703
704
  #
@@ -105,8 +105,8 @@ module Google
105
105
  # Required. The updated topic object.
106
106
  # @!attribute [rw] update_mask
107
107
  # @return [Google::Protobuf::FieldMask]
108
- # Required. Indicates which fields in the provided topic to update. Must be specified
109
- # and non-empty. Note that if `update_mask` contains
108
+ # Required. Indicates which fields in the provided topic to update. Must be
109
+ # specified and non-empty. Note that if `update_mask` contains
110
110
  # "message_storage_policy" then the new value will be determined based on the
111
111
  # policy configured at the project or organization level. The
112
112
  # `message_storage_policy` must not be set in the `topic` provided above.
@@ -184,7 +184,7 @@ module Google
184
184
  # Request for the `ListTopicSnapshots` method.
185
185
  # @!attribute [rw] topic
186
186
  # @return [String]
187
- # The name of the topic that snapshots are attached to.
187
+ # Required. The name of the topic that snapshots are attached to.
188
188
  # Format is `projects/{project}/topics/{topic}`.
189
189
  # @!attribute [rw] page_size
190
190
  # @return [Integer]
@@ -225,10 +225,9 @@ module Google
225
225
  # in length, and it must not start with `"goog"`.
226
226
  # @!attribute [rw] topic
227
227
  # @return [String]
228
- # Required. The name of the topic from which this subscription is receiving messages.
229
- # Format is `projects/{project}/topics/{topic}`.
230
- # The value of this field will be `_deleted-topic_` if the topic has been
231
- # deleted.
228
+ # Required. The name of the topic from which this subscription is receiving
229
+ # messages. Format is `projects/{project}/topics/{topic}`. The value of this
230
+ # field will be `_deleted-topic_` if the topic has been deleted.
232
231
  # @!attribute [rw] push_config
233
232
  # @return [Google::Cloud::PubSub::V1::PushConfig]
234
233
  # If push delivery is used with this subscription, this field is
@@ -507,14 +506,17 @@ module Google
507
506
  # Format is `projects/{project}/subscriptions/{sub}`.
508
507
  # @!attribute [rw] return_immediately
509
508
  # @return [true, false]
510
- # If this field set to true, the system will respond immediately even if
511
- # it there are no messages available to return in the `Pull` response.
512
- # Otherwise, the system may wait (for a bounded amount of time) until at
513
- # least one message is available, rather than returning no messages.
509
+ # Optional. If this field set to true, the system will respond immediately
510
+ # even if it there are no messages available to return in the `Pull`
511
+ # response. Otherwise, the system may wait (for a bounded amount of time)
512
+ # until at least one message is available, rather than returning no messages.
513
+ # Warning: setting this field to `true` is discouraged because it adversely
514
+ # impacts the performance of `Pull` operations. We recommend that users do
515
+ # not set this field.
514
516
  # @!attribute [rw] max_messages
515
517
  # @return [Integer]
516
- # Required. The maximum number of messages to return for this request. Must be a
517
- # positive integer. The Pub/Sub system may return fewer than the number
518
+ # Required. The maximum number of messages to return for this request. Must
519
+ # be a positive integer. The Pub/Sub system may return fewer than the number
518
520
  # specified.
519
521
  class PullRequest; end
520
522
 
@@ -537,10 +539,10 @@ module Google
537
539
  # Required. List of acknowledgment IDs.
538
540
  # @!attribute [rw] ack_deadline_seconds
539
541
  # @return [Integer]
540
- # Required. The new ack deadline with respect to the time this request was sent to
541
- # the Pub/Sub system. For example, if the value is 10, the new
542
- # ack deadline will expire 10 seconds after the `ModifyAckDeadline` call
543
- # was made. Specifying zero might immediately make the message available for
542
+ # Required. The new ack deadline with respect to the time this request was
543
+ # sent to the Pub/Sub system. For example, if the value is 10, the new ack
544
+ # deadline will expire 10 seconds after the `ModifyAckDeadline` call was
545
+ # made. Specifying zero might immediately make the message available for
544
546
  # delivery to another subscriber client. This typically results in an
545
547
  # increase in the rate of message redeliveries (that is, duplicates).
546
548
  # The minimum deadline you can specify is 0 seconds.
@@ -554,8 +556,9 @@ module Google
554
556
  # Format is `projects/{project}/subscriptions/{sub}`.
555
557
  # @!attribute [rw] ack_ids
556
558
  # @return [Array<String>]
557
- # Required. The acknowledgment ID for the messages being acknowledged that was returned
558
- # by the Pub/Sub system in the `Pull` response. Must not be empty.
559
+ # Required. The acknowledgment ID for the messages being acknowledged that
560
+ # was returned by the Pub/Sub system in the `Pull` response. Must not be
561
+ # empty.
559
562
  class AcknowledgeRequest; end
560
563
 
561
564
  # Request for the `StreamingPull` streaming RPC method. This request is used to
@@ -563,8 +566,8 @@ module Google
563
566
  # deadline modifications from the client to the server.
564
567
  # @!attribute [rw] subscription
565
568
  # @return [String]
566
- # Required. The subscription for which to initialize the new stream. This must be
567
- # provided in the first request on the stream, and must not be set in
569
+ # Required. The subscription for which to initialize the new stream. This
570
+ # must be provided in the first request on the stream, and must not be set in
568
571
  # subsequent requests from client to server.
569
572
  # Format is `projects/{project}/subscriptions/{sub}`.
570
573
  # @!attribute [rw] ack_ids
@@ -596,8 +599,8 @@ module Google
596
599
  # processing was interrupted.
597
600
  # @!attribute [rw] stream_ack_deadline_seconds
598
601
  # @return [Integer]
599
- # Required. The ack deadline to use for the stream. This must be provided in the
600
- # first request on the stream, but it can also be updated on subsequent
602
+ # Required. The ack deadline to use for the stream. This must be provided in
603
+ # the first request on the stream, but it can also be updated on subsequent
601
604
  # requests from client to server. The minimum deadline you can specify is 10
602
605
  # seconds. The maximum deadline you can specify is 600 seconds (10 minutes).
603
606
  # @!attribute [rw] client_id
@@ -620,10 +623,10 @@ module Google
620
623
  # Request for the `CreateSnapshot` method.
621
624
  # @!attribute [rw] name
622
625
  # @return [String]
623
- # Required. User-provided name for this snapshot. If the name is not provided in the
624
- # request, the server will assign a random name for this snapshot on the same
625
- # project as the subscription. Note that for REST API requests, you must
626
- # specify a name. See the <a
626
+ # Required. User-provided name for this snapshot. If the name is not provided
627
+ # in the request, the server will assign a random name for this snapshot on
628
+ # the same project as the subscription. Note that for REST API requests, you
629
+ # must specify a name. See the <a
627
630
  # href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource
628
631
  # name rules</a>. Format is `projects/{project}/snapshots/{snap}`.
629
632
  # @!attribute [rw] subscription
@@ -198,6 +198,9 @@ module Google
198
198
  google_api_client.freeze
199
199
 
200
200
  headers = { :"x-goog-api-client" => google_api_client }
201
+ if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
202
+ headers[:"x-goog-user-project"] = credentials.quota_project_id
203
+ end
201
204
  headers.merge!(metadata) unless metadata.nil?
202
205
  client_config_file = Pathname.new(__dir__).join(
203
206
  "publisher_client_config.json"
@@ -390,8 +393,8 @@ module Google
390
393
  # A hash of the same form as `Google::Cloud::PubSub::V1::Topic`
391
394
  # can also be provided.
392
395
  # @param update_mask [Google::Protobuf::FieldMask | Hash]
393
- # Required. Indicates which fields in the provided topic to update. Must be specified
394
- # and non-empty. Note that if `update_mask` contains
396
+ # Required. Indicates which fields in the provided topic to update. Must be
397
+ # specified and non-empty. Note that if `update_mask` contains
395
398
  # "message_storage_policy" then the new value will be determined based on the
396
399
  # policy configured at the project or organization level. The
397
400
  # `message_storage_policy` must not be set in the `topic` provided above.
@@ -222,6 +222,9 @@ module Google
222
222
  google_api_client.freeze
223
223
 
224
224
  headers = { :"x-goog-api-client" => google_api_client }
225
+ if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
226
+ headers[:"x-goog-user-project"] = credentials.quota_project_id
227
+ end
225
228
  headers.merge!(metadata) unless metadata.nil?
226
229
  client_config_file = Pathname.new(__dir__).join(
227
230
  "subscriber_client_config.json"
@@ -431,10 +434,9 @@ module Google
431
434
  # plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
432
435
  # in length, and it must not start with `"goog"`.
433
436
  # @param topic [String]
434
- # Required. The name of the topic from which this subscription is receiving messages.
435
- # Format is `projects/{project}/topics/{topic}`.
436
- # The value of this field will be `_deleted-topic_` if the topic has been
437
- # deleted.
437
+ # Required. The name of the topic from which this subscription is receiving
438
+ # messages. Format is `projects/{project}/topics/{topic}`. The value of this
439
+ # field will be `_deleted-topic_` if the topic has been deleted.
438
440
  # @param push_config [Google::Cloud::PubSub::V1::PushConfig | Hash]
439
441
  # If push delivery is used with this subscription, this field is
440
442
  # used to configure it. An empty `pushConfig` signifies that the subscriber
@@ -735,10 +737,10 @@ module Google
735
737
  # @param ack_ids [Array<String>]
736
738
  # Required. List of acknowledgment IDs.
737
739
  # @param ack_deadline_seconds [Integer]
738
- # Required. The new ack deadline with respect to the time this request was sent to
739
- # the Pub/Sub system. For example, if the value is 10, the new
740
- # ack deadline will expire 10 seconds after the `ModifyAckDeadline` call
741
- # was made. Specifying zero might immediately make the message available for
740
+ # Required. The new ack deadline with respect to the time this request was
741
+ # sent to the Pub/Sub system. For example, if the value is 10, the new ack
742
+ # deadline will expire 10 seconds after the `ModifyAckDeadline` call was
743
+ # made. Specifying zero might immediately make the message available for
742
744
  # delivery to another subscriber client. This typically results in an
743
745
  # increase in the rate of message redeliveries (that is, duplicates).
744
746
  # The minimum deadline you can specify is 0 seconds.
@@ -791,8 +793,9 @@ module Google
791
793
  # Required. The subscription whose message is being acknowledged.
792
794
  # Format is `projects/{project}/subscriptions/{sub}`.
793
795
  # @param ack_ids [Array<String>]
794
- # Required. The acknowledgment ID for the messages being acknowledged that was returned
795
- # by the Pub/Sub system in the `Pull` response. Must not be empty.
796
+ # Required. The acknowledgment ID for the messages being acknowledged that
797
+ # was returned by the Pub/Sub system in the `Pull` response. Must not be
798
+ # empty.
796
799
  # @param options [Google::Gax::CallOptions]
797
800
  # Overrides the default settings for this call, e.g, timeout,
798
801
  # retries, etc.
@@ -832,14 +835,17 @@ module Google
832
835
  # Required. The subscription from which messages should be pulled.
833
836
  # Format is `projects/{project}/subscriptions/{sub}`.
834
837
  # @param max_messages [Integer]
835
- # Required. The maximum number of messages to return for this request. Must be a
836
- # positive integer. The Pub/Sub system may return fewer than the number
838
+ # Required. The maximum number of messages to return for this request. Must
839
+ # be a positive integer. The Pub/Sub system may return fewer than the number
837
840
  # specified.
838
841
  # @param return_immediately [true, false]
839
- # If this field set to true, the system will respond immediately even if
840
- # it there are no messages available to return in the `Pull` response.
841
- # Otherwise, the system may wait (for a bounded amount of time) until at
842
- # least one message is available, rather than returning no messages.
842
+ # Optional. If this field set to true, the system will respond immediately
843
+ # even if it there are no messages available to return in the `Pull`
844
+ # response. Otherwise, the system may wait (for a bounded amount of time)
845
+ # until at least one message is available, rather than returning no messages.
846
+ # Warning: setting this field to `true` is discouraged because it adversely
847
+ # impacts the performance of `Pull` operations. We recommend that users do
848
+ # not set this field.
843
849
  # @param options [Google::Gax::CallOptions]
844
850
  # Overrides the default settings for this call, e.g, timeout,
845
851
  # retries, etc.
@@ -1047,10 +1053,10 @@ module Google
1047
1053
  # REST API requests, you must specify a name in the request.
1048
1054
  #
1049
1055
  # @param name [String]
1050
- # Required. User-provided name for this snapshot. If the name is not provided in the
1051
- # request, the server will assign a random name for this snapshot on the same
1052
- # project as the subscription. Note that for REST API requests, you must
1053
- # specify a name. See the <a
1056
+ # Required. User-provided name for this snapshot. If the name is not provided
1057
+ # in the request, the server will assign a random name for this snapshot on
1058
+ # the same project as the subscription. Note that for REST API requests, you
1059
+ # must specify a name. See the <a
1054
1060
  # href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource
1055
1061
  # name rules</a>. Format is `projects/{project}/snapshots/{snap}`.
1056
1062
  # @param subscription [String]
@@ -32,9 +32,9 @@
32
32
  "initial_retry_delay_millis": 100,
33
33
  "retry_delay_multiplier": 1.3,
34
34
  "max_retry_delay_millis": 60000,
35
- "initial_rpc_timeout_millis": 5000,
36
- "rpc_timeout_multiplier": 1.3,
37
- "max_rpc_timeout_millis": 600000,
35
+ "initial_rpc_timeout_millis": 25000,
36
+ "rpc_timeout_multiplier": 1.0,
37
+ "max_rpc_timeout_millis": 25000,
38
38
  "total_timeout_millis": 600000
39
39
  },
40
40
  "streaming_messaging": {
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module PubSub
19
- VERSION = "1.3.1".freeze
19
+ VERSION = "1.4.0".freeze
20
20
  end
21
21
 
22
22
  Pubsub = PubSub unless const_defined? :Pubsub
@@ -4,6 +4,7 @@
4
4
 
5
5
  require 'google/protobuf'
6
6
 
7
+ require 'google/api/annotations_pb'
7
8
  require 'google/api/client_pb'
8
9
  require 'google/api/field_behavior_pb'
9
10
  require 'google/api/resource_pb'
@@ -11,7 +12,6 @@ require 'google/protobuf/duration_pb'
11
12
  require 'google/protobuf/empty_pb'
12
13
  require 'google/protobuf/field_mask_pb'
13
14
  require 'google/protobuf/timestamp_pb'
14
- require 'google/api/annotations_pb'
15
15
  Google::Protobuf::DescriptorPool.generated_pool.build do
16
16
  add_message "google.pubsub.v1.MessageStoragePolicy" do
17
17
  repeated :allowed_persistence_regions, :string, 1
@@ -1,7 +1,7 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # Source: google/pubsub/v1/pubsub.proto for package 'Google::Cloud::PubSub::V1'
3
3
  # Original file comments:
4
- # Copyright 2019 Google LLC.
4
+ # Copyright 2020 Google LLC
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -15,7 +15,6 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
- #
19
18
 
20
19
 
21
20
  require 'grpc'
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: 1.3.1
4
+ version: 1.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: 2020-02-18 00:00:00.000000000 Z
12
+ date: 2020-03-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby