Skip to main content

ProjectionTxn

Trait ProjectionTxn 

Source
pub trait ProjectionTxn {
    // Required methods
    fn apply_event(&mut self, id: u64, bytes: &[u8]) -> Result<(), AzothError>;
    fn commit(self: Box<Self>, new_cursor: u64) -> Result<(), AzothError>;
    fn rollback(self: Box<Self>);

    // Provided method
    fn apply_batch(
        &mut self,
        events: &[(u64, Vec<u8>)],
    ) -> Result<(), AzothError> { ... }
}
Expand description

Transaction for projection store operations

Note: Not required to be Send, as some backends have thread-affine transactions

Required Methods§

Source

fn apply_event(&mut self, id: u64, bytes: &[u8]) -> Result<(), AzothError>

Apply a single event to the projection

Source

fn commit(self: Box<Self>, new_cursor: u64) -> Result<(), AzothError>

Commit transaction and update cursor

Source

fn rollback(self: Box<Self>)

Rollback transaction

Provided Methods§

Source

fn apply_batch(&mut self, events: &[(u64, Vec<u8>)]) -> Result<(), AzothError>

Apply a batch of events to the projection

Implementations on Foreign Types§

Source§

impl<'a> ProjectionTxn for SimpleProjectionTxn<'a>

Source§

fn apply_event(&mut self, _id: u64, _bytes: &[u8]) -> Result<(), AzothError>

Source§

fn commit( self: Box<SimpleProjectionTxn<'a>>, new_cursor: u64, ) -> Result<(), AzothError>

Source§

fn rollback(self: Box<SimpleProjectionTxn<'a>>)

Implementors§