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§

source

type AccountId

The account identifier type.

source

type BlockNumber

The block number type.

source

type Error: Debug

The error type that is returned by the provider.

source

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.

source

type DataProvider: ElectionDataProvider<AccountId = Self::AccountId, BlockNumber = Self::BlockNumber>

The data provider of the election.

Provided Methods§

source

fn desired_targets_checked() -> Result<u32>

checked call to Self::DataProvider::desired_targets() ensuring the value never exceeds Self::MaxWinners.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<AccountId, BlockNumber, DataProvider, MaxWinners> ElectionProviderBase for NoElection<(AccountId, BlockNumber, DataProvider, MaxWinners)>
where DataProvider: ElectionDataProvider<AccountId = AccountId, BlockNumber = BlockNumber>, MaxWinners: Get<u32>,

§

type AccountId = AccountId

§

type BlockNumber = BlockNumber

§

type Error = &'static str

§

type MaxWinners = MaxWinners

§

type DataProvider = DataProvider

source§

impl<T: Config> ElectionProviderBase for OnChainExecution<T>

§

type AccountId = <<T as Config>::System as Config>::AccountId

§

type BlockNumber = <<<<T as Config>::System as Config>::Block as HeaderProvider>::HeaderT as Header>::Number

§

type Error = Error

§

type MaxWinners = <T as Config>::MaxWinners

§

type DataProvider = <T as Config>::DataProvider