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§
sourcefn health_check(&mut self) -> Result<()>
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
sourcefn validators<'a>(&'a self) -> Box<dyn Iterator<Item = &'a dyn Validator> + 'a>
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
sourcefn validators_mut<'a>(
&'a mut self
) -> Box<dyn Iterator<Item = &'a mut dyn Validator> + 'a>
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
sourcefn validator(&self, id: PeerId) -> Option<&dyn Validator>
fn validator(&self, id: PeerId) -> Option<&dyn Validator>
Returns a reference to the Validator with the provided PeerId
sourcefn validator_mut(&mut self, id: PeerId) -> Option<&mut dyn Validator>
fn validator_mut(&mut self, id: PeerId) -> Option<&mut dyn Validator>
Returns a mutable reference to the Validator with the provided PeerId
sourcefn upgrade_validator(&mut self, id: PeerId, version: &Version) -> Result<()>
fn upgrade_validator(&mut self, id: PeerId, version: &Version) -> Result<()>
Upgrade a Validator to run specified Version
sourcefn full_nodes<'a>(&'a self) -> Box<dyn Iterator<Item = &'a dyn FullNode> + 'a>
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
sourcefn full_nodes_mut<'a>(
&'a mut self
) -> Box<dyn Iterator<Item = &'a mut dyn FullNode> + 'a>
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
sourcefn full_node(&self, id: PeerId) -> Option<&dyn FullNode>
fn full_node(&self, id: PeerId) -> Option<&dyn FullNode>
Returns a reference to the FullNode with the provided PeerId
sourcefn full_node_mut(&mut self, id: PeerId) -> Option<&mut dyn FullNode>
fn full_node_mut(&mut self, id: PeerId) -> Option<&mut dyn FullNode>
Returns a mutable reference to the FullNode with the provided PeerId
sourcefn add_validator(
&mut self,
version: &Version,
template: NodeConfig
) -> Result<PeerId>
fn add_validator( &mut self, version: &Version, template: NodeConfig ) -> Result<PeerId>
Adds a Validator to the swarm with the provided PeerId
sourcefn remove_validator(&mut self, id: PeerId) -> Result<()>
fn remove_validator(&mut self, id: PeerId) -> Result<()>
Removes the Validator with the provided PeerId
sourcefn add_full_node(
&mut self,
version: &Version,
template: NodeConfig
) -> Result<PeerId>
fn add_full_node( &mut self, version: &Version, template: NodeConfig ) -> Result<PeerId>
Adds a FullNode to the swarm with the provided PeerId
sourcefn remove_full_node(&mut self, id: PeerId) -> Result<()>
fn remove_full_node(&mut self, id: PeerId) -> Result<()>
Removes the FullNode with the provided PeerId
sourcefn versions<'a>(&'a self) -> Box<dyn Iterator<Item = Version> + 'a>
fn versions<'a>(&'a self) -> Box<dyn Iterator<Item = Version> + 'a>
Return a list of supported Versions
sourcefn chain_info(&mut self) -> ChainInfo<'_>
fn chain_info(&mut self) -> ChainInfo<'_>
Construct a ChainInfo from this Swarm