ecs-logs: Index | Files

package pool

import ""


Package Files


type LimitedConnPool Uses

type LimitedConnPool struct {
    // contains filtered or unexported fields

A LimitedConnPool is a connection pool, with the property that the total number of live connections is limited to the size parameter passed to NewLimited. In order to make this guarantee, we assume that all new connections are introduced by calls to the Get method, and returned to the pool by calls to Close().

func NewLimited Uses

func NewLimited(size int, dial func() (io.WriteCloser, error)) (*LimitedConnPool, error)

NewLimited returns a new LimitedConnPool with the given size limit and dial function.

func (*LimitedConnPool) Close Uses

func (p *LimitedConnPool) Close()

func (*LimitedConnPool) Errors Uses

func (p *LimitedConnPool) Errors() <-chan error

Errors returns a channel of errors encountered when dialing new connections. Errors will be dropped if this channel is not consumed.

func (*LimitedConnPool) Get Uses

func (p *LimitedConnPool) Get() io.WriteCloser

Get retrieves a connection from the pool, if available. A new connection will only be dialed if the total number of live connections is below the configured size limit. Closing the returned io.WriteCloser automatically returns the connection to the pool.

Package pool imports 3 packages (graph) and is imported by 1 packages. Updated 2018-05-25. Refresh now. Tools for package owners.