bufferpool

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ENOBUF = errors.New("no such buffer can be used")

	GlobalPool = NewBufferPool(32)
)

Functions

func Put

func Put(b *Buffer)

Types

type Buffer

type Buffer struct {
	*bytes.Buffer
	// contains filtered or unexported fields
}

func Get

func Get() *Buffer

func (*Buffer) AddRefer

func (this *Buffer) AddRefer(n int) int64

func (*Buffer) Free

func (this *Buffer) Free() (n int64)

func (*Buffer) IsFree

func (this *Buffer) IsFree() bool

func (*Buffer) ReadFromLimited

func (this *Buffer) ReadFromLimited(r io.Reader, n int64) (int64, error)

func (*Buffer) TeeReader

func (this *Buffer) TeeReader(r io.Reader, max int64) (io.ReadCloser, error)

type BufferPool

type BufferPool struct {
	*sync.Pool
	// contains filtered or unexported fields
}

func NewBufferPool

func NewBufferPool(blackSize int) *BufferPool

func (*BufferPool) Get

func (this *BufferPool) Get() *Buffer

func (*BufferPool) New

func (this *BufferPool) New() interface{}

func (*BufferPool) Put

func (this *BufferPool) Put(b *Buffer)

type SCounter

type SCounter struct {
	// contains filtered or unexported fields
}

func (*SCounter) Add

func (this *SCounter) Add(n int) int64

func (*SCounter) Load

func (this *SCounter) Load() int64

Jump to

Keyboard shortcuts

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