Trait frame_support::traits::ChangeMembers
source · pub trait ChangeMembers<AccountId: Clone + Ord> {
// Required method
fn change_members_sorted(
incoming: &[AccountId],
outgoing: &[AccountId],
sorted_new: &[AccountId]
);
// Provided methods
fn change_members(
incoming: &[AccountId],
outgoing: &[AccountId],
new: Vec<AccountId>
) { ... }
fn set_members_sorted(new_members: &[AccountId], old_members: &[AccountId]) { ... }
fn compute_members_diff_sorted(
new_members: &[AccountId],
old_members: &[AccountId]
) -> (Vec<AccountId>, Vec<AccountId>) { ... }
fn set_prime(_prime: Option<AccountId>) { ... }
fn get_prime() -> Option<AccountId> { ... }
}
Expand description
Trait for type that can handle incremental changes to a set of account IDs.
Required Methods§
sourcefn change_members_sorted(
incoming: &[AccountId],
outgoing: &[AccountId],
sorted_new: &[AccountId]
)
fn change_members_sorted( incoming: &[AccountId], outgoing: &[AccountId], sorted_new: &[AccountId] )
A number of members _incoming
just joined the set and replaced some _outgoing
ones. The
new set is thus given by sorted_new
and must be sorted.
NOTE: This is the only function that needs to be implemented in ChangeMembers
.
This resets any previous value of prime.
Provided Methods§
sourcefn change_members(
incoming: &[AccountId],
outgoing: &[AccountId],
new: Vec<AccountId>
)
fn change_members( incoming: &[AccountId], outgoing: &[AccountId], new: Vec<AccountId> )
A number of members incoming
just joined the set and replaced some outgoing
ones. The
new set is given by new
, and need not be sorted.
This resets any previous value of prime.
sourcefn set_members_sorted(new_members: &[AccountId], old_members: &[AccountId])
fn set_members_sorted(new_members: &[AccountId], old_members: &[AccountId])
Set the new members; they must already be sorted. This will compute the diff and use it
to call change_members_sorted
.
This resets any previous value of prime.
sourcefn compute_members_diff_sorted(
new_members: &[AccountId],
old_members: &[AccountId]
) -> (Vec<AccountId>, Vec<AccountId>)
fn compute_members_diff_sorted( new_members: &[AccountId], old_members: &[AccountId] ) -> (Vec<AccountId>, Vec<AccountId>)
Compute diff between new and old members; they must already be sorted.
Returns incoming and outgoing members.