Documentation
¶
Index ¶
Constants ¶
View Source
const ( Name = "grpc_client" // DefaultTimeout 默认的连接超时时间 DefaultTimeout = 3 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func Get ¶
func Get(service string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
Get new grpc client
func New ¶
func New(service string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
Types ¶
type BackoffConfig ¶
type BackoffConfig struct {
// BaseDelay is the amount of time to backoff after the first failure.
BaseDelay golug_types.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 golug_types.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 golug_types.Duration
Timeout golug_types.Duration
DialTimeout golug_types.Duration
MaxDelay golug_types.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
type ClientParameters ¶
type ClientParameters struct {
PermitWithoutStream bool `json:"permit_without_stream"`
Time golug_types.Duration `json:"time"`
Timeout golug_types.Duration `json:"timeout"`
}
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 golug_types.Duration
}
Click to show internal directories.
Click to hide internal directories.