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:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user