Skip to main content

BalSource

Trait BalSource 

Source
pub trait BalSource: Send + Sync {
    // Required methods
    fn head<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn finalized<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn block<'life0, 'async_trait>(
        &'life0 self,
        number: u64,
    ) -> Pin<Box<dyn Future<Output = Result<SourcedBlock>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn header<'life0, 'async_trait>(
        &'life0 self,
        number: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Header>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn bal<'life0, 'async_trait>(
        &'life0 self,
        number: u64,
    ) -> Pin<Box<dyn Future<Output = Result<BlockAccessList>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Where blocks and their BALs come from.

Required Methods§

Source

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

Latest block number the source knows.

Source

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

Latest finalized block number (reorg horizon).

Source

fn block<'life0, 'async_trait>( &'life0 self, number: u64, ) -> Pin<Box<dyn Future<Output = Result<SourcedBlock>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Header + BAL for one block.

Provided Methods§

Source

fn header<'life0, 'async_trait>( &'life0 self, number: u64, ) -> Pin<Box<dyn Future<Output = Result<Header>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Header only. Used for reorg checks, where fetching the BAL would be wasted work; the default goes through BalSource::block.

Source

fn bal<'life0, 'async_trait>( &'life0 self, number: u64, ) -> Pin<Box<dyn Future<Output = Result<BlockAccessList>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

BAL body only, unverified. Lets a backup supply the body while the header — the canonical-chain fact — still comes from the primary.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<S: BalSource + ?Sized> BalSource for &S

Source§

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

Source§

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

Source§

fn block<'life0, 'async_trait>( &'life0 self, number: u64, ) -> Pin<Box<dyn Future<Output = Result<SourcedBlock>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn header<'life0, 'async_trait>( &'life0 self, number: u64, ) -> Pin<Box<dyn Future<Output = Result<Header>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn bal<'life0, 'async_trait>( &'life0 self, number: u64, ) -> Pin<Box<dyn Future<Output = Result<BlockAccessList>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl<S: BalSource> BalSource for Option<S>

Option<S> is a source that is simply absent: every call fails with crate::SourceError::Transport. Lets Fallback<P, Option<B>> express “backup configured or not” without a second type.

Source§

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

Source§

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

Source§

fn block<'life0, 'async_trait>( &'life0 self, number: u64, ) -> Pin<Box<dyn Future<Output = Result<SourcedBlock>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn header<'life0, 'async_trait>( &'life0 self, number: u64, ) -> Pin<Box<dyn Future<Output = Result<Header>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn bal<'life0, 'async_trait>( &'life0 self, number: u64, ) -> Pin<Box<dyn Future<Output = Result<BlockAccessList>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§