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<StakeTuple>>> + 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 load_drb_result<'life0, 'async_trait>(
&'life0 self,
epoch: EpochNumber,
) -> Pin<Box<dyn Future<Output = Result<Option<DrbResult>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn load_epoch_root<'life0, 'async_trait>(
&'life0 self,
epoch: EpochNumber,
) -> Pin<Box<dyn Future<Output = Result<Option<Header>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn store_epoch_root<'life0, 'async_trait>(
&'life0 self,
epoch: EpochNumber,
block_header: Header,
) -> 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: AuthenticatedValidatorMap,
block_reward: Option<RewardAmount>,
stake_table_hash: Option<StakeTableHash>,
) -> 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_finalized: 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,
from_l1_block: u64,
l1_finalized: u64,
) -> Pin<Box<dyn Future<Output = Result<(Option<EventsPersistenceRead>, Vec<(EventKey, StakeTableEvent)>)>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete_stake_tables<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn store_all_validators<'life0, 'async_trait>(
&'life0 self,
epoch: EpochNumber,
all_validators: IndexMap<Address, RegisteredValidator<PubKey>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn load_all_validators<'life0, 'async_trait>(
&'life0 self,
epoch: EpochNumber,
offset: u64,
limit: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<RegisteredValidator<PubKey>>>> + 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<StakeTuple>>> + 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<StakeTuple>>> + 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 load_drb_result<'life0, 'async_trait>(
&'life0 self,
epoch: EpochNumber,
) -> Pin<Box<dyn Future<Output = Result<Option<DrbResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_drb_result<'life0, 'async_trait>(
&'life0 self,
epoch: EpochNumber,
) -> Pin<Box<dyn Future<Output = Result<Option<DrbResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load the DRB result for epoch.
Sourcefn load_epoch_root<'life0, 'async_trait>(
&'life0 self,
epoch: EpochNumber,
) -> Pin<Box<dyn Future<Output = Result<Option<Header>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_epoch_root<'life0, 'async_trait>(
&'life0 self,
epoch: EpochNumber,
) -> Pin<Box<dyn Future<Output = Result<Option<Header>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load the epoch root block header for epoch.
Sourcefn store_epoch_root<'life0, 'async_trait>(
&'life0 self,
epoch: EpochNumber,
block_header: Header,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn store_epoch_root<'life0, 'async_trait>(
&'life0 self,
epoch: EpochNumber,
block_header: Header,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Store the epoch root block header for epoch.
Sourcefn store_stake<'life0, 'async_trait>(
&'life0 self,
epoch: EpochNumber,
stake: AuthenticatedValidatorMap,
block_reward: Option<RewardAmount>,
stake_table_hash: Option<StakeTableHash>,
) -> 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: AuthenticatedValidatorMap,
block_reward: Option<RewardAmount>,
stake_table_hash: Option<StakeTableHash>,
) -> 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
fn store_events<'life0, 'async_trait>(
&'life0 self,
l1_finalized: 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,
from_l1_block: u64,
l1_finalized: u64,
) -> Pin<Box<dyn Future<Output = Result<(Option<EventsPersistenceRead>, Vec<(EventKey, StakeTableEvent)>)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn delete_stake_tables<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_stake_tables<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete all stake table events, the L1 block tracker, and the epoch DRB and root data.
fn store_all_validators<'life0, 'async_trait>(
&'life0 self,
epoch: EpochNumber,
all_validators: IndexMap<Address, RegisteredValidator<PubKey>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_all_validators<'life0, 'async_trait>(
&'life0 self,
epoch: EpochNumber,
offset: u64,
limit: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<RegisteredValidator<PubKey>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".