Documentation ¶
Overview ¶
package roaring implements roaring bitmaps with support for incremental changes.
Index ¶
- Constants
- func BSFQ(memory uint64) int
- func POPCNTQ(memory uint64) int
- type Bitmap
- func (b *Bitmap) Add(a ...uint64) (changed bool, err error)
- func (b *Bitmap) Check() error
- func (b *Bitmap) Clone() *Bitmap
- func (b *Bitmap) Contains(v uint64) bool
- func (b *Bitmap) Count() (n uint64)
- func (b *Bitmap) CountRange(start, end uint64) (n uint64)
- func (b *Bitmap) Difference(other *Bitmap) *Bitmap
- func (b *Bitmap) ForEach(fn func(uint64))
- func (b *Bitmap) ForEachRange(start, end uint64, fn func(uint64))
- func (b *Bitmap) Info() BitmapInfo
- func (b *Bitmap) Intersect(other *Bitmap) *Bitmap
- func (b *Bitmap) IntersectionCount(other *Bitmap) uint64
- func (b *Bitmap) Iterator() *Iterator
- func (b *Bitmap) Max() uint64
- func (b *Bitmap) OffsetRange(offset, start, end uint64) *Bitmap
- func (b *Bitmap) Remove(a ...uint64) (changed bool, err error)
- func (b *Bitmap) Slice() []uint64
- func (b *Bitmap) SliceRange(start, end uint64) []uint64
- func (b *Bitmap) Union(other *Bitmap) *Bitmap
- func (b *Bitmap) UnmarshalBinary(data []byte) error
- func (b *Bitmap) WriteTo(w io.Writer) (n int64, err error)
- type BitmapInfo
- type BufIterator
- type ContainerInfo
- type ErrorList
- type Iterator
Constants ¶
const ArrayMaxSize = 4096
The maximum size of array containers.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bitmap ¶
type Bitmap struct { // Writer where operations are appended to. OpWriter io.Writer // contains filtered or unexported fields }
Bitmap represents a roaring bitmap.
func (*Bitmap) Clone ¶
Clone returns a heap allocated copy of the bitmap. Note: The OpWriter IS NOT copied to the new bitmap.
func (*Bitmap) CountRange ¶
CountRange returns the number of bits set between [start, end).
func (*Bitmap) Difference ¶
Difference returns the difference of b and other.
func (*Bitmap) ForEachRange ¶
ForEachRange executes fn for each value in the bitmap between [start, end).
func (*Bitmap) IntersectionCount ¶
IntersectionCount returns the number of intersections between b and other.
func (*Bitmap) Max ¶
Max returns the highest value in the bitmap. Returns zero if the bitmap is empty.
func (*Bitmap) OffsetRange ¶
OffsetRange returns a new bitmap with a containers offset by start.
func (*Bitmap) SliceRange ¶
SliceRange returns a slice of integers between [start, end).
func (*Bitmap) UnmarshalBinary ¶
UnmarshalBinary decodes b from a binary-encoded byte slice.
type BitmapInfo ¶
type BitmapInfo struct { OpN int Containers []ContainerInfo }
BitmapInfo represents a point-in-time snapshot of bitmap stats.
type BufIterator ¶
type BufIterator struct {
// contains filtered or unexported fields
}
BufIterator wraps an iterator to provide the ability to unread values.
func NewBufIterator ¶
func NewBufIterator(itr *Iterator) *BufIterator
NewBufIterator returns a buffered iterator that wraps itr.
func (*BufIterator) Next ¶
func (itr *BufIterator) Next() (v uint64, eof bool)
Next returns the next pair in the bitmap. If a value has been buffered then it is returned and the buffer is cleared.
func (*BufIterator) Peek ¶
func (itr *BufIterator) Peek() (v uint64, eof bool)
Peek reads the next value but leaves it on the buffer.
func (*BufIterator) Seek ¶
func (itr *BufIterator) Seek(v uint64)
Seek moves to the first pair equal to or greater than pseek/bseek.
func (*BufIterator) Unread ¶
func (itr *BufIterator) Unread()
Unread pushes previous pair on to the buffer. Panics if the buffer is already full.
type ContainerInfo ¶
type ContainerInfo struct { Key uint64 // container key Type string // container type (array or bitmap) N int // number of bits Alloc int // memory used Pointer unsafe.Pointer // offset within the mmap }
ContainerInfo represents a point-in-time snapshot of container stats.
type ErrorList ¶
type ErrorList []error
ErrorList represents a list of errors.
func (*ErrorList) Append ¶
Append appends an error to the list. If err is an ErrorList then all errors are appended.
func (*ErrorList) AppendWithPrefix ¶
AppendWithPrefix appends an error to the list and includes a prefix.