Trait pallet_session::SessionHandler
source · pub trait SessionHandler<ValidatorId> {
const KEY_TYPE_IDS: &'static [KeyTypeId];
// Required methods
fn on_genesis_session<Ks: OpaqueKeys>(validators: &[(ValidatorId, Ks)]);
fn on_new_session<Ks: OpaqueKeys>(
changed: bool,
validators: &[(ValidatorId, Ks)],
queued_validators: &[(ValidatorId, Ks)]
);
fn on_disabled(validator_index: u32);
// Provided method
fn on_before_session_ending() { ... }
}
Expand description
Handler for session life cycle events.
Required Associated Constants§
sourceconst KEY_TYPE_IDS: &'static [KeyTypeId]
const KEY_TYPE_IDS: &'static [KeyTypeId]
All the key type ids this session handler can process.
The order must be the same as it expects them in
on_new_session
and
on_genesis_session
.
Required Methods§
sourcefn on_genesis_session<Ks: OpaqueKeys>(validators: &[(ValidatorId, Ks)])
fn on_genesis_session<Ks: OpaqueKeys>(validators: &[(ValidatorId, Ks)])
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.
sourcefn on_new_session<Ks: OpaqueKeys>(
changed: bool,
validators: &[(ValidatorId, Ks)],
queued_validators: &[(ValidatorId, Ks)]
)
fn on_new_session<Ks: OpaqueKeys>( changed: bool, validators: &[(ValidatorId, Ks)], queued_validators: &[(ValidatorId, Ks)] )
Session set has changed; act appropriately. Note that this can be called before initialization of your pallet.
changed
is true whenever any of the session keys or underlying economic
identities or weightings behind those keys has changed.
sourcefn on_disabled(validator_index: u32)
fn on_disabled(validator_index: u32)
A validator got disabled. Act accordingly until a new session begins.
Provided Methods§
sourcefn 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.