model

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithOperatorID added in v0.6.0

func ContextWithOperatorID(ctx context.Context, id uint64) context.Context

ContextWithOperatorID returns a copy of ctx carrying the given operator ID.

func OperatorIDFromContext added in v0.6.0

func OperatorIDFromContext(ctx context.Context) (uint64, bool)

OperatorIDFromContext returns the operator ID stored in ctx, if any.

Types

type OperatorIDer added in v0.6.0

type OperatorIDer interface {
	OperatorID() uint64
}

OperatorIDer is an optional interface for operators that carry a deterministic fingerprint derived from their logical plan subtree. Only data-fetching operators implement this; pure-computation operators do not.

type Series

type Series struct {
	// ID is a numerical, zero-based identifier for a series.
	// It allows using slices instead of maps for fast lookups.
	ID     uint64
	Metric labels.Labels
}

type StepVector

type StepVector struct {
	T         int64
	SampleIDs []uint64
	Samples   []float64

	HistogramIDs []uint64
	Histograms   []*histogram.FloatHistogram
}

func (*StepVector) AppendHistogram

func (s *StepVector) AppendHistogram(histogramID uint64, h *histogram.FloatHistogram)

func (*StepVector) AppendHistogramWithSizeHint added in v0.5.0

func (s *StepVector) AppendHistogramWithSizeHint(histogramID uint64, h *histogram.FloatHistogram, hint int)

AppendHistogramWithSizeHint appends a histogram and lazily pre-allocates capacity if needed. Use this when you know the expected number of histograms to avoid repeated slice growth.

func (*StepVector) AppendHistograms

func (s *StepVector) AppendHistograms(histogramIDs []uint64, hs []*histogram.FloatHistogram)

func (*StepVector) AppendSample

func (s *StepVector) AppendSample(id uint64, val float64)

func (*StepVector) AppendSampleWithSizeHint added in v0.5.0

func (s *StepVector) AppendSampleWithSizeHint(id uint64, val float64, hint int)

AppendSampleWithSizeHint appends a sample and lazily pre-allocates capacity if needed. Use this when you know the expected number of samples to avoid repeated slice growth.

func (*StepVector) AppendSamples

func (s *StepVector) AppendSamples(ids []uint64, vals []float64)

func (*StepVector) RemoveHistogram

func (s *StepVector) RemoveHistogram(index int)

func (*StepVector) RemoveSample

func (s *StepVector) RemoveSample(index int)

func (*StepVector) Reset added in v0.5.0

func (s *StepVector) Reset(t int64)

Reset resets the StepVector to the given timestamp while preserving slice capacity.

type Unwrapper added in v0.6.0

type Unwrapper interface {
	Unwrap() VectorOperator
}

type VectorOperator

type VectorOperator interface {
	// Next yields vectors of samples from all series for one or more execution steps.
	// The caller provides a buffer (buf) to be filled with StepVectors.
	// Returns the number of StepVectors written to buf and any error encountered.
	// A return value of 0 indicates no more data is available.
	Next(ctx context.Context, buf []StepVector) (int, error)

	// Series returns all series that the operator will process during Next results.
	// The result can be used by upstream operators to allocate output tables and buffers
	// before starting to process samples.
	Series(ctx context.Context) ([]labels.Labels, error)

	// Explain returns human-readable explanation of the current operator and optional nested operators.
	Explain() (next []VectorOperator)

	fmt.Stringer
}

VectorOperator performs operations on series in step by step fashion.

func Unwrap added in v0.6.0

func Unwrap(op VectorOperator) VectorOperator

func WithID added in v0.6.0

func WithID(op VectorOperator, id uint64) VectorOperator

WithID wraps op so that it implements OperatorIDer.

Jump to

Keyboard shortcuts

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