Documentation ¶
Index ¶
- Constants
- Variables
- func NewConnPool(ctx context.Context, codec api.XProtocolCodec, host types.Host) types.ConnectionPool
- func NewKeepAlive(codec str.Client, proto api.XProtocol, timeout time.Duration) types.KeepAlive
- func NewPoolBinding(p *connpool) types.ConnectionPool
- func NewPoolMultiplex(p *connpool) types.ConnectionPool
- func NewPoolPingPong(p *connpool) types.ConnectionPool
- func NewStreamFactory(codec api.XProtocolCodec) types.ProtocolStreamFactory
- func RefreshKeepaliveConfig(c KeepaliveConfig)
- func SetDefaultMaxConnNumPerHostPortForMuxPool(maxConns int)
- func SetIdleTimeout(d time.Duration)
- type KeepaliveConfig
Constants ¶
const ( Init = iota Connecting Connected GoAway // received GoAway frame )
for xprotocol
Variables ¶
var DefaultKeepaliveConfig = KeepaliveConfig{
TickCountIfFail: 1,
TickCountIfSucc: 1,
FailCountToClose: 6,
}
DefaultKeepaliveConfig keeps the same with previous behavior
Functions ¶
func NewConnPool ¶
func NewConnPool(ctx context.Context, codec api.XProtocolCodec, host types.Host) types.ConnectionPool
NewConnPool init a connection pool
func NewKeepAlive ¶ added in v0.11.0
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 NewStreamFactory ¶ added in v0.26.0
func NewStreamFactory(codec api.XProtocolCodec) types.ProtocolStreamFactory
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
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