Documentation ¶
Overview ¶
package roaring implements roaring bitmaps with support for incremental changes.
Index ¶
- Constants
- func BSFQ(memory uint64) int
- func POPCNTQ(memory uint64) int
- func WriteUint16(w io.Writer, b []byte, v uint16) (int, error)
- func WriteUint32(w io.Writer, b []byte, v uint32) (int, error)
- func WriteUint64(w io.Writer, b []byte, v uint64) (int, error)
- 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) Flip(start, end uint64) *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) Optimize()
- 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)
- func (b *Bitmap) Xor(other *Bitmap) *Bitmap
- type BitmapInfo
- type ContainerInfo
- type ErrorList
- type Iterator
Constants ¶
const ( ContainerArray = byte(1) ContainerBitmap = byte(2) ContainerRun = byte(3) )
const ArrayMaxSize = 4096
The maximum size of array containers.
const RunMaxSize = 2048
The maximum size of run length encoded containers.
Variables ¶
This section is empty.
Functions ¶
func WriteUint16 ¶ added in v0.7.0
hoping this in-lines
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) Flip ¶ added in v0.4.0
Perform a logical negate of the bits in the range [start,end].
func (*Bitmap) ForEachRange ¶
ForEachRange executes fn for each value in the bitmap between [start, end).
func (*Bitmap) IntersectionCount ¶
IntersectionCount returns the number of set bits that would result in an intersection between b and other. It is more efficient than actually intersecting the two and counting the result.
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) Optimize ¶ added in v0.6.0
func (b *Bitmap) Optimize()
Optimize converts array and bitmap containers to run containers as necessary.
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 ContainerInfo ¶
type ContainerInfo struct { Key uint64 // container key Type string // container type (array, bitmap, or run) 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.