From ea356c472e9926d707f873ff1bef2f8aa5bd19f8 Mon Sep 17 00:00:00 2001 From: Filip Petkovski Date: Wed, 13 Dec 2023 08:35:02 +0100 Subject: [PATCH] Add comment on SampleRingIterator methods Signed-off-by: Filip Petkovski --- storage/buffer.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/storage/buffer.go b/storage/buffer.go index 234771a770..d19f841d43 100644 --- a/storage/buffer.go +++ b/storage/buffer.go @@ -360,14 +360,20 @@ func (it *SampleRingIterator) Next() chunkenc.ValueType { } } +// At returns the current float element of the iterator. func (it *SampleRingIterator) At() (int64, float64) { return it.t, it.f } +// AtHistogram returns the current histogram element of the iterator. func (it *SampleRingIterator) AtHistogram() (int64, *histogram.Histogram) { return it.t, it.h } +// AtFloatHistogram returns the current histogram element of the iterator. If the +// current sample is an integer histogram, it will be converted to a float histogram. +// An optional histogram.FloatHistogram can be provided to avoid allocating a new +// object for the conversion. func (it *SampleRingIterator) AtFloatHistogram(fh *histogram.FloatHistogram) (int64, *histogram.FloatHistogram) { if it.fh == nil { return it.t, it.h.ToFloat(fh)