indexpointers

package
v3.6.7 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSection

func CheckSection(section *dataobj.Section) bool

CheckSection returns true if section is a indexpointers section.

func Iter

Iter iterates over indexpointers in the provided decoder. All indexpointers sections are iterated over in order.

func IterSection

func IterSection(ctx context.Context, section *Section) result.Seq[IndexPointer]

Types

type Builder

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

func NewBuilder

func NewBuilder(metrics *Metrics, pageSize, pageRowCount int) *Builder

func (*Builder) Append

func (b *Builder) Append(path string, startTs time.Time, endTs time.Time)

Append adds a new index pointer to the builder.

func (*Builder) EstimatedSize

func (b *Builder) EstimatedSize() int

EstimatedSize returns the estimated size of the Pointers section in bytes.

func (*Builder) Flush

func (b *Builder) Flush(w dataobj.SectionWriter) (n int64, err error)

Flush flushes the streams section to the provided writer.

After successful encoding, b is reset to a fresh state and can be reused.

func (*Builder) Reset

func (b *Builder) Reset()

Reset resets all state, allowing IndexPointers to be reused.

func (*Builder) SetTenant

func (b *Builder) SetTenant(tenant string)

func (*Builder) Tenant

func (b *Builder) Tenant() string

func (*Builder) Type

func (b *Builder) Type() dataobj.SectionType

type Column

type Column struct {
	Section *Section
	Name    string
	Type    ColumnType
	// contains filtered or unexported fields
}

A Column represents one of the columns in the indexpointers section. Valid columns can only be retrieved by calling Section.Columns.

Data in columns can be read by using a [Reader].

type ColumnStats

type ColumnStats struct {
	Name             string
	Type             string
	ValueType        string
	RowsCount        uint64
	Compression      string
	UncompressedSize uint64
	CompressedSize   uint64
	MetadataOffset   uint64
	MetadataSize     uint64
	ValuesCount      uint64
	Cardinality      uint64

	Pages []PageStats
}

ColumnStats provides statistics about a column in a section.

type ColumnType

type ColumnType int

ColumnType represents the kind of information stored in a Column.

const (
	ColumnTypeInvalid      ColumnType = iota // ColumnTypeInvalid is an invalid column.
	ColumnTypePath                           // ColumnTypePath is a column containing the path to the index object.
	ColumnTypeMinTimestamp                   // ColumnTypeMinTimestamp is a column containing the minimum timestamp of the index object.
	ColumnTypeMaxTimestamp                   // ColumnTypeMaxTimestamp is a column containing the maximum timestamp of the index object.
)

func ParseColumnType

func ParseColumnType(text string) (ColumnType, error)

ParseColumnType parses a ColumnType from a string. The expected string format is same same as the return value of ColumnType.String.

func (ColumnType) String

func (ct ColumnType) String() string

String returns the human-readable name of ct.

type IndexPointer

type IndexPointer struct {
	Path    string
	StartTs time.Time
	EndTs   time.Time
}

IndexPointer is a pointer to an index object. It is used to lookup the index object by data object path within a time range.

The path is the data object path, the start and end timestamps are the time range of data stored in the index object.

type Metrics

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

func NewMetrics

func NewMetrics() *Metrics

func (*Metrics) Observe

func (m *Metrics) Observe(ctx context.Context, section *Section) error

Observe observes section statistics for a given section.

func (*Metrics) Register

func (m *Metrics) Register(reg prometheus.Registerer) error

func (*Metrics) Unregister

func (m *Metrics) Unregister(reg prometheus.Registerer)

type PageStats

type PageStats struct {
	UncompressedSize uint64
	CompressedSize   uint64
	CRC32            uint32
	RowsCount        uint64
	Encoding         string
	DataOffset       uint64
	DataSize         uint64
	ValuesCount      uint64
}

PageStats provides statistics about a page in a column.

type RowPredicate

type RowPredicate interface {
	// contains filtered or unexported methods
}

RowPredicate is an expression used to filter rows in a data object.

type RowReader

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

RowReader is a reader for index pointers in a data object.

func NewRowReader

func NewRowReader(sec *Section) *RowReader

NewRowReader creates a new RowReader for the given section.

func (*RowReader) Close

func (r *RowReader) Close() error

Close closes the RowReader and releases any resources it holds. Closed RowReaders can be reused by calling RowReader.Reset.

func (*RowReader) Read

func (r *RowReader) Read(ctx context.Context, s []IndexPointer) (int, error)

Read reads up to the next len(s) indexpointers from the reader and stores them into s. It returns the number of indexpointers read and any error encountered. At the end of the indexpointers section, Read returns 0, io.EOF.

func (*RowReader) Reset

func (r *RowReader) Reset(sec *Section)

Reset resets the RowReader with a new decoder to read from. Reset allows reusing a RowReader without allocating a new one.

Any set predicate is cleared when Reset is called.

Reset may be called with a nil object and a negative section index to clear the RowReader without needing a new object.

func (*RowReader) SetPredicate

func (r *RowReader) SetPredicate(p RowPredicate) error

SetPredicate sets the predicate to use for filtering indexpointers. RowReader.Read will only return indexpointers for which the predicate passes.

SetPredicate returns an error if the predicate is not supported by RowReader.

A predicate may only be set before reading begins or after a call to RowReader.Reset.

type Section

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

Section represents an opened indexpointers section.

func Open

func Open(ctx context.Context, section *dataobj.Section) (*Section, error)

Open opens a Section from an underlying dataobj.Section. Open returns an error if the section metadata could not be read or if the provided ctx is canceled.

func (*Section) Columns

func (s *Section) Columns() []*Column

Columns returns the set of Columns in the section. The slice of returned sections must not be mutated.

Unrecognized columns (e.g., when running older code against newer indexpointers sections) are skipped.

type Stats

type Stats struct {
	UncompressedSize uint64
	CompressedSize   uint64

	MinTimestamp          time.Time
	MaxTimestamp          time.Time
	TimestampDistribution []uint64 // Indexpointer count per hour.

	Columns []ColumnStats
}

Stats provides statistics about a indexpointers section.

func ReadStats

func ReadStats(ctx context.Context, section *Section) (Stats, error)

ReadStats returns statistics about the indexpointers section. ReadStats returns an error if the indexpointers section couldn't be inspected or if the provided ctx is canceled.

type TimeRangeRowPredicate

type TimeRangeRowPredicate struct{ Start, End time.Time }

A TimeRangeRowPredicate is a RowPredicate which requires a start and end timestamp column to exist, and for the timestamp to be within the range.

Jump to

Keyboard shortcuts

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