Documentation
¶
Index ¶
- Constants
- Variables
- func GetBytes(size int) *[]byte
- func NewBufferPoolContext(ctx context.Context) context.Context
- func PoolContext(ctx context.Context) *bufferValue
- func PutBytes(buf *[]byte)
- func RegistryBuffer(poolCtx BufferPoolCtx)
- type BufferPoolCtx
- type ByteBufferPoolContainer
- type IoBuffer
- 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 ¶
View Source
var ( ErrEOF = errors.New("EOF") ErrTooLarge = errors.New("io buffer: too large") ErrNegativeCount = errors.New("io buffer: negative count") ErrInvalidWriteCount = errors.New("io buffer: invalid write count") ErrClosedPipeWrite = errors.New("write on closed buffer") ConnReadTimeout = 15 * time.Second )
Functions ¶
func PoolContext ¶
func RegistryBuffer ¶
func RegistryBuffer(poolCtx BufferPoolCtx)
Types ¶
type BufferPoolCtx ¶
type BufferPoolCtx interface { Index() int New() interface{} Reset(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 ¶
type IoBuffer interface { Read(p []byte) (n int, err error) ReadeOnce(r io.Reader) (n int64, err error) ReadFrom(r io.Reader) (n int64, err error) Grow(n int) error Write(p []byte) (n int, err error) WriteString(s string) (n int, err error) WriteByte(p byte) error WriteUint16(p uint16) error WriteUint32(p uint32) error WriteUint64(p uint64) error WriteTo(w io.Writer) (n int64, err error) Peek(n int) []byte Bytes() []byte Drain(offset int) Len() int Cap() int Reset() Clone() IoBuffer String() string Alloc(int) Free() Count(int32) int32 EOF() bool SetEOF(eof bool) Append(data []byte) error CloseWithError(err error) }
func NewPipeBuffer ¶
type TempBufferCtx ¶
type TempBufferCtx struct {
// contains filtered or unexported fields
}
func (*TempBufferCtx) Index ¶
func (t *TempBufferCtx) Index() int
func (*TempBufferCtx) New ¶
func (t *TempBufferCtx) New() interface{}
func (*TempBufferCtx) Reset ¶
func (t *TempBufferCtx) Reset(interface{})
Click to show internal directories.
Click to hide internal directories.