conn

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2017 License: AGPL-3.0, Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoConnection = fmt.Errorf("No connection exists")
)

Functions

func TestConnection

func TestConnection(p *Pool) error

testConnection tests if we can run an Echo query on a connection.

Types

type Pool

type Pool struct {
	Addr string
	// contains filtered or unexported fields
}

"Pool" is used to manage the grpc client connection(s) for communicating with other worker instances. Right now it just holds one of them.

func NewPool

func NewPool(addr string) (*Pool, error)

NewPool creates a new "pool" with one gRPC connection, refcount 0.

func (*Pool) AddOwner

func (p *Pool) AddOwner()

AddOwner adds 1 to the refcount for the pool (atomically).

func (*Pool) Get

func (p *Pool) Get() *grpc.ClientConn

Get returns the connection to use from the pool of connections.

type Pools

type Pools struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func Get

func Get() *Pools

func (*Pools) Any

func (p *Pools) Any() (*Pool, error)

func (*Pools) Connect

func (p *Pools) Connect(addr string) *Pool

Returns a pool that you should call put() on.

func (*Pools) Get

func (p *Pools) Get(addr string) (*Pool, error)

func (*Pools) Release

func (p *Pools) Release(pl *Pool)

One of these must be called for each call to get(...).

Jump to

Keyboard shortcuts

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