connpool

package
v0.0.85 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialer

type Dialer interface {
	Dial(ctx context.Context, network, address string) (net.Conn, error)
}

type InFlightConns

type InFlightConns struct {
	// contains filtered or unexported fields
}

func NewInFlightConns

func NewInFlightConns() (*InFlightConns, error)

func (*InFlightConns) Add

func (i *InFlightConns) Add(conn net.Conn)

func (*InFlightConns) Close

func (i *InFlightConns) Close() error

func (*InFlightConns) Remove

func (i *InFlightConns) Remove(conn net.Conn)

type OneTimePool

type OneTimePool struct {
	InFlightConns *InFlightConns

	Dialer Dialer
	// contains filtered or unexported fields
}

OneTimePool is a pool designed to create continous bare connections that are for one time only usage

func NewOneTimePool

func NewOneTimePool(ctx context.Context, address string, poolSize int) (*OneTimePool, error)

func (*OneTimePool) Acquire

func (p *OneTimePool) Acquire(c context.Context) (net.Conn, error)

Acquire acquires an idle connection from the pool

func (*OneTimePool) Close

func (p *OneTimePool) Close() error

func (*OneTimePool) Run

func (p *OneTimePool) Run() error

Jump to

Keyboard shortcuts

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