selene-core 0.4.2

selene-core is the backend for Selene, a local-first music player
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use lunar_lib::database::{CompareAndSwapTransaction, CustomTransactionError, DatabaseEntry};

pub trait Mergeable: DatabaseEntry {
    type Err;

    /// Merges [`Self`] into the `into` entry
    ///
    /// This means the identifier of `to` will be preserved, while [`Self`] is deleted
    /// All references to [`Self`] should be relinked to `into`
    ///
    /// This function should be a single atomic transaction
    fn tx_merge(
        &self,
        into: Self::Id,
        cas_tx: &mut CompareAndSwapTransaction<Self::EntryDb>,
    ) -> Result<(), CustomTransactionError<Self::Err>>;
}