pub trait OneSessionHandler<ValidatorId>: BoundToRuntimeAppPublic {
type Key: Decode + RuntimeAppPublic;
// Required methods
fn on_genesis_session<'a, I>(validators: I)
where I: 'a + Iterator<Item = (&'a ValidatorId, Self::Key)>,
ValidatorId: 'a;
fn on_new_session<'a, I>(changed: bool, validators: I, queued_validators: I)
where I: 'a + Iterator<Item = (&'a ValidatorId, Self::Key)>,
ValidatorId: 'a;
fn on_disabled(_validator_index: u32);
// Provided method
fn on_before_session_ending() { ... }
}
Expand description
A session handler for specific key type.
Required Associated Types§
Required Methods§
fn on_genesis_session<'a, I>(validators: I)
fn on_genesis_session<'a, I>(validators: I)
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.
fn on_new_session<'a, I>(changed: bool, validators: I, queued_validators: I)
fn on_new_session<'a, I>(changed: bool, validators: I, queued_validators: I)
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.
fn on_disabled(_validator_index: u32)
fn on_disabled(_validator_index: u32)
A validator got disabled. Act accordingly until a new session begins.
Provided Methods§
fn on_before_session_ending()
fn on_before_session_ending()
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.