github.com/thanos-io/thanos@v0.32.5/pkg/block/indexheader/header.go (about) 1 // Copyright (c) The Thanos Authors. 2 // Licensed under the Apache License 2.0. 3 4 package indexheader 5 6 import ( 7 "io" 8 9 "github.com/pkg/errors" 10 "github.com/prometheus/prometheus/tsdb/index" 11 ) 12 13 // NotFoundRangeErr is an error returned by PostingsOffset when there is no posting for given name and value pairs. 14 var NotFoundRangeErr = errors.New("range not found") 15 16 // Reader is an interface allowing to read essential, minimal number of index fields from the small portion of index file called header. 17 type Reader interface { 18 io.Closer 19 20 // IndexVersion returns version of index. 21 IndexVersion() (int, error) 22 23 // PostingsOffset returns start and end offsets of postings for given name and value. 24 // The end offset might be bigger than the actual posting ending, but not larger than the whole index file. 25 // NotFoundRangeErr is returned when no index can be found for given name and value. 26 // TODO(bwplotka): Move to PostingsOffsets(name string, value ...string) []index.Range and benchmark. 27 PostingsOffset(name string, value string) (index.Range, error) 28 29 // LookupSymbol returns string based on given reference. 30 // Error is return if the symbol can't be found. 31 LookupSymbol(o uint32) (string, error) 32 33 // LabelValues returns all label values for given label name or error. 34 // If no values are found for label name, or label name does not exists, 35 // then empty string is returned and no error. 36 LabelValues(name string) ([]string, error) 37 38 // LabelNames returns all label names in sorted order. 39 LabelNames() ([]string, error) 40 }