Skip to main content

SpawnedNode

Trait SpawnedNode 

Source
pub trait SpawnedNode:
    Any
    + Serialize
    + Send
    + Sync
    + 'static {
    // Required methods
    fn core(&self) -> &NodeCore;
    fn wait_until_is_up<'life0, 'async_trait>(
        &'life0 self,
        timeout_secs: u64,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn kind(&self) -> NodeKind { ... }
    fn name(&self) -> &str { ... }
    fn is_running(&self) -> bool { ... }
    fn last_start_ts(&self) -> u64 { ... }
    fn base_dir(&self) -> &PathBuf { ... }
    fn args(&self) -> Vec<&str> { ... }
    fn logs<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn pause<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn resume<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn restart<'life0, 'async_trait>(
        &'life0 self,
        after: Option<Duration>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Behaviour shared by every node zombienet spawns, regardless of what it runs.

Implementors only need to provide core and wait_until_is_up; everything else is delegated to the NodeCore.

NOTE: this trait is deliberately dyn-compatible. Generic methods (e.g the subxt client::<Config>()) stay inherent on the concrete types — downcast with Network::get_node or Network::get_jam_node to reach them.

Required Methods§

Source

fn core(&self) -> &NodeCore

The provider handle and runtime state of this node.

Source

fn wait_until_is_up<'life0, 'async_trait>( &'life0 self, timeout_secs: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Wait until the node reports it finished booting.

How readiness is established is up to each node flavour (Prometheus scrape for substrate, log/rpc probe for JAM), which is why this has no default implementation.

Provided Methods§

Source

fn kind(&self) -> NodeKind

What flavour of node this is.

Source

fn name(&self) -> &str

Source

fn is_running(&self) -> bool

Source

fn last_start_ts(&self) -> u64

Source

fn base_dir(&self) -> &PathBuf

Source

fn args(&self) -> Vec<&str>

Source

fn logs<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn pause<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn resume<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn restart<'life0, 'async_trait>( &'life0 self, after: Option<Duration>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Trait Implementations§

Source§

impl<'erased> Serialize for dyn SpawnedNode + 'erased

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'erased> Serialize for dyn SpawnedNode + Send + 'erased

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'erased> Serialize for dyn SpawnedNode + Sync + 'erased

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'erased> Serialize for dyn SpawnedNode + Send + Sync + 'erased

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§