buffer

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBuffer

func GetBuffer(size int) []byte

GetBuffer returns a bytes from the pool with the given size.

func PutBuffer

func PutBuffer(buf []byte)

PutBuffer frees the bytes to the pool.

Types

type Buffers

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

Buffers contains buckets for sharding.

func NewBuffers

func NewBuffers(pageSize int) *Buffers

NewBuffers creates a new Buffers with the given page size.

func (*Buffers) AssignPool

func (b *Buffers) AssignPool(size int) (p *Pool)

AssignPool assigns a fixed size bytes pool with the given size.

func (*Buffers) GetBuffer

func (b *Buffers) GetBuffer(size int) []byte

GetBuffer returns a bytes from the pool with the given size.

func (*Buffers) PutBuffer

func (b *Buffers) PutBuffer(buf []byte)

PutBuffer frees the bytes to the pool.

type Pool

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

Pool represents a fixed size bytes pool.

func AssignPool

func AssignPool(size int) *Pool

AssignPool assigns a fixed size bytes pool with the given size.

func (*Pool) GetBuffer

func (p *Pool) GetBuffer() []byte

GetBuffer returns a bytes from the pool with the given size.

func (*Pool) GetBufferSize added in v0.0.2

func (p *Pool) GetBufferSize(size int) []byte

GetBufferSize returns a bytes from the pool with the given size.

func (*Pool) PutBuffer

func (p *Pool) PutBuffer(buf []byte)

PutBuffer frees the bytes to the pool.

Jump to

Keyboard shortcuts

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