pool

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RpcNomad     RPCType = 0x01
	RpcRaft              = 0x02
	RpcMultiplex         = 0x03
	RpcTLS               = 0x04
	RpcStreaming         = 0x05

	// RpcMultiplexV2 allows a multiplexed connection to switch modes between
	// RpcNomad and RpcStreaming per opened stream.
	RpcMultiplexV2 = 0x06
)

Variables

This section is empty.

Functions

func NewClientCodec

func NewClientCodec(conn io.ReadWriteCloser) rpc.ClientCodec

NewClientCodec returns a new rpc.ClientCodec to be used to make RPC calls.

func NewServerCodec

func NewServerCodec(conn io.ReadWriteCloser) rpc.ServerCodec

NewServerCodec returns a new rpc.ServerCodec to be used to handle RPCs.

Types

type Conn

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

Conn is a pooled connection to a Nomad server

func (*Conn) Close

func (c *Conn) Close() error

type ConnPool

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

ConnPool is used to maintain a connection pool to other Nomad servers. This is used to reduce the latency of RPC requests between servers. It is only used to pool connections in the rpcNomad mode. Raft connections are pooled separately.

func NewPool

func NewPool(logger hclog.Logger, maxTime time.Duration, maxStreams int, tlsWrap tlsutil.RegionWrapper) *ConnPool

NewPool is used to make a new connection pool Maintain at most one connection per host, for up to maxTime. Set maxTime to 0 to disable reaping. maxStreams is used to control the number of idle streams allowed. If TLS settings are provided outgoing connections use TLS.

func (*ConnPool) RPC

func (p *ConnPool) RPC(region string, addr net.Addr, version int, method string, args interface{}, reply interface{}) error

RPC is used to make an RPC call to a remote host

func (*ConnPool) ReloadTLS

func (p *ConnPool) ReloadTLS(tlsWrap tlsutil.RegionWrapper)

ReloadTLS reloads TLS configuration on the fly

func (*ConnPool) SetConnListener

func (p *ConnPool) SetConnListener(l chan<- *yamux.Session)

SetConnListener is used to listen to new connections being made. The channel will be closed when the conn pool is closed or a new listener is set.

func (*ConnPool) Shutdown

func (p *ConnPool) Shutdown() error

Shutdown is used to close the connection pool

type RPCType

type RPCType byte

type StreamClient

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

streamClient is used to wrap a stream with an RPC client

func (*StreamClient) Close

func (sc *StreamClient) Close()

Jump to

Keyboard shortcuts

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