Skip to main content

AtomicResource

Trait AtomicResource 

Source
pub trait AtomicResource:
    Send
    + Sync
    + Debug {
    // Required methods
    fn descriptor(&self) -> EffectDescriptor;
    fn apply<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tx: &'life1 dyn AtomicTx,
    ) -> Pin<Box<dyn Future<Output = Result<Value, EffectError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

One member that commits with the journal or not at all.

Required Methods§

Source

fn descriptor(&self) -> EffectDescriptor

What this does, for the journal record and the effect key.

Source

fn apply<'life0, 'life1, 'async_trait>( &'life0 self, tx: &'life1 dyn AtomicTx, ) -> Pin<Box<dyn Future<Output = Result<Value, EffectError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Apply it, inside the journal’s transaction.

Returning Err rolls the whole transaction back, including every other member and the group’s own records. There is no partial outcome to report and nothing to compensate.

§Errors

If the resource refuses the work.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§