MCPcopy
hub / github.com/prometheus/prometheus / IndexReader

Interface IndexReader

tsdb/block.go:61–110  ·  view source on GitHub ↗

IndexReader provides reading access of serialized index data.

Source from the content-addressed store, hash-verified

59
60// IndexReader provides reading access of serialized index data.
61type IndexReader interface {
62 // Symbols return an iterator over sorted string symbols that may occur in
63 // series' labels and indices. It is not safe to use the returned strings
64 // beyond the lifetime of the index reader.
65 Symbols() index.StringIter
66
67 // SortedLabelValues returns sorted possible label values.
68 SortedLabelValues(ctx context.Context, name string, hints *storage.LabelHints, matchers ...*labels.Matcher) ([]string, error)
69
70 // LabelValues returns possible label values which may not be sorted.
71 LabelValues(ctx context.Context, name string, hints *storage.LabelHints, matchers ...*labels.Matcher) ([]string, error)
72
73 // Postings returns the postings list iterator for the label pairs.
74 // The Postings here contain the offsets to the series inside the index.
75 // Found IDs are not strictly required to point to a valid Series, e.g.
76 // during background garbage collections.
77 Postings(ctx context.Context, name string, values ...string) (index.Postings, error)
78
79 // PostingsForLabelMatching returns a sorted iterator over postings having a label with the given name and a value for which match returns true.
80 // If no postings are found having at least one matching label, an empty iterator is returned.
81 PostingsForLabelMatching(ctx context.Context, name string, match func(value string) bool) index.Postings
82
83 // PostingsForAllLabelValues returns a sorted iterator over all postings having a label with the given name.
84 // If no postings are found with the label in question, an empty iterator is returned.
85 PostingsForAllLabelValues(ctx context.Context, name string) index.Postings
86
87 // SortedPostings returns a postings list that is reordered to be sorted
88 // by the label set of the underlying series.
89 SortedPostings(index.Postings) index.Postings
90
91 // ShardedPostings returns a postings list filtered by the provided shardIndex
92 // out of shardCount. For a given posting, its shard MUST be computed hashing
93 // the series labels mod shardCount, using a hash function which is consistent over time.
94 ShardedPostings(p index.Postings, shardIndex, shardCount uint64) index.Postings
95
96 // Series populates the given builder and chunk metas for the series identified
97 // by the reference.
98 // Returns storage.ErrNotFound if the ref does not resolve to a known series.
99 Series(ref storage.SeriesRef, builder *labels.ScratchBuilder, chks *[]chunks.Meta) error
100
101 // LabelNames returns all the unique label names present in the index in sorted order.
102 LabelNames(ctx context.Context, matchers ...*labels.Matcher) ([]string, error)
103
104 // LabelNamesFor returns all the label names for the series referred to by the postings.
105 // The names returned are sorted.
106 LabelNamesFor(ctx context.Context, postings index.Postings) ([]string, error)
107
108 // Close releases the underlying resources of the reader.
109 Close() error
110}
111
112// ChunkWriter serializes a time block of chunked series data.
113type ChunkWriter interface {

Callers 77

TestHead_TruncateFunction · 0.65
SymbolsMethod · 0.65
PopulateBlockMethod · 0.65
SymbolsMethod · 0.65
LabelValuesMethod · 0.65
SearchLabelValuesMethod · 0.65

Implementers 7

mockIndextsdb/querier_test.go
mockMatcherIndextsdb/querier_test.go
mockReaderOfLabelstsdb/querier_test.go
OOOCompactionHeadIndexReadertsdb/ooo_head_read.go
blockIndexReadertsdb/block.go
headIndexReadertsdb/head_read.go
Readertsdb/index/index.go

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…