buffer

package
v0.0.0-...-6113c70 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

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 GetBytes

func GetBytes(size int) *[]byte

func NewBufferPoolContext

func NewBufferPoolContext(ctx context.Context) context.Context

func PoolContext

func PoolContext(ctx context.Context) *bufferValue

func PutBytes

func PutBytes(buf *[]byte)

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

func NewPipeBuffer(capacity int) IoBuffer

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{})

Jump to

Keyboard shortcuts

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