Sha256: fdec4dae12ec1b51385ef71a62088828da83efa408af83d744508f7787cc4466

Contents?: true

Size: 1.92 KB

Versions: 33

Compression:

Stored size: 1.92 KB

Contents

# frozen_string_literal: true

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

module Gapic
  module GrpcServiceConfig
    ##
    # RetryPolicy encapsulates the parameters governing the client-side retry
    # for the GRPC method invocation. It is embedded into the MethodConfig
    #
    class RetryPolicy
      attr_reader :initial_delay_seconds, :max_delay_seconds, :multiplier, :status_codes

      ##
      # Create new ParsedRetryPolicy.
      #
      # @param initial_delay_seconds [Float, nil] the value of initial retry delay in seconds if provided
      # @param max_delay_seconds [Float, nil] the value of max retry delay in seconds if provided
      # @param multiplier [Float, nil] the value of retry multiplier if provided
      # @param status_codes [Array<String>, nil] the retry status codes if provided
      #
      def initialize initial_delay_seconds, max_delay_seconds, multiplier, status_codes
        @initial_delay_seconds = initial_delay_seconds
        @max_delay_seconds     = max_delay_seconds
        @multiplier            = multiplier
        @status_codes          = status_codes
      end

      ##
      # Returns whether RetryPolicy is empty (does not contain any values)
      #
      # @return [Boolean] whether RetryPolicy is empty
      #
      def empty?
        @initial_delay_seconds.nil? && @max_delay_seconds.nil? && @multiplier.nil? && status_codes.to_a.empty?
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
gapic-generator-0.6.15 lib/gapic/grpc_service_config/retry_policy.rb
gapic-generator-0.6.14 lib/gapic/grpc_service_config/retry_policy.rb
gapic-generator-0.6.13 lib/gapic/grpc_service_config/retry_policy.rb
gapic-generator-0.6.12 lib/gapic/grpc_service_config/retry_policy.rb
gapic-generator-0.6.11 lib/gapic/grpc_service_config/retry_policy.rb
gapic-generator-0.6.10 lib/gapic/grpc_service_config/retry_policy.rb
gapic-generator-0.6.9 lib/gapic/grpc_service_config/retry_policy.rb
gapic-generator-0.6.8 lib/gapic/grpc_service_config/retry_policy.rb
gapic-generator-0.6.7 lib/gapic/grpc_service_config/retry_policy.rb
gapic-generator-0.6.6 lib/gapic/grpc_service_config/retry_policy.rb
gapic-generator-0.6.5 lib/gapic/grpc_service_config/retry_policy.rb
gapic-generator-0.6.4 lib/gapic/grpc_service_config/retry_policy.rb
gapic-generator-0.6.3 lib/gapic/grpc_service_config/retry_policy.rb
gapic-generator-0.6.2 lib/gapic/grpc_service_config/retry_policy.rb
gapic-generator-0.6.1 lib/gapic/grpc_service_config/retry_policy.rb
gapic-generator-0.6.0 lib/gapic/grpc_service_config/retry_policy.rb
gapic-generator-0.5.1 lib/gapic/grpc_service_config/retry_policy.rb
gapic-generator-0.5.0 lib/gapic/grpc_service_config/retry_policy.rb
gapic-generator-0.4.2 lib/gapic/grpc_service_config/retry_policy.rb
gapic-generator-0.4.0 lib/gapic/grpc_service_config/retry_policy.rb