pub trait BlockStore: Send + Sync {
// Required methods
fn put_block(&mut self, block: Block);
fn get_block(&self, hash: &BlockHash) -> Option<Block>;
fn get_block_by_height(&self, h: Height) -> Option<Block>;
// Provided methods
fn put_commit_qc(&mut self, _height: Height, _qc: QuorumCertificate) { ... }
fn get_commit_qc(&self, _height: Height) -> Option<QuorumCertificate> { ... }
fn flush(&self) { ... }
fn get_blocks_in_range(&self, from: Height, to: Height) -> Vec<Block> { ... }
fn tip_height(&self) -> Height { ... }
fn put_tx_index(&mut self, _tx_hash: [u8; 32], _height: Height, _index: u32) { ... }
fn get_tx_location(&self, _tx_hash: &[u8; 32]) -> Option<(Height, u32)> { ... }
fn put_block_results(&mut self, _height: Height, _results: EndBlockResponse) { ... }
fn get_block_results(&self, _height: Height) -> Option<EndBlockResponse> { ... }
}Required Methods§
fn put_block(&mut self, block: Block)
fn get_block(&self, hash: &BlockHash) -> Option<Block>
fn get_block_by_height(&self, h: Height) -> Option<Block>
Provided Methods§
Sourcefn put_commit_qc(&mut self, _height: Height, _qc: QuorumCertificate)
fn put_commit_qc(&mut self, _height: Height, _qc: QuorumCertificate)
Store the QC that committed a block at the given height.
Sourcefn get_commit_qc(&self, _height: Height) -> Option<QuorumCertificate>
fn get_commit_qc(&self, _height: Height) -> Option<QuorumCertificate>
Retrieve the commit QC for a block at the given height.
Sourcefn get_blocks_in_range(&self, from: Height, to: Height) -> Vec<Block>
fn get_blocks_in_range(&self, from: Height, to: Height) -> Vec<Block>
Get blocks in [from, to] inclusive. Default iterates one-by-one.
Sourcefn tip_height(&self) -> Height
fn tip_height(&self) -> Height
Return the highest stored block height.
Sourcefn put_tx_index(&mut self, _tx_hash: [u8; 32], _height: Height, _index: u32)
fn put_tx_index(&mut self, _tx_hash: [u8; 32], _height: Height, _index: u32)
Store a tx hash → (height, index) mapping.
Sourcefn get_tx_location(&self, _tx_hash: &[u8; 32]) -> Option<(Height, u32)>
fn get_tx_location(&self, _tx_hash: &[u8; 32]) -> Option<(Height, u32)>
Look up a tx hash → (height, index_in_block).
Sourcefn put_block_results(&mut self, _height: Height, _results: EndBlockResponse)
fn put_block_results(&mut self, _height: Height, _results: EndBlockResponse)
Store the EndBlockResponse for a given height.
Sourcefn get_block_results(&self, _height: Height) -> Option<EndBlockResponse>
fn get_block_results(&self, _height: Height) -> Option<EndBlockResponse>
Retrieve the EndBlockResponse for a given height.