DataSourceLifeCycle

Trait DataSourceLifeCycle 

Source
pub trait DataSourceLifeCycle:
    Clone
    + Send
    + Sync
    + Sized
    + 'static {
    type Storage: Send + Sync;

    // Required methods
    fn create<'async_trait>(
        node_id: usize,
    ) -> Pin<Box<dyn Future<Output = Self::Storage> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn connect<'life0, 'async_trait>(
        storage: &'life0 Self::Storage,
    ) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn reset<'life0, 'async_trait>(
        storage: &'life0 Self::Storage,
    ) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn handle_event<'life0, 'life1, 'async_trait>(
        &'life0 self,
        event: &'life1 Event<MockTypes>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn leaf_only_ds<'life0, 'async_trait>(
        _storage: &'life0 Self::Storage,
    ) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn setup<'life0, 'async_trait, V>(
        _network: &'life0 mut MockNetwork<Self, V>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where V: 'async_trait + Versions,
             Self: 'async_trait,
             'life0: 'async_trait { ... }
}

Required Associated Types§

Source

type Storage: Send + Sync

Backing storage for the data source.

This can be used to connect to data sources to the same underlying data. It must be kept alive as long as the related data sources are open.

Required Methods§

Source

fn create<'async_trait>( node_id: usize, ) -> Pin<Box<dyn Future<Output = Self::Storage> + Send + 'async_trait>>
where Self: 'async_trait,

Source

fn connect<'life0, 'async_trait>( storage: &'life0 Self::Storage, ) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn reset<'life0, 'async_trait>( storage: &'life0 Self::Storage, ) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn handle_event<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 Event<MockTypes>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

fn leaf_only_ds<'life0, 'async_trait>( _storage: &'life0 Self::Storage, ) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn setup<'life0, 'async_trait, V>( _network: &'life0 mut MockNetwork<Self, V>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where V: 'async_trait + Versions, Self: 'async_trait, 'life0: 'async_trait,

Setup runs after setting up the network but before starting a test.

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§