connpool

package module
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: Apache-2.0 Imports: 7 Imported by: 15

README

= connpool
Connection pool to enforce max duration & delay between commands

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn interface {
	net.Conn

	ReadWriter() *bufio.ReadWriter
	EmptyReadBuffer(deadline time.Time) ([]byte, error)
	ReadUntil(delim byte, deadline time.Time) ([]byte, error)
}

Conn .

func Wrap

func Wrap(c net.Conn) Conn

Wrap .

type Logger

type Logger interface {
	Debugf(format string, a ...interface{})
	Infof(format string, a ...interface{})
	Warnf(format string, a ...interface{})
	Errorf(format string, a ...interface{})
}

type NewConnectionFunc added in v0.1.2

type NewConnectionFunc func(context.Context) (net.Conn, error)

type Pool

type Pool struct {
	NewConnection NewConnectionFunc
	TTL           time.Duration
	Delay         time.Duration
	Logger        Logger
	// contains filtered or unexported fields
}

func (*Pool) Do

func (p *Pool) Do(ctx context.Context, work Work) error

type Work

type Work func(Conn) error

Jump to

Keyboard shortcuts

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