pub trait InstantElectionProvider: ElectionProvider {
fn elect_with_bounds(
max_voters: usize,
max_targets: usize
) -> Result<Supports<Self::AccountId>, Self::Error>;
}
Expand description
A sub-trait of the ElectionProvider
for cases where we need to be sure an election needs to
happen instantly, not asynchronously.
The same DataProvider
is assumed to be used.
Consequently, allows for control over the amount of data that is being fetched from the
ElectionProvider::DataProvider
.
Required Methods§
sourcefn elect_with_bounds(
max_voters: usize,
max_targets: usize
) -> Result<Supports<Self::AccountId>, Self::Error>
fn elect_with_bounds(
max_voters: usize,
max_targets: usize
) -> Result<Supports<Self::AccountId>, Self::Error>
Elect a new set of winners, but unlike ElectionProvider::elect
which cannot enforce
bounds, this trait method can enforce bounds on the amount of data provided by the
DataProvider
.
An implementing type, if itself bounded, should choose the minimum of the two bounds to
choose the final value of max_voters
and max_targets
. In other words, an implementation
should guarantee that max_voter
and max_targets
provided to this method are absolutely
respected.