buf

package
v0.0.0-...-d1c0873 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderBufferPoolSize = 8192
)

Variables

This section is empty.

Functions

func NewTinyBufferPool

func NewTinyBufferPool() *sync.Pool

Types

type BufferPool

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

BufferPool defines the struct of a buffered pool with 4 objects.

func NewBufferPool

func NewBufferPool() (bufferP *BufferPool)

NewBufferPool returns a new buffered pool.

func (*BufferPool) Get

func (bufferP *BufferPool) Get(size int) (data []byte, err error)

Get returns the data based on the given size. Different size corresponds to different object in the pool.

func (*BufferPool) Put

func (bufferP *BufferPool) Put(data []byte)

Put puts the given data into the buffer pool.

Jump to

Keyboard shortcuts

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