Ledger

Trait Ledger 

Source
pub trait Ledger {
Show 15 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 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>>;
}
Expand description

Implements both read-write and read-only transactions to DB.

Required Methods§

Source

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

Source

fn delete_block(&mut self, b: &Block) -> Result<()>

Source

fn block_header(&self, hash: &[u8]) -> Result<Option<Header>>

Source

fn light_block(&self, hash: &[u8]) -> Result<Option<LightBlock>>

Source

fn block(&self, hash: &[u8]) -> Result<Option<Block>>

Source

fn block_hash_by_height(&self, height: u64) -> Result<Option<[u8; 32]>>

Source

fn block_by_height(&self, height: u64) -> Result<Option<Block>>

Source

fn block_exists(&self, hash: &[u8]) -> Result<bool>

Source

fn ledger_tx(&self, tx_id: &[u8]) -> Result<Option<SpentTransaction>>

Source

fn ledger_txs(&self, tx_ids: Vec<&[u8; 32]>) -> Result<Vec<SpentTransaction>>

Source

fn ledger_tx_exists(&self, tx_id: &[u8]) -> Result<bool>

Source

fn block_label_by_height( &self, height: u64, ) -> Result<Option<([u8; 32], Label)>>

Source

fn store_block_label( &mut self, height: u64, hash: &[u8; 32], label: Label, ) -> Result<()>

Source

fn faults_by_block(&self, start_height: u64) -> Result<Vec<Fault>>

Source

fn faults(&self, faults_ids: &[[u8; 32]]) -> Result<Vec<Fault>>

Implementors§

Source§

impl<'db, DB: DBAccess> Ledger for DBTransaction<'db, DB>