selene_core/database/mergeable.rs
1use crate::database::{DatabaseEntry, DatabaseError, transaction_args::CompareAndSwapTransaction};
2
3pub trait Mergeable: DatabaseEntry {
4 /// Merges [`Self`] into the `into` entry
5 ///
6 /// This means the identifier of `to` will be preserved, while [`Self`] is deleted
7 /// All references to [`Self`] should be relinked to `into`
8 ///
9 /// This function should be a single atomic transaction
10 fn tx_merge(
11 &self,
12 into: Self::Id,
13 cas_tx: &mut CompareAndSwapTransaction,
14 ) -> Result<(), DatabaseError>;
15}