Trait AppView

Source
pub trait AppView: Send + Sync {
    // Required methods
    fn name(&self) -> String;
    fn init_chain<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        dbtx: &'life1 mut PgTransaction<'_>,
        app_state: &'life2 Value,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn index_batch<'life0, 'life1, 'async_trait>(
        &'life0 self,
        dbtx: &'life1 mut PgTransaction<'_>,
        batch: EventBatch,
        context: EventBatchContext,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Represents a specific index of raw event data.

Required Methods§

Source

fn name(&self) -> String

Return the name of this index.

This should be unique across all of the indices.

Source

fn init_chain<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dbtx: &'life1 mut PgTransaction<'_>, app_state: &'life2 Value, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

This will be called once when processing the genesis before the first block.

Source

fn index_batch<'life0, 'life1, 'async_trait>( &'life0 self, dbtx: &'life1 mut PgTransaction<'_>, batch: EventBatch, context: EventBatchContext, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

This allows processing a batch of events, over many blocks.

Implementors§