pool

package
v0.0.0-...-b3b45a9 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2015 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ExpvarKeyGets is the key name for the expvar that captures pool
	// get requests. Pass it to expvar.Get to inspect current statistics.
	ExpvarKeyGets = "srvproxy_pool_gets"
)

Variables

View Source
var (
	// ErrNoHosts indicates a pool is empty.
	ErrNoHosts = errors.New("no hosts available")
)

Functions

This section is empty.

Types

type Factory

type Factory func([]string) Pool

Factory converts a slice of hosts to a Pool.

type Pool

type Pool interface {
	Get() (host string, err error)
	Close()
}

Pool describes anything which can yield hosts for transactions. Pools don't grant exclusive use of hosts.

func Instrument

func Instrument(next Pool) Pool

Instrument records metrics for operations against the wrapped Pool.

func Report

func Report(w io.Writer, next Pool) Pool

Report logs JSON-encoded pool operations for the wrapped pool to the passed io.Writer. If w is nil, Report is a no-op.

func RoundRobin

func RoundRobin(hosts []string) Pool

RoundRobin returns a plain round-robining Pool. Close is a no-op.

func Stream

func Stream(r resolve.Resolver, name string, f Factory) Pool

Stream returns a Pool, created via the Factory, that's continuously updated with hosts resolved from the name.

Jump to

Keyboard shortcuts

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