referrerpolicy=no-referrer-when-downgrade
frame_election_provider_support

Trait ElectionProvider

Source
pub trait ElectionProvider: ElectionProviderBase {
    // Required methods
    fn ongoing() -> bool;
    fn elect() -> Result<BoundedSupportsOf<Self>, Self::Error>;
}
Expand description

Elect a new set of winners, bounded by MaxWinners.

It must always use ElectionProviderBase::DataProvider to fetch the data it needs.

This election provider that could function asynchronously. This implies that this election might needs data ahead of time (ergo, receives no arguments to elect), and might be ongoing at times.

Required Methods§

Source

fn ongoing() -> bool

Indicate if this election provider is currently ongoing an asynchronous election or not.

Source

fn elect() -> Result<BoundedSupportsOf<Self>, Self::Error>

Performs the election. This should be implemented as a self-weighing function. The implementor should register its appropriate weight at the end of execution with the system pallet directly.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

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

Source§

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