Trait phron_finality::party::traits::NodeSessionManager
source · 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§
Spawns every task needed for an authority to run in a session.
sourcefn early_start_validator_session(
&self,
session: SessionId,
node_id: NodeIndex,
authorities: &[AuthorityId]
) -> Result<(), Self::Error>
fn early_start_validator_session( &self, session: SessionId, node_id: NodeIndex, authorities: &[AuthorityId] ) -> Result<(), Self::Error>
Prepare validator session.
sourcefn start_nonvalidator_session(
&self,
session: SessionId,
authorities: &[AuthorityId]
) -> Result<(), Self::Error>
fn start_nonvalidator_session( &self, session: SessionId, authorities: &[AuthorityId] ) -> Result<(), Self::Error>
Starts nonvalidator session.
sourcefn node_idx(&self, authorities: &[AuthorityId]) -> Option<NodeIndex>
fn node_idx(&self, authorities: &[AuthorityId]) -> Option<NodeIndex>
Returns idx of the node if it is in the authority set, None otherwise