referrerpolicy=no-referrer-when-downgrade
pub trait EstimateNextSessionRotation<BlockNumber> {
    // Required methods
    fn average_session_length() -> BlockNumber;
    fn estimate_current_session_progress(
        now: BlockNumber,
    ) -> (Option<Permill>, Weight);
    fn estimate_next_session_rotation(
        now: BlockNumber,
    ) -> (Option<BlockNumber>, Weight);
}
Expand description

Something that can estimate at which block the next session rotation will happen (i.e. a new session starts).

The accuracy of the estimates is dependent on the specific implementation, but in order to get the best estimate possible these methods should be called throughout the duration of the session (rather than calling once and storing the result).

This should be the same logical unit that dictates ShouldEndSession to the session module. No assumptions are made about the scheduling of the sessions.

Required Methods§

source

fn average_session_length() -> BlockNumber

Return the average length of a session.

This may or may not be accurate.

source

fn estimate_current_session_progress( now: BlockNumber, ) -> (Option<Permill>, Weight)

Return an estimate of the current session progress.

None should be returned if the estimation fails to come to an answer.

source

fn estimate_next_session_rotation( now: BlockNumber, ) -> (Option<BlockNumber>, Weight)

Return the block number at which the next session rotation is estimated to happen.

None should be returned if the estimation fails to come to an answer.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<BlockNumber: Zero> EstimateNextSessionRotation<BlockNumber> for ()

source§

fn average_session_length() -> BlockNumber

source§

fn estimate_current_session_progress( _: BlockNumber, ) -> (Option<Permill>, Weight)

source§

fn estimate_next_session_rotation( _: BlockNumber, ) -> (Option<BlockNumber>, Weight)

Implementors§