Documentation
¶
Index ¶
- Constants
- Variables
- type Buffer
- type BufferPool
- type BytesBuffer
- type LinkedList
- func (l *LinkedList) Free()
- func (l *LinkedList) Pop() (*Buffer, error)
- func (l *LinkedList) Push(b *Buffer) bool
- func (l *LinkedList) Read(p []byte) (n int, err error)
- func (l *LinkedList) ReadAll() ([]byte, error)
- func (l *LinkedList) Size() int
- func (l *LinkedList) WithBufferPool(bp *BufferPool) *LinkedList
- func (l *LinkedList) Write(p []byte) (n int, err error)
Constants ¶
View Source
const ( UnLimitedLinkedListLength int = 0 UnLimitedBufferPoolSize int = 0 DefaultBufferSize int = 1024 * 4 )
Variables ¶
View Source
var ErrBufferPoolFull = errors.New("buffer pool is full")
View Source
var ErrBufferTooSmall = errors.New("buffer is too small")
View Source
var ErrLinkedListEmpty = errors.New("linked list is empty")
View Source
var ErrLinkedListFull = errors.New("linked list is full")
LinkedList
View Source
var ErrLinkedListMaxLengthTooSmall = errors.New("linked list max length is too small")
Functions ¶
This section is empty.
Types ¶
type BufferPool ¶
type BufferPool struct {
// contains filtered or unexported fields
}
func NewBufferPool ¶
func NewBufferPool(maxPoolSize int) *BufferPool
func (*BufferPool) Put ¶
func (bp *BufferPool) Put(buf *Buffer)
func (*BufferPool) TotalSize ¶
func (bp *BufferPool) TotalSize() int
func (*BufferPool) WithBufferSize ¶
func (bp *BufferPool) WithBufferSize(size int) *BufferPool
WithBufferSize set the buffer size of the buffer pool, it can only be called before the buffer pool is used.
type BytesBuffer ¶
type BytesBuffer struct {
// contains filtered or unexported fields
}
func NewBytesBuffer ¶
func NewBytesBuffer() *BytesBuffer
func (*BytesBuffer) Free ¶
func (b *BytesBuffer) Free()
Free is not nessary to call gc will free the memory
func (*BytesBuffer) ReadAll ¶
func (b *BytesBuffer) ReadAll() ([]byte, error)
type LinkedList ¶
type LinkedList struct {
// contains filtered or unexported fields
}
func NewLinkedListIO ¶
func NewLinkedListIO(maxLength int) *LinkedList
func (*LinkedList) Free ¶
func (l *LinkedList) Free()
Free all buffers in the list it's not big deal if you forget to call this function gc will do it for you
func (*LinkedList) Pop ¶
func (l *LinkedList) Pop() (*Buffer, error)
func (*LinkedList) Push ¶
func (l *LinkedList) Push(b *Buffer) bool
func (*LinkedList) ReadAll ¶
func (l *LinkedList) ReadAll() ([]byte, error)
func (*LinkedList) Size ¶
func (l *LinkedList) Size() int
func (*LinkedList) WithBufferPool ¶
func (l *LinkedList) WithBufferPool(bp *BufferPool) *LinkedList
Click to show internal directories.
Click to hide internal directories.