Next advances the iterator to the next element.
()
| 113 | |
| 114 | // Next advances the iterator to the next element. |
| 115 | func (b *BufferedSeriesIterator) Next() chunkenc.ValueType { |
| 116 | // Add current element to buffer before advancing. |
| 117 | switch b.valueType { |
| 118 | case chunkenc.ValNone: |
| 119 | return chunkenc.ValNone |
| 120 | case chunkenc.ValFloat: |
| 121 | t, f := b.it.At() |
| 122 | st := b.it.AtST() |
| 123 | b.buf.addF(fSample{st: st, t: t, f: f}) |
| 124 | case chunkenc.ValHistogram: |
| 125 | t, h := b.it.AtHistogram(&b.hReader) |
| 126 | st := b.it.AtST() |
| 127 | b.buf.addH(hSample{st: st, t: t, h: h}) |
| 128 | case chunkenc.ValFloatHistogram: |
| 129 | t, fh := b.it.AtFloatHistogram(&b.fhReader) |
| 130 | st := b.it.AtST() |
| 131 | b.buf.addFH(fhSample{st: st, t: t, fh: fh}) |
| 132 | default: |
| 133 | panic(fmt.Errorf("BufferedSeriesIterator: unknown value type %v", b.valueType)) |
| 134 | } |
| 135 | |
| 136 | b.valueType = b.it.Next() |
| 137 | if b.valueType != chunkenc.ValNone { |
| 138 | b.lastTime = b.AtT() |
| 139 | } |
| 140 | return b.valueType |
| 141 | } |
| 142 | |
| 143 | // At returns the current float element of the iterator. |
| 144 | func (b *BufferedSeriesIterator) At() (int64, float64) { |