pub struct Fallback<P, B> {
pub primary: P,
pub backup: B,
}Expand description
Primary for the chain, backup for old data.
Fields§
§primary: PDecides head/finalized/headers; asked first for everything.
backup: BAsked for a BAL body or a proof when the primary cannot serve it.
Implementations§
Trait Implementations§
Source§impl<P: BalSource, B: BalSource> BalSource for Fallback<P, B>
impl<P: BalSource, B: BalSource> BalSource for Fallback<P, B>
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,
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 always from the primary; body from the primary, or from the backup if the primary has none. The archive verifies the body against this header, so a backup body is held to the primary’s chain.
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,
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,
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 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 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,
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.
Source§impl<P: StateSource, B: StateSource> StateSource for Fallback<P, B>
impl<P: StateSource, B: StateSource> StateSource for Fallback<P, B>
Source§fn proof<'life0, 'life1, 'async_trait>(
&'life0 self,
addr: Address,
slots: &'life1 [B256],
block: u64,
) -> Pin<Box<dyn Future<Output = Result<AccountProof>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn proof<'life0, 'life1, 'async_trait>(
&'life0 self,
addr: Address,
slots: &'life1 [B256],
block: u64,
) -> Pin<Box<dyn Future<Output = Result<AccountProof>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
eth_getProof(addr, slots, block). One call per (address, block)
carries any number of slots — batching happens here, not in JSON-RPC.Auto Trait Implementations§
impl<P, B> Freeze for Fallback<P, B>
impl<P, B> RefUnwindSafe for Fallback<P, B>where
P: RefUnwindSafe,
B: RefUnwindSafe,
impl<P, B> Send for Fallback<P, B>
impl<P, B> Sync for Fallback<P, B>
impl<P, B> Unpin for Fallback<P, B>
impl<P, B> UnsafeUnpin for Fallback<P, B>where
P: UnsafeUnpin,
B: UnsafeUnpin,
impl<P, B> UnwindSafe for Fallback<P, B>where
P: UnwindSafe,
B: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more