lids

package
v0.78.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchedIteratorAsc added in v0.77.0

type BatchedIteratorAsc struct {
	Cursor
}

func NewBatchedIteratorAsc added in v0.77.0

func NewBatchedIteratorAsc(it *IteratorAsc) *BatchedIteratorAsc

func (*BatchedIteratorAsc) NextBatch added in v0.77.0

func (it *BatchedIteratorAsc) NextBatch() node.LIDBatch

func (*BatchedIteratorAsc) NextBatchGeq added in v0.77.0

func (it *BatchedIteratorAsc) NextBatchGeq(nextID node.LID) node.LIDBatch

func (*BatchedIteratorAsc) String added in v0.77.0

func (*BatchedIteratorAsc) String() string

type BatchedIteratorDesc added in v0.77.0

type BatchedIteratorDesc struct {
	Cursor
}

func NewBatchedIteratorDesc added in v0.77.0

func NewBatchedIteratorDesc(it *IteratorDesc) *BatchedIteratorDesc

func (*BatchedIteratorDesc) NextBatch added in v0.77.0

func (it *BatchedIteratorDesc) NextBatch() node.LIDBatch

func (*BatchedIteratorDesc) NextBatchGeq added in v0.77.0

func (it *BatchedIteratorDesc) NextBatchGeq(nextID node.LID) node.LIDBatch

func (*BatchedIteratorDesc) String added in v0.77.0

func (*BatchedIteratorDesc) String() string

type Block

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

Block contains LIDs in variable format. It's used during search/queries processing. Each posting list is either a roaring bitmap or a delta-encoded slice. bitmapIndexes holds the list indexes that were stored as bitmaps.

On-disk format:

[bitmapsCount: uint32]   — number of lists stored as roaring bitmaps
[bitmaps: bitmapsCount × roaring bitmap, serial format]
[bitmapIndexes: delta-bitpack []uint32] — sorted list indices encoded as bitmaps
[offsets: delta-bitpack []uint32]     — slice boundaries in the delta-encoded LIDs array
[lids: delta-bitpack []uint32]        — concatenated delta-encoded LID values

func (*Block) AppendLIDsTo added in v0.77.0

func (b *Block) AppendLIDsTo(idx int, dst []uint32) []uint32

func (*Block) GetCount added in v0.77.0

func (b *Block) GetCount() int

func (*Block) GetLIDs added in v0.74.0

func (b *Block) GetLIDs(i int) node.LIDBatch

func (*Block) GetSizeBytes

func (b *Block) GetSizeBytes() int

func (*Block) Unpack

func (b *Block) Unpack(data []byte, fracVer config.BinaryDataVersion, buf *UnpackBuffer) error

type BlockPacker added in v0.77.0

type BlockPacker struct {
	LidsBitmapThreshold int
	// contains filtered or unexported fields
}

func NewBlockPacker added in v0.77.0

func NewBlockPacker() *BlockPacker

func (*BlockPacker) Pack added in v0.77.0

func (p *BlockPacker) Pack(b *UnpackedBlock, dst []byte) []byte

type Counter

type Counter interface {
	AddLIDsCount(int)
}

type Cursor

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

func NewLIDsCursor

func NewLIDsCursor(
	table *Table,
	loader *Loader,
	startIndex uint32,
	tid uint32,
	counter Counter,
	minLID, maxLID uint32,
) Cursor

type IteratorAsc

type IteratorAsc struct {
	Cursor
	// contains filtered or unexported fields
}

func NewIteratorAsc added in v0.77.0

func NewIteratorAsc(
	table *Table,
	loader *Loader,
	startIndex uint32,
	tid uint32,
	counter Counter,
	minLID, maxLID uint32,
) *IteratorAsc

func (*IteratorAsc) Next

func (it *IteratorAsc) Next() node.LID

func (*IteratorAsc) NextGeq added in v0.69.0

func (it *IteratorAsc) NextGeq(nextID node.LID) node.LID

NextGeq returns the next (in reverse iteration order) LID that is <= maxLID.

func (*IteratorAsc) String

func (*IteratorAsc) String() string

type IteratorDesc

type IteratorDesc struct {
	Cursor
	// contains filtered or unexported fields
}

func NewIteratorDesc added in v0.77.0

func NewIteratorDesc(
	table *Table,
	loader *Loader,
	startIndex uint32,
	tid uint32,
	counter Counter,
	minLID, maxLID uint32,
) *IteratorDesc

func (*IteratorDesc) Next

func (it *IteratorDesc) Next() node.LID

func (*IteratorDesc) NextGeq added in v0.69.0

func (it *IteratorDesc) NextGeq(nextID node.LID) node.LID

NextGeq finds next greater or equal

func (*IteratorDesc) String

func (*IteratorDesc) String() string

type Loader

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

Loader is responsible for reading from disk, unpacking and caching LID. NOT THREAD SAFE. Do not use concurrently. Use your own Loader instance for each search query

func NewLoader

func NewLoader(fracVer config.BinaryDataVersion, r *storage.IndexReader, c cache.Cache[*Block]) *Loader

func (*Loader) GetLIDsBlock

func (l *Loader) GetLIDsBlock(blockIndex uint32) (*Block, error)

func (*Loader) Load added in v0.78.0

func (l *Loader) Load(blockIndex uint32) (*Block, int, error)

type Table

type Table struct {
	StartBlockIndex uint32
	MaxTIDs         []uint32 // defines last tid for each block
	MinTIDs         []uint32 // defines first not continued tid for each block
	FirstLIDs       []uint32
	LastLIDs        []uint32

	FracVer     config.BinaryDataVersion
	IsContinued []bool // legacy field, only used in BinaryDataV0-BinaryDataV4 (inclusive)
}

func NewTable

func NewTable(
	fracVer config.BinaryDataVersion,
	startOfLIDsBlockIndex uint32,
	minTIDs, maxTIDs []uint32,
	firstLIDs, lastLIDs []uint32,
	isContinued []bool,
) *Table

func (*Table) GetAdjustedMinTID

func (t *Table) GetAdjustedMinTID(blockIndex uint32) uint32

func (*Table) GetChunkIndex

func (t *Table) GetChunkIndex(blockIndex, tid uint32) int

func (*Table) GetChunksCount

func (t *Table) GetChunksCount(blockIndex uint32) uint32

func (*Table) GetFirstBlockIndexForTID

func (t *Table) GetFirstBlockIndexForTID(tid uint32) uint32

GetFirstBlockIndexForTID finds first block index in file for TID

func (*Table) GetLastBlockIndexForTID

func (t *Table) GetLastBlockIndexForTID(tid uint32) uint32

GetLastBlockIndexForTID finds last block index in file for TID

func (*Table) HasTIDInNextBlock

func (t *Table) HasTIDInNextBlock(blockIndex, tid uint32) bool

func (*Table) HasTIDInPrevBlock

func (t *Table) HasTIDInPrevBlock(blockIndex, tid uint32) bool

func (*Table) SeekBlockGeq added in v0.77.0

func (t *Table) SeekBlockGeq(index, tid, nextLID uint32) uint32

SeekBlockGeq finds next block for provided TID which contains lid greater or equal to provided LID starting from provided index (inclusive). - index: an index of block which is already suits and contains next portion of LIDs. Safe to return for old fractions.

func (*Table) SeekBlockLeq added in v0.77.0

func (t *Table) SeekBlockLeq(index, tid, nextLID uint32) uint32

SeekBlockLeq finds next block with lowest index for provided TID which contains LIDs less or equal to provided LID starting from provided index (inclusive). - index: an index of block which is already suits and contains next portion of LIDs. Safe to return for old fractions.

type UnpackBuffer

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

UnpackBuffer keeps intermediate temporary buffers for decoding. Used only for a single fraction.

func (*UnpackBuffer) Reset added in v0.72.0

func (b *UnpackBuffer) Reset(fracVer config.BinaryDataVersion)

type UnpackedBlock added in v0.77.0

type UnpackedBlock struct {
	LIDs    []uint32
	Offsets []uint32
}

UnpackedBlock contains accumulated LIDs ready to pack. It's only used on sealing/compaction (index writing) time.

Jump to

Keyboard shortcuts

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