use crate::{Entry, Record};

pub mod btree;
pub mod index;
#[cfg(feature = "value_indexes")]
pub mod value_indexes;

pub trait IndexUpdateCollection<Item>
where
    Self: Sync + Send,
    Item: Record,
{
    fn update(&self, id: &Item::SelfId, old: Option<&Item>, new: Option<&Item>);

    /// only for new items
    fn batch_update(&self, items: &[Entry<Item>]) {
        for item in items {
            self.update(&item.key, None, Some(&item.val));
        }
    }
}
