inverted

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 42 Imported by: 1 module, 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

Overview

Package inverted implements an inverted index repository.

Package inverted implements a inverted index repository.

Package inverted implements a inverted index repository.

Index

Constants

View Source
const (
	// ExternalSegmentTempDirName is the name of the directory used for temporary external segments.
	ExternalSegmentTempDirName = "external-segment-temp"

	// LockFilename is the bluge exclusive-lock file kept in every index
	// directory while a writer is open (github.com/SkyAPM/bluge directory_fs).
	// It must never be copied into a snapshot.
	LockFilename = "bluge.pid"
)

Variables

This section is empty.

Functions

func BlugeQuery added in v0.11.0

func BlugeQuery(q index.Query) (bluge.Query, bool)

BlugeQuery extracts the underlying bluge query from a Query built by this package, so callers reading a bluge index directly (without a Store) can reuse the same query construction.

func BuildIndexModeQuery added in v0.8.0

func BuildIndexModeQuery(measureName string, criteria *modelv1.Criteria, schema logical.Schema) (index.Query, error)

BuildIndexModeQuery returns blugeQuery for index mode.

func BuildPropertyQuery added in v0.8.0

func BuildPropertyQuery(req *propertyv1.QueryRequest, groupField, idField string) (index.Query, error)

BuildPropertyQuery returns blugeQuery for property query.

func BuildPropertyQueryFromEntity added in v0.9.0

func BuildPropertyQueryFromEntity(groupField, group, name, entityIDField, entityID string) (index.Query, error)

BuildPropertyQueryFromEntity builds a property query from entity information.

func BuildQuery added in v0.8.0

func BuildQuery(criteria *modelv1.Criteria, schema logical.Schema, entityDict map[string]int,
	entity []*modelv1.TagValue,
) (index.Query, [][]*modelv1.TagValue, bool, error)

BuildQuery returns blugeQuery for local indices.

func NewStore

func NewStore(opts StoreOpts) (index.SeriesStore, error)

NewStore create a new inverted index repository.

func ReadOnlyDocCount added in v0.11.0

func ReadOnlyDocCount(path string) (int64, error)

ReadOnlyDocCount opens the index directory at path read-only and returns the number of indexed documents. Unlike NewStore it never acquires the exclusive directory lock, so it can inspect a closed (or even concurrently open) segment index without reopening its writable index. A missing or unflushed index (no usable snapshot) returns a count of 0 together with the open error, which callers may treat as an empty index.

Types

type ExternalSegmentWrapper added in v0.9.0

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

ExternalSegmentWrapper wraps Bluge's ExternalSegmentReceiver for BanyanDB usage.

func NewExternalSegmentWrapper added in v0.9.0

func NewExternalSegmentWrapper(receiver *blugeIndex.ExternalSegmentReceiver, logger *logger.Logger) *ExternalSegmentWrapper

NewExternalSegmentWrapper creates a new wrapper for external segment operations.

func (*ExternalSegmentWrapper) BytesReceived added in v0.9.0

func (esw *ExternalSegmentWrapper) BytesReceived() uint64

BytesReceived returns the number of bytes received so far.

func (*ExternalSegmentWrapper) CompleteSegment added in v0.9.0

func (esw *ExternalSegmentWrapper) CompleteSegment() error

CompleteSegment signals completion of segment streaming.

func (*ExternalSegmentWrapper) StartSegment added in v0.9.0

func (esw *ExternalSegmentWrapper) StartSegment() error

StartSegment begins streaming a new segment.

func (*ExternalSegmentWrapper) Status added in v0.9.0

func (esw *ExternalSegmentWrapper) Status() string

Status returns the current status of the segment streaming.

func (*ExternalSegmentWrapper) WriteChunk added in v0.9.0

func (esw *ExternalSegmentWrapper) WriteChunk(data []byte) error

WriteChunk writes a chunk of segment data.

type GlobalIndexError added in v0.7.0

type GlobalIndexError struct {
	IndexRule *databasev1.IndexRule
	Expr      logical.LiteralExpr
}

GlobalIndexError represents a index rule is "global". The local filter can't handle it.

func (GlobalIndexError) Error added in v0.7.0

func (g GlobalIndexError) Error() string

type Metrics added in v0.7.0

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

Metrics is the metrics for the inverted index.

func NewMetrics added in v0.7.0

func NewMetrics(factory observability.Factory, labelNames ...string) *Metrics

NewMetrics creates a new metrics for the inverted index.

func (*Metrics) DeleteAll added in v0.7.0

func (m *Metrics) DeleteAll(labelValues ...string)

DeleteAll deletes all metrics with the given label values.

type StoreOpts

type StoreOpts struct {
	Logger                 *logger.Logger
	Metrics                *Metrics
	PrepareMergeCallback   func(src []*roaringpkg.Bitmap, segments []segment.Segment, id uint64) (dest []*roaringpkg.Bitmap, err error)
	Path                   string
	ExternalSegmentTempDir string
	BatchWaitSec           int64
	CacheMaxBytes          int
	EnableDeduplication    bool
}

StoreOpts wraps options to create an inverted index repository.

Jump to

Keyboard shortcuts

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