metadata

package
v1.15.3 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelNameTenantDataset     = "__tenant_dataset__"
	LabelValueDatasetTSDBIndex = "dataset_tsdb_index"
	LabelNameUnsymbolized      = "__unsymbolized__"
)

Variables

View Source
var ErrMetadataInvalid = errors.New("metadata: invalid metadata")

Functions

func Decode

func Decode(b []byte, md *metastorev1.BlockMeta) error

Decode metadata encoded with Encode.

Note that the metadata decoded from the object has zero Size field, as the block size is not known at the point the metadata is written. It is expected that the caller has access to the block object and can set the Size field after reading the metadata.

func Encode

func Encode(w io.Writer, md *metastorev1.BlockMeta) error

Encode writes the metadata to the writer in the following format:

raw       | protobuf-encoded metadata
be_uint32 | size of the raw metadata
be_uint32 | CRC32 of the raw metadata and size

func FindDatasets

func FindDatasets(md *metastorev1.BlockMeta, matchers ...*labels.Matcher) goiter.Seq[*metastorev1.Dataset]

func LabelPairs

func LabelPairs(ls []int32) iter.Iterator[[]int32]

func Sanitize

func Sanitize(md *metastorev1.BlockMeta) error

func Tenant

func Tenant(md *metastorev1.BlockMeta) string

func Timestamp

func Timestamp(md *metastorev1.BlockMeta) time.Time

Types

type LabelBuilder

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

func NewLabelBuilder

func NewLabelBuilder(strings *StringTable) *LabelBuilder

func (*LabelBuilder) Build

func (lb *LabelBuilder) Build() []int32

func (*LabelBuilder) Put

func (lb *LabelBuilder) Put(x []int32, strings []string)

func (*LabelBuilder) WithLabelSet

func (lb *LabelBuilder) WithLabelSet(pairs ...string) *LabelBuilder

type LabelMatcher

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

func NewLabelMatcher

func NewLabelMatcher(strings []string, matchers []*labels.Matcher, keep ...string) *LabelMatcher

func (*LabelMatcher) CollectMatches

func (lm *LabelMatcher) CollectMatches(dst, labels []int32) ([]int32, bool)

CollectMatches returns a new set of labels with only the labels that satisfy the match expressions and that are in the keep list.

func (*LabelMatcher) IsValid

func (lm *LabelMatcher) IsValid() bool

func (*LabelMatcher) Matches

func (lm *LabelMatcher) Matches(labels []int32) bool

Matches reports whether the given set of labels matches the matchers. Note that at least one labels set must satisfy matchers to return true. For negations, all labels sets must satisfy the matchers to return true. TODO(kolesnikovae): This might be really confusing; it's worth relaxing it.

func (*LabelMatcher) MatchesPairs

func (lm *LabelMatcher) MatchesPairs(pairs []int32) bool

type LabelsCollector

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

func NewLabelsCollector

func NewLabelsCollector(labels ...string) *LabelsCollector

func (*LabelsCollector) CollectMatches

func (s *LabelsCollector) CollectMatches(lm *LabelMatcher)

CollectMatches from the given matcher.

The matcher and collect MUST be configured to keep the same set of labels, in the exact order.

A single collector may collect labels from multiple matchers.

func (*LabelsCollector) Unique

func (s *LabelsCollector) Unique() goiter.Seq[*typesv1.Labels]

type StringTable

type StringTable struct {
	Dict    map[string]int32
	Strings []string
}

func NewStringTable

func NewStringTable() *StringTable

func OpenStringTable

func OpenStringTable(src *metastorev1.BlockMeta) *StringTable

func (*StringTable) Clone

func (t *StringTable) Clone() *StringTable

func (*StringTable) Export

func (t *StringTable) Export(dst *metastorev1.BlockMeta)

func (*StringTable) Import

func (t *StringTable) Import(src *metastorev1.BlockMeta)

Import strings from the metadata entry and update the references.

func (*StringTable) IsEmpty

func (t *StringTable) IsEmpty() bool

func (*StringTable) Load

func (t *StringTable) Load(x iter.Iterator[string]) error

func (*StringTable) Lookup

func (t *StringTable) Lookup(i int32) string

func (*StringTable) LookupString

func (t *StringTable) LookupString(s string) int32

func (*StringTable) Put

func (t *StringTable) Put(s string) int32

func (*StringTable) Reset

func (t *StringTable) Reset()

Jump to

Keyboard shortcuts

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