netpool

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opt

type Opt[T any] struct {
	Name       string
	TargetSize int
	New        func(context.Context) (T, error)
	Release    func(T) error
}

type Pool

type Pool[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any](opt Opt[T]) *Pool[T]

func (*Pool[T]) Close

func (p *Pool[T]) Close() error

func (*Pool[T]) Discard

func (p *Pool[T]) Discard(v T) error

func (*Pool[T]) Fill

func (p *Pool[T]) Fill(ctx context.Context)

func (*Pool[T]) Get

func (p *Pool[T]) Get(ctx context.Context) (T, error)

func (*Pool[T]) Put

func (p *Pool[T]) Put(v T)

Jump to

Keyboard shortcuts

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