grpcc

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2021 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name = "grpcc"

	// DefaultTimeout 默认的连接超时时间
	DefaultTimeout = 3 * time.Second
)

Variables

This section is empty.

Functions

func GetClient

func GetClient(service string, opts ...func(cfg *Cfg)) *client

func HealthCheck added in v0.1.3

func HealthCheck(srv string, conn *grpc.ClientConn) error

func NewDirect added in v0.1.0

func NewDirect(addr string, opts ...func(cfg *Cfg)) (*grpc.ClientConn, error)

Types

type Cfg

type Cfg struct {
	Registry             string        `json:"registry"`
	MaxMsgSize           int           `json:"max_msg_size"`
	Codec                string        `json:"codec"`
	Compressor           string        `json:"compressor"`
	Decompressor         string        `json:"decompressor"`
	Balancer             string        `json:"balancer"`
	BackoffMaxDelay      time.Duration `json:"backoff_max_delay"`
	Timeout              time.Duration `json:"timeout"`
	DialTimeout          time.Duration `json:"dial_timeout"`
	MaxDelay             time.Duration `json:"max_delay"`
	UserAgent            string        `json:"user_agent"`
	Authority            string        `json:"authority"`
	ChannelzParentID     int64         `json:"channelz_parent_id"`
	DisableServiceConfig bool          `json:"disable_service_config"`
	DefaultServiceConfig string        `json:"default_service_config"`
	DisableRetry         bool          `json:"disable_retry"`
	MaxHeaderListSize    uint32        `json:"max_header_list_size"`
	DisableHealthCheck   bool          `json:"disable_health_check"`
	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 maximum message that client can receive (4 MB).
	MaxRecvMsgSize     int                            `json:"max_recv_msg_size"`
	NoProxy            bool                           `json:"no_proxy"`
	Proxy              bool                           `json:"proxy"`
	ConnectParams      connectParams                  `json:"connect_params"`
	ClientParameters   clientParameters               `json:"client_parameters"`
	Call               callParameters                 `json:"call"`
	Middlewares        []types.Middleware             `json:"-"`
	DialOptions        []grpc.DialOption              `json:"-"`
	UnaryInterceptors  []grpc.UnaryClientInterceptor  `json:"-"`
	StreamInterceptors []grpc.StreamClientInterceptor `json:"-"`
}

Cfg ...

func GetCfg

func GetCfg(name string) *Cfg

func GetDefaultCfg

func GetDefaultCfg(opts ...func(cfg *Cfg)) *Cfg

func (Cfg) Build

func (t Cfg) Build(target string) (conn *grpc.ClientConn, gErr error)

func (Cfg) BuildDirect added in v0.1.0

func (t Cfg) BuildDirect(target string) (conn *grpc.ClientConn, gErr error)

func (Cfg) ToOpts

func (t Cfg) ToOpts() []grpc.DialOption

type Client

type Client interface {
	Check(opts ...grpc.CallOption) (*grpc_health_v1.HealthCheckResponse, error)
	Get() (*grpc.ClientConn, error)
	Close() error
}

type DialOptions

type DialOptions = []grpc.DialOption

Directories

Path Synopsis
balancer
p2c

Jump to

Keyboard shortcuts

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