frac

package
v0.84.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 19 Imported by: ? modules, 0 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 (
	DistributionMaxInterval     = 24 * time.Hour
	DistributionBucket          = time.Minute
	DistributionSpreadThreshold = 10 * time.Minute
)

Variables

View Source
var (
	FetcherStagesSeconds = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: "seq_db_store",
		Subsystem: "fetcher",
		Name:      "fraction_stages_seconds",
		Buckets:   metric.SecondsBuckets,
		Help:      "Fetch processing time by stage",
	}, []string{"stage", "fraction_type"})
)

Functions

func FractionToString added in v0.84.0

func FractionToString(f Fraction, fracType string) string

func SearchMetric added in v0.84.0

func SearchMetric(
	params processor.SearchParams,
) *prometheus.HistogramVec

Types

type AggLimits

type AggLimits struct {
	MaxFieldTokens     int // MaxFieldTokens max AggQuery.Field uniq values to parse.
	MaxFieldValues     int // MaxFieldValues max AggQuery.Field uniq values to hold per aggregation request.
	MaxGroupTokens     int // MaxGroupTokens max AggQuery.GroupBy unique values.
	MaxTIDsPerFraction int // MaxTIDsPerFraction max number of tokens per fraction.
}

type BatchExecutionConfig added in v0.77.0

type BatchExecutionConfig struct {
	Enabled bool
	// CostThreshold is the minimum estimated non-batched iteration
	// cost required to enable batch-at-a-time query evaluation.
	CostThreshold int
}

type Config

type Config struct {
	Search SearchConfig

	SkipSortDocs bool
	KeepWalFile  bool
}

type DocLocation added in v0.71.0

type DocLocation = util.Pair[seq.ID, seq.DocPos]

type Fraction

type Fraction interface {
	Info() *Info
	IsIntersecting(from seq.MID, to seq.MID) bool
	Contains(mid seq.MID) bool
	Fetch(context.Context, []seq.ID, bool) ([][]byte, error)
	Search(context.Context, processor.SearchParams) (*seq.QPR, error)
	FindLIDs(context.Context, []seq.ID) ([]seq.LID, error)
}

type Info

type Info struct {
	Path          string                   `json:"name"`
	Ver           string                   `json:"ver"`
	BinaryDataVer config.BinaryDataVersion `json:"binary_data_ver"`
	DocsTotal     uint32                   `json:"docs_total"`    // How many LIDs fraction has.
	DocsOnDisk    uint64                   `json:"docs_on_disk"`  // How much compressed docs data is stored on disk.
	DocsRaw       uint64                   `json:"docs_raw"`      // How much raw docs data is appended.
	MetaOnDisk    uint64                   `json:"meta_on_disk"`  // How much compressed metadata is stored on disk.
	IndexOnDisk   uint64                   `json:"index_on_disk"` // How much compressed index data is stored on disk.
	InfoOnDisk    uint64                   `json:"-"`

	ConstRegularBlockSize int `json:"const_regular_block_size"`
	ConstIDsPerBlock      int `json:"const_ids_per_block"`
	ConstLIDBlockCap      int `json:"const_lid_block_cap"`

	From         seq.MID               `json:"from"`
	To           seq.MID               `json:"to"`
	CreationTime uint64                `json:"creation_time"`
	SealingTime  uint64                `json:"sealing_time"`
	Distribution *seq.MIDsDistribution `json:"distribution"`
}

func NewInfo

func NewInfo(filename string, docsOnDisk, metaOnDisk uint64) *Info

func (*Info) AddMID added in v0.84.0

func (s *Info) AddMID(mid uint64)

func (*Info) BuildDistribution

func (s *Info) BuildDistribution(mids []uint64)

func (*Info) FullSize

func (s *Info) FullSize() uint64

func (*Info) InitEmptyDistribution

func (s *Info) InitEmptyDistribution() bool

func (*Info) IsIntersecting

func (s *Info) IsIntersecting(from, to seq.MID) bool

func (*Info) MarshalJSON added in v0.84.0

func (s *Info) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON marshaling to always store From and To in milliseconds

func (*Info) Name

func (s *Info) Name() string

func (*Info) String

func (s *Info) String() string

func (*Info) UnmarshalJSON added in v0.84.0

func (s *Info) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom JSON unmarshaling to convert From and To from milliseconds to nanoseconds

type MaterializedColumnAggConfig added in v0.80.0

type MaterializedColumnAggConfig struct {
	Enabled bool
}

type QueryOptimizationConfig added in v0.77.0

type QueryOptimizationConfig struct {
	BatchExecution        BatchExecutionConfig
	MaterializedColumnAgg MaterializedColumnAggConfig
}

type SealParams

type SealParams struct {
	// DisableIndexCompression disables compression
	// of index components (lids, ids, etc.)
	DisableIndexCompression bool

	IDsZstdLevel           int
	LIDsZstdLevel          int
	TokenListZstdLevel     int
	DocsPositionsZstdLevel int
	TokenTableZstdLevel    int
	DocBlocksZstdLevel     int // DocBlocksZstdLevel is the zstd compress level of each document block.

	LIDBlockSize                 int
	LIDsBitmapThreshold          int // LIDsBitmapThreshold is the minimum number of LIDs in the lid list to serialize as bitmap.
	TokenBlockSize               int
	TokenFreqThresholdPercentage float64
	DocBlockSize                 int // DocBlockSize is decompressed payload size of document block.
}

type SearchConfig

type SearchConfig struct {
	AggLimits         AggLimits
	QueryOptimization QueryOptimizationConfig
}

type SkipMaskProvider added in v0.84.0

type SkipMaskProvider interface {
	GetIDsIteratorByFrac(fracName string, minLID, maxLID uint32, reverse bool) (node.Node, bool, func() error, error)
	GetIDsBitmapByFrac(fracName string, minLID, maxLID uint32) (*roaring.Bitmap, error)
	RemoveFrac(fracName string)
}

type Source added in v0.84.0

type Source interface {
	// Info returns metadata describing this source.
	Info() *Info

	// ID returns an iterator over stored document identifiers paired with
	// their positions, in descending [seq.ID] order.
	IDs() iter.Seq2[DocLocation, error]

	// BlockOffsets returns byte offsets to each document block
	// within this source's `.docs` file.
	BlockOffsets() []uint64

	// TokenTriplet iterates over fields in lexicographic order.
	// For each field, it yields tokens (lexicographically sorted)
	// paired with the local document ID list for that token.
	TokenTriplets() iter.Seq2[string, iter.Seq2[TokenLIDs, error]]
}

Source defines the data required to write all index files for a fraction.

type TokenLIDs

type TokenLIDs = util.Pair[[]byte, []uint32]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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