nodedb_columnar/compaction/mod.rs
1// SPDX-License-Identifier: Apache-2.0
2
3//! Segment compaction: merge segments, drop deleted rows, re-encode.
4//!
5//! Compaction reads one or more source segments along with their delete
6//! bitmaps, filters out deleted rows, and writes a new compacted segment.
7//! The caller is responsible for the atomic metadata swap (WAL commit marker
8//! → swap segment references → delete old files).
9//!
10//! Triggered when a segment's delete ratio exceeds the threshold (default 20%)
11//! or when the segment count exceeds a limit.
12
13pub mod extract;
14pub mod segment;
15pub mod segments;
16
17#[cfg(test)]
18mod tests;
19
20pub use segment::{CompactionResult, DEFAULT_DELETE_RATIO_THRESHOLD, compact_segment};
21pub use segments::compact_segments;