pub trait OneSessionHandler<ValidatorId>: BoundToRuntimeAppPublic {
    type Key: Decode + Default + RuntimeAppPublic;
    fn on_genesis_session<'a, I: 'a>(validators: I)
    where
        I: Iterator<Item = (&'a ValidatorId, Self::Key)>,
        ValidatorId: 'a
;
fn on_new_session<'a, I: 'a>(
        changed: bool,
        validators: I,
        queued_validators: I
    )
    where
        I: Iterator<Item = (&'a ValidatorId, Self::Key)>,
        ValidatorId: 'a
;
fn on_disabled(_validator_index: usize); fn on_before_session_ending() { ... } }
Expand description

A session handler for specific key type.

Associated Types

The key type expected.

Required methods

The given validator set will be used for the genesis session. It is guaranteed that the given validator set will also be used for the second session, therefore the first call to on_new_session should provide the same validator set.

Session set has changed; act appropriately. Note that this can be called before initialization of your module.

changed is true when at least one of the session keys or the underlying economic identities/distribution behind one the session keys has changed, false otherwise.

The validators are the validators of the incoming session, and queued_validators will follow.

A validator got disabled. Act accordingly until a new session begins.

Provided methods

A notification for end of the session.

Note it is triggered before any SessionManager::end_session handlers, so we can still affect the validator set.

Implementors