Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PooledMultiBuffer ¶
type PooledMultiBuffer struct {
// contains filtered or unexported fields
}
PooledMultiBuffer provides io.Reader interface over multiple bytes.Buffers (like io.MultiReader) buffers are taken from sync.Pool to reduce GC pressure
func NewPooledMultiBuffer ¶
func NewPooledMultiBuffer(count int, pool *sync.Pool) *PooledMultiBuffer
NewPooledMultiBuffer makes new PooledMiltiBuffer. Pool is used to manage memory for buffers and reuse them between multiple PooledMultiBuffers Count is used as a hint to possible buffer count. You may provide 0 as initial count.
func (*PooledMultiBuffer) AcquireBuffer ¶
func (q *PooledMultiBuffer) AcquireBuffer(initialCap int) *bytes.Buffer
AcquireBuffer provides a buffer. It may allocate new buffer in memory or take it from internal memory pool. To optimize memory allocations you can set initial buffer capacity if it is known. It is guaranteed that internal buffers read order is the same as the order of AcquireBuffer calls
func (*PooledMultiBuffer) Close ¶
func (q *PooledMultiBuffer) Close()
Close release all acquired buffers and return them into memory pool Read should not be called after close