Connection

Trait Connection 

Source
pub trait Connection: Send {
    // Required methods
    fn init_watermark<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        pipeline_task: &'life1 str,
        checkpoint_hi_inclusive: Option<u64>,
    ) -> Pin<Box<dyn Future<Output = Result<Option<InitWatermark>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn accepts_chain_id<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        pipeline_task: &'life1 str,
        chain_id: [u8; 32],
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn committer_watermark<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        pipeline_task: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<CommitterWatermark>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn set_committer_watermark<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        pipeline_task: &'life1 str,
        watermark: CommitterWatermark,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Represents a database connection that can be used by the indexer framework to manage watermark operations, agnostic of the underlying store implementation.

Required Methods§

Source

fn init_watermark<'life0, 'life1, 'async_trait>( &'life0 mut self, pipeline_task: &'life1 str, checkpoint_hi_inclusive: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<Option<InitWatermark>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Initializes a watermark by either returning the existing watermark or, if the impl supports it, attempting to create it. Returns Ok(Some(_)) if a watermark existed or was created by this impl. Returns Ok(None) if a watermark does not exist and this impl does not attempt to create one. Returns Err(_) if the store encountered an error while trying to read or create the watermark.

Source

fn accepts_chain_id<'life0, 'life1, 'async_trait>( &'life0 mut self, pipeline_task: &'life1 str, chain_id: [u8; 32], ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Checks if the store can accept a chain_id. Returns Ok(true) if the store accepts this chain_id thereby allowing processing to continue. Returns Ok(false) if the store does not accept the chain_id thereby halting processing with an error. Returns Err(_) if the store encountered an error while trying to determine if it could accept the chain_id which will cause accepts_chain_id to be retried.

Source

fn committer_watermark<'life0, 'life1, 'async_trait>( &'life0 mut self, pipeline_task: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<CommitterWatermark>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Given a pipeline_task representing either a pipeline name or a pipeline with an associated task (formatted as {pipeline}{Store::DELIMITER}{task}), return the committer watermark from the Store. The indexer fetches this value for each pipeline added to determine which checkpoint to resume processing from.

Source

fn set_committer_watermark<'life0, 'life1, 'async_trait>( &'life0 mut self, pipeline_task: &'life1 str, watermark: CommitterWatermark, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Upsert the high watermark for the pipeline_task - representing either a pipeline name or a pipeline with an associated task (formatted as {pipeline}{Store::DELIMITER}{task}) - as long as it raises the watermark stored in the database. Returns a boolean indicating whether the watermark was actually updated or not.

Implementors§