sizedpool

package
v0.2.18 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 4 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PoolOption

type PoolOption[T any] func(*SizedPool[T]) error

func WithPool

func WithPool[T any](p *sync.Pool) PoolOption[T]

func WithSize

func WithSize[T any](size int64) PoolOption[T]

type SizedPool

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

func New

func New[T any](options ...PoolOption[T]) (*SizedPool[T], error)

func (*SizedPool[T]) Get

func (sz *SizedPool[T]) Get(ctx context.Context) (T, error)

func (*SizedPool[T]) Put

func (sz *SizedPool[T]) Put(x T)

func (*SizedPool[T]) Size

func (sz *SizedPool[T]) Size() int64

Current size of the pool

func (*SizedPool[T]) Vary

func (sz *SizedPool[T]) Vary(ctx context.Context, x int64) error

Vary capacity by x - it's internally enqueued as a normal Acquire/Release operation as other Get/Put but tokens are held internally

Jump to

Keyboard shortcuts

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