pub trait ElectionProviderBase {
type AccountId;
type BlockNumber;
type Error: Debug;
type MaxWinners: Get<u32>;
type DataProvider: ElectionDataProvider<AccountId = Self::AccountId, BlockNumber = Self::BlockNumber>;
// Provided method
fn desired_targets_checked() -> Result<u32> { ... }
}
Expand description
Base trait for types that can provide election
Required Associated Types§
sourcetype BlockNumber
type BlockNumber
The block number type.
sourcetype MaxWinners: Get<u32>
type MaxWinners: Get<u32>
The upper bound on election winners that can be returned.
WARNING
when communicating with the data provider, one must ensure that
DataProvider::desired_targets
returns a value less than this bound. An
implementation can chose to either return an error and/or sort and
truncate the output to meet this bound.
sourcetype DataProvider: ElectionDataProvider<AccountId = Self::AccountId, BlockNumber = Self::BlockNumber>
type DataProvider: ElectionDataProvider<AccountId = Self::AccountId, BlockNumber = Self::BlockNumber>
The data provider of the election.
Provided Methods§
sourcefn desired_targets_checked() -> Result<u32>
fn desired_targets_checked() -> Result<u32>
checked call to Self::DataProvider::desired_targets()
ensuring the value never exceeds
Self::MaxWinners
.