pub struct SecondaryDB { /* private fields */ }
Expand description
Open DB as secondary instance with specified column families
Implementations§
Source§impl SecondaryDB
impl SecondaryDB
Sourcepub fn open_cf<P, I, N>(
opts: &Options,
path: P,
cf_names: I,
secondary_path: String,
) -> Self
pub fn open_cf<P, I, N>( opts: &Options, path: P, cf_names: I, secondary_path: String, ) -> Self
Open a SecondaryDB
Sourcepub fn get_pinned(
&self,
col: Col,
key: &[u8],
) -> Result<Option<DBPinnableSlice<'_>>, Error>
pub fn get_pinned( &self, col: Col, key: &[u8], ) -> Result<Option<DBPinnableSlice<'_>>, Error>
Return the value associated with a key using RocksDB’s PinnableSlice from the given column so as to avoid unnecessary memory copy.
Sourcepub fn try_catch_up_with_primary(&self) -> Result<(), Error>
pub fn try_catch_up_with_primary(&self) -> Result<(), Error>
Make the secondary instance catch up with the primary by tailing and replaying the MANIFEST and WAL of the primary.
Trait Implementations§
Source§impl ChainStore for SecondaryDB
impl ChainStore for SecondaryDB
Source§fn cache(&self) -> Option<&StoreCache>
fn cache(&self) -> Option<&StoreCache>
Return cache reference
Source§fn get(&self, col: Col, key: &[u8]) -> Option<DBPinnableSlice<'_>>
fn get(&self, col: Col, key: &[u8]) -> Option<DBPinnableSlice<'_>>
Return the bytes associated with a key value and the given column family.
Source§fn get_iter(&self, col: Col, mode: IteratorMode<'_>) -> DBIterator<'_>
fn get_iter(&self, col: Col, mode: IteratorMode<'_>) -> DBIterator<'_>
Return an iterator over the database key-value pairs in the given column family.
Source§fn borrow_as_data_loader(&self) -> BorrowedDataLoaderWrapper<'_, Self>
fn borrow_as_data_loader(&self) -> BorrowedDataLoaderWrapper<'_, Self>
Return the borrowed data loader wrapper
Source§fn get_block_header(&self, hash: &Byte32) -> Option<HeaderView>
fn get_block_header(&self, hash: &Byte32) -> Option<HeaderView>
Get header by block header hash
Source§fn get_block_body(&self, hash: &Byte32) -> Vec<TransactionView>
fn get_block_body(&self, hash: &Byte32) -> Vec<TransactionView>
Get block body by block header hash
Source§fn get_unfrozen_block(&self, hash: &Byte32) -> Option<BlockView>
fn get_unfrozen_block(&self, hash: &Byte32) -> Option<BlockView>
Get unfrozen block from ky-store with given hash
Source§fn get_block_txs_hashes(&self, hash: &Byte32) -> Vec<Byte32>
fn get_block_txs_hashes(&self, hash: &Byte32) -> Vec<Byte32>
Get all transaction-hashes in block body by block header hash
Source§fn get_block_proposal_txs_ids(
&self,
hash: &Byte32,
) -> Option<ProposalShortIdVec>
fn get_block_proposal_txs_ids( &self, hash: &Byte32, ) -> Option<ProposalShortIdVec>
Get proposal short id by block header hash
Source§fn get_block_uncles(&self, hash: &Byte32) -> Option<UncleBlockVecView>
fn get_block_uncles(&self, hash: &Byte32) -> Option<UncleBlockVecView>
Get block uncles by block header hash
Source§fn get_block_extension(&self, hash: &Byte32) -> Option<Bytes>
fn get_block_extension(&self, hash: &Byte32) -> Option<Bytes>
Get block extension by block header hash
Source§fn get_block_ext(&self, block_hash: &Byte32) -> Option<BlockExt>
fn get_block_ext(&self, block_hash: &Byte32) -> Option<BlockExt>
Get block ext by block header hash Read more
Source§fn get_block_number(&self, hash: &Byte32) -> Option<u64>
fn get_block_number(&self, hash: &Byte32) -> Option<u64>
Get block number by block header hash
Source§fn is_main_chain(&self, hash: &Byte32) -> bool
fn is_main_chain(&self, hash: &Byte32) -> bool
TODO(doc): @quake
Source§fn get_tip_header(&self) -> Option<HeaderView>
fn get_tip_header(&self) -> Option<HeaderView>
TODO(doc): @quake
Source§fn transaction_exists(&self, hash: &Byte32) -> bool
fn transaction_exists(&self, hash: &Byte32) -> bool
Returns true if the transaction confirmed in main chain. Read more
Source§fn get_transaction(&self, hash: &Byte32) -> Option<(TransactionView, Byte32)>
fn get_transaction(&self, hash: &Byte32) -> Option<(TransactionView, Byte32)>
Get commit transaction and block hash by its hash
Source§fn get_transaction_info(&self, hash: &Byte32) -> Option<TransactionInfo>
fn get_transaction_info(&self, hash: &Byte32) -> Option<TransactionInfo>
TODO(doc): @quake
Source§fn get_transaction_with_info(
&self,
hash: &Byte32,
) -> Option<(TransactionView, TransactionInfo)>
fn get_transaction_with_info( &self, hash: &Byte32, ) -> Option<(TransactionView, TransactionInfo)>
Gets transaction and associated info with correspond hash
Source§fn get_cell(&self, out_point: &OutPoint) -> Option<CellMeta>
fn get_cell(&self, out_point: &OutPoint) -> Option<CellMeta>
Gets cell meta data with out_point
Source§fn get_current_epoch_ext(&self) -> Option<EpochExt>
fn get_current_epoch_ext(&self) -> Option<EpochExt>
Gets current epoch ext
Source§fn get_block_epoch_index(&self, block_hash: &Byte32) -> Option<Byte32>
fn get_block_epoch_index(&self, block_hash: &Byte32) -> Option<Byte32>
Gets epoch index by block hash
Source§fn get_uncle_header(&self, hash: &Byte32) -> Option<HeaderView>
fn get_uncle_header(&self, hash: &Byte32) -> Option<HeaderView>
Gets header by uncle header hash
Source§fn block_exists(&self, hash: &Byte32) -> bool
fn block_exists(&self, hash: &Byte32) -> bool
TODO(doc): @quake
Source§fn get_cellbase(&self, hash: &Byte32) -> Option<TransactionView>
fn get_cellbase(&self, hash: &Byte32) -> Option<TransactionView>
Gets cellbase by block hash
Source§fn get_latest_built_filter_data_block_hash(&self) -> Option<Byte32>
fn get_latest_built_filter_data_block_hash(&self) -> Option<Byte32>
Gets latest built filter data block hash
Source§fn get_block_filter(&self, hash: &Byte32) -> Option<Bytes>
fn get_block_filter(&self, hash: &Byte32) -> Option<Bytes>
Gets block filter data by block hash
Source§fn get_block_filter_hash(&self, hash: &Byte32) -> Option<Byte32>
fn get_block_filter_hash(&self, hash: &Byte32) -> Option<Byte32>
Gets block filter hash by block hash
Source§fn get_packed_block_header(&self, hash: &Byte32) -> Option<Header>
fn get_packed_block_header(&self, hash: &Byte32) -> Option<Header>
Gets block header bytes by block hash
Source§fn get_header_digest(&self, position_u64: u64) -> Option<HeaderDigest>
fn get_header_digest(&self, position_u64: u64) -> Option<HeaderDigest>
Gets a header digest.
Source§fn get_ancestor(&self, base: &Byte32, number: u64) -> Option<HeaderView>
fn get_ancestor(&self, base: &Byte32, number: u64) -> Option<HeaderView>
Gets ancestor block header by a base block hash and number
Source§impl Clone for SecondaryDB
impl Clone for SecondaryDB
Source§fn clone(&self) -> SecondaryDB
fn clone(&self) -> SecondaryDB
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for SecondaryDB
impl RefUnwindSafe for SecondaryDB
impl Send for SecondaryDB
impl Sync for SecondaryDB
impl Unpin for SecondaryDB
impl UnwindSafe for SecondaryDB
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more