Documentation
¶
Index ¶
- Constants
- Variables
- func Decode(b []byte, md *metastorev1.BlockMeta) error
- func Encode(w io.Writer, md *metastorev1.BlockMeta) error
- func FindDatasets(md *metastorev1.BlockMeta, matchers ...*labels.Matcher) (fn func(yield func(*metastorev1.Dataset) bool))
- func LabelPairs(ls []int32) iter.Iterator[[]int32]
- func Sanitize(md *metastorev1.BlockMeta) error
- func Tenant(md *metastorev1.BlockMeta) string
- func Timestamp(md *metastorev1.BlockMeta) time.Time
- type LabelBuilder
- type LabelMatcher
- type StringTable
- func (t *StringTable) Export(dst *metastorev1.BlockMeta)
- func (t *StringTable) Import(src *metastorev1.BlockMeta)
- func (t *StringTable) IsEmpty() bool
- func (t *StringTable) Load(x iter.Iterator[string]) error
- func (t *StringTable) Lookup(i int32) string
- func (t *StringTable) LookupString(s string) int32
- func (t *StringTable) Put(s string) int32
- func (t *StringTable) Reset()
Constants ¶
const ( LabelNameTenantDataset = "__tenant_dataset__" LabelValueDatasetTSDBIndex = "dataset_tsdb_index" )
Variables ¶
var ErrMetadataInvalid = errors.New("metadata: invalid metadata")
Functions ¶
func Decode ¶ added in v1.13.0
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 ¶ added in v1.13.0
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 ¶ added in v1.13.0
func FindDatasets(md *metastorev1.BlockMeta, matchers ...*labels.Matcher) (fn func(yield func(*metastorev1.Dataset) bool))
func Sanitize ¶
func Sanitize(md *metastorev1.BlockMeta) error
func Tenant ¶
func Tenant(md *metastorev1.BlockMeta) string
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 ¶ added in v1.13.0
func (lb *LabelBuilder) WithLabelSet(pairs ...string) *LabelBuilder
type LabelMatcher ¶
type LabelMatcher struct {
// contains filtered or unexported fields
}
func NewLabelMatcher ¶
func NewLabelMatcher(strings *StringTable, matchers []*labels.Matcher, keep ...string) *LabelMatcher
func (*LabelMatcher) AllMatches ¶ added in v1.13.0
func (lm *LabelMatcher) AllMatches() []model.Labels
func (*LabelMatcher) CollectMatches ¶ added in v1.13.0
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 ¶ added in v1.13.0
func (lm *LabelMatcher) MatchesPairs(pairs []int32) bool
type StringTable ¶
func NewStringTable ¶
func NewStringTable() *StringTable
func OpenStringTable ¶ added in v1.13.0
func OpenStringTable(src *metastorev1.BlockMeta) *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) 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()