pub trait NodeSessionManager {
    type Error: Display;

    // Required methods
    fn spawn_authority_task_for_session<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session: SessionId,
        node_id: NodeIndex,
        backup: (Box<dyn Write + Send + Sync>, Box<dyn Read + Send + Sync>),
        authorities: &'life1 [AuthorityId]
    ) -> Pin<Box<dyn Future<Output = AuthorityTask> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn early_start_validator_session(
        &self,
        session: SessionId,
        node_id: NodeIndex,
        authorities: &[AuthorityId]
    ) -> Result<(), Self::Error>;
    fn start_nonvalidator_session(
        &self,
        session: SessionId,
        authorities: &[AuthorityId]
    ) -> Result<(), Self::Error>;
    fn stop_session(&self, session: SessionId) -> Result<(), Self::Error>;
    fn node_idx(&self, authorities: &[AuthorityId]) -> Option<NodeIndex>;
}
Expand description

Abstraction over session related tasks.

Required Associated Types§

Required Methods§

source

fn spawn_authority_task_for_session<'life0, 'life1, 'async_trait>( &'life0 self, session: SessionId, node_id: NodeIndex, backup: (Box<dyn Write + Send + Sync>, Box<dyn Read + Send + Sync>), authorities: &'life1 [AuthorityId] ) -> Pin<Box<dyn Future<Output = AuthorityTask> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Spawns every task needed for an authority to run in a session.

source

fn early_start_validator_session( &self, session: SessionId, node_id: NodeIndex, authorities: &[AuthorityId] ) -> Result<(), Self::Error>

Prepare validator session.

source

fn start_nonvalidator_session( &self, session: SessionId, authorities: &[AuthorityId] ) -> Result<(), Self::Error>

Starts nonvalidator session.

source

fn stop_session(&self, session: SessionId) -> Result<(), Self::Error>

Terminates the session.

source

fn node_idx(&self, authorities: &[AuthorityId]) -> Option<NodeIndex>

Returns idx of the node if it is in the authority set, None otherwise

Implementors§

source§

impl<C, SC, B, RB, BE, SM, JS> NodeSessionManager for NodeSessionManagerImpl<C, SC, B, RB, BE, SM, JS>
where B: BlockT<Hash = BlockHash>, B::Header: HeaderT<Number = BlockNumber>, C: ClientForPhron<B, BE> + Send + Sync + 'static, C::Api: PhronSessionApi<B>, BE: Backend<B> + 'static, SC: SelectChain<B> + 'static, RB: RequestBlocks, SM: SessionManager<VersionedEitherMessage<Split<NetworkData<HashWrapper<BlakeTwo256>, PhronData, Signature, SignatureSet<Signature>>, RmcNetworkData<BlockHash, Signature, SignatureSet<Signature>>>, Split<NetworkData<HashWrapper<BlakeTwo256>, PhronData, Signature, SignatureSet<Signature>>, RmcNetworkData<BlockHash, Signature, SignatureSet<Signature>>>>>, JS: JustificationSubmissions<Justification> + Send + Sync + Clone + 'static,

§

type Error = <SM as SessionManager<VersionedEitherMessage<Split<NetworkData<Wrapper<BlakeTwo256>, PhronData, Signature, SignatureSet<Signature>>, Message<SignableHash<<Header<u32, BlakeTwo256> as Header>::Hash>, Signature, SignatureSet<Signature>>>, Split<NetworkData<Wrapper<BlakeTwo256>, PhronData, Signature, SignatureSet<Signature>>, Message<SignableHash<<Header<u32, BlakeTwo256> as Header>::Hash>, Signature, SignatureSet<Signature>>>>>>::Error