hopr_chain_actions::action_state

Trait ActionState

Source
pub trait ActionState {
    // Required methods
    fn match_and_resolve<'life0, 'life1, 'async_trait>(
        &'life0 self,
        event: &'life1 SignificantChainEvent,
    ) -> Pin<Box<dyn Future<Output = Vec<IndexerExpectation>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn register_expectation<'life0, 'async_trait>(
        &'life0 self,
        exp: IndexerExpectation,
    ) -> Pin<Box<dyn Future<Output = Result<ExpectationResolver>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn unregister_expectation<'life0, 'async_trait>(
        &'life0 self,
        tx_hash: Hash,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Allows tracking state of an Action via registering IndexerExpectations on SignificantChainEvents coming from the Indexer and resolving them as they are matched. Once expectations are matched, they are automatically unregistered.

Required Methods§

Source

fn match_and_resolve<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 SignificantChainEvent, ) -> Pin<Box<dyn Future<Output = Vec<IndexerExpectation>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Tries to match the given event against the registered expectations. Each matched expectation is resolved, unregistered and returned.

Source

fn register_expectation<'life0, 'async_trait>( &'life0 self, exp: IndexerExpectation, ) -> Pin<Box<dyn Future<Output = Result<ExpectationResolver>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Registers new IndexerExpectation.

Source

fn unregister_expectation<'life0, 'async_trait>( &'life0 self, tx_hash: Hash, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Manually unregisters IndexerExpectation given its TX hash.

Implementors§