Trait StateSynchronizer

Source
pub trait StateSynchronizer:
    Send
    + Sync
    + 'static {
    // Required methods
    fn initialize<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = SyncResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn start<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = SyncResult<(JoinHandle<SyncResult<()>>, Receiver<StateSyncMessage<BlockHeader>>)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn close<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = SyncResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

StateSynchronizer

Used to synchronize the state of a single protocol. The synchronizer is responsible for delivering messages to the client that let him reconstruct subsets of the protocol state.

This involves deciding which components to track according to the clients preferences, retrieving & emitting snapshots of components which the client has not seen yet and subsequently delivering delta messages for the components that have changed.

Required Methods§

Source

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

Source

fn start<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = SyncResult<(JoinHandle<SyncResult<()>>, Receiver<StateSyncMessage<BlockHeader>>)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Starts the state synchronization.

Source

fn close<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = SyncResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Ends the synchronization loop.

Implementors§

Source§

impl<R, D> StateSynchronizer for ProtocolStateSynchronizer<R, D>
where R: RPCClient + Clone + Send + Sync + 'static, D: DeltasClient + Clone + Send + Sync + 'static,