Skip to main content

ChainReader

Trait ChainReader 

Source
pub trait ChainReader: Send + Sync {
    // Required methods
    fn read_one(&self, origin: u64, seq: SeqNum) -> Option<Vec<u8>>;
    fn read_range(
        &self,
        origin: u64,
        start: SeqNum,
        end: SeqNum,
    ) -> Vec<(SeqNum, Vec<u8>)>;
    fn latest_seq(&self, origin: u64) -> Option<SeqNum>;
}
Expand description

Lower-level read primitive consumed by the executor.

Decouples the executor from the substrate’s channel-keyed storage: an integration-layer implementor decides how to resolve a chain origin hash (u64) into a readable chain (e.g. by maintaining a secondary origin → ChannelName index and dispatching to a Redex manager).

Methods are synchronous because the underlying RedEX read API is synchronous (mmap-backed). The async dimension lives at the MeshQueryExecutor level for cross-node fan-out.

Required Methods§

Source

fn read_one(&self, origin: u64, seq: SeqNum) -> Option<Vec<u8>>

Read the event at seq from chain origin. None if the chain is unknown, the seq has been evicted, or never written.

Source

fn read_range( &self, origin: u64, start: SeqNum, end: SeqNum, ) -> Vec<(SeqNum, Vec<u8>)>

Read events in [start, end) from chain origin. Returns (seq, payload) pairs in seq-asc order. Evicted entries are silently skipped, matching RedEX semantics.

Source

fn latest_seq(&self, origin: u64) -> Option<SeqNum>

The tip seq for origin, or None if the chain has never been written or is unknown.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§