Immutable blocks with mmap reads

Flush sealed head chunks to ULID-named block directories on disk. Each
block contains CRC'd chunk segment files (mmap'd for reads), a binary
index (symbol table, series, postings with TOC), and a meta.json written
last as the immutability gate. WAL is truncated after block fsync,
preserving the crash-safety ording invariant.
This commit is contained in:
2026-07-04 14:59:39 -04:00
parent 376d3faf25
commit 42b03db2fa
16 changed files with 2176 additions and 2 deletions
+12
View File
@@ -70,6 +70,18 @@ func (sm *seriesMap) set(hash uint64, s *memSeries) {
rs.mu.Unlock()
}
// forEach calls fn for every series in the map. The series lock is NOT held.
func (sm *seriesMap) forEach(fn func(s *memSeries)) {
for i := range sm.refStripes {
rs := &sm.refStripes[i]
rs.mu.RLock()
for _, s := range rs.m {
fn(s)
}
rs.mu.RUnlock()
}
}
// remove deletes a series from both maps.
func (sm *seriesMap) remove(hash uint64, s *memSeries) {
hs := &sm.hashStripes[hash%numStripes]