Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferPool ¶
type BufferPool interface { // Get fetches a bytes.Buffer from pool Get() *byteutil.Buffer // Put places supplied bytes.Buffer in pool Put(*byteutil.Buffer) }
BufferPool is a pooled allocator for bytes.Buffer objects
func NewBufferPool ¶
func NewBufferPool(size int) BufferPool
NewBufferPool returns a newly instantiated bytes.Buffer pool
type BufioReaderPool ¶
type BufioReaderPool interface { // Get fetches a bufio.Reader from pool and resets to supplied reader Get(io.Reader) *bufio.Reader // Put places supplied bufio.Reader back in pool Put(*bufio.Reader) }
BufioReaderPool is a pooled allocator for bufio.Reader objects.
func NewBufioReaderPool ¶
func NewBufioReaderPool(size int) BufioReaderPool
NewBufioReaderPool returns a newly instantiated bufio.Reader pool.
type BufioWriterPool ¶
type BufioWriterPool interface { // Get fetches a bufio.Writer from pool and resets to supplied writer Get(io.Writer) *bufio.Writer // Put places supplied bufio.Writer back in pool Put(*bufio.Writer) }
BufioWriterPool is a pooled allocator for bufio.Writer objects.
func NewBufioWriterPool ¶
func NewBufioWriterPool(size int) BufioWriterPool
NewBufioWriterPool returns a newly instantiated bufio.Writer pool.
type HashEncoderPool ¶ added in v1.1.0
type HashEncoderPool interface { // Get fetches a hashenc.HashEncoder from pool Get() hashenc.HashEncoder // Put places supplied hashenc.HashEncoder back in pool Put(hashenc.HashEncoder) }
HashEncoderPool is a pooled allocator for hashenc.HashEncoder objects.
func NewHashEncoderPool ¶ added in v1.1.0
func NewHashEncoderPool(hash func() hash.Hash, enc func() hashenc.Encoder) HashEncoderPool
NewHashEncoderPool returns a newly instantiated hashenc.HashEncoder pool.
type PathBuilderPool ¶
type PathBuilderPool interface { // Get fetches a fastpath.Builder from pool Get() *fastpath.Builder // Put places supplied fastpath.Builder back in pool Put(*fastpath.Builder) }
PathBuilderPool is a pooled allocator for fastpath.Builder objects
func NewPathBuilderPool ¶
func NewPathBuilderPool(size int) PathBuilderPool
NewPathBuilderPool returns a newly instantiated fastpath.Builder pool
type Pool ¶ added in v1.1.0
type Pool struct { // New is used to instantiate new items New func() interface{} // Evict is called on evicted items during pool .Clean() Evict func(interface{}) // contains filtered or unexported fields }
func (*Pool) Clean ¶ added in v1.1.0
func (p *Pool) Clean()
Clean will drop the current victim pools, move the current local pools to its place and reset the local pools ptr in order to be regenerated
func (*Pool) Get ¶ added in v1.1.0
func (p *Pool) Get() interface{}
Get attempts to fetch an item from the pool, failing that allocates with supplied .New() function
func (*Pool) LocalSize ¶ added in v1.1.0
LocalSize returns the total number of elements in all the proc-local pools
func (*Pool) Put ¶ added in v1.1.0
func (p *Pool) Put(v interface{})
Put places supplied item in the proc local pool
func (*Pool) VictimSize ¶ added in v1.1.0
VictimSize returns the total number of elements in all the victim (old proc-local) pools