Documentation ¶
Index ¶
Constants ¶
View Source
const ( Name = "grpc_client" // DefaultTimeout 默认的连接超时时间 DefaultTimeout = 3 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func Client ¶ added in v0.0.11
func Client(service string, opts ...grpc.DialOption) *client
Types ¶
type BackoffConfig ¶
type BackoffConfig struct { // BaseDelay is the amount of time to backoff after the first failure. BaseDelay time.Duration // Multiplier is the factor with which to multiply backoffs after a // failed retry. Should ideally be greater than 1. Multiplier float64 // Jitter is the factor with which backoffs are randomized. Jitter float64 // MaxDelay is the upper bound of backoff delay. MaxDelay time.Duration }
BackoffConfig defines the configuration options for backoff.
type Cfg ¶
type Cfg struct { Registry string `json:"registry"` MaxMsgSize int Codec string Compressor string Decompressor string Balancer string BackoffMaxDelay time.Duration Timeout time.Duration DialTimeout time.Duration MaxDelay time.Duration `json:"max_delay"` UserAgent string ConnectParams ConnectParams Authority string ChannelzParentID int64 DisableServiceConfig bool DefaultServiceConfig string DisableRetry bool MaxHeaderListSize uint32 DisableHealthCheck bool BalancerName string `json:"balancer_name"` Insecure bool `json:"insecure"` Block bool `json:"block"` IdleNum uint32 `json:"idle_num"` WriteBuffer int `json:"write_buffer"` ReadBuffer int `json:"read_buffer"` WindowSize int32 `json:"window_size"` ConnWindowSize int32 `json:"conn_window_size"` MaxRecvMsgSize int `json:"max_recv_msg_size"` NoProxy bool Proxy bool `json:"proxy"` ClientParameters ClientParameters `json:"params"` Call Call `json:"call"` }
WithContextDialer
func GetDefaultCfg ¶
func GetDefaultCfg() Cfg
func (Cfg) ToOpts ¶ added in v0.0.11
func (t Cfg) ToOpts() []grpc.DialOption
type ClientParameters ¶
type ConnectParams ¶
type ConnectParams struct { // Backoff specifies the configuration options for connection backoff. Backoff BackoffConfig // MinConnectTimeout is the minimum amount of time we are willing to give a // connection to complete. MinConnectTimeout time.Duration }
Click to show internal directories.
Click to hide internal directories.