pool

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2017 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// keep numbers unique.
	// iota depends on order
	RPCConsul      RPCType = 0
	RPCRaft                = 1
	RPCMultiplex           = 2 // Old Muxado byte, no longer supported.
	RPCTLS                 = 3
	RPCMultiplexV2         = 4
	RPCSnapshot            = 5
	RPCGossip              = 6
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

Conn is a pooled connection to a Consul server

func (*Conn) Close

func (c *Conn) Close() error

type ConnPool

type ConnPool struct {
	// SrcAddr is the source address for outgoing connections.
	SrcAddr *net.TCPAddr

	// LogOutput is used to control logging
	LogOutput io.Writer

	// The maximum time to keep a connection open
	MaxTime time.Duration

	// The maximum number of open streams to keep
	MaxStreams int

	// TLS wrapper
	TLSWrapper tlsutil.DCWrapper

	// ForceTLS is used to enforce outgoing TLS verification
	ForceTLS bool

	sync.Mutex
	// contains filtered or unexported fields
}

ConnPool is used to maintain a connection pool to other Consul servers. This is used to reduce the latency of RPC requests between servers. It is only used to pool connections in the rpcConsul mode. Raft connections are pooled separately. Maintain at most one connection per host, for up to MaxTime. When MaxTime connection reaping is disabled. MaxStreams is used to control the number of idle streams allowed. If TLS settings are provided outgoing connections use TLS.

func (*ConnPool) DialTimeout

func (p *ConnPool) DialTimeout(dc string, addr net.Addr, timeout time.Duration, useTLS bool) (net.Conn, HalfCloser, error)

DialTimeout is used to establish a raw connection to the given server, with a given connection timeout.

func (*ConnPool) Ping

func (p *ConnPool) Ping(dc string, addr net.Addr, version int, useTLS bool) (bool, error)

Ping sends a Status.Ping message to the specified server and returns true if healthy, false if an error occurred

func (*ConnPool) RPC

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

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

func (*ConnPool) Shutdown

func (p *ConnPool) Shutdown() error

Shutdown is used to close the connection pool

type HalfCloser

type HalfCloser interface {
	CloseWrite() error
}

HalfCloser is an interface that exposes a TCP half-close. We need this because we want to expose the raw TCP connection underlying a TLS one in a way that's hard to screw up and use for anything else. There's a change brewing that will allow us to use the TLS connection for this instead - https://go-review.googlesource.com/#/c/25159/.

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