Documentation
¶
Overview ¶
Package nativeadapter bridges the public index API to native owner queries.
Index ¶
- Constants
- type Adapter
- func (a *Adapter) Acquire(ctx context.Context) (*native.ReadView, error)
- func (a *Adapter) Batch(ctx context.Context, batch index.Batch) error
- func (a *Adapter) MatchField(ctx context.Context, view *native.ReadView, request native.FieldRequest) ([]native.QueryHit, error)
- func (a *Adapter) MatchRange(ctx context.Context, view *native.ReadView, request native.RangeRequest) ([]native.QueryHit, error)
- func (a *Adapter) MatchTerms(ctx context.Context, view *native.ReadView, request native.TermSetRequest) ([]native.QueryHit, error)
- func (a *Adapter) NewSearcher(ctx context.Context, options SearcherOptions) (*Searcher, error)
- type RootLease
- type Searcher
- func (s *Searcher) Close() error
- func (s *Searcher) Iterator(ctx context.Context, fieldKey index.FieldKey, termRange index.RangeOpts, ...) (index.FieldIterator[*index.DocumentResult], error)
- func (s *Searcher) Match(fieldKey index.FieldKey, matches []string, ...) (posting.List, posting.List, error)
- func (s *Searcher) MatchField(fieldKey index.FieldKey) (posting.List, posting.List, error)
- func (s *Searcher) MatchTerms(field index.Field) (posting.List, posting.List, error)
- func (s *Searcher) Range(fieldKey index.FieldKey, options index.RangeOpts) (posting.List, posting.List, error)
- func (s *Searcher) Sort(ctx context.Context, seriesIDs []common.SeriesID, fieldKey index.FieldKey, ...) (index.FieldIterator[*index.DocumentResult], error)
- type SearcherOptions
- type Store
- func (s *Store) Activity() (uint64, uint64)
- func (s *Store) Batch(ctx context.Context, batch index.Batch) error
- func (s *Store) Close() error
- func (s *Store) EnableExternalSegments() (index.ExternalSegmentStreamer, error)
- func (s *Store) NewSearcher(ctx context.Context) (*Searcher, error)
- func (s *Store) Sort(ctx context.Context, seriesIDs []common.SeriesID, fieldKey index.FieldKey, ...) (index.FieldIterator[*index.DocumentResult], error)
- func (s *Store) Stats() (int64, int64)
- func (s *Store) TakeFileSnapshot(destination string) error
Constants ¶
const DefaultMaxTerms uint64 = ^uint64(0)
DefaultMaxTerms preserves the existing product contract for fields whose dictionaries exceed a caller-selected budget. Callers that need a bounded expansion must set SearcherOptions.MaxTerms explicitly; the production default does not silently reject valid high-cardinality fields.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
Adapter translates public index documents to native owner batches.
func (*Adapter) MatchField ¶
func (a *Adapter) MatchField(ctx context.Context, view *native.ReadView, request native.FieldRequest) ([]native.QueryHit, error)
MatchField executes bounded indexed-field presence matching.
func (*Adapter) MatchRange ¶
func (a *Adapter) MatchRange(ctx context.Context, view *native.ReadView, request native.RangeRequest) ([]native.QueryHit, error)
MatchRange executes bounded encoded range matching.
func (*Adapter) MatchTerms ¶
func (a *Adapter) MatchTerms(ctx context.Context, view *native.ReadView, request native.TermSetRequest) ([]native.QueryHit, error)
MatchTerms executes exact term membership on one pinned view.
func (*Adapter) NewSearcher ¶
NewSearcher acquires one immutable native view for the request. Callers must close the returned searcher after consuming all iterators.
type Searcher ¶
type Searcher struct {
// contains filtered or unexported fields
}
Searcher binds one request context and one immutable native ReadView. The view remains pinned until Close; no method opens a legacy search reader.
func (*Searcher) Iterator ¶
func (s *Searcher) Iterator( ctx context.Context, fieldKey index.FieldKey, termRange index.RangeOpts, order modelv1.Sort, pageSize int, ) (index.FieldIterator[*index.DocumentResult], error)
Iterator creates a page-backed cursor for one series and optional encoded field range. It does not materialize all matching documents.
func (*Searcher) Match ¶
func (s *Searcher) Match(fieldKey index.FieldKey, matches []string, options *modelv1.Condition_MatchOption) (posting.List, posting.List, error)
Match performs analyzed any/all term matching under the field's series and time constraints. Analysis is done before entering the native package.
func (*Searcher) MatchField ¶
MatchField returns every document in the field's series/time scope, matching the legacy engine's Range-with-empty-options contract: it is a scope scan, not a field-presence check. A document that never set the field is still returned (its sort position is the cursor's "missing" sentinel); the stream NOT filter relies on this to treat "field absent" as satisfying a negated HAVING/EQ condition, the same way the legacy index always did.
func (*Searcher) MatchTerms ¶
MatchTerms returns exact term membership for one field value.
func (*Searcher) Range ¶
func (s *Searcher) Range(fieldKey index.FieldKey, options index.RangeOpts) (posting.List, posting.List, error)
Range performs bounded encoded range membership. An empty range means indexed-field presence, matching the public index contract.
func (*Searcher) Sort ¶
func (s *Searcher) Sort( ctx context.Context, seriesIDs []common.SeriesID, fieldKey index.FieldKey, order modelv1.Sort, timeRange *timestamp.TimeRange, pageSize int, ) (index.FieldIterator[*index.DocumentResult], error)
Sort returns a page-backed native sort cursor. Series IDs are represented as one bounded OR selection and the timestamp range is evaluated inside the pinned native view.
type SearcherOptions ¶
type SearcherOptions struct {
MaxTerms uint64
MaxCandidates uint64
// AsyncPersistence permits Batch to return after native publication but
// before the immutable root has been durably persisted. The default is
// synchronous, matching the historical writer's safe default.
AsyncPersistence bool
// PersistInterval spaces background persists when AsyncPersistence is
// set; see native.OwnerOptions.PersistInterval.
PersistInterval time.Duration
// TimeMetrics receives time-range pruning counts from every query the
// owner NewStore creates serves; see native.OwnerOptions.TimeMetrics. It
// is read only by NewStore, not by NewSearcher.
TimeMetrics native.TimeMetrics
}
SearcherOptions supplies the mandatory native budgets for dictionary expansion and candidate materialization. A zero MaxTerms is rejected by NewSearcher rather than silently turning MatchField into an unbounded walk.
type Store ¶
Store is the narrow production owner seam. It intentionally does not implement index.Store: query ownership is explicit through NewSearcher and iterators retain their pinned view until Close.
func NewStore ¶
func NewStore(path string, lease RootLease, options SearcherOptions) (*Store, error)
NewStore creates a native owner under a database-owned lease.
func (*Store) EnableExternalSegments ¶
func (s *Store) EnableExternalSegments() (index.ExternalSegmentStreamer, error)
EnableExternalSegments forwards the native staged-segment capability.
func (*Store) NewSearcher ¶
NewSearcher pins one immutable view for the request.
func (*Store) Sort ¶
func (s *Store) Sort(ctx context.Context, seriesIDs []common.SeriesID, fieldKey index.FieldKey, order modelv1.Sort, timeRange *timestamp.TimeRange, pageSize int, ) (index.FieldIterator[*index.DocumentResult], error)
Sort creates an iterator which owns the request searcher until Close.
func (*Store) TakeFileSnapshot ¶
TakeFileSnapshot copies the current immutable native root.