Struct ckb_shared::Snapshot [−][src]
pub struct Snapshot { /* fields omitted */ }Expand description
A snapshot captures a point-in-time view of the DB at the time it’s created
Implementations
impl Snapshot[src]
impl Snapshot[src]pub fn new(
tip_header: HeaderView,
total_difficulty: U256,
epoch_ext: EpochExt,
store: StoreSnapshot,
proposals: ProposalView,
consensus: Arc<Consensus>
) -> Snapshot[src]
pub fn new(
tip_header: HeaderView,
total_difficulty: U256,
epoch_ext: EpochExt,
store: StoreSnapshot,
proposals: ProposalView,
consensus: Arc<Consensus>
) -> Snapshot[src]New snapshot created after tip change
pub fn refresh(&self, store: StoreSnapshot) -> Snapshot[src]
pub fn refresh(&self, store: StoreSnapshot) -> Snapshot[src]Refreshing on block commit is necessary operation, even tip remains unchanged. when node relayed compact block,if some uncles were not available from receiver’s local sources, in GetBlockTransactions/BlockTransactions roundtrip, node will need access block data of uncles.
pub fn tip_header(&self) -> &HeaderView[src]
pub fn tip_header(&self) -> &HeaderView[src]Return reference of tip header
pub fn tip_number(&self) -> u64[src]
pub fn tip_number(&self) -> u64[src]Return tip header number
pub fn cloned_consensus(&self) -> Arc<Consensus>[src]
pub fn cloned_consensus(&self) -> Arc<Consensus>[src]Makes a clone of the Arc<Consensus>
pub fn proposals(&self) -> &ProposalView[src]
pub fn proposals(&self) -> &ProposalView[src]Return reference of proposals view
pub fn total_difficulty(&self) -> &U256[src]
pub fn total_difficulty(&self) -> &U256[src]Return current best chain total_difficulty
pub fn finalize_block_reward(
&self,
parent: &HeaderView
) -> Result<(Script, BlockReward), Error>[src]
pub fn finalize_block_reward(
&self,
parent: &HeaderView
) -> Result<(Script, BlockReward), Error>[src]Shortcuts for calculate block reward, invoke RewardCalculator
Trait Implementations
impl CellChecker for Snapshot[src]
impl CellChecker for Snapshot[src]impl CellProvider for Snapshot[src]
impl CellProvider for Snapshot[src]pub fn cell(&self, out_point: &OutPoint, with_data: bool) -> CellStatus[src]
pub fn cell(&self, out_point: &OutPoint, with_data: bool) -> CellStatus[src]TODO(doc): @quake
impl<'a> ChainStore<'a> for Snapshot[src]
impl<'a> ChainStore<'a> for Snapshot[src]type Vector = DBPinnableSlice<'a>
type Vector = DBPinnableSlice<'a>TODO(doc): @quake
pub fn cache(&'a self) -> Option<&'a StoreCache>[src]
pub fn cache(&'a self) -> Option<&'a StoreCache>[src]TODO(doc): @quake
pub fn get(
&'a self,
col: &'static str,
key: &[u8]
) -> Option<<Snapshot as ChainStore<'a>>::Vector>[src]
pub fn get(
&'a self,
col: &'static str,
key: &[u8]
) -> Option<<Snapshot as ChainStore<'a>>::Vector>[src]Return the bytes associated with a key value and the given column family.
pub fn get_iter(
&self,
col: &'static str,
mode: IteratorMode<'_>
) -> DBIterator<'_>[src]
pub fn get_iter(
&self,
col: &'static str,
mode: IteratorMode<'_>
) -> DBIterator<'_>[src]TODO(doc): @quake
pub fn get_tip_header(&self) -> Option<HeaderView>[src]
pub fn get_tip_header(&self) -> Option<HeaderView>[src]TODO(doc): @quake
pub fn get_current_epoch_ext(&'a self) -> Option<EpochExt>[src]
pub fn get_current_epoch_ext(&'a self) -> Option<EpochExt>[src]Gets current epoch ext
fn cell_provider(&self) -> CellProviderWrapper<'_, Self>[src]
fn cell_provider(&self) -> CellProviderWrapper<'_, Self>[src]TODO(doc): @quake
fn as_data_provider(&'a self) -> DataLoaderWrapper<'a, Self>[src]
fn as_data_provider(&'a self) -> DataLoaderWrapper<'a, Self>[src]Return the provider trait default implementation
fn get_block_header(&'a self, hash: &Byte32) -> Option<HeaderView>[src]
fn get_block_header(&'a self, hash: &Byte32) -> Option<HeaderView>[src]Get header by block header hash
fn get_block_body(&'a self, hash: &Byte32) -> Vec<TransactionView, Global>[src]
fn get_block_body(&'a self, hash: &Byte32) -> Vec<TransactionView, Global>[src]Get block body by block header hash
fn get_unfrozen_block(&'a self, hash: &Byte32) -> Option<BlockView>[src]
fn get_unfrozen_block(&'a self, hash: &Byte32) -> Option<BlockView>[src]Get unfrozen block from ky-store with given hash
fn get_block_txs_hashes(&'a self, hash: &Byte32) -> Vec<Byte32, Global>[src]
fn get_block_txs_hashes(&'a self, hash: &Byte32) -> Vec<Byte32, Global>[src]Get all transaction-hashes in block body by block header hash
fn get_block_proposal_txs_ids(
&'a self,
hash: &Byte32
) -> Option<ProposalShortIdVec>[src]
fn get_block_proposal_txs_ids(
&'a self,
hash: &Byte32
) -> Option<ProposalShortIdVec>[src]Get proposal short id by block header hash
fn get_block_uncles(&'a self, hash: &Byte32) -> Option<UncleBlockVecView>[src]
fn get_block_uncles(&'a self, hash: &Byte32) -> Option<UncleBlockVecView>[src]Get block uncles by block header hash
fn get_block_ext(&'a self, block_hash: &Byte32) -> Option<BlockExt>[src]
fn get_block_ext(&'a self, block_hash: &Byte32) -> Option<BlockExt>[src]Get block ext by block header hash
fn get_block_hash(&'a self, number: u64) -> Option<Byte32>[src]
fn get_block_hash(&'a self, number: u64) -> Option<Byte32>[src]Get block header hash by block number
fn get_block_number(&'a self, hash: &Byte32) -> Option<u64>[src]
fn get_block_number(&'a self, hash: &Byte32) -> Option<u64>[src]Get block number by block header hash
fn is_main_chain(&'a self, hash: &Byte32) -> bool[src]
fn is_main_chain(&'a self, hash: &Byte32) -> bool[src]TODO(doc): @quake
fn transaction_exists(&'a self, hash: &Byte32) -> bool[src]
fn transaction_exists(&'a self, hash: &Byte32) -> bool[src]Returns true if the transaction confirmed in main chain. Read more
fn get_transaction(&'a self, hash: &Byte32) -> Option<(TransactionView, Byte32)>[src]
fn get_transaction(&'a self, hash: &Byte32) -> Option<(TransactionView, Byte32)>[src]Get commit transaction and block hash by its hash
fn get_transaction_info(&'a self, hash: &Byte32) -> Option<TransactionInfo>[src]
fn get_transaction_info(&'a self, hash: &Byte32) -> Option<TransactionInfo>[src]TODO(doc): @quake
fn get_transaction_with_info(
&'a self,
hash: &Byte32
) -> Option<(TransactionView, TransactionInfo)>[src]
fn get_transaction_with_info(
&'a self,
hash: &Byte32
) -> Option<(TransactionView, TransactionInfo)>[src]Gets transaction and associated info with correspond hash
fn get_cell(&'a self, out_point: &OutPoint) -> Option<CellMeta>[src]
fn get_cell(&'a self, out_point: &OutPoint) -> Option<CellMeta>[src]Gets cell meta data with out_point
fn get_epoch_ext(&'a self, hash: &Byte32) -> Option<EpochExt>[src]
fn get_epoch_ext(&'a self, hash: &Byte32) -> Option<EpochExt>[src]Gets epoch ext by epoch index
fn get_epoch_index(&'a self, number: u64) -> Option<Byte32>[src]
fn get_epoch_index(&'a self, number: u64) -> Option<Byte32>[src]Gets epoch index by epoch number
fn get_block_epoch_index(&'a self, block_hash: &Byte32) -> Option<Byte32>[src]
fn get_block_epoch_index(&'a self, block_hash: &Byte32) -> Option<Byte32>[src]Gets epoch index by block hash
fn get_block_epoch(&'a self, hash: &Byte32) -> Option<EpochExt>[src]
fn get_block_epoch(&'a self, hash: &Byte32) -> Option<EpochExt>[src]TODO(doc): @quake
fn get_uncle_header(&'a self, hash: &Byte32) -> Option<HeaderView>[src]
fn get_uncle_header(&'a self, hash: &Byte32) -> Option<HeaderView>[src]Gets header by uncle header hash
fn block_exists(&'a self, hash: &Byte32) -> bool[src]
fn block_exists(&'a self, hash: &Byte32) -> bool[src]TODO(doc): @quake
fn get_cellbase(&'a self, hash: &Byte32) -> Option<TransactionView>[src]
fn get_cellbase(&'a self, hash: &Byte32) -> Option<TransactionView>[src]Gets cellbase by block hash
fn get_packed_block(&'a self, hash: &Byte32) -> Option<Block>[src]
fn get_packed_block(&'a self, hash: &Byte32) -> Option<Block>[src]TODO(doc): @quake
fn get_packed_block_header(&'a self, hash: &Byte32) -> Option<Header>[src]
fn get_packed_block_header(&'a self, hash: &Byte32) -> Option<Header>[src]TODO(doc): @quake
impl HeaderChecker for Snapshot[src]
impl HeaderChecker for Snapshot[src]pub fn check_valid(&self, block_hash: &Byte32) -> Result<(), OutPointError>[src]
pub fn check_valid(&self, block_hash: &Byte32) -> Result<(), OutPointError>[src]Check if header in main chain
impl HeaderProvider for Snapshot[src]
impl HeaderProvider for Snapshot[src]pub fn get_header(&self, hash: &Byte32) -> Option<HeaderView>[src]
pub fn get_header(&self, hash: &Byte32) -> Option<HeaderView>[src]TODO(doc): @quake
fn timestamp_and_parent(&self, block_hash: &Byte32) -> (u64, u64, Byte32)
fn timestamp_and_parent(&self, block_hash: &Byte32) -> (u64, u64, Byte32)Return timestamp and block_number of the corresponding block_hash, and hash of parent block
fn block_median_time(
&self,
block_hash: &Byte32,
median_block_count: usize
) -> u64
fn block_median_time(
&self,
block_hash: &Byte32,
median_block_count: usize
) -> u64Return past block median time, including the timestamp of the given one
Auto Trait Implementations
impl !RefUnwindSafe for Snapshot
impl Send for Snapshot
impl Sync for Snapshot
impl Unpin for Snapshot
impl !UnwindSafe for Snapshot
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,