Documentation ¶
Overview ¶
nolint
nolint
Index ¶
- Constants
- Variables
- func CleanBufferPoolContext(ctx context.Context) context.Context
- func GetBytes(size int) *[]byte
- func GetBytesByContext(context context.Context, size int) *[]byte
- func NewBufferPoolContext(ctx context.Context) context.Context
- func PoolContext(ctx context.Context) *bufferValue
- func PutBytes(buf *[]byte)
- func PutIoBuffer(buf IoBuffer) error
- func RegisterBuffer(poolCtx BufferPoolCtx)
- func SetLogFunc(f func(msg string))
- func TransmitBufferPoolContext(dst context.Context, src context.Context)
- type BufferPoolCtx
- type ByteBufferCtx
- type ByteBufferPoolContainer
- type IoBuffer
- type IoBufferPool
- type TempBufferCtx
Constants ¶
View Source
const ( AutoExpand = -1 MinRead = 1 << 9 MaxRead = 1 << 17 ResetOffMark = -1 DefaultSize = 1 << 4 MaxBufferLength = 1 << 20 MaxThreshold = 1 << 22 )
Variables ¶
Functions ¶
func CleanBufferPoolContext ¶ added in v1.2.0
CleanBufferPoolContext cleans the bufferValue in the context
func GetBytesByContext ¶ added in v1.2.0
GetBytesByContext returns []byte from byteBufferPool by context
func NewBufferPoolContext ¶ added in v1.2.0
NewBufferPoolContext returns a context with bufferValue
func PoolContext ¶ added in v1.2.0
PoolContext returns bufferValue by context
func RegisterBuffer ¶ added in v1.2.0
func RegisterBuffer(poolCtx BufferPoolCtx)
Types ¶
type BufferPoolCtx ¶ added in v1.2.0
type BufferPoolCtx interface { // Index returns the bufferpool's Index Index() int // New returns the buffer New() interface{} // Reset resets the buffer Reset(interface{}) }
BufferPoolCtx is the bufferpool's context nolint
type ByteBufferCtx ¶ added in v1.2.0
type ByteBufferCtx struct {
TempBufferCtx
}
func (ByteBufferCtx) New ¶ added in v1.2.0
func (ctx ByteBufferCtx) New() interface{}
func (ByteBufferCtx) Reset ¶ added in v1.2.0
func (ctx ByteBufferCtx) Reset(i interface{})
type ByteBufferPoolContainer ¶
type ByteBufferPoolContainer struct {
// contains filtered or unexported fields
}
func NewByteBufferPoolContainer ¶
func NewByteBufferPoolContainer() *ByteBufferPoolContainer
func (*ByteBufferPoolContainer) Reset ¶
func (c *ByteBufferPoolContainer) Reset()
func (*ByteBufferPoolContainer) Take ¶
func (c *ByteBufferPoolContainer) Take(size int) *[]byte
type IoBuffer ¶
keep this alias for compatbile. if you write new code, use api.IoBuffer instead.
func NewIoBufferBytes ¶
func NewIoBufferEOF ¶
func NewIoBufferEOF() IoBuffer
func NewIoBufferString ¶
func NewPipeBuffer ¶
type IoBufferPool ¶
type IoBufferPool struct {
// contains filtered or unexported fields
}
IoBufferPool is Iobuffer Pool
func (*IoBufferPool) GetIoBuffer ¶
func (p *IoBufferPool) GetIoBuffer(size int) IoBuffer
GetIoBuffer returns IoBuffer from pool
func (*IoBufferPool) PutIoBuffer ¶
func (p *IoBufferPool) PutIoBuffer(buf IoBuffer) error
PutIoBuffer returns IoBuffer to pool
type TempBufferCtx ¶ added in v1.2.0
type TempBufferCtx struct {
// contains filtered or unexported fields
}
TempBufferCtx is template for BufferPoolCtx
func (*TempBufferCtx) Index ¶ added in v1.2.0
func (t *TempBufferCtx) Index() int
Index returns current index
func (*TempBufferCtx) New ¶ added in v1.2.0
func (t *TempBufferCtx) New() interface{}
New is a default action, which needs to implementation
func (*TempBufferCtx) Reset ¶ added in v1.2.0
func (t *TempBufferCtx) Reset(x interface{})
Reset is a default action, which needs to implementation
Click to show internal directories.
Click to hide internal directories.