go-vitess.v1: gopkg.in/src-d/go-vitess.v1/bucketpool Index | Files

package bucketpool

import "gopkg.in/src-d/go-vitess.v1/bucketpool"

Index

Package Files

bucketpool.go

type Pool Uses

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

Pool is actually multiple pools which store buffers of specific size. i.e. it can be three pools which return buffers 32K, 64K and 128K.

func New Uses

func New(minSize, maxSize int) *Pool

New returns Pool which has buckets from minSize to maxSize. Buckets increase with the power of two, i.e with multiplier 2: [2b, 4b, 16b, ... , 1024b] Last pool will always be capped to maxSize.

func (*Pool) Get Uses

func (p *Pool) Get(size int) *[]byte

Get returns pointer to []byte which has len size. If there is no bucket with buffers >= size, slice will be allocated.

func (*Pool) Put Uses

func (p *Pool) Put(b *[]byte)

Put returns pointer to slice to some bucket. Discards slice for which there is no bucket

Package bucketpool imports 2 packages (graph) and is imported by 2 packages. Updated 2019-06-13. Refresh now. Tools for package owners.