conn

package
v1.1.31 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// StateBlock block is unavailable state
	StateBlock state = 0x01 + iota
	// StateReady ready is unavailable state
	StateReady

	// StateWorking is available state
	StateWorking
)

Variables

View Source
var (
	// DefaultConnectTimeout dial rpc connection timeout
	// connect server within connectTimeout
	// if out of ranges,will be timeout
	DefaultConnectTimeout = time.Second * 5
	// DefaultKeepaliveInterval rpc keepalive interval time
	//keepalive setting,the period for requesting heartbeat to stay connected
	DefaultKeepaliveInterval = time.Second * 5
	// DefaultKeepaliveLifetime rpc keepalive lifetime
	//keepalive setting,the longest time the connection can survive
	DefaultKeepaliveLifetime = time.Second * 600
)

Functions

This section is empty.

Types

type Conn

type Conn struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Conn include transport client

func NewConn

func NewConn(
	e *endpoint.Endpoint,
	closeCallback chan string,
) (*Conn, error)

NewConn is create a conn closeCallBack is the conn client occur error and callback

func (*Conn) Block

func (c *Conn) Block()

Block swap state to block

func (*Conn) Client

func (c *Conn) Client() transport.Client

Client get client

func (*Conn) CloseConn added in v1.1.6

func (c *Conn) CloseConn()

CloseConn close client connection

func (*Conn) Cursor

func (c *Conn) Cursor() int

func (*Conn) GetState

func (c *Conn) GetState() state

GetState get state

func (*Conn) GrowError

func (c *Conn) GrowError()

GrowError grow error and let the error conn retry working util conn is out of serviceName

func (*Conn) GrowErrorCount

func (c *Conn) GrowErrorCount() uint32

GrowErrorCount error safe grow one

func (*Conn) IsBlock

func (c *Conn) IsBlock() bool

IsBlock judge state is block

func (*Conn) IsWorking

func (c *Conn) IsWorking() bool

IsWorking judge state is working

func (*Conn) Ready

func (c *Conn) Ready()

Ready swap state to ready

func (*Conn) SetCursor

func (c *Conn) SetCursor(i int)

func (*Conn) Working

func (c *Conn) Working()

Working swap state to working

Jump to

Keyboard shortcuts

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