pub trait MembershipPersistence:
Send
+ Sync
+ 'static {
// Required methods
fn load_stake<'life0, 'async_trait>(
&'life0 self,
epoch: EpochNumber,
) -> Pin<Box<dyn Future<Output = Result<Option<IndexMap<Address, Validator<BLSPubKey>>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn load_latest_stake<'life0, 'async_trait>(
&'life0 self,
limit: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<IndexedStake>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn store_stake<'life0, 'async_trait>(
&'life0 self,
epoch: EpochNumber,
stake: IndexMap<Address, Validator<BLSPubKey>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn store_events<'life0, 'async_trait>(
&'life0 self,
l1_block: u64,
events: Vec<(EventKey, StakeTableEvent)>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn load_events<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<(u64, Vec<(EventKey, StakeTableEvent)>)>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Trait used by Memberships
implementations to interact with persistence layer.
Required Methods§
Sourcefn load_stake<'life0, 'async_trait>(
&'life0 self,
epoch: EpochNumber,
) -> Pin<Box<dyn Future<Output = Result<Option<IndexMap<Address, Validator<BLSPubKey>>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_stake<'life0, 'async_trait>(
&'life0 self,
epoch: EpochNumber,
) -> Pin<Box<dyn Future<Output = Result<Option<IndexMap<Address, Validator<BLSPubKey>>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load stake table for epoch from storage
Sourcefn load_latest_stake<'life0, 'async_trait>(
&'life0 self,
limit: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<IndexedStake>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_latest_stake<'life0, 'async_trait>(
&'life0 self,
limit: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<IndexedStake>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load stake tables for storage for latest n
known epochs
Sourcefn store_stake<'life0, 'async_trait>(
&'life0 self,
epoch: EpochNumber,
stake: IndexMap<Address, Validator<BLSPubKey>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn store_stake<'life0, 'async_trait>(
&'life0 self,
epoch: EpochNumber,
stake: IndexMap<Address, Validator<BLSPubKey>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Store stake table at epoch
in the persistence layer