buf

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 7 Imported by: 10

Documentation

Index

Constants

View Source
const (
	InvalidLimit      = 0
	MinBufferChanSize = 16
)
View Source
const (
	BufferTypeHeader    = 0
	BufferTypeNormal    = 1
	BufferTypeHeaderVer = 2
	BufferTypeRepair    = 3
)

Variables

View Source
var (
	ClodVolWriteBufPool = sync.Pool{
		New: func() interface{} {
			b := make([]byte, 32*1024)
			return b
		},
	}
	ClodVolReaderBufPool = sync.Pool{
		New: func() interface{} {
			b := make([]byte, 1024*1024)
			return b
		},
	}
)
View Source
var (
	HeaderBufferPoolSize int = 8192

	NormalBuffersTotalLimit  int64
	HeadBuffersTotalLimit    int64
	HeadVerBuffersTotalLimit int64
	RepairBuffersTotalLimit  int64
)

Functions

func InitCachePool added in v1.34.0

func InitCachePool(blockSize int)

func InitbCachePool added in v1.34.0

func InitbCachePool(blockSize int)

func NewHeadBufferPool added in v1.34.0

func NewHeadBufferPool() *sync.Pool

func NewHeadVerBufferPool added in v1.34.0

func NewHeadVerBufferPool() *sync.Pool

func NewNormalBufferPool added in v1.34.0

func NewNormalBufferPool() *sync.Pool

func NewRepiarBufferPool added in v1.34.0

func NewRepiarBufferPool() *sync.Pool

func NewTinyBufferPool added in v1.34.0

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.

type FileBCachePool added in v1.34.0

type FileBCachePool struct {
	// contains filtered or unexported fields
}
var (
	BCachePool *FileBCachePool
)

func (*FileBCachePool) Get added in v1.34.0

func (fileCachePool *FileBCachePool) Get() []byte

func (*FileBCachePool) Put added in v1.34.0

func (fileCachePool *FileBCachePool) Put(data []byte)

type FileCachePool added in v1.34.0

type FileCachePool struct {
	// contains filtered or unexported fields
}
var (
	CachePool *FileCachePool
)

func (*FileCachePool) Get added in v1.34.0

func (fileCachePool *FileCachePool) Get() []byte

func (*FileCachePool) Put added in v1.34.0

func (fileCachePool *FileCachePool) Put(data []byte)

Jump to

Keyboard shortcuts

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