Struct cfxcore::block_data_manager::db_manager::DBManager
source · pub struct DBManager { /* private fields */ }
Implementations§
source§impl DBManager
impl DBManager
pub fn new_from_rocksdb(db: Arc<SystemDB>, pow: Arc<PowComputer>) -> Self
source§impl DBManager
impl DBManager
pub fn new_from_sqlite(db_path: &Path, pow: Arc<PowComputer>) -> Self
source§impl DBManager
impl DBManager
pub fn insert_block_traces_to_db( &self, block_hash: &H256, block_traces: &BlockTracesWithEpoch )
pub fn block_traces_from_db( &self, block_hash: &H256 ) -> Option<BlockTracesWithEpoch>
sourcepub fn block_from_db(&self, block_hash: &H256) -> Option<Block>
pub fn block_from_db(&self, block_hash: &H256) -> Option<Block>
TODO Use new_with_rlp_size
pub fn insert_block_header_to_db(&self, header: &BlockHeader)
pub fn block_header_from_db(&self, hash: &H256) -> Option<BlockHeader>
pub fn remove_block_header_from_db(&self, hash: &H256)
pub fn insert_transaction_index_to_db( &self, hash: &H256, value: &TransactionIndex )
pub fn transaction_index_from_db(&self, hash: &H256) -> Option<TransactionIndex>
pub fn insert_hash_by_block_number_to_db(&self, block_number: u64, hash: &H256)
pub fn hash_by_block_number_from_db(&self, block_number: &u64) -> Option<H256>
sourcepub fn insert_local_block_info_to_db(
&self,
block_hash: &H256,
value: &LocalBlockInfo
)
pub fn insert_local_block_info_to_db( &self, block_hash: &H256, value: &LocalBlockInfo )
Store block info to db. Block info includes block status and
the sequence number when the block enters consensus graph.
The db key is the block hash plus one extra byte, so we can get better
data locality if we get both a block and its info from db.
The info is not a part of the block because the block is inserted
before we know its info, and we do not want to insert a large chunk
again. TODO Maybe we can use in-place modification (operator merge
in rocksdb) to keep the info together with the block.
sourcepub fn local_block_info_from_db(
&self,
block_hash: &H256
) -> Option<LocalBlockInfo>
pub fn local_block_info_from_db( &self, block_hash: &H256 ) -> Option<LocalBlockInfo>
Get block info from db.
pub fn insert_blamed_header_verified_roots_to_db( &self, block_height: u64, value: &BlamedHeaderVerifiedRoots )
sourcepub fn blamed_header_verified_roots_from_db(
&self,
block_height: u64
) -> Option<BlamedHeaderVerifiedRoots>
pub fn blamed_header_verified_roots_from_db( &self, block_height: u64 ) -> Option<BlamedHeaderVerifiedRoots>
Get correct roots of blamed headers from db. These are maintained on light nodes only.
pub fn remove_blamed_header_verified_roots_from_db(&self, block_height: u64)
pub fn insert_block_body_to_db(&self, block: &Block)
pub fn block_body_from_db( &self, hash: &H256 ) -> Option<Vec<Arc<SignedTransaction>>>
pub fn remove_block_body_from_db(&self, hash: &H256)
pub fn insert_block_execution_result_to_db( &self, hash: &H256, value: &BlockExecutionResultWithEpoch )
pub fn insert_block_reward_result_to_db( &self, hash: &H256, value: &DataVersionTuple<H256, BlockRewardResult> )
pub fn block_execution_result_from_db( &self, hash: &H256 ) -> Option<BlockExecutionResultWithEpoch>
pub fn block_reward_result_from_db( &self, hash: &H256 ) -> Option<DataVersionTuple<H256, BlockRewardResult>>
pub fn remove_block_execution_result_from_db(&self, hash: &H256)
pub fn remove_block_reward_result_from_db(&self, hash: &H256)
pub fn remove_block_trace_from_db(&self, hash: &H256)
pub fn remove_transaction_index_from_db(&self, hash: &H256)
pub fn insert_checkpoint_hashes_to_db( &self, checkpoint_prev: &H256, checkpoint_cur: &H256 )
pub fn checkpoint_hashes_from_db(&self) -> Option<(H256, H256)>
pub fn insert_executed_epoch_set_hashes_to_db( &self, epoch: u64, executed_hashes: &Vec<H256> )
pub fn insert_skipped_epoch_set_hashes_to_db( &self, epoch: u64, skipped_hashes: &Vec<H256> )
pub fn executed_epoch_set_hashes_from_db(&self, epoch: u64) -> Option<Vec<H256>>
pub fn skipped_epoch_set_hashes_from_db(&self, epoch: u64) -> Option<Vec<H256>>
pub fn insert_terminals_to_db(&self, terminals: &Vec<H256>)
pub fn terminals_from_db(&self) -> Option<Vec<H256>>
pub fn insert_epoch_execution_commitment_to_db( &self, hash: &H256, ctx: &EpochExecutionCommitment )
pub fn epoch_execution_commitment_from_db( &self, hash: &H256 ) -> Option<EpochExecutionCommitment>
pub fn remove_epoch_execution_commitment_from_db(&self, hash: &H256)
pub fn insert_instance_id_to_db(&self, instance_id: u64)
pub fn instance_id_from_db(&self) -> Option<u64>
pub fn insert_execution_context_to_db( &self, hash: &H256, ctx: &EpochExecutionContext )
pub fn execution_context_from_db( &self, hash: &H256 ) -> Option<EpochExecutionContext>
pub fn remove_epoch_execution_context_from_db(&self, hash: &H256)
pub fn insert_gc_progress_to_db(&self, next_to_process: u64)
pub fn gc_progress_from_db(&self) -> Option<u64>
pub fn insert_pos_reward(&self, pos_epoch: u64, pos_reward: &PosRewardInfo)
pub fn pos_reward_by_pos_epoch(&self, pos_epoch: u64) -> Option<PosRewardInfo>
Trait Implementations§
source§impl MallocSizeOf for DBManager
impl MallocSizeOf for DBManager
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
Auto Trait Implementations§
impl !RefUnwindSafe for DBManager
impl Send for DBManager
impl Sync for DBManager
impl Unpin for DBManager
impl !UnwindSafe for DBManager
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Conv for T
impl<T> Conv for T
source§impl<T> ElementSatisfy<ElementNoConstrain> for T
impl<T> ElementSatisfy<ElementNoConstrain> for T
fn to_constrain_object(&self) -> &ElementNoConstrain
fn to_constrain_object_mut(&mut self) -> &mut ElementNoConstrain
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
Formats each item in a sequence. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self
, then passes self.deref()
into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref()
only in debug builds, and is erased in release
builds.