Skip to main content

OriginDirectory

Trait OriginDirectory 

Source
pub trait OriginDirectory:
    Send
    + Sync
    + Debug {
    // Required method
    fn lookup_origins<'life0, 'async_trait>(
        &'life0 self,
        namespace_id: U256,
    ) -> Pin<Box<dyn Future<Output = Vec<NodeId>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Read-only view of the on-chain origin directory, keyed by the namespace a request is published under (ADR 002 §Retrieval by namespace).

Implementations MUST be cheap to clone (typically Arc<inner>); consumers hold a long-lived Arc<dyn OriginDirectory> and invoke lookup_origins on a lookup miss, or on a ranged pull whose probed holders do not cover every block (ADR 022 §FIND_VALUE Flow). Both are uncommon: under normal operation the DHT holds an entry for every actively-serving authorized origin.

async because the chain-backed implementation may issue one on-demand getOrigins RPC on a cold-namespace miss; Empty/Static resolve synchronously.

Required Methods§

Source

fn lookup_origins<'life0, 'async_trait>( &'life0 self, namespace_id: U256, ) -> Pin<Box<dyn Future<Output = Vec<NodeId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return the operator NodeIds authorised as origins for namespace_id, already filtered to only currently-active stakers (the active == true filter from CapacityBond.nodeIdOf per ADR 022 §FIND_VALUE Flow “Origin discovery”).

Returns an empty vector when the namespace has no authorized origins — including namespace_id == 0 (no namespace: cache/DHT-only, no origins per ADR 002 §Namespace 0).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§