feat: Extend chunkenc.Iterator with CT access (PROM-60)

Implement PROM-60 read TSDB access API.

Signed-off-by: bwplotka <bwplotka@gmail.com>
This commit is contained in:
bwplotka 2025-09-11 12:47:59 +01:00
parent 594f9d63a5
commit f2f76a24ad
4 changed files with 24 additions and 0 deletions

View File

@ -151,6 +151,10 @@ type Iterator interface {
// AtT returns the current timestamp.
// Before the iterator has advanced, the behaviour is unspecified.
AtT() int64
// AtCT returns the current created timestamp.
// The created timestamp (ct) is optional. The value int64(0) means no timestamp.
// Before the iterator has advanced, the behaviour is unspecified.
AtCT() int64
// Err returns the current error. It should be used only after the
// iterator is exhausted, i.e. `Next` or `Seek` have returned ValNone.
Err() error
@ -241,6 +245,10 @@ func (it *mockSeriesIterator) AtT() int64 {
return it.timeStamps[it.currIndex]
}
func (*mockSeriesIterator) AtCT() int64 {
return 0
}
func (it *mockSeriesIterator) Next() ValueType {
if it.currIndex < len(it.timeStamps)-1 {
it.currIndex++
@ -269,6 +277,10 @@ func (nopIterator) AtFloatHistogram(*histogram.FloatHistogram) (int64, *histogra
return math.MinInt64, nil
}
func (nopIterator) AtT() int64 { return math.MinInt64 }
func (nopIterator) AtCT() int64 {
return 0
}
func (nopIterator) Err() error { return nil }
// Pool is used to create and reuse chunk references to avoid allocations.

View File

@ -910,6 +910,10 @@ func (it *floatHistogramIterator) AtT() int64 {
return it.t
}
func (*floatHistogramIterator) AtCT() int64 {
return 0 // CT is not supported at the moment.
}
func (it *floatHistogramIterator) Err() error {
return it.err
}

View File

@ -1019,6 +1019,10 @@ func (it *histogramIterator) AtT() int64 {
return it.t
}
func (*histogramIterator) AtCT() int64 {
return 0 // CT is not supported at the moment.
}
func (it *histogramIterator) Err() error {
return it.err
}

View File

@ -277,6 +277,10 @@ func (it *xorIterator) AtT() int64 {
return it.t
}
func (*xorIterator) AtCT() int64 {
return 0 // CT is not supported at the moment.
}
func (it *xorIterator) Err() error {
return it.err
}