Trait hotshot_types::traits::storage::Storage

source ·
pub trait Storage<TYPES: NodeType>:
    Send
    + Sync
    + Clone {
    // Required methods
    fn append_vid<'life0, 'life1, 'async_trait>(
        &'life0 self,
        proposal: &'life1 Proposal<TYPES, VidDisperseShare<TYPES>>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn append_da<'life0, 'life1, 'async_trait>(
        &'life0 self,
        proposal: &'life1 Proposal<TYPES, DaProposal<TYPES>>,
        vid_commit: <VidSchemeType as VidScheme>::Commit,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn append_proposal<'life0, 'life1, 'async_trait>(
        &'life0 self,
        proposal: &'life1 Proposal<TYPES, QuorumProposal<TYPES>>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn append_proposal2<'life0, 'life1, 'async_trait>(
        &'life0 self,
        proposal: &'life1 Proposal<TYPES, QuorumProposal2<TYPES>>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn record_action<'life0, 'async_trait>(
        &'life0 self,
        view: TYPES::View,
        action: HotShotAction,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_high_qc<'life0, 'async_trait>(
        &'life0 self,
        high_qc: QuorumCertificate<TYPES>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_high_qc2<'life0, 'async_trait>(
        &'life0 self,
        high_qc: QuorumCertificate2<TYPES>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_undecided_state<'life0, 'async_trait>(
        &'life0 self,
        leaves: CommitmentMap<Leaf<TYPES>>,
        state: BTreeMap<TYPES::View, View<TYPES>>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_undecided_state2<'life0, 'async_trait>(
        &'life0 self,
        leaves: CommitmentMap<Leaf2<TYPES>>,
        state: BTreeMap<TYPES::View, View<TYPES>>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_decided_upgrade_certificate<'life0, 'async_trait>(
        &'life0 self,
        decided_upgrade_certificate: Option<UpgradeCertificate<TYPES>>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn migrate_consensus<'life0, 'async_trait>(
        &'life0 self,
        convert_leaf: fn(_: Leaf<TYPES>) -> Leaf2<TYPES>,
        convert_proposal: fn(_: Proposal<TYPES, QuorumProposal<TYPES>>) -> Proposal<TYPES, QuorumProposal2<TYPES>>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Abstraction for storing a variety of consensus payload datum.

Required Methods§

source

fn append_vid<'life0, 'life1, 'async_trait>( &'life0 self, proposal: &'life1 Proposal<TYPES, VidDisperseShare<TYPES>>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Add a proposal to the stored VID proposals.

source

fn append_da<'life0, 'life1, 'async_trait>( &'life0 self, proposal: &'life1 Proposal<TYPES, DaProposal<TYPES>>, vid_commit: <VidSchemeType as VidScheme>::Commit, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Add a proposal to the stored DA proposals.

source

fn append_proposal<'life0, 'life1, 'async_trait>( &'life0 self, proposal: &'life1 Proposal<TYPES, QuorumProposal<TYPES>>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Add a proposal we sent to the store

source

fn append_proposal2<'life0, 'life1, 'async_trait>( &'life0 self, proposal: &'life1 Proposal<TYPES, QuorumProposal2<TYPES>>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Add a proposal we sent to the store

source

fn record_action<'life0, 'async_trait>( &'life0 self, view: TYPES::View, action: HotShotAction, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Record a HotShotAction taken.

source

fn update_high_qc<'life0, 'async_trait>( &'life0 self, high_qc: QuorumCertificate<TYPES>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update the current high QC in storage.

source

fn update_high_qc2<'life0, 'async_trait>( &'life0 self, high_qc: QuorumCertificate2<TYPES>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update the current high QC in storage.

source

fn update_undecided_state<'life0, 'async_trait>( &'life0 self, leaves: CommitmentMap<Leaf<TYPES>>, state: BTreeMap<TYPES::View, View<TYPES>>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update the currently undecided state of consensus. This includes the undecided leaf chain, and the undecided state.

source

fn update_undecided_state2<'life0, 'async_trait>( &'life0 self, leaves: CommitmentMap<Leaf2<TYPES>>, state: BTreeMap<TYPES::View, View<TYPES>>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update the currently undecided state of consensus. This includes the undecided leaf chain, and the undecided state.

source

fn update_decided_upgrade_certificate<'life0, 'async_trait>( &'life0 self, decided_upgrade_certificate: Option<UpgradeCertificate<TYPES>>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Upgrade the current decided upgrade certificate in storage.

source

fn migrate_consensus<'life0, 'async_trait>( &'life0 self, convert_leaf: fn(_: Leaf<TYPES>) -> Leaf2<TYPES>, convert_proposal: fn(_: Proposal<TYPES, QuorumProposal<TYPES>>) -> Proposal<TYPES, QuorumProposal2<TYPES>>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Migrate leaves from Leaf to Leaf2, and proposals from QuorumProposal to QuorumProposal2

Object Safety§

This trait is not object safe.

Implementors§