grpclient

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

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 Call

type Call struct {
	Header                map[string]string
	Trailer               map[string]string
	WaitForReady          bool
	FailFast              bool
	MaxCallRecvMsgSize    int
	MaxCallSendMsgSize    int
	UseCompressor         string
	CallContentSubtype    string
	ForceCodec            string
	MaxRetryRPCBufferSize int
}

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 ClientParameters struct {
	PermitWithoutStream bool          `json:"permit_without_stream"`
	Time                time.Duration `json:"time"`
	Timeout             time.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 time.Duration
}

Directories

Path Synopsis
balancer
p2c

Jump to

Keyboard shortcuts

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