Trait SequencerPersistence

Source
pub trait SequencerPersistence:
    Sized
    + Send
    + Sync
    + Clone
    + 'static {
Show 35 methods // Required methods fn load_config<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<NetworkConfig>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn save_config<'life0, 'life1, 'async_trait>( &'life0 self, cfg: &'life1 NetworkConfig, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn load_latest_acted_view<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<ViewNumber>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn load_quorum_proposals<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<ViewNumber, Proposal<SeqTypes, QuorumProposalWrapper<SeqTypes>>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn load_quorum_proposal<'life0, 'async_trait>( &'life0 self, view: ViewNumber, ) -> Pin<Box<dyn Future<Output = Result<Proposal<SeqTypes, QuorumProposalWrapper<SeqTypes>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn load_vid_share<'life0, 'async_trait>( &'life0 self, view: ViewNumber, ) -> Pin<Box<dyn Future<Output = Result<Option<Proposal<SeqTypes, VidDisperseShare<SeqTypes>>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn load_da_proposal<'life0, 'async_trait>( &'life0 self, view: ViewNumber, ) -> Pin<Box<dyn Future<Output = Result<Option<Proposal<SeqTypes, DaProposal2<SeqTypes>>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn load_upgrade_certificate<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<UpgradeCertificate<SeqTypes>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn load_start_epoch_info<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<InitializerEpochInfo<SeqTypes>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn load_state_cert<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<LightClientStateUpdateCertificate<SeqTypes>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn append_decided_leaves<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, decided_view: ViewNumber, leaf_chain: impl 'async_trait + IntoIterator<Item = (&'life1 LeafInfo<SeqTypes>, QuorumCertificate2<SeqTypes>)> + Send, consumer: &'life2 (impl 'async_trait + EventConsumer + 'static), ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn load_anchor_leaf<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<(Leaf2, QuorumCertificate2<SeqTypes>)>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn append_vid<'life0, 'life1, 'async_trait>( &'life0 self, proposal: &'life1 Proposal<SeqTypes, ADVZDisperseShare<SeqTypes>>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn append_vid2<'life0, 'life1, 'async_trait>( &'life0 self, proposal: &'life1 Proposal<SeqTypes, VidDisperseShare2<SeqTypes>>, ) -> 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<SeqTypes, DaProposal<SeqTypes>>, vid_commit: VidCommitment, ) -> 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: ViewNumber, epoch: Option<EpochNumber>, action: HotShotAction, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn append_quorum_proposal2<'life0, 'life1, 'async_trait>( &'life0 self, proposal: &'life1 Proposal<SeqTypes, QuorumProposalWrapper<SeqTypes>>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn store_upgrade_certificate<'life0, 'async_trait>( &'life0 self, decided_upgrade_certificate: Option<UpgradeCertificate<SeqTypes>>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn migrate_anchor_leaf<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn migrate_da_proposals<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn migrate_vid_shares<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn migrate_quorum_proposals<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn migrate_quorum_certificates<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn store_next_epoch_quorum_certificate<'life0, 'async_trait>( &'life0 self, high_qc: NextEpochQuorumCertificate2<SeqTypes>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn load_next_epoch_quorum_certificate<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<NextEpochQuorumCertificate2<SeqTypes>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn append_da2<'life0, 'life1, 'async_trait>( &'life0 self, proposal: &'life1 Proposal<SeqTypes, DaProposal2<SeqTypes>>, vid_commit: VidCommitment, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn add_drb_result<'life0, 'async_trait>( &'life0 self, epoch: <SeqTypes as NodeType>::Epoch, drb_result: DrbResult, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn add_epoch_root<'life0, 'async_trait>( &'life0 self, epoch: <SeqTypes as NodeType>::Epoch, block_header: <SeqTypes as NodeType>::BlockHeader, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn add_state_cert<'life0, 'async_trait>( &'life0 self, state_cert: LightClientStateUpdateCertificate<SeqTypes>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided methods fn into_catchup_provider( self, _backoff: BackoffParams, ) -> Result<Arc<dyn StateCatchup>> { ... } fn load_consensus_state<'life0, 'async_trait, V>( &'life0 self, state: NodeState, ) -> Pin<Box<dyn Future<Output = Result<(HotShotInitializer<SeqTypes>, Option<ViewNumber>)>> + Send + 'async_trait>> where V: 'async_trait + Versions, Self: 'async_trait, 'life0: 'async_trait { ... } fn handle_event<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, event: &'life1 Event, consumer: &'life2 (impl 'async_trait + EventConsumer + 'static), ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn migrate_consensus<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn load_anchor_view<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ViewNumber>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn append_proposal2<'life0, 'life1, 'async_trait>( &'life0 self, proposal: &'life1 Proposal<SeqTypes, QuorumProposalWrapper<SeqTypes>>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... }
}

Required Methods§

Source

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

Load the orchestrator config from storage.

Returns None if no config exists (we are joining a network for the first time). Fails with Err if it could not be determined whether a config exists or not.

Source

fn save_config<'life0, 'life1, 'async_trait>( &'life0 self, cfg: &'life1 NetworkConfig, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Save the orchestrator config to storage.

Source

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

Load the highest view saved with save_voted_view.

Source

fn load_quorum_proposals<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<ViewNumber, Proposal<SeqTypes, QuorumProposalWrapper<SeqTypes>>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load the proposals saved by consensus

Source

fn load_quorum_proposal<'life0, 'async_trait>( &'life0 self, view: ViewNumber, ) -> Pin<Box<dyn Future<Output = Result<Proposal<SeqTypes, QuorumProposalWrapper<SeqTypes>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn load_vid_share<'life0, 'async_trait>( &'life0 self, view: ViewNumber, ) -> Pin<Box<dyn Future<Output = Result<Option<Proposal<SeqTypes, VidDisperseShare<SeqTypes>>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn load_da_proposal<'life0, 'async_trait>( &'life0 self, view: ViewNumber, ) -> Pin<Box<dyn Future<Output = Result<Option<Proposal<SeqTypes, DaProposal2<SeqTypes>>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

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

Source

fn load_start_epoch_info<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<InitializerEpochInfo<SeqTypes>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn load_state_cert<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<LightClientStateUpdateCertificate<SeqTypes>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn append_decided_leaves<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, decided_view: ViewNumber, leaf_chain: impl 'async_trait + IntoIterator<Item = (&'life1 LeafInfo<SeqTypes>, QuorumCertificate2<SeqTypes>)> + Send, consumer: &'life2 (impl 'async_trait + EventConsumer + 'static), ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Append decided leaves to persistent storage and emit a corresponding event.

consumer will be sent a Decide event containing all decided leaves in persistent storage up to and including view. If available in persistent storage, full block payloads and VID info will also be included for each leaf.

Once the new decided leaves have been processed, old data up to view will be garbage collected The consumer’s handling of this event is a prerequisite for the completion of garbage collection: if the consumer fails to process the event, no data is deleted. This ensures that, if called repeatedly, all decided leaves ever recorded in consensus storage will eventually be passed to the consumer.

Note that the converse is not true: if garbage collection fails, it is not guaranteed that the consumer hasn’t processed the decide event. Thus, in rare cases, some events may be processed twice, or the consumer may get two events which share a subset of their data. Thus, it is the consumer’s responsibility to make sure its handling of each leaf is idempotent.

If the consumer fails to handle the new decide event, it may be retried, or simply postponed until the next decide, at which point all persisted leaves from the failed GC run will be included in the event along with subsequently decided leaves.

This functionality is useful for keeping a separate view of the blockchain in sync with the consensus storage. For example, the consumer could be used for moving data from consensus storage to long-term archival storage.

Source

fn load_anchor_leaf<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<(Leaf2, QuorumCertificate2<SeqTypes>)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

fn load_next_epoch_quorum_certificate<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<NextEpochQuorumCertificate2<SeqTypes>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn append_da2<'life0, 'life1, 'async_trait>( &'life0 self, proposal: &'life1 Proposal<SeqTypes, DaProposal2<SeqTypes>>, vid_commit: VidCommitment, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn add_drb_result<'life0, 'async_trait>( &'life0 self, epoch: <SeqTypes as NodeType>::Epoch, drb_result: DrbResult, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn add_epoch_root<'life0, 'async_trait>( &'life0 self, epoch: <SeqTypes as NodeType>::Epoch, block_header: <SeqTypes as NodeType>::BlockHeader, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn add_state_cert<'life0, 'async_trait>( &'life0 self, state_cert: LightClientStateUpdateCertificate<SeqTypes>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Source

fn into_catchup_provider( self, _backoff: BackoffParams, ) -> Result<Arc<dyn StateCatchup>>

Use this storage as a state catchup backend, if supported.

Source

fn load_consensus_state<'life0, 'async_trait, V>( &'life0 self, state: NodeState, ) -> Pin<Box<dyn Future<Output = Result<(HotShotInitializer<SeqTypes>, Option<ViewNumber>)>> + Send + 'async_trait>>
where V: 'async_trait + Versions, Self: 'async_trait, 'life0: 'async_trait,

Load the latest known consensus state.

Returns an initializer to resume HotShot from the latest saved state (or start from genesis, if there is no saved state). Also returns the anchor view number, which can be used as a reference point to process any events which were not processed before a previous shutdown, if applicable,.

Source

fn handle_event<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, event: &'life1 Event, consumer: &'life2 (impl 'async_trait + EventConsumer + 'static), ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Update storage based on an event from consensus.

Source

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

Source

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

Source

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

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.

Implementors§