Trait StakeTableDataSource

Source
pub(crate) trait StakeTableDataSource<T: NodeType> {
    // Required methods
    fn get_stake_table(
        &self,
        epoch: Option<<T as NodeType>::Epoch>,
    ) -> impl Send + Future<Output = Result<Vec<PeerConfig<T>>>>;
    fn get_stake_table_current(
        &self,
    ) -> impl Send + Future<Output = Result<StakeTableWithEpochNumber<T>>>;
    fn get_validators(
        &self,
        epoch: <T as NodeType>::Epoch,
    ) -> impl Send + Future<Output = Result<IndexMap<Address, Validator<BLSPubKey>>>>;
    fn get_block_reward(
        &self,
        epoch: Option<EpochNumber>,
    ) -> impl Send + Future<Output = Result<Option<RewardAmount>>>;
    fn current_proposal_participation(
        &self,
    ) -> impl Send + Future<Output = HashMap<BLSPubKey, f64>>;
    fn previous_proposal_participation(
        &self,
    ) -> impl Send + Future<Output = HashMap<BLSPubKey, f64>>;
}

Required Methods§

Source

fn get_stake_table( &self, epoch: Option<<T as NodeType>::Epoch>, ) -> impl Send + Future<Output = Result<Vec<PeerConfig<T>>>>

Get the stake table for a given epoch

Source

fn get_stake_table_current( &self, ) -> impl Send + Future<Output = Result<StakeTableWithEpochNumber<T>>>

Get the stake table for the current epoch if not provided

Source

fn get_validators( &self, epoch: <T as NodeType>::Epoch, ) -> impl Send + Future<Output = Result<IndexMap<Address, Validator<BLSPubKey>>>>

Get all the validators

Source

fn get_block_reward( &self, epoch: Option<EpochNumber>, ) -> impl Send + Future<Output = Result<Option<RewardAmount>>>

Source

fn current_proposal_participation( &self, ) -> impl Send + Future<Output = HashMap<BLSPubKey, f64>>

Get the current proposal participation.

Source

fn previous_proposal_participation( &self, ) -> impl Send + Future<Output = HashMap<BLSPubKey, f64>>

Get the previous proposal participation.

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.

Implementations on Foreign Types§

Source§

impl<N: ConnectedNetwork<PubKey>, D: Sync, V: Versions, P: SequencerPersistence> StakeTableDataSource<SeqTypes> for ExtensibleDataSource<D, ApiState<N, P, V>>

Source§

async fn get_stake_table( &self, epoch: Option<<SeqTypes as NodeType>::Epoch>, ) -> Result<Vec<PeerConfig<SeqTypes>>>

Get the stake table for a given epoch

Source§

async fn get_stake_table_current( &self, ) -> Result<StakeTableWithEpochNumber<SeqTypes>>

Get the stake table for the current epoch if not provided

Source§

async fn get_validators( &self, epoch: <SeqTypes as NodeType>::Epoch, ) -> Result<ValidatorMap>

Get all the validators

Source§

async fn current_proposal_participation(&self) -> HashMap<PubKey, f64>

Get all the validator participation for the current epoch

Source§

async fn get_block_reward( &self, epoch: Option<EpochNumber>, ) -> Result<Option<RewardAmount>>

Source§

async fn previous_proposal_participation(&self) -> HashMap<PubKey, f64>

Implementors§