Function run_session

Source
pub async fn run_session<DP: DataProvider, UFH: UnitFinalizationHandler<Data = DP::Output>, US: AsyncWrite + Send + Sync + 'static, UL: AsyncRead + Send + Sync + 'static, N: Network<NetworkData<UFH::Hasher, DP::Output, MK::Signature, MK::PartialMultisignature>>, SH: SpawnHandle, MK: MultiKeychain>(
    config: Config,
    local_io: LocalIO<DP, UFH, US, UL>,
    network: N,
    keychain: MK,
    spawn_handle: SH,
    terminator: Terminator,
)
Expand description

Starts the consensus algorithm as an async task. It stops establishing consensus for new data items after reaching the threshold specified in Config::max_round or upon receiving a stop signal from exit. For a detailed description of the consensus implemented by run_session see docs for devs or the original paper.

Please note that in order to fulfill the constraint [UnitFinalizationHandler<Data = DP::Output, Hasher = H>] it is enough to provide implementation of FinalizationHandler<DP::Output>. We provide implementation of [UnitFinalizationHandler<Data = DP::Output, Hasher = H>] for anything that satisfies the trait FinalizationHandler<DP::Output> (by means of [FinalizationHandlerAdapter]). Implementing UnitFinalizationHandler directly is considered less stable since it exposes intrisics which might be subject to change. Implement FinalizationHandler<DP::Output> instead, unless you absolutely know what you are doing.