Class: Gapic::GrpcServiceConfig::RetryPolicy

Inherits:
Object
  • Object
show all
Defined in:
lib/gapic/grpc_service_config/retry_policy.rb

Overview

RetryPolicy encapsulates the parameters governing the client-side retry for the GRPC method invocation. It is embedded into the MethodConfig

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(initial_delay_seconds, max_delay_seconds, multiplier, status_codes) ⇒ RetryPolicy

Create new ParsedRetryPolicy.

Parameters:

  • initial_delay_seconds (Float, nil)

    the value of initial retry delay in seconds if provided

  • max_delay_seconds (Float, nil)

    the value of max retry delay in seconds if provided

  • multiplier (Float, nil)

    the value of retry multiplier if provided

  • status_codes (Array<String>, nil)

    the retry status codes if provided



37
38
39
40
41
42
# File 'lib/gapic/grpc_service_config/retry_policy.rb', line 37

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

Instance Attribute Details

#initial_delay_secondsObject (readonly)

Returns the value of attribute initial_delay_seconds.



24
25
26
# File 'lib/gapic/grpc_service_config/retry_policy.rb', line 24

def initial_delay_seconds
  @initial_delay_seconds
end

#max_delay_secondsObject (readonly)

Returns the value of attribute max_delay_seconds.



25
26
27
# File 'lib/gapic/grpc_service_config/retry_policy.rb', line 25

def max_delay_seconds
  @max_delay_seconds
end

#multiplierObject (readonly)

Returns the value of attribute multiplier.



26
27
28
# File 'lib/gapic/grpc_service_config/retry_policy.rb', line 26

def multiplier
  @multiplier
end

#status_codesObject (readonly)

Returns the value of attribute status_codes.



27
28
29
# File 'lib/gapic/grpc_service_config/retry_policy.rb', line 27

def status_codes
  @status_codes
end

Instance Method Details

#empty?Boolean

Returns whether RetryPolicy is empty (does not contain any values)

Returns:

  • (Boolean)

    whether RetryPolicy is empty



49
50
51
# File 'lib/gapic/grpc_service_config/retry_policy.rb', line 49

def empty?
  @initial_delay_seconds.nil? && @max_delay_seconds.nil? && @multiplier.nil? && status_codes.to_a.empty?
end