Struct noble_scored_pool::Module[][src]

pub struct Module<T: Config<I>, I: Instance = DefaultInstance>(_);

Implementations

impl<T: Config<I> + 'static, I: Instance> Module<T, I>[src]

pub fn pool(
) -> Vec<(<T as Config>::AccountId, Option<<T as Config<I>>::Score>)>
[src]

The current pool of candidates, stored as an ordered Vec (ordered descending by score, None last, highest first).

pub fn candidate_exists<K: EncodeLike<T::AccountId>>(key: K) -> bool[src]

A Map of the candidates. The information in this Map is redundant to the information in the Pool. But the Map enables us to easily check if a candidate is already in the pool, without having to iterate over the entire pool (the Pool is not sorted by T::AccountId, but by T::Score instead).

pub fn members() -> Vec<T::AccountId>[src]

The current membership, stored as an ordered Vec.

pub fn member_count() -> u32[src]

Size of the Members set.

impl<T: Config<I>, I: Instance> Module<T, I>[src]

Can also be called using Call.

pub fn submit_candidacy(origin: T::Origin) -> DispatchResult[src]

Add origin to the pool of candidates.

This results in CandidateDeposit being reserved from the origin account. The deposit is returned once candidacy is withdrawn by the candidate or the entity is kicked by KickOrigin.

The dispatch origin of this function must be signed.

The index parameter of this function must be set to the index of the transactor in the Pool.

NOTE: Calling this function will bypass origin filters.

pub fn withdraw_candidacy(origin: T::Origin, index: u32) -> DispatchResult[src]

An entity withdraws candidacy and gets its deposit back.

If the entity is part of the Members, then the highest member of the Pool that is not currently in Members is immediately placed in the set instead.

The dispatch origin of this function must be signed.

The index parameter of this function must be set to the index of the transactor in the Pool.

NOTE: Calling this function will bypass origin filters.

pub fn kick(
    origin: T::Origin,
    dest: <T::Lookup as StaticLookup>::Source,
    index: u32
) -> DispatchResult
[src]

Kick a member who from the set.

May only be called from T::KickOrigin.

The index parameter of this function must be set to the index of dest in the Pool.

NOTE: Calling this function will bypass origin filters.

pub fn score(
    origin: T::Origin,
    dest: <T::Lookup as StaticLookup>::Source,
    index: u32,
    score: T::Score
) -> DispatchResult
[src]

Score a member who with score.

May only be called from T::ScoreOrigin.

The index parameter of this function must be set to the index of the dest in the Pool.

NOTE: Calling this function will bypass origin filters.

pub fn change_member_count(origin: T::Origin, count: u32) -> DispatchResult[src]

Dispatchable call to change MemberCount.

This will only have an effect the next time a refresh happens (this happens each Period).

May only be called from root.

NOTE: Calling this function will bypass origin filters.

Trait Implementations

impl<T: Config<I>, I: Instance> Callable<T> for Module<T, I>[src]

type Call = Call<T, I>

impl<T: Clone + Config<I>, I: Clone + Instance> Clone for Module<T, I>[src]

impl<T: Copy + Config<I>, I: Copy + Instance> Copy for Module<T, I>[src]

impl<T: Config<I>, I: Instance> Debug for Module<T, I> where
    T: Debug,
    I: Debug
[src]

impl<T: Eq + Config<I>, I: Eq + Instance> Eq for Module<T, I>[src]

impl<T: Config<I>, I: Instance> GetNobleVersion for Module<T, I>[src]

impl<T: Config<I>, I: Instance> IntegrityTest for Module<T, I>[src]

impl<T: Config<I>, I: Instance> ModuleErrorMetadata for Module<T, I>[src]

impl<T: Config + Config<I>, I: Instance> OffchainWorker<<T as Config>::BlockNumber> for Module<T, I>[src]

impl<T: Config + Config<I>, I: Instance> OnFinalize<<T as Config>::BlockNumber> for Module<T, I>[src]

impl<T: Config<I>, I: Instance> OnGenesis for Module<T, I>[src]

impl<T: Config + Config<I>, I: Instance> OnInitialize<<T as Config>::BlockNumber> for Module<T, I>[src]

impl<T: Config<I>, I: Instance> OnRuntimeUpgrade for Module<T, I>[src]

impl<T: PartialEq + Config<I>, I: PartialEq + Instance> PartialEq<Module<T, I>> for Module<T, I>[src]

impl<T: Config<I>, I: Instance> StructuralEq for Module<T, I>[src]

impl<T: Config<I>, I: Instance> StructuralPartialEq for Module<T, I>[src]

Auto Trait Implementations

impl<T, I> RefUnwindSafe for Module<T, I> where
    I: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, I> Send for Module<T, I> where
    I: Send,
    T: Send

impl<T, I> Sync for Module<T, I> where
    I: Sync,
    T: Sync

impl<T, I> Unpin for Module<T, I> where
    I: Unpin,
    T: Unpin

impl<T, I> UnwindSafe for Module<T, I> where
    I: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CheckedConversion for T[src]

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Any + Send + Sync

impl<T> DynClone for T where
    T: Clone
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IsType<T> for T[src]

impl<T, Outer> IsWrappedBy<Outer> for T where
    T: From<Outer>,
    Outer: AsRef<T> + AsMut<T> + From<T>, 

pub fn from_ref(outer: &Outer) -> &T

Get a reference to the inner from the outer.

pub fn from_mut(outer: &mut Outer) -> &mut T

Get a mutable reference to the inner from the outer.

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeRefUnwindSafe for T where
    T: RefUnwindSafe

impl<T> Member for T where
    T: 'static + Send + Sync + Debug + Eq + PartialEq<T> + Clone
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SaturatedConversion for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 

impl<T, S> UniqueSaturatedInto<T> for S where
    T: Bounded,
    S: TryInto<T>, 

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,