buf

package
v2.0.0-rc.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

View Source
const (
	HeaderBufferPoolSize = 8192
	BlockBufferPoolSize  = 1024
	TinyBufferPoolSize   = 100
)

Variables

View Source
var (
	Buffers = NewBufferPool()
)

Functions

This section is empty.

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