Trait forge::Swarm

source ·
pub trait Swarm {
Show 17 methods // Required methods fn health_check(&mut self) -> Result<()>; fn validators<'a>( &'a self ) -> Box<dyn Iterator<Item = &'a dyn Validator> + 'a>; fn validators_mut<'a>( &'a mut self ) -> Box<dyn Iterator<Item = &'a mut dyn Validator> + 'a>; fn validator(&self, id: PeerId) -> Option<&dyn Validator>; fn validator_mut(&mut self, id: PeerId) -> Option<&mut dyn Validator>; fn upgrade_validator(&mut self, id: PeerId, version: &Version) -> Result<()>; fn full_nodes<'a>( &'a self ) -> Box<dyn Iterator<Item = &'a dyn FullNode> + 'a>; fn full_nodes_mut<'a>( &'a mut self ) -> Box<dyn Iterator<Item = &'a mut dyn FullNode> + 'a>; fn full_node(&self, id: PeerId) -> Option<&dyn FullNode>; fn full_node_mut(&mut self, id: PeerId) -> Option<&mut dyn FullNode>; fn add_validator( &mut self, version: &Version, template: NodeConfig ) -> Result<PeerId>; fn remove_validator(&mut self, id: PeerId) -> Result<()>; fn add_full_node( &mut self, version: &Version, template: NodeConfig ) -> Result<PeerId>; fn remove_full_node(&mut self, id: PeerId) -> Result<()>; fn versions<'a>(&'a self) -> Box<dyn Iterator<Item = Version> + 'a>; fn chain_info(&mut self) -> ChainInfo<'_>; fn logs_location(&mut self) -> String;
}
Expand description

Trait used to represent a running network comprised of Validators and FullNodes

Required Methods§

source

fn health_check(&mut self) -> Result<()>

Performs a health check on the entire swarm, ensuring all Nodes are Live and that no forks have occurred

source

fn validators<'a>(&'a self) -> Box<dyn Iterator<Item = &'a dyn Validator> + 'a>

Returns an Iterator of references to all the Validators in the Swarm

source

fn validators_mut<'a>( &'a mut self ) -> Box<dyn Iterator<Item = &'a mut dyn Validator> + 'a>

Returns an Iterator of mutable references to all the Validators in the Swarm

source

fn validator(&self, id: PeerId) -> Option<&dyn Validator>

Returns a reference to the Validator with the provided PeerId

source

fn validator_mut(&mut self, id: PeerId) -> Option<&mut dyn Validator>

Returns a mutable reference to the Validator with the provided PeerId

source

fn upgrade_validator(&mut self, id: PeerId, version: &Version) -> Result<()>

Upgrade a Validator to run specified Version

source

fn full_nodes<'a>(&'a self) -> Box<dyn Iterator<Item = &'a dyn FullNode> + 'a>

Returns an Iterator of references to all the FullNodes in the Swarm

source

fn full_nodes_mut<'a>( &'a mut self ) -> Box<dyn Iterator<Item = &'a mut dyn FullNode> + 'a>

Returns an Iterator of mutable references to all the FullNodes in the Swarm

source

fn full_node(&self, id: PeerId) -> Option<&dyn FullNode>

Returns a reference to the FullNode with the provided PeerId

source

fn full_node_mut(&mut self, id: PeerId) -> Option<&mut dyn FullNode>

Returns a mutable reference to the FullNode with the provided PeerId

source

fn add_validator( &mut self, version: &Version, template: NodeConfig ) -> Result<PeerId>

Adds a Validator to the swarm with the provided PeerId

source

fn remove_validator(&mut self, id: PeerId) -> Result<()>

Removes the Validator with the provided PeerId

source

fn add_full_node( &mut self, version: &Version, template: NodeConfig ) -> Result<PeerId>

Adds a FullNode to the swarm with the provided PeerId

source

fn remove_full_node(&mut self, id: PeerId) -> Result<()>

Removes the FullNode with the provided PeerId

source

fn versions<'a>(&'a self) -> Box<dyn Iterator<Item = Version> + 'a>

Return a list of supported Versions

source

fn chain_info(&mut self) -> ChainInfo<'_>

Construct a ChainInfo from this Swarm

source

fn logs_location(&mut self) -> String

Implementors§