client

package
v0.0.0-...-917d9ad Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LCS_Disconnected = iota
	LCS_Connecting
	LCS_Connected
	LCS_Disconnecting
)
View Source
const (
	LCS_Unknown = iota
	LCS_Idle
	LCS_Busy
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultConnPool

type DefaultConnPool struct {
	// contains filtered or unexported fields
}

func NewDefaultConnPool

func NewDefaultConnPool(address string, idlConfig LongConnPoolConfig) *DefaultConnPool

func (*DefaultConnPool) Close

func (dc *DefaultConnPool) Close() error

func (*DefaultConnPool) Discard

func (dc *DefaultConnPool) Discard(conn *LongConn) error

func (*DefaultConnPool) Get

func (dc *DefaultConnPool) Get(ctx context.Context, address string) (*LongConn, error)

func (*DefaultConnPool) Open

func (dc *DefaultConnPool) Open()

func (*DefaultConnPool) Put

func (dc *DefaultConnPool) Put(conn *LongConn) error

func (*DefaultConnPool) RequestMessage

func (dc *DefaultConnPool) RequestMessage(msg protoreflect.ProtoMessage, timeout int64) (proto.Message, error)

func (*DefaultConnPool) Tick

func (dc *DefaultConnPool) Tick()

type Future

type Future struct {
	// contains filtered or unexported fields
}

请求器

func (*Future) Error

func (ref *Future) Error() error

Error 错误信息

func (*Future) Result

func (ref *Future) Result() proto.Message

Result 结果

func (*Future) Wait

func (ref *Future) Wait()

type LongConn

type LongConn struct {
	LongConnLinkedNode
	// contains filtered or unexported fields
}

func NewLongConn

func NewLongConn(ascription LongConnPool, usedLastTime int64) *LongConn

func (*LongConn) Close

func (c *LongConn) Close()

func (*LongConn) Dial

func (c *LongConn) Dial(addr string, timeout time.Duration) error

func (*LongConn) EscalateFailure

func (c *LongConn) EscalateFailure(reason interface{}, message interface{})

func (*LongConn) IsConnected

func (c *LongConn) IsConnected() bool

func (*LongConn) RequestMessage

func (c *LongConn) RequestMessage(message proto.Message, timeout int64) (proto.Message, error)

type LongConnDirect

type LongConnDirect int

type LongConnLinkedNode

type LongConnLinkedNode struct {
	intrusive.LinkedNode
}

type LongConnPool

type LongConnPool interface {
	RequestMessage(protoreflect.ProtoMessage, int64) (proto.Message, error)

	Get(ctx context.Context, address string) (*LongConn, error)

	Put(*LongConn) error

	Discard(*LongConn) error

	Open()

	Close() error
}

type LongConnPoolConfig

type LongConnPoolConfig struct {
	MaxConn            int32         // 最大连接数
	MaxIdleConn        int32         // 最大空闲连接数
	MaxIdleConnTimeout time.Duration // 空闲连接最大闲置时间
	ConnectTimeout     time.Duration // 连接超时时间
}

func CheckLongConnPoolConfig

func CheckLongConnPoolConfig(config LongConnPoolConfig) *LongConnPoolConfig

type LongConnState

type LongConnState int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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