Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoEndpoints is returned when no endpoints are configured or available. ErrNoEndpoints = errors.New("endpoints: no endpoints configured or available") // ErrGetOnClosedEndpoint is returned by endpoint.GetConn if the endpoint // has been closed because it was removed from the watch. // This error is retryable. ErrGetOnClosedEndpoint = errors.New("endpoint closed") )
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct { Endpoint string // Conn is the item created by a Set.OpenSocket(host) call. Conn io.Closer // Data can be uses to store other info on the connection. // Used by the thriftset to store protocol and transport factories. Data interface{} // contains filtered or unexported fields }
A Conn represents a connection to an endpoint.
type Pooler ¶
type Pooler interface { // OpenConn creates the network connection to the host. // This could be tcp, udp, higher level thrift, etc. OpenConn(host string) (io.Closer, error) IdleTimeout() time.Duration MaxActivePerHost() int MaxIdlePerHost() int }
Pooler can be throught of as a parent wrapper to a bunch of endpoints. It defines how connections are opened. And the general behavior of the pool.
type Set ¶
type Set struct { Pooler Pooler // contains filtered or unexported fields }
Set contains a list of endpoints and defines some operation on top of it.
func (*Set) Close ¶
Close will close all the hosts and thus all the connections for all the endpoints.
func (*Set) GetConn ¶
GetConn returns a connection from the endpoint with the current least amount of active connections.
func (*Set) SetEndpoints ¶
SetEndpoints will do a smart update of the endpoint lists. New hosts will be added, old ones will be removed.
Click to show internal directories.
Click to hide internal directories.