headChunkReader provides chunk reading for the head block. Not safe for concurrent use from multiple goroutines.
| 466 | // headChunkReader provides chunk reading for the head block. |
| 467 | // Not safe for concurrent use from multiple goroutines. |
| 468 | type 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 | |
| 484 | func (h *headChunkReader) Close() error { |
| 485 | if h.isoState != nil { |
nothing calls this directly
no outgoing calls
no test coverage detected