bitmapdb

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2023 License: Apache-2.0 Imports: 19 Imported by: 3 modules, 7 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ChunkLimit = uint64(1950 * datasize.B) // threshold beyond which MDBX overflow pages appear: 4096 / 2 - (keySize + 8)
View Source
const MaxUint32 = 1<<32 - 1
View Source
const MetaHeaderSize = 64

Variables

This section is empty.

Functions

func Bytesmask

func Bytesmask(fixedbits int) (fixedbytes int, mask byte)

func CutLeft

func CutLeft(bm *roaring.Bitmap, sizeLimit uint64) *roaring.Bitmap

CutLeft - cut from bitmap `targetSize` bytes from left removing lft part from `bm` returns nil on zero cardinality

func CutLeft64

func CutLeft64(bm *roaring64.Bitmap, sizeLimit uint64) *roaring64.Bitmap

CutLeft - cut from bitmap `targetSize` bytes from left removing lft part from `bm` returns nil on zero cardinality

func Get

func Get(db kv.Tx, bucket string, key []byte, from, to uint32) (*roaring.Bitmap, error)

Get - reading as much chunks as needed to satisfy [from, to] condition join all chunks to 1 bitmap by Or operator

func Get64

func Get64(db kv.Tx, bucket string, key []byte, from, to uint64) (*roaring64.Bitmap, error)

Get - reading as much chunks as needed to satisfy [from, to] condition join all chunks to 1 bitmap by Or operator

func NewBitmap

func NewBitmap() *roaring.Bitmap

func NewBitmap64

func NewBitmap64() *roaring64.Bitmap

func ReturnToPool

func ReturnToPool(a *roaring.Bitmap)

func ReturnToPool64

func ReturnToPool64(a *roaring64.Bitmap)

func SeekInBitmap

func SeekInBitmap(m *roaring.Bitmap, n uint32) (found uint32, ok bool)

SeekInBitmap - returns value in bitmap which is >= n

func SeekInBitmap64

func SeekInBitmap64(m *roaring64.Bitmap, n uint64) (found uint64, ok bool)

SeekInBitmap - returns value in bitmap which is >= n

func TruncateRange

func TruncateRange(db kv.RwTx, bucket string, key []byte, to uint32) error

TruncateRange - gets existing bitmap in db and call RemoveRange operator on it. starts from hot shard, stops when shard not overlap with [from-to) !Important: [from, to)

func TruncateRange64

func TruncateRange64(db kv.RwTx, bucket string, key []byte, to uint64) error

TruncateRange - gets existing bitmap in db and call RemoveRange operator on it. starts from hot shard, stops when shard not overlap with [from-to) !Important: [from, to)

func Walk

func Walk(c kv.Cursor, startkey []byte, fixedbits int, walker func(k, v []byte) (bool, error)) error

func WalkChunkWithKeys

func WalkChunkWithKeys(k []byte, m *roaring.Bitmap, sizeLimit uint64, f func(chunkKey []byte, chunk *roaring.Bitmap) error) error

func WalkChunkWithKeys64

func WalkChunkWithKeys64(k []byte, m *roaring64.Bitmap, sizeLimit uint64, f func(chunkKey []byte, chunk *roaring64.Bitmap) error) error

func WalkChunks

func WalkChunks(bm *roaring.Bitmap, sizeLimit uint64, f func(chunk *roaring.Bitmap, isLast bool) error) error

func WalkChunks64

func WalkChunks64(bm *roaring64.Bitmap, sizeLimit uint64, f func(chunk *roaring64.Bitmap, isLast bool) error) error

Types

type BitmapStream

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

func NewBitmapStream

func NewBitmapStream(bm *roaring64.Bitmap) *BitmapStream

func (*BitmapStream) Close

func (it *BitmapStream) Close()

func (*BitmapStream) HasNext

func (it *BitmapStream) HasNext() bool

func (*BitmapStream) Next

func (it *BitmapStream) Next() (uint64, error)

func (*BitmapStream) ToBitmap

func (it *BitmapStream) ToBitmap() (*roaring64.Bitmap, error)

type FixedSizeBitmaps

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

func OpenFixedSizeBitmaps

func OpenFixedSizeBitmaps(filePath string, bitsPerBitmap int) (*FixedSizeBitmaps, error)

func (*FixedSizeBitmaps) At

func (bm *FixedSizeBitmaps) At(item uint64) (res []uint64, err error)

func (*FixedSizeBitmaps) Close

func (bm *FixedSizeBitmaps) Close()

func (*FixedSizeBitmaps) FileName

func (bm *FixedSizeBitmaps) FileName() string

func (*FixedSizeBitmaps) FilePath

func (bm *FixedSizeBitmaps) FilePath() string

func (*FixedSizeBitmaps) First2At

func (bm *FixedSizeBitmaps) First2At(item, after uint64) (fst uint64, snd uint64, ok, ok2 bool, err error)

type FixedSizeBitmapsWriter

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

func NewFixedSizeBitmapsWriter

func NewFixedSizeBitmapsWriter(indexFile string, bitsPerBitmap int, amount uint64, logger log.Logger) (*FixedSizeBitmapsWriter, error)

func (*FixedSizeBitmapsWriter) AddArray

func (w *FixedSizeBitmapsWriter) AddArray(item uint64, listOfValues []uint64) error

func (*FixedSizeBitmapsWriter) Build

func (w *FixedSizeBitmapsWriter) Build() error

func (*FixedSizeBitmapsWriter) Close

func (w *FixedSizeBitmapsWriter) Close()

func (*FixedSizeBitmapsWriter) DisableFsync

func (w *FixedSizeBitmapsWriter) DisableFsync()

type ToBitamp

type ToBitamp interface {
	ToBitmap() (*roaring64.Bitmap, error)
}

type ToBitmap

type ToBitmap interface {
	ToBitmap() (*roaring64.Bitmap, error)
}

type ToIterInterface

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

func (*ToIterInterface) HasNext

func (i *ToIterInterface) HasNext() bool

func (*ToIterInterface) Next

func (i *ToIterInterface) Next() (uint64, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL