pub struct StoreTransaction { /* private fields */ }Expand description
A Transaction DB
Implementations§
Source§impl StoreTransaction
impl StoreTransaction
Sourcepub fn insert_raw(
&self,
col: Col,
key: &[u8],
value: &[u8],
) -> Result<(), Error>
pub fn insert_raw( &self, col: Col, key: &[u8], value: &[u8], ) -> Result<(), Error>
Inserts a raw key-value pair into the specified column.
Sourcepub fn delete(&self, col: Col, key: &[u8]) -> Result<(), Error>
pub fn delete(&self, col: Col, key: &[u8]) -> Result<(), Error>
Deletes a key from the specified column.
Sourcepub fn commit(&self) -> Result<(), Error>
pub fn commit(&self) -> Result<(), Error>
Commits the transaction, writing all changes to the database.
Sourcepub fn get_snapshot(&self) -> StoreTransactionSnapshot<'_>
pub fn get_snapshot(&self) -> StoreTransactionSnapshot<'_>
Returns a snapshot of the transaction’s current state.
Sourcepub fn get_update_for_tip_hash(
&self,
snapshot: &StoreTransactionSnapshot<'_>,
) -> Option<Byte32>
pub fn get_update_for_tip_hash( &self, snapshot: &StoreTransactionSnapshot<'_>, ) -> Option<Byte32>
Gets the tip header hash for update, locking the row in the transaction.
Sourcepub fn insert_tip_header(&self, h: &HeaderView) -> Result<(), Error>
pub fn insert_tip_header(&self, h: &HeaderView) -> Result<(), Error>
Inserts or updates the tip header hash in the store.
Sourcepub fn insert_block(&self, block: &BlockView) -> Result<(), Error>
pub fn insert_block(&self, block: &BlockView) -> Result<(), Error>
Inserts a block into the store.
Sourcepub fn delete_block(&self, block: &BlockView) -> Result<(), Error>
pub fn delete_block(&self, block: &BlockView) -> Result<(), Error>
Deletes a block from the store.
Sourcepub fn insert_block_ext(
&self,
block_hash: &Byte32,
ext: &BlockExt,
) -> Result<(), Error>
pub fn insert_block_ext( &self, block_hash: &Byte32, ext: &BlockExt, ) -> Result<(), Error>
Inserts block extension data.
Sourcepub fn attach_block(&self, block: &BlockView) -> Result<(), Error>
pub fn attach_block(&self, block: &BlockView) -> Result<(), Error>
Attaches a block to the main chain, indexing its transactions and uncles.
Sourcepub fn detach_block(&self, block: &BlockView) -> Result<(), Error>
pub fn detach_block(&self, block: &BlockView) -> Result<(), Error>
Detaches a block from the main chain, removing its transaction and uncle indices.
Sourcepub fn insert_block_epoch_index(
&self,
block_hash: &Byte32,
epoch_hash: &Byte32,
) -> Result<(), Error>
pub fn insert_block_epoch_index( &self, block_hash: &Byte32, epoch_hash: &Byte32, ) -> Result<(), Error>
Inserts the block-to-epoch index mapping.
Sourcepub fn insert_epoch_ext(
&self,
hash: &Byte32,
epoch: &EpochExt,
) -> Result<(), Error>
pub fn insert_epoch_ext( &self, hash: &Byte32, epoch: &EpochExt, ) -> Result<(), Error>
Inserts epoch extension data.
Sourcepub fn insert_current_epoch_ext(&self, epoch: &EpochExt) -> Result<(), Error>
pub fn insert_current_epoch_ext(&self, epoch: &EpochExt) -> Result<(), Error>
Inserts the current epoch extension data.
Sourcepub fn insert_cells(
&self,
cells: impl Iterator<Item = (OutPoint, CellEntry, Option<CellDataEntry>)>,
) -> Result<(), Error>
pub fn insert_cells( &self, cells: impl Iterator<Item = (OutPoint, CellEntry, Option<CellDataEntry>)>, ) -> Result<(), Error>
Inserts multiple cells into the store.
Sourcepub fn delete_cells(
&self,
out_points: impl Iterator<Item = OutPoint>,
) -> Result<(), Error>
pub fn delete_cells( &self, out_points: impl Iterator<Item = OutPoint>, ) -> Result<(), Error>
Deletes multiple cells from the store.
Sourcepub fn insert_header_digest(
&self,
position_u64: u64,
header_digest: &HeaderDigest,
) -> Result<(), Error>
pub fn insert_header_digest( &self, position_u64: u64, header_digest: &HeaderDigest, ) -> Result<(), Error>
Inserts a header digest.
Trait Implementations§
Source§impl CellChecker for StoreTransaction
impl CellChecker for StoreTransaction
Source§impl CellProvider for StoreTransaction
impl CellProvider for StoreTransaction
Source§impl ChainStore for StoreTransaction
impl ChainStore for StoreTransaction
Source§fn cache(&self) -> Option<&StoreCache>
fn cache(&self) -> Option<&StoreCache>
Source§fn get(&self, col: Col, key: &[u8]) -> Option<DBPinnableSlice<'_>>
fn get(&self, col: Col, key: &[u8]) -> Option<DBPinnableSlice<'_>>
Source§fn get_iter(&self, col: Col, mode: IteratorMode<'_>) -> DBIter<'_>
fn get_iter(&self, col: Col, mode: IteratorMode<'_>) -> DBIter<'_>
Source§fn borrow_as_data_loader(&self) -> BorrowedDataLoaderWrapper<'_, Self>
fn borrow_as_data_loader(&self) -> BorrowedDataLoaderWrapper<'_, Self>
Source§fn get_block_header(&self, hash: &Byte32) -> Option<HeaderView>
fn get_block_header(&self, hash: &Byte32) -> Option<HeaderView>
Source§fn get_block_body(&self, hash: &Byte32) -> Vec<TransactionView>
fn get_block_body(&self, hash: &Byte32) -> Vec<TransactionView>
Source§fn get_unfrozen_block(&self, hash: &Byte32) -> Option<BlockView>
fn get_unfrozen_block(&self, hash: &Byte32) -> Option<BlockView>
Source§fn get_block_txs_hashes(&self, hash: &Byte32) -> Vec<Byte32>
fn get_block_txs_hashes(&self, hash: &Byte32) -> Vec<Byte32>
Source§fn get_block_proposal_txs_ids(
&self,
hash: &Byte32,
) -> Option<ProposalShortIdVec>
fn get_block_proposal_txs_ids( &self, hash: &Byte32, ) -> Option<ProposalShortIdVec>
Source§fn get_block_uncles(&self, hash: &Byte32) -> Option<UncleBlockVecView>
fn get_block_uncles(&self, hash: &Byte32) -> Option<UncleBlockVecView>
Source§fn get_block_extension(&self, hash: &Byte32) -> Option<Bytes>
fn get_block_extension(&self, hash: &Byte32) -> Option<Bytes>
Source§fn get_block_ext(&self, block_hash: &Byte32) -> Option<BlockExt>
fn get_block_ext(&self, block_hash: &Byte32) -> Option<BlockExt>
Source§fn get_block_hash(&self, number: BlockNumber) -> Option<Byte32>
fn get_block_hash(&self, number: BlockNumber) -> Option<Byte32>
Source§fn get_block_number(&self, hash: &Byte32) -> Option<BlockNumber>
fn get_block_number(&self, hash: &Byte32) -> Option<BlockNumber>
Source§fn is_main_chain(&self, hash: &Byte32) -> bool
fn is_main_chain(&self, hash: &Byte32) -> bool
Source§fn get_tip_header(&self) -> Option<HeaderView>
fn get_tip_header(&self) -> Option<HeaderView>
Source§fn transaction_exists(&self, hash: &Byte32) -> bool
fn transaction_exists(&self, hash: &Byte32) -> bool
Source§fn get_transaction(&self, hash: &Byte32) -> Option<(TransactionView, Byte32)>
fn get_transaction(&self, hash: &Byte32) -> Option<(TransactionView, Byte32)>
Source§fn get_transaction_info(&self, hash: &Byte32) -> Option<TransactionInfo>
fn get_transaction_info(&self, hash: &Byte32) -> Option<TransactionInfo>
Source§fn get_transaction_with_info(
&self,
hash: &Byte32,
) -> Option<(TransactionView, TransactionInfo)>
fn get_transaction_with_info( &self, hash: &Byte32, ) -> Option<(TransactionView, TransactionInfo)>
Source§fn get_cell(&self, out_point: &OutPoint) -> Option<CellMeta>
fn get_cell(&self, out_point: &OutPoint) -> Option<CellMeta>
Source§fn get_cell_data(&self, out_point: &OutPoint) -> Option<(Bytes, Byte32)>
fn get_cell_data(&self, out_point: &OutPoint) -> Option<(Bytes, Byte32)>
Source§fn get_cell_data_hash(&self, out_point: &OutPoint) -> Option<Byte32>
fn get_cell_data_hash(&self, out_point: &OutPoint) -> Option<Byte32>
Source§fn get_current_epoch_ext(&self) -> Option<EpochExt>
fn get_current_epoch_ext(&self) -> Option<EpochExt>
Source§fn get_epoch_index(&self, number: EpochNumber) -> Option<Byte32>
fn get_epoch_index(&self, number: EpochNumber) -> Option<Byte32>
Source§fn get_block_epoch_index(&self, block_hash: &Byte32) -> Option<Byte32>
fn get_block_epoch_index(&self, block_hash: &Byte32) -> Option<Byte32>
Source§fn get_block_epoch(&self, hash: &Byte32) -> Option<EpochExt>
fn get_block_epoch(&self, hash: &Byte32) -> Option<EpochExt>
Source§fn get_uncle_header(&self, hash: &Byte32) -> Option<HeaderView>
fn get_uncle_header(&self, hash: &Byte32) -> Option<HeaderView>
Source§fn block_exists(&self, hash: &Byte32) -> bool
fn block_exists(&self, hash: &Byte32) -> bool
Source§fn get_cellbase(&self, hash: &Byte32) -> Option<TransactionView>
fn get_cellbase(&self, hash: &Byte32) -> Option<TransactionView>
Source§fn get_latest_built_filter_data_block_hash(&self) -> Option<Byte32>
fn get_latest_built_filter_data_block_hash(&self) -> Option<Byte32>
Source§fn get_block_filter(&self, hash: &Byte32) -> Option<Bytes>
fn get_block_filter(&self, hash: &Byte32) -> Option<Bytes>
Source§fn get_block_filter_hash(&self, hash: &Byte32) -> Option<Byte32>
fn get_block_filter_hash(&self, hash: &Byte32) -> Option<Byte32>
Source§fn get_packed_block_header(&self, hash: &Byte32) -> Option<Header>
fn get_packed_block_header(&self, hash: &Byte32) -> Option<Header>
Source§fn get_header_digest(&self, position_u64: u64) -> Option<HeaderDigest>
fn get_header_digest(&self, position_u64: u64) -> Option<HeaderDigest>
Source§fn get_ancestor(&self, base: &Byte32, number: BlockNumber) -> Option<HeaderView>
fn get_ancestor(&self, base: &Byte32, number: BlockNumber) -> Option<HeaderView>
Source§impl MMRStore<HeaderDigest> for &StoreTransaction
impl MMRStore<HeaderDigest> for &StoreTransaction
Source§impl VersionbitsIndexer for StoreTransaction
impl VersionbitsIndexer for StoreTransaction
Source§fn block_epoch_index(&self, block_hash: &Byte32) -> Option<Byte32>
fn block_epoch_index(&self, block_hash: &Byte32) -> Option<Byte32>
Source§fn block_header(&self, block_hash: &Byte32) -> Option<HeaderView>
fn block_header(&self, block_hash: &Byte32) -> Option<HeaderView>
Auto Trait Implementations§
impl Freeze for StoreTransaction
impl !RefUnwindSafe for StoreTransaction
impl Send for StoreTransaction
impl Sync for StoreTransaction
impl Unpin for StoreTransaction
impl !UnwindSafe for StoreTransaction
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
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>
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>
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