Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrFailedToConnect = errors.New("failed to bring connection to ready state")
Functions ¶
func StringToCodeHookFunc ¶
func StringToCodeHookFunc() mapstructure.DecodeHookFuncType
Types ¶
type ConnectionConfig ¶
type ConnectionConfig struct {
// GRPC Service address.
// See https://github.com/grpc/grpc/blob/master/doc/naming.md for format. TLDR: "host:port" is okay
Address string `mapstructure:"address"`
// Keepalive options
Keepalive *KeepaliveConfig
// Retry policy config
Retry *RetryConfig `mapstructure:"retry"`
// Max outgoing grpc request size in megabytes
MaxGrpcSendMsgSizeMB int `mapstructure:"max_grpc_send_msg_size_mb"`
// Max incoming grpc request size in megabytes
MaxGrpcRecvMsgSizeMB int `mapstructure:"max_grpc_recv_msg_size_mb"`
// TLSConfig: unused
TLS *TLSConfig `mapstructure:"tls"`
// Lazy defines if the connection should be established immediately
Lazy bool `mapstructure:"lazy"`
}
ConnectionConfig holds GRPC client configuration
func (*ConnectionConfig) Validate ¶
func (c *ConnectionConfig) Validate() error
type ConnectionsConfig ¶
type ConnectionsConfig map[string]*ConnectionConfig
func (*ConnectionsConfig) Validate ¶
func (c *ConnectionsConfig) Validate() error
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container is a simple container for holding named GRPC connections.
func NewContainer ¶
func NewContainer() *Container
type ExponentialBackoffConfig ¶
type ExponentialBackoffConfig struct {
// Base delay is the length of the first delay in the retry cycle
BaseDelay time.Duration `mapstructure:"base_delay"`
// Jitter fraction
Jitter float64 `mapstructure:"jitter"`
// MaxAttempts is the cap for retry attempts. Set 0 to disable
MaxAttempts int `mapstructure:"max_attempts"`
}
func (*ExponentialBackoffConfig) Validate ¶
func (c *ExponentialBackoffConfig) Validate() error
type KeepaliveConfig ¶
type KeepaliveConfig struct {
Time time.Duration
Timeout time.Duration
PermitWithoutStream bool `mapstructure:"permit_without_stream"`
}
KeepaliveConfig holds grpc keepalive balancing options. see keepalive.ClientParameters for details.
type LinearBackoffConfig ¶
type LinearBackoffConfig struct {
// Delay is the delay length between retries
Delay time.Duration
// Jitter fraction
Jitter float64 `mapstructure:"jitter"`
// MaxAttempts is the cap for retry attempts. Set 0 to disable
MaxAttempts int
}
func (*LinearBackoffConfig) Validate ¶
func (c *LinearBackoffConfig) Validate() error
type RetryConfig ¶
type RetryConfig struct {
ExponentialBackoff *ExponentialBackoffConfig `mapstructure:"exponential"`
LinearBackoff *LinearBackoffConfig `mapstructure:"linear"`
Codes []codes.Code `mapstructure:"codes"`
}
func NewDefaultRetryConfig ¶
func NewDefaultRetryConfig() *RetryConfig
func (*RetryConfig) Validate ¶
func (c *RetryConfig) Validate() error
Click to show internal directories.
Click to hide internal directories.