Documentation
¶
Index ¶
- Constants
- Variables
- func InitCachePool(blockSize int)
- func InitbCachePool(blockSize int)
- func NewHeadBufferPool() *sync.Pool
- func NewHeadVerBufferPool() *sync.Pool
- func NewNormalBufferPool() *sync.Pool
- func NewRepiarBufferPool() *sync.Pool
- func NewTinyBufferPool() *sync.Pool
- type BufferPool
- type FileBCachePool
- type FileCachePool
Constants ¶
View Source
const ( InvalidLimit = 0 MinBufferChanSize = 16 )
View Source
const ( BufferTypeHeader = 0 BufferTypeNormal = 1 BufferTypeHeaderVer = 2 BufferTypeRepair = 3 )
Variables ¶
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 NewHeadVerBufferPool ¶ added in v1.34.0
func NewNormalBufferPool ¶ added in v1.34.0
func NewRepiarBufferPool ¶ added in v1.34.0
func NewTinyBufferPool ¶ added in v1.34.0
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)
Click to show internal directories.
Click to hide internal directories.