pub trait Ledger {
Show 21 methods
// Required methods
fn store_block(
&mut self,
header: &Header,
txs: &[SpentTransaction],
faults: &[Fault],
label: Label,
) -> Result<usize>;
fn delete_block(&mut self, b: &Block) -> Result<()>;
fn block_header(&self, hash: &[u8]) -> Result<Option<Header>>;
fn light_block(&self, hash: &[u8]) -> Result<Option<LightBlock>>;
fn block(&self, hash: &[u8]) -> Result<Option<Block>>;
fn block_hash_by_height(&self, height: u64) -> Result<Option<[u8; 32]>>;
fn block_by_height(&self, height: u64) -> Result<Option<Block>>;
fn store_blob_data(&self, hash: &[u8; 32], data: Vec<u8>) -> Result<()>;
fn blob_data_by_hash(&self, hash: &[u8; 32]) -> Result<Option<Vec<u8>>>;
fn store_blobs_height(
&self,
block_height: u64,
blob_hashes: &[[u8; 32]],
) -> Result<()>;
fn blobs_by_height(
&self,
block_height: u64,
) -> Result<Option<Vec<[u8; 32]>>>;
fn delete_blobs_by_height(&self, block_height: u64) -> Result<()>;
fn block_exists(&self, hash: &[u8]) -> Result<bool>;
fn ledger_tx(&self, tx_id: &[u8]) -> Result<Option<SpentTransaction>>;
fn ledger_txs(
&self,
tx_ids: Vec<&[u8; 32]>,
) -> Result<Vec<SpentTransaction>>;
fn ledger_tx_exists(&self, tx_id: &[u8]) -> Result<bool>;
fn block_label_by_height(
&self,
height: u64,
) -> Result<Option<([u8; 32], Label)>>;
fn store_block_label(
&mut self,
height: u64,
hash: &[u8; 32],
label: Label,
) -> Result<()>;
fn faults_by_block(&self, start_height: u64) -> Result<Vec<Fault>>;
fn faults(&self, faults_ids: &[[u8; 32]]) -> Result<Vec<Fault>>;
fn latest_block(&self) -> Result<LightBlock>;
}Expand description
Implements both read-write and read-only transactions to DB.
Required Methods§
Sourcefn store_block(
&mut self,
header: &Header,
txs: &[SpentTransaction],
faults: &[Fault],
label: Label,
) -> Result<usize>
fn store_block( &mut self, header: &Header, txs: &[SpentTransaction], faults: &[Fault], label: Label, ) -> Result<usize>
Read-write transactions Returns disk footprint of the committed transaction