use crate::loader::models::TableSpec;
use crate::project::models::Deletes;
pub fn deletes_note(spec: &TableSpec) -> String {
let Some(deletes) = spec.deletes.as_ref() else {
return String::new();
};
let action = match deletes.apply {
Deletes::Soft => "soft-deletes",
Deletes::Hard => "deletes",
};
let mut note = String::new();
if deletes.scan {
note.push_str(&format!(
", then a full key scan of {} {action} the rows of keys it no longer holds (at most {}% of the table)",
spec.source_table.qualified_name(),
deletes.max_drop
));
}
if let (Some(from), Some(cursor)) = (&deletes.from, &spec.cursor) {
note.push_str(&format!(
", then {action} the rows whose key {} lists deleted at or after the row's {} (its tombstones load first)",
from.source_table,
cursor.label()
));
}
note
}