use crate::db::commit::{PreparedIndexMutation, PreparedRowCommitOp};
impl PreparedIndexMutation {
pub(crate) fn apply(self) {
self.index_store.with_borrow_mut(|store| {
if let Some(value) = self.value {
store.insert(self.key, value);
} else {
store.remove(&self.key);
}
});
}
pub(in crate::db) fn fold_recovered(self) -> Result<(), crate::error::InternalError> {
self.index_store
.with_borrow_mut(|store| store.fold_recovered_journal_entry(self.key, self.value))
}
}
impl PreparedRowCommitOp {
pub(crate) fn apply(self) {
for index_op in self.index_ops {
index_op.apply();
}
let data_generation = self.data_store.with_borrow_mut(|store| {
if let Some(value) = self.data_value {
store.insert(self.data_key, value);
} else {
store.remove(&self.data_key);
}
store.generation()
});
self.data_index_store.with_borrow_mut(|store| {
store.mark_prefix_cardinality_data_generation(data_generation);
});
}
}