MCPcopy Create free account
hub / github.com/cortexproject/cortex / Iterator

Interface Iterator

pkg/chunk/iterator.go:12–29  ·  view source on GitHub ↗

Iterator enables efficient access to the content of a chunk. It is generally not safe to use an Iterator concurrently with or after chunk mutation.

Source from the content-addressed store, hash-verified

10// generally not safe to use an Iterator concurrently with or after chunk
11// mutation.
12type Iterator interface {
13 // Scans the next value in the chunk. Directly after the iterator has
14 // been created, the next value is the first value in the
15 // chunk. Otherwise, it is the value following the last value scanned or
16 // found (by one of the Find... methods). Returns chunkenc.ValNoe if either
17 // the end of the chunk is reached or an error has occurred.
18 Scan() chunkenc.ValueType
19 // Finds the oldest value at or after the provided time and returns the value type.
20 // Returns chunkenc.ValNone if either the chunk contains no value at or after
21 // the provided time, or an error has occurred.
22 FindAtOrAfter(model.Time) chunkenc.ValueType
23 // Returns a batch of the provisded size; NB not idempotent! Should only be called
24 // once per Scan.
25 Batch(size int, valType chunkenc.ValueType) Batch
26 // Returns the last error encountered. In general, an error signals data
27 // corruption in the chunk and requires quarantining.
28 Err() error
29}
30
31// BatchSize is samples per batch; this was choose by benchmarking all sizes from
32// 1 to 128.

Callers 1

resetMethod · 0.92

Implementers 2

mockIteratorpkg/querier/batch/chunk_test.go
prometheusChunkIteratorpkg/chunk/chunk.go

Calls

no outgoing calls

Tested by

no test coverage detected