retry

package
v2.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultNameConfig

func DefaultNameConfig() nameConfig

func DefaultRetryDialOption

func DefaultRetryDialOption() (grpc.DialOption, error)

DefaultRetryDialOption returns DialOption that configures the default service config, which will be used in cases where:

1. User provide service config in SDK build after DefaultRetryDialOption function. In this case retries configuration override user's service config.

2. User don't get service config through xDS. In that case service config from xDS override retries configuration.

func NewNameConfig

func NewNameConfig(service, method string) nameConfig

func RetryDialOption

func RetryDialOption(opts ...RetryOption) (grpc.DialOption, error)

RetryDialOption returns DialOption that configures the default service config, which will be used in cases where:

1. User provide service config in SDK build after RetryDialOption function. In this case retries configuration override user's service config.

2. User don't get service config through xDS. In that case service config from xDS override retries configuration.

It's recommended to use default configuration (DefaultRetryDialOption) for retries in SDK to avoid retry amplification.

Types

type Duration

type Duration time.Duration

Duration defines JSON marshal and unmarshal methods to conform to the protobuf JSON spec defined here.

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON converts from d to a JSON string output.

func (Duration) String

func (d Duration) String() string

type GRPCKeepAliveConfig

type GRPCKeepAliveConfig struct {
	Time                time.Duration `yaml:"time" validate:"required"`
	Timeout             time.Duration `yaml:"timeout" validate:"required"`
	PermitWithoutStream bool          `yaml:"permit_without_stream"`
}

type RetryConfig

type RetryConfig struct {
	// contains filtered or unexported fields
}

func DefaultRetryConfig

func DefaultRetryConfig() *RetryConfig

type RetryOption

type RetryOption func(c *RetryConfig)

func WithDefaultRetryConfig

func WithDefaultRetryConfig() RetryOption

func WithRetries

func WithRetries(nm nameConfig, n int) RetryOption

func WithRetryableStatusCodes

func WithRetryableStatusCodes(nm nameConfig, codes ...codes.Code) RetryOption

func WithThrottlingMode

func WithThrottlingMode(mode ThrottlingMode) RetryOption

type ThrottlingMode

type ThrottlingMode string

ThrottlingMode provides the mode SDK will retry request.

const (
	// ThrottlingModePersistent model provides retry attempts and budget for persistent environments.
	// This mode is suitable when you use SDK in your server application, or any long-lived applications.
	ThrottlingModePersistent ThrottlingMode = "persistent"

	// ThrottlingModeTemporary model provides retry attempts and budget for temporary environments.
	// This mode is suitable when you use SDK in some CI scripts, or any short-lived applications.
	ThrottlingModeTemporary ThrottlingMode = "temporary"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL