Skip to main content

ValidatorNodeProvider

Trait ValidatorNodeProvider 

Source
pub trait ValidatorNodeProvider:
    'static
    + Send
    + Sync {
    type Node: ValidatorNode + MaybeSend + MaybeSync + Clone + 'static;

    // Required method
    fn make_node(&self, address: &str) -> Result<Self::Node, NodeError>;

    // Provided methods
    fn make_nodes(
        &self,
        committee: &Committee,
    ) -> Result<impl Iterator<Item = (ValidatorPublicKey, Self::Node)> + '_, NodeError> { ... }
    fn make_nodes_from_list<A>(
        &self,
        validators: impl IntoIterator<Item = (ValidatorPublicKey, A)>,
    ) -> Result<impl Iterator<Item = (ValidatorPublicKey, Self::Node)>, NodeError>
       where A: AsRef<str> { ... }
}
Expand description

Turn an address into a validator node.

Required Associated Types§

Source

type Node: ValidatorNode + MaybeSend + MaybeSync + Clone + 'static

The type of validator node produced by this provider.

Required Methods§

Source

fn make_node(&self, address: &str) -> Result<Self::Node, NodeError>

Creates a node from a validator’s address.

Provided Methods§

Source

fn make_nodes( &self, committee: &Committee, ) -> Result<impl Iterator<Item = (ValidatorPublicKey, Self::Node)> + '_, NodeError>

Creates a node for each validator in the committee.

Source

fn make_nodes_from_list<A>( &self, validators: impl IntoIterator<Item = (ValidatorPublicKey, A)>, ) -> Result<impl Iterator<Item = (ValidatorPublicKey, Self::Node)>, NodeError>
where A: AsRef<str>,

Creates a node for each validator in the given list of public keys and addresses.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§