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.
| 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. |
| 138 | type 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. |
| 179 | type ValueType uint8 |
no outgoing calls
no test coverage detected
searching dependent graphs…