index

package
v0.0.0-...-92d0331 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index interface {
	// Add inserts rowID for the given value into the index
	Add(rowID uint32, value interface{}) error
	// Remove removes rowID (and its associated value) from the index
	Remove(rowID uint32) error
	// Search returns all rowIDs matching the given value
	Search(value interface{}) ([]uint32, error)
	// Clear removes all entries
	Clear() error
}

func NewBloomIndex

func NewBloomIndex(fpRate float64) Index

func NewHashIndex

func NewHashIndex(sizeHint int) Index

NewHashIndex constructs a new HashIndex

func NewRoaringIndex

func NewRoaringIndex() Index

NewRoaringIndex constructs a new Index backed by multiple Roaring bitmaps

func NewSortedIndex

func NewSortedIndex(batchSize int) Index

type IndexManager

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

func NewIndexManager

func NewIndexManager(settings IndexSettings) *IndexManager

NewIndexManager creates a new index manager with the given settings

func (*IndexManager) CreateIndex

func (im *IndexManager) CreateIndex(column string, strategy Strategy) error

CreateIndex instantiates a new index of the specified strategy for a given column

func (*IndexManager) GetIndex

func (im *IndexManager) GetIndex(column string, strategy Strategy) (Index, bool)

GetIndex retrieves an existing index for a given column and strategy

type IndexSettings

type IndexSettings struct {
	// BloomFilterFPRate is the desired false-positive rate for the Bloom filter
	BloomFilterFPRate float64
	// HashIndexSize is an (optional) hint for sizing a HashIndex
	HashIndexSize int
	// SortedBatchSize is an (optional) parameter for the SortedIndex
	SortedBatchSize int
}

type Strategy

type Strategy int
const (
	RoaringBitmap Strategy = iota
	HashIndex
	Bloom
	SortedColumn
)

Jump to

Keyboard shortcuts

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