mithril_persistence/store/
stake_store.rs

1use async_trait::async_trait;
2use mithril_common::{
3    entities::{Epoch, StakeDistribution},
4    StdResult,
5};
6
7/// Represent a way to store the stake of mithril party members.
8#[async_trait]
9pub trait StakeStorer: Sync + Send {
10    /// Save the stakes in the store for a given `epoch`.
11    async fn save_stakes(
12        &self,
13        epoch: Epoch,
14        stakes: StakeDistribution,
15    ) -> StdResult<Option<StakeDistribution>>;
16
17    /// Get the stakes of all party at a given `epoch`.
18    async fn get_stakes(&self, epoch: Epoch) -> StdResult<Option<StakeDistribution>>;
19}