bpool

package
v0.0.0-...-1526e7e Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BytePoolCap

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

BytePoolCap implements a leaky pool of []byte in the form of a bounded channel.

func NewBytePoolCap

func NewBytePoolCap(maxSize uint64, width int, capwidth int) (bp *BytePoolCap)

NewBytePoolCap creates a new BytePool bounded to the given maxSize, with new byte arrays sized based on width.

func (*BytePoolCap) Get

func (bp *BytePoolCap) Get() (b []byte)

Get gets a []byte from the BytePool, or creates a new one if none are available in the pool.

func (*BytePoolCap) Populate

func (bp *BytePoolCap) Populate()

Populate - populates and pre-warms the byte pool, this function is non-blocking.

func (*BytePoolCap) Put

func (bp *BytePoolCap) Put(b []byte)

Put returns the given Buffer to the BytePool.

func (*BytePoolCap) Width

func (bp *BytePoolCap) Width() (n int)

Width returns the width of the byte arrays in this pool.

func (*BytePoolCap) WidthCap

func (bp *BytePoolCap) WidthCap() (n int)

WidthCap returns the cap width of the byte arrays in this pool.

Jump to

Keyboard shortcuts

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