Skip to main content

HeadSource

Trait HeadSource 

Source
pub trait HeadSource: Send + Sync {
    // Required method
    fn head<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A source of the current chain head block number.

Implementations MAY serve from a short TTL cache. The returned value is always at-or-before the true head at the call instant and never ahead of it — callers may rely on that direction (see the module doc), but MUST NOT assume the value is exactly current. A caller needing the head for a deadline decision (“has block X been reached yet?”) rather than a scan upper bound would be delayed by up to the TTL; no watcher does that today.

Err keeps the provider’s typed cause in its chain. A watcher tick treats every Err as retryable and fails into backoff; a boot read classifies it (boot_retry::is_permanent_boot_error), so a deterministic failure such as a rejected API key fails boot at once.

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,

The current chain head, at or before the true head and never ahead of it. Err keeps its typed cause in its chain.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§