use crate::db::index::IndexKey;
#[derive(Debug)]
pub(in crate::db) struct IndexMutationPlan {
pub(in crate::db) groups: Vec<IndexDeltaGroup>,
}
impl IndexMutationPlan {
pub(in crate::db) const fn new(groups: Vec<IndexDeltaGroup>) -> Self {
Self { groups }
}
}
#[derive(Debug)]
pub(in crate::db) struct IndexDeltaGroup {
pub(in crate::db) index_store: String,
pub(in crate::db) deltas: Vec<IndexDelta>,
}
impl IndexDeltaGroup {
#[must_use]
pub(in crate::db) fn new(index_store: &str, deltas: Vec<IndexDelta>) -> Self {
Self {
index_store: index_store.to_string(),
deltas,
}
}
}
#[derive(Debug)]
pub(in crate::db) enum IndexDelta {
Remove(IndexMembershipDelta),
Insert(IndexMembershipDelta),
}
impl IndexDelta {
#[must_use]
pub(in crate::db) const fn remove(key: IndexKey) -> Self {
Self::Remove(IndexMembershipDelta { key })
}
#[must_use]
pub(in crate::db) const fn insert(key: IndexKey) -> Self {
Self::Insert(IndexMembershipDelta { key })
}
}
#[derive(Debug)]
pub(in crate::db) struct IndexMembershipDelta {
pub(in crate::db) key: IndexKey,
}