Skip to main content

CatchupStorage

Trait CatchupStorage 

Source
pub(crate) trait CatchupStorage: Sync {
    // Provided methods
    fn get_accounts(
        &self,
        _instance: &NodeState,
        _height: u64,
        _view: ViewNumber,
        _accounts: &[FeeAccount],
    ) -> impl Send + Future<Output = Result<(FeeMerkleTree, Leaf2)>> { ... }
    fn get_accounts_at(
        &self,
        _height: u64,
        _root: FeeMerkleCommitment,
        _accounts: &[FeeAccount],
    ) -> impl Send + Future<Output = Result<FeeMerkleTree>> { ... }
    fn get_reward_accounts_v1(
        &self,
        _instance: &NodeState,
        _height: u64,
        _view: ViewNumber,
        _accounts: &[RewardAccountV1],
    ) -> impl Send + Future<Output = Result<(RewardMerkleTreeV1, Leaf2)>> { ... }
    fn get_reward_accounts_v2(
        &self,
        _instance: &NodeState,
        _height: u64,
        _view: ViewNumber,
        _accounts: &[RewardAccountV2],
    ) -> impl Send + Future<Output = Result<(RewardMerkleTreeV2, Leaf2)>> { ... }
    fn get_frontier(
        &self,
        _instance: &NodeState,
        _height: u64,
        _view: ViewNumber,
    ) -> impl Send + Future<Output = Result<BlocksFrontier>> { ... }
    fn get_frontier_at(
        &self,
        _height: u64,
        _root: BlockMerkleCommitment,
    ) -> impl Send + Future<Output = Result<BlocksFrontier>> { ... }
    fn get_chain_config(
        &self,
        _commitment: Commitment<ChainConfig>,
    ) -> impl Send + Future<Output = Result<ChainConfig>> { ... }
    fn get_leaf_chain(
        &self,
        _height: u64,
    ) -> impl Send + Future<Output = Result<Vec<Leaf2>>> { ... }
    fn load_cert2(
        &self,
        _height: u64,
    ) -> impl Send + Future<Output = Result<Option<Certificate2<SeqTypes>>>> { ... }
    fn get_leaf(
        &self,
        _height: u64,
    ) -> impl Send + Future<Output = Result<Leaf2>> { ... }
    fn load_serialized_reward_merkle_tree_v2(
        &self,
        _height: u64,
    ) -> impl Send + Future<Output = Result<Vec<u8>>> { ... }
}

Provided Methods§

Source

fn get_accounts( &self, _instance: &NodeState, _height: u64, _view: ViewNumber, _accounts: &[FeeAccount], ) -> impl Send + Future<Output = Result<(FeeMerkleTree, Leaf2)>>

Get the state of the requested accounts.

The state is fetched from a snapshot at the given height and view, which must correspond! height is provided to simplify lookups for backends where data is not indexed by view. This function is intended to be used for catchup, so view should be no older than the last decided view.

If successful, this function also returns the leaf from view, if it is available. This can be used to add the recovered state to HotShot’s state map, so that future requests can get the state from memory rather than storage.

Source

fn get_accounts_at( &self, _height: u64, _root: FeeMerkleCommitment, _accounts: &[FeeAccount], ) -> impl Send + Future<Output = Result<FeeMerkleTree>>

Get the state of the requested accounts from the snapshot at height whose root is root.

Unlike get_accounts, this does not read the leaf or header at height, so it works after the data pruner deleted them, as long as the snapshot is stored.

Source

fn get_reward_accounts_v1( &self, _instance: &NodeState, _height: u64, _view: ViewNumber, _accounts: &[RewardAccountV1], ) -> impl Send + Future<Output = Result<(RewardMerkleTreeV1, Leaf2)>>

Source

fn get_reward_accounts_v2( &self, _instance: &NodeState, _height: u64, _view: ViewNumber, _accounts: &[RewardAccountV2], ) -> impl Send + Future<Output = Result<(RewardMerkleTreeV2, Leaf2)>>

Source

fn get_frontier( &self, _instance: &NodeState, _height: u64, _view: ViewNumber, ) -> impl Send + Future<Output = Result<BlocksFrontier>>

Get the blocks Merkle tree frontier.

The state is fetched from a snapshot at the given height and view, which must correspond! height is provided to simplify lookups for backends where data is not indexed by view. This function is intended to be used for catchup, so view should be no older than the last decided view.

Source

fn get_frontier_at( &self, _height: u64, _root: BlockMerkleCommitment, ) -> impl Send + Future<Output = Result<BlocksFrontier>>

Get the blocks Merkle tree frontier from the snapshot at height whose root is root.

Unlike get_frontier, this does not read the header at height, so it works after the data pruner deleted it, as long as the snapshot is stored.

Source

fn get_chain_config( &self, _commitment: Commitment<ChainConfig>, ) -> impl Send + Future<Output = Result<ChainConfig>>

Source

fn get_leaf_chain( &self, _height: u64, ) -> impl Send + Future<Output = Result<Vec<Leaf2>>>

Source

fn load_cert2( &self, _height: u64, ) -> impl Send + Future<Output = Result<Option<Certificate2<SeqTypes>>>>

Load the cert2 stored at exactly height, if one exists.

Source

fn get_leaf(&self, _height: u64) -> impl Send + Future<Output = Result<Leaf2>>

Load a decided leaf at the given height.

Source

fn load_serialized_reward_merkle_tree_v2( &self, _height: u64, ) -> impl Send + Future<Output = Result<Vec<u8>>>

The serialized tree the header at height commits to.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl CatchupStorage for MetricsDataSource

Source§

impl CatchupStorage for SqlStorage

Source§

async fn load_serialized_reward_merkle_tree_v2( &self, height: u64, ) -> Result<Vec<u8>>

The tree is stored only at the heights it changed, so the latest row at or below height may be an older epoch’s: it is served only if it matches the header at height.

Source§

async fn get_reward_accounts_v1( &self, instance: &NodeState, height: u64, view: ViewNumber, accounts: &[RewardAccountV1], ) -> Result<(RewardMerkleTreeV1, Leaf2)>

Source§

async fn get_reward_accounts_v2( &self, instance: &NodeState, height: u64, view: ViewNumber, accounts: &[RewardAccountV2], ) -> Result<(RewardMerkleTreeV2, Leaf2)>

Source§

async fn get_accounts( &self, instance: &NodeState, height: u64, view: ViewNumber, accounts: &[FeeAccount], ) -> Result<(FeeMerkleTree, Leaf2)>

Source§

async fn get_accounts_at( &self, height: u64, root: FeeMerkleCommitment, accounts: &[FeeAccount], ) -> Result<FeeMerkleTree>

Source§

async fn get_frontier( &self, instance: &NodeState, height: u64, view: ViewNumber, ) -> Result<BlocksFrontier>

Source§

async fn get_frontier_at( &self, height: u64, root: BlockMerkleCommitment, ) -> Result<BlocksFrontier>

Source§

async fn get_chain_config( &self, commitment: Commitment<ChainConfig>, ) -> Result<ChainConfig>

Source§

async fn get_leaf_chain(&self, height: u64) -> Result<Vec<Leaf2>>

Source§

async fn load_cert2( &self, height: u64, ) -> Result<Option<Certificate2<SeqTypes>>>

Source§

async fn get_leaf(&self, height: u64) -> Result<Leaf2>

Source§

impl CatchupStorage for SqlStorage

Source§

async fn load_serialized_reward_merkle_tree_v2( &self, height: u64, ) -> Result<Vec<u8>>

The tree is stored only at the heights it changed, so the latest row at or below height may be an older epoch’s: it is served only if it matches the header at height.

Source§

async fn get_reward_accounts_v1( &self, instance: &NodeState, height: u64, view: ViewNumber, accounts: &[RewardAccountV1], ) -> Result<(RewardMerkleTreeV1, Leaf2)>

Source§

async fn get_reward_accounts_v2( &self, instance: &NodeState, height: u64, view: ViewNumber, accounts: &[RewardAccountV2], ) -> Result<(RewardMerkleTreeV2, Leaf2)>

Source§

async fn get_accounts( &self, instance: &NodeState, height: u64, view: ViewNumber, accounts: &[FeeAccount], ) -> Result<(FeeMerkleTree, Leaf2)>

Source§

async fn get_accounts_at( &self, height: u64, root: FeeMerkleCommitment, accounts: &[FeeAccount], ) -> Result<FeeMerkleTree>

Source§

async fn get_frontier( &self, instance: &NodeState, height: u64, view: ViewNumber, ) -> Result<BlocksFrontier>

Source§

async fn get_frontier_at( &self, height: u64, root: BlockMerkleCommitment, ) -> Result<BlocksFrontier>

Source§

async fn get_chain_config( &self, commitment: Commitment<ChainConfig>, ) -> Result<ChainConfig>

Source§

async fn get_leaf_chain(&self, height: u64) -> Result<Vec<Leaf2>>

Source§

async fn load_cert2( &self, height: u64, ) -> Result<Option<Certificate2<SeqTypes>>>

Source§

async fn get_leaf(&self, height: u64) -> Result<Leaf2>

Source§

impl<T, S> CatchupStorage for ExtensibleDataSource<T, S>
where T: CatchupStorage, S: Sync,

Source§

async fn get_accounts( &self, instance: &NodeState, height: u64, view: ViewNumber, accounts: &[FeeAccount], ) -> Result<(FeeMerkleTree, Leaf2)>

Source§

async fn get_accounts_at( &self, height: u64, root: FeeMerkleCommitment, accounts: &[FeeAccount], ) -> Result<FeeMerkleTree>

Source§

async fn get_reward_accounts_v2( &self, instance: &NodeState, height: u64, view: ViewNumber, accounts: &[RewardAccountV2], ) -> Result<(RewardMerkleTreeV2, Leaf2)>

Source§

async fn get_reward_accounts_v1( &self, instance: &NodeState, height: u64, view: ViewNumber, accounts: &[RewardAccountV1], ) -> Result<(RewardMerkleTreeV1, Leaf2)>

Source§

async fn get_frontier( &self, instance: &NodeState, height: u64, view: ViewNumber, ) -> Result<BlocksFrontier>

Source§

async fn get_frontier_at( &self, height: u64, root: BlockMerkleCommitment, ) -> Result<BlocksFrontier>

Source§

async fn get_chain_config( &self, commitment: Commitment<ChainConfig>, ) -> Result<ChainConfig>

Source§

async fn get_leaf_chain(&self, height: u64) -> Result<Vec<Leaf2>>

Source§

async fn load_cert2( &self, height: u64, ) -> Result<Option<Certificate2<SeqTypes>>>

Source§

async fn get_leaf(&self, height: u64) -> Result<Leaf2>

Source§

async fn load_serialized_reward_merkle_tree_v2( &self, height: u64, ) -> Result<Vec<u8>>

Implementors§

Source§

impl CatchupStorage for espresso_node::api::fs::DataSource

Source§

impl CatchupStorage for espresso_node::api::sql::postgres::DataSource

Source§

impl CatchupStorage for espresso_node::api::sql::sqlite::DataSource