Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Allocator ¶
type Allocator interface {
Get(size int) ([]byte, error)
Put([]byte) bool
}
Allocator handles byte slices for bloom queriers. It exists to reduce the cost of allocations and allows to re-use already allocated memory.
type Bucket ¶
type Bucket struct {
Size int // Number of buffers
Capacity uint64 // Size of a buffer
}
type BytePool ¶
type BytePool struct {
// contains filtered or unexported fields
}
BytePool uses a sync.Pool to re-cycle already allocated buffers.
func NewBytePoolAllocator ¶
func NewBytePoolAllocator(minSize, maxSize int, factor float64) *BytePool
type MemPool ¶
type MemPool struct {
// contains filtered or unexported fields
}
MemPool is an Allocator implementation that uses a fixed size memory pool that is split into multiple slabs of different buffer sizes. Buffers are re-cycled and need to be returned back to the pool, otherwise the pool runs out of available buffers.
type SimpleHeapAllocator ¶
type SimpleHeapAllocator struct{}
SimpleHeapAllocator allocates a new byte slice every time and does not re-cycle buffers.
Click to show internal directories.
Click to hide internal directories.