Trait JournalingObject

Source
pub trait JournalingObject: Send + Sync {
    // Required methods
    fn apply_mutation(
        &self,
        mutation: Mutation,
        context: &ApplyContext<'_, '_>,
        assoc_obj: AssocObj<'_>,
    ) -> Result<(), Error>;
    fn drop_mutation(&self, mutation: Mutation, transaction: &Transaction<'_>);
    fn flush<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Version, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn write_mutation(&self, mutation: &Mutation, writer: Writer<'_>) { ... }
}
Expand description

Objects that use journaling to track mutations (Allocator and ObjectStore) implement this. This is primarily used by ObjectManager and SuperBlock with flush calls used in a few tests.

Required Methods§

Source

fn apply_mutation( &self, mutation: Mutation, context: &ApplyContext<'_, '_>, assoc_obj: AssocObj<'_>, ) -> Result<(), Error>

This method get called when the transaction commits, which can either be during live operation (See ObjectManager::apply_mutation) or during journal replay, in which case transaction will be None (See super_block::read).

Source

fn drop_mutation(&self, mutation: Mutation, transaction: &Transaction<'_>)

Called when a transaction fails to commit.

Source

fn flush<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Version, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Flushes in-memory changes to the device (to allow journal space to be freed).

Also returns the earliest version of a struct in the filesystem.

Provided Methods§

Source

fn write_mutation(&self, mutation: &Mutation, writer: Writer<'_>)

Writes a mutation to the journal. This allows objects to encrypt or otherwise modify what gets written to the journal.

Implementors§