MCPcopy
hub / github.com/prometheus/prometheus / headChunkReader

Struct headChunkReader

tsdb/head_read.go:468–482  ·  view source on GitHub ↗

headChunkReader provides chunk reading for the head block. Not safe for concurrent use from multiple goroutines.

Source from the content-addressed store, hash-verified

466// headChunkReader provides chunk reading for the head block.
467// Not safe for concurrent use from multiple goroutines.
468type headChunkReader struct {
469 head *Head
470 mint, maxt int64
471 isoState *isolationState
472 // When true, enables the head-chunks cache. Range queries benefit from
473 // caching because they look up every chunk of a series; instant queries
474 // only need one chunk per series, so the cache is wasted overhead.
475 enableCache bool
476 // Cache for head chunks — avoids O(n²) linked-list walks when
477 // iterating all chunks of a series oldest-to-newest.
478 cachedSeriesRef storage.SeriesRef
479 cachedHeadChunks []*memChunk
480 cachedHeadChunksHead *memChunk // Head pointer at collection time; detects head-chunk replacement.
481 cachedMmapLen int // len(s.mmappedChunks) at collection time; detects mmap events.
482}
483
484func (h *headChunkReader) Close() error {
485 if h.isoState != nil {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected