pub(crate) mod fifo;
pub(crate) mod leveled;
pub(crate) mod drop_range;
pub mod filter;
mod flavour;
pub(crate) mod major;
pub(crate) mod movedown;
pub(crate) mod pulldown;
pub(crate) mod state;
pub(crate) mod stream;
pub(crate) mod worker;
pub use fifo::Strategy as Fifo;
pub use filter::{CompactionFilter, Factory, ItemAccessor, Verdict};
pub use leveled::Strategy as Leveled;
pub use {fifo::NAME as FIFO_COMPACTION_NAME, leveled::NAME as LEVELED_COMPACTION_NAME};
pub type Levelled = Leveled;
#[doc(hidden)]
pub use movedown::Strategy as MoveDown;
#[doc(hidden)]
pub use pulldown::Strategy as PullDown;
use crate::{
compaction::state::CompactionState, config::Config, version::Version, HashSet, KvPair, TableId,
};
#[derive(Debug, Eq, PartialEq)]
pub struct Input {
pub table_ids: HashSet<TableId>,
pub dest_level: u8,
pub canonical_level: u8,
pub target_size: u64,
}
#[derive(Debug, Eq, PartialEq)]
pub enum Choice {
DoNothing,
Move(Input),
Merge(Input),
Drop(HashSet<TableId>),
}
#[expect(clippy::module_name_repetitions)]
pub trait CompactionStrategy {
fn get_name(&self) -> &'static str;
#[doc(hidden)]
fn get_config(&self) -> Vec<KvPair> {
vec![]
}
fn choose(&self, version: &Version, config: &Config, state: &CompactionState) -> Choice;
}