xprotocol

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: Apache-2.0 Imports: 24 Imported by: 4

Documentation

Index

Constants

View Source
const (
	Init = iota
	Connecting
	Connected
)

for xprotocol

Variables

View Source
var DefaultKeepaliveConfig = KeepaliveConfig{
	TickCountIfFail:  1,
	TickCountIfSucc:  1,
	FailCountToClose: 6,
}

DefaultKeepaliveConfig keeps the same with previous behavior

Functions

func NewConnPool

func NewConnPool(ctx context.Context, host types.Host) types.ConnectionPool

NewConnPool init a connection pool

func NewKeepAlive added in v0.11.0

func NewKeepAlive(codec str.Client, proto types.ProtocolName, timeout time.Duration) types.KeepAlive

NewKeepAlive creates a keepalive object

func NewPoolBinding added in v0.17.0

func NewPoolBinding(p *connpool) types.ConnectionPool

NewPoolBinding generates a binding connection pool the upstream connection close will trigger the downstream connection to close and vice versa

func NewPoolMultiplex added in v0.17.0

func NewPoolMultiplex(p *connpool) types.ConnectionPool

NewPoolMultiplex generates a multiplex conn pool

func NewPoolPingPong added in v0.17.0

func NewPoolPingPong(p *connpool) types.ConnectionPool

NewPoolPingPong generates a connection pool which uses p pingpong protocol

func RefreshKeepaliveConfig added in v0.20.0

func RefreshKeepaliveConfig(c KeepaliveConfig)

RefreshKeepaliveConfig refresh the keepalive config

func SetDefaultMaxConnNumPerHostPortForMuxPool added in v0.22.0

func SetDefaultMaxConnNumPerHostPortForMuxPool(maxConns int)

SetDefaultMaxConnNumPerHostPortForMuxPool set the max connections for each host:port users could use this function or cluster threshold config to configure connection no.

func SetIdleTimeout added in v0.11.0

func SetIdleTimeout(d time.Duration)

SetIdleTimeout calculates the idle timeout as max idle count.

Types

type KeepaliveConfig added in v0.20.0

type KeepaliveConfig struct {
	// the next hb will be sent after tick_count_if_fail times of ConnReadTimeout if the current hb fails
	// if normal request comes after a heartbeat request, the next tick will be delayed
	TickCountIfFail uint32
	// the next hb will be sent after tick_count_if_succ times of ConnReadTimeout if the current hb succs
	// if normal request comes after a heartbeat request, the next tick will be delayed
	TickCountIfSucc uint32
	// if hb fails in a line, and count = fail_count_to_close, close this connection
	FailCountToClose uint32
}

KeepaliveConfig is the the config for xprotocol keepalive the config parameter can be set from the outside system

Jump to

Keyboard shortcuts

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