MCPcopy
hub / github.com/prometheus/prometheus / Iterator

Interface Iterator

tsdb/chunkenc/chunk.go:138–176  ·  view source on GitHub ↗

Iterator is a simple iterator that can only get the next value. Iterator iterates over the samples of a time series, in timestamp-increasing order.

Source from the content-addressed store, hash-verified

136// Iterator is a simple iterator that can only get the next value.
137// Iterator iterates over the samples of a time series, in timestamp-increasing order.
138type Iterator interface {
139 // Next advances the iterator by one and returns the type of the value
140 // at the new position (or ValNone if the iterator is exhausted).
141 Next() ValueType
142 // Seek advances the iterator forward to the first sample with a
143 // timestamp equal or greater than t. If the current sample found by a
144 // previous `Next` or `Seek` operation already has this property, Seek
145 // has no effect. If a sample has been found, Seek returns the type of
146 // its value. Otherwise, it returns ValNone, after which the iterator is
147 // exhausted.
148 Seek(t int64) ValueType
149 // At returns the current timestamp/value pair if the value is a float.
150 // Before the iterator has advanced, the behaviour is unspecified.
151 At() (int64, float64)
152 // AtHistogram returns the current timestamp/value pair if the value is a
153 // histogram with integer counts. Before the iterator has advanced, the behaviour
154 // is unspecified.
155 // The method accepts an optional Histogram object which will be
156 // reused when not nil. Otherwise, a new Histogram object will be allocated.
157 AtHistogram(*histogram.Histogram) (int64, *histogram.Histogram)
158 // AtFloatHistogram returns the current timestamp/value pair if the
159 // value is a histogram with floating-point counts. It also works if the
160 // value is a histogram with integer counts, in which case a
161 // FloatHistogram copy of the histogram is returned. Before the iterator
162 // has advanced, the behaviour is unspecified.
163 // The method accepts an optional FloatHistogram object which will be
164 // reused when not nil. Otherwise, a new FloatHistogram object will be allocated.
165 AtFloatHistogram(*histogram.FloatHistogram) (int64, *histogram.FloatHistogram)
166 // AtT returns the current timestamp.
167 // Before the iterator has advanced, the behaviour is unspecified.
168 AtT() int64
169 // AtST returns the current start timestamp.
170 // Returns 0 if the start timestamp is not implemented or not set.
171 // Before the iterator has advanced, the behaviour is unspecified.
172 AtST() int64
173 // Err returns the current error. It should be used only after the
174 // iterator is exhausted, i.e. `Next` or `Seek` have returned ValNone.
175 Err() error
176}
177
178// ValueType defines the type of a value an Iterator points to.
179type ValueType uint8

Callers 44

BenchmarkXor2ReadFunction · 0.95
BenchmarkXorReadFunction · 0.95
BenchmarkQuerySeekFunction · 0.95
SeekMethod · 0.65
SeekMethod · 0.65
TestCorruptedChunkFunction · 0.65
testChunkFunction · 0.65
BenchmarkXor2ReadFunction · 0.95
BenchmarkXorReadFunction · 0.95

Implementers 15

DeletedIteratortsdb/querier.go
mockSampleIteratortsdb/querier_test.go
mockSeriesIteratortsdb/chunkenc/chunk.go
nopIteratortsdb/chunkenc/chunk.go
xor2Iteratortsdb/chunkenc/xor2.go
histogramIteratortsdb/chunkenc/histogram.go
xorIteratortsdb/chunkenc/xor.go
floatHistogramIteratortsdb/chunkenc/float_histogram.go
chainSampleIteratorstorage/merge.go
mockSeriesIteratorstorage/buffer_test.go
fakeSeriesIteratorstorage/buffer_test.go

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…