pub struct DBTransaction<'db, DB: DBAccess> { /* private fields */ }Implementations§
Trait Implementations§
Source§impl<DB: DBAccess> ConsensusStorage for DBTransaction<'_, DB>
Implementation of the Candidate trait for DBTransaction<'db, DB>.
impl<DB: DBAccess> ConsensusStorage for DBTransaction<'_, DB>
Implementation of the Candidate trait for DBTransaction<'db, DB>.
Source§fn delete_candidate<F>(&mut self, closure: F) -> Result<()>
fn delete_candidate<F>(&mut self, closure: F) -> Result<()>
Source§fn clear_candidates(&mut self) -> Result<()>
fn clear_candidates(&mut self) -> Result<()>
Deletes all items from the CF_CANDIDATES column family.
§Returns
Returns Ok(()) if the deletion is successful, or an error if the
operation fails.
Source§fn store_validation_result(
&mut self,
consensus_header: &ConsensusHeader,
validation_result: &ValidationResult,
) -> Result<()>
fn store_validation_result( &mut self, consensus_header: &ConsensusHeader, validation_result: &ValidationResult, ) -> Result<()>
Source§fn validation_result(
&self,
consensus_header: &ConsensusHeader,
) -> Result<Option<ValidationResult>>
fn validation_result( &self, consensus_header: &ConsensusHeader, ) -> Result<Option<ValidationResult>>
Source§fn delete_validation_results<F>(&mut self, closure: F) -> Result<()>
fn delete_validation_results<F>(&mut self, closure: F) -> Result<()>
Source§fn clear_validation_results(&mut self) -> Result<()>
fn clear_validation_results(&mut self) -> Result<()>
Deletes all items from the CF_VALIDATION_RESULTS column family.
§Returns
Returns Ok(()) if the deletion is successful, or an error if the
operation fails.
Source§fn candidate_by_iteration(
&self,
consensus_header: &ConsensusHeader,
) -> Result<Option<Block>>
fn candidate_by_iteration( &self, consensus_header: &ConsensusHeader, ) -> Result<Option<Block>>
Fetches a candidate block by lookup key (prev_block_hash, iteration).
fn count_candidates(&self) -> usize
fn count_validation_results(&self) -> usize
Source§impl<DB: DBAccess> Debug for DBTransaction<'_, DB>
impl<DB: DBAccess> Debug for DBTransaction<'_, DB>
Source§impl<DB: DBAccess> Ledger for DBTransaction<'_, DB>
impl<DB: DBAccess> Ledger for DBTransaction<'_, DB>
Source§fn ledger_txs(&self, tx_ids: Vec<&[u8; 32]>) -> Result<Vec<SpentTransaction>>
fn ledger_txs(&self, tx_ids: Vec<&[u8; 32]>) -> Result<Vec<SpentTransaction>>
Returns a list of transactions from the ledger
This function expects a list of transaction IDs that are in the ledger.
It will return an error if any of the transaction IDs are not found in the ledger.
Source§fn ledger_tx_exists(&self, tx_id: &[u8]) -> Result<bool>
fn ledger_tx_exists(&self, tx_id: &[u8]) -> Result<bool>
Returns true if the transaction exists in the ledger
This is a convenience method that checks if a transaction exists in the ledger without unmarshalling the transaction
Source§fn store_block(
&mut self,
header: &Header,
txs: &[SpentTransaction],
faults: &[Fault],
label: Label,
) -> Result<usize>
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
fn faults_by_block(&self, start_height: u64) -> Result<Vec<Fault>>
fn store_block_label( &mut self, height: u64, hash: &[u8; 32], label: Label, ) -> Result<()>
fn delete_block(&mut self, b: &Block) -> Result<()>
fn block_exists(&self, hash: &[u8]) -> Result<bool>
fn faults(&self, faults_ids: &[[u8; 32]]) -> Result<Vec<Fault>>
fn latest_block(&self) -> Result<LightBlock>
fn blob_data_by_hash(&self, hash: &[u8; 32]) -> Result<Option<Vec<u8>>>
fn store_blob_data(&self, hash: &[u8; 32], data: Vec<u8>) -> Result<()>
fn store_blobs_height( &self, block_height: u64, blob_hashes: &[[u8; 32]], ) -> Result<()>
fn delete_blobs_by_height(&self, block_height: u64) -> Result<()>
fn blobs_by_height(&self, block_height: u64) -> Result<Option<Vec<[u8; 32]>>>
fn block(&self, hash: &[u8]) -> Result<Option<Block>>
fn light_block(&self, hash: &[u8]) -> Result<Option<LightBlock>>
fn block_header(&self, hash: &[u8]) -> Result<Option<Header>>
fn block_hash_by_height(&self, height: u64) -> Result<Option<[u8; 32]>>
fn ledger_tx(&self, tx_id: &[u8]) -> Result<Option<SpentTransaction>>
fn block_by_height(&self, height: u64) -> Result<Option<Block>>
fn block_label_by_height( &self, height: u64, ) -> Result<Option<([u8; 32], Label)>>
Source§impl<DB: DBAccess> Mempool for DBTransaction<'_, DB>
impl<DB: DBAccess> Mempool for DBTransaction<'_, DB>
Source§fn mempool_expired_txs(&self, timestamp: u64) -> Result<Vec<[u8; 32]>>
fn mempool_expired_txs(&self, timestamp: u64) -> Result<Vec<[u8; 32]>>
Get all expired transactions hashes.
Source§fn store_mempool_tx(&mut self, tx: &Transaction, timestamp: u64) -> Result<()>
fn store_mempool_tx(&mut self, tx: &Transaction, timestamp: u64) -> Result<()>
Adds a transaction to the mempool with a timestamp.
Source§fn mempool_tx(&self, hash: [u8; 32]) -> Result<Option<Transaction>>
fn mempool_tx(&self, hash: [u8; 32]) -> Result<Option<Transaction>>
Gets a transaction from the mempool.
Source§fn mempool_tx_exists(&self, h: [u8; 32]) -> Result<bool>
fn mempool_tx_exists(&self, h: [u8; 32]) -> Result<bool>
Checks if a transaction exists in the mempool.
Source§fn delete_mempool_tx(
&mut self,
h: [u8; 32],
cascade: bool,
) -> Result<Vec<[u8; 32]>>
fn delete_mempool_tx( &mut self, h: [u8; 32], cascade: bool, ) -> Result<Vec<[u8; 32]>>
Deletes a transaction from the mempool. Read more
Source§fn mempool_txs_by_spendable_ids(&self, n: &[SpendingId]) -> HashSet<[u8; 32]>
fn mempool_txs_by_spendable_ids(&self, n: &[SpendingId]) -> HashSet<[u8; 32]>
Get transactions hash from the mempool, searching by spendable ids
Source§fn mempool_txs_sorted_by_fee(
&self,
) -> Box<dyn Iterator<Item = Transaction> + '_>
fn mempool_txs_sorted_by_fee( &self, ) -> Box<dyn Iterator<Item = Transaction> + '_>
Get an iterator over the mempool transactions sorted by gas price
Source§fn mempool_txs_ids_sorted_by_fee(
&self,
) -> Box<dyn Iterator<Item = (u64, [u8; 32])> + '_>
fn mempool_txs_ids_sorted_by_fee( &self, ) -> Box<dyn Iterator<Item = (u64, [u8; 32])> + '_>
Get an iterator over the mempool transactions hash by gas price
Source§fn mempool_txs_ids_sorted_by_low_fee(
&self,
) -> Box<dyn Iterator<Item = (u64, [u8; 32])> + '_>
fn mempool_txs_ids_sorted_by_low_fee( &self, ) -> Box<dyn Iterator<Item = (u64, [u8; 32])> + '_>
Get an iterator over the mempool transactions hash by gas price (asc)
Source§fn mempool_txs_count(&self) -> usize
fn mempool_txs_count(&self) -> usize
Number of persisted transactions
Source§impl<DB: DBAccess> Metadata for DBTransaction<'_, DB>
impl<DB: DBAccess> Metadata for DBTransaction<'_, DB>
Auto Trait Implementations§
impl<'db, DB> !Freeze for DBTransaction<'db, DB>
impl<'db, DB> !RefUnwindSafe for DBTransaction<'db, DB>
impl<'db, DB> !Send for DBTransaction<'db, DB>
impl<'db, DB> !Sync for DBTransaction<'db, DB>
impl<'db, DB> Unpin for DBTransaction<'db, DB>
impl<'db, DB> UnwindSafe for DBTransaction<'db, DB>where
DB: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.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>
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§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
Source§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 moreSource§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 moreSource§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
Source§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
Source§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.Source§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.Source§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.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§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 moreSource§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 moreSource§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 moreSource§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 moreSource§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 moreSource§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 moreSource§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.