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§
Sourcefn apply_event(&mut self, id: u64, bytes: &[u8]) -> Result<(), AzothError>
fn apply_event(&mut self, id: u64, bytes: &[u8]) -> Result<(), AzothError>
Apply a single event to the projection
Provided Methods§
Sourcefn apply_batch(&mut self, events: &[(u64, Vec<u8>)]) -> Result<(), AzothError>
fn apply_batch(&mut self, events: &[(u64, Vec<u8>)]) -> Result<(), AzothError>
Apply a batch of events to the projection