pub trait Swarm: Sync {
Show 17 methods
fn health_check<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
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
Performs a health check on the entire swarm, ensuring all Nodes are Live and that no forks have occurred
fn 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
fn 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
Returns a reference to the Validator with the provided PeerId
fn 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
fn 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
fn 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
fn 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
Returns a reference to the FullNode with the provided PeerId
fn 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
fn 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
fn remove_validator(&mut self, id: PeerId) -> Result<()>
fn remove_validator(&mut self, id: PeerId) -> Result<()>
Removes the Validator with the provided PeerId
fn 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
fn remove_full_node(&mut self, id: PeerId) -> Result<()>
fn remove_full_node(&mut self, id: PeerId) -> Result<()>
Removes the FullNode with the provided PeerId
Return a list of supported Versions
fn chain_info(&mut self) -> ChainInfo<'_>
fn chain_info(&mut self) -> ChainInfo<'_>
Construct a ChainInfo from this Swarm