pub struct BlockMemory<N>where
N: Network,{ /* private fields */ }
Expand description
An in-memory block storage.
Trait Implementations§
Source§impl<N> BlockStorage<N> for BlockMemory<N>where
N: Network,
impl<N> BlockStorage<N> for BlockMemory<N>where
N: Network,
Source§fn state_root_map(&self) -> &<BlockMemory<N> as BlockStorage<N>>::StateRootMap
fn state_root_map(&self) -> &<BlockMemory<N> as BlockStorage<N>>::StateRootMap
Returns the state root map.
Source§fn reverse_state_root_map(
&self,
) -> &<BlockMemory<N> as BlockStorage<N>>::ReverseStateRootMap
fn reverse_state_root_map( &self, ) -> &<BlockMemory<N> as BlockStorage<N>>::ReverseStateRootMap
Returns the reverse state root map.
Source§fn id_map(&self) -> &<BlockMemory<N> as BlockStorage<N>>::IDMap
fn id_map(&self) -> &<BlockMemory<N> as BlockStorage<N>>::IDMap
Returns the ID map.
Source§fn reverse_id_map(&self) -> &<BlockMemory<N> as BlockStorage<N>>::ReverseIDMap
fn reverse_id_map(&self) -> &<BlockMemory<N> as BlockStorage<N>>::ReverseIDMap
Returns the reverse ID map.
Source§fn header_map(&self) -> &<BlockMemory<N> as BlockStorage<N>>::HeaderMap
fn header_map(&self) -> &<BlockMemory<N> as BlockStorage<N>>::HeaderMap
Returns the header map.
Source§fn certificate_map(
&self,
) -> &<BlockMemory<N> as BlockStorage<N>>::CertificateMap
fn certificate_map( &self, ) -> &<BlockMemory<N> as BlockStorage<N>>::CertificateMap
Returns the certificate map.
Returns the authority map.
Source§fn ratifications_map(
&self,
) -> &<BlockMemory<N> as BlockStorage<N>>::RatificationsMap
fn ratifications_map( &self, ) -> &<BlockMemory<N> as BlockStorage<N>>::RatificationsMap
Returns the ratifications map.
Source§fn solutions_map(&self) -> &<BlockMemory<N> as BlockStorage<N>>::SolutionsMap
fn solutions_map(&self) -> &<BlockMemory<N> as BlockStorage<N>>::SolutionsMap
Returns the solutions map.
Source§fn puzzle_commitments_map(
&self,
) -> &<BlockMemory<N> as BlockStorage<N>>::PuzzleCommitmentsMap
fn puzzle_commitments_map( &self, ) -> &<BlockMemory<N> as BlockStorage<N>>::PuzzleCommitmentsMap
Returns the puzzle commitments map.
Source§fn transactions_map(
&self,
) -> &<BlockMemory<N> as BlockStorage<N>>::TransactionsMap
fn transactions_map( &self, ) -> &<BlockMemory<N> as BlockStorage<N>>::TransactionsMap
Returns the transactions map.
Source§fn aborted_transaction_ids_map(
&self,
) -> &<BlockMemory<N> as BlockStorage<N>>::AbortedTransactionIDsMap
fn aborted_transaction_ids_map( &self, ) -> &<BlockMemory<N> as BlockStorage<N>>::AbortedTransactionIDsMap
Returns the aborted transaction IDs map.
Source§fn rejected_or_aborted_transaction_id_map(
&self,
) -> &<BlockMemory<N> as BlockStorage<N>>::RejectedOrAbortedTransactionIDMap
fn rejected_or_aborted_transaction_id_map( &self, ) -> &<BlockMemory<N> as BlockStorage<N>>::RejectedOrAbortedTransactionIDMap
Returns the rejected transaction ID or aborted transaction ID map.
Source§fn confirmed_transactions_map(
&self,
) -> &<BlockMemory<N> as BlockStorage<N>>::ConfirmedTransactionsMap
fn confirmed_transactions_map( &self, ) -> &<BlockMemory<N> as BlockStorage<N>>::ConfirmedTransactionsMap
Returns the confirmed transactions map.
Source§fn rejected_deployment_or_execution_map(
&self,
) -> &<BlockMemory<N> as BlockStorage<N>>::RejectedDeploymentOrExecutionMap
fn rejected_deployment_or_execution_map( &self, ) -> &<BlockMemory<N> as BlockStorage<N>>::RejectedDeploymentOrExecutionMap
Returns the rejected deployment or execution map.
Source§fn transaction_store(
&self,
) -> &TransactionStore<N, <BlockMemory<N> as BlockStorage<N>>::TransactionStorage>
fn transaction_store( &self, ) -> &TransactionStore<N, <BlockMemory<N> as BlockStorage<N>>::TransactionStorage>
Returns the transaction store.
Source§type StateRootMap = MemoryMap<u32, <N as Network>::StateRoot>
type StateRootMap = MemoryMap<u32, <N as Network>::StateRoot>
The mapping of
block height
to state root
.Source§type ReverseStateRootMap = MemoryMap<<N as Network>::StateRoot, u32>
type ReverseStateRootMap = MemoryMap<<N as Network>::StateRoot, u32>
The mapping of
state root
to block height
.Source§type IDMap = MemoryMap<u32, <N as Network>::BlockHash>
type IDMap = MemoryMap<u32, <N as Network>::BlockHash>
The mapping of
block height
to block hash
.Source§type ReverseIDMap = MemoryMap<<N as Network>::BlockHash, u32>
type ReverseIDMap = MemoryMap<<N as Network>::BlockHash, u32>
The mapping of
block hash
to block height
.Source§type HeaderMap = MemoryMap<<N as Network>::BlockHash, Header<N>>
type HeaderMap = MemoryMap<<N as Network>::BlockHash, Header<N>>
The mapping of
block hash
to block header
.Source§type AuthorityMap = MemoryMap<<N as Network>::BlockHash, Authority<N>>
type AuthorityMap = MemoryMap<<N as Network>::BlockHash, Authority<N>>
The mapping of
block hash
to block authority
.Source§type CertificateMap = MemoryMap<Field<N>, (u32, u64)>
type CertificateMap = MemoryMap<Field<N>, (u32, u64)>
The mapping of
certificate ID
to (block height
, round height
).Source§type RatificationsMap = MemoryMap<<N as Network>::BlockHash, Ratifications<N>>
type RatificationsMap = MemoryMap<<N as Network>::BlockHash, Ratifications<N>>
The mapping of
block hash
to block ratifications
.Source§type SolutionsMap = MemoryMap<<N as Network>::BlockHash, Option<CoinbaseSolution<N>>>
type SolutionsMap = MemoryMap<<N as Network>::BlockHash, Option<CoinbaseSolution<N>>>
The mapping of
block hash
to block solutions
.Source§type PuzzleCommitmentsMap = MemoryMap<PuzzleCommitment<N>, u32>
type PuzzleCommitmentsMap = MemoryMap<PuzzleCommitment<N>, u32>
The mapping of
puzzle commitment
to block height
.Source§type TransactionsMap = MemoryMap<<N as Network>::BlockHash, Vec<<N as Network>::TransactionID>>
type TransactionsMap = MemoryMap<<N as Network>::BlockHash, Vec<<N as Network>::TransactionID>>
The mapping of
block hash
to [transaction ID]
.Source§type AbortedTransactionIDsMap = MemoryMap<<N as Network>::BlockHash, Vec<<N as Network>::TransactionID>>
type AbortedTransactionIDsMap = MemoryMap<<N as Network>::BlockHash, Vec<<N as Network>::TransactionID>>
The mapping of
block hash
to [aborted transaction ID]
.Source§type RejectedOrAbortedTransactionIDMap = MemoryMap<<N as Network>::TransactionID, <N as Network>::BlockHash>
type RejectedOrAbortedTransactionIDMap = MemoryMap<<N as Network>::TransactionID, <N as Network>::BlockHash>
The mapping of rejected or aborted
transaction ID
to block hash
.Source§type ConfirmedTransactionsMap = MemoryMap<<N as Network>::TransactionID, (<N as Network>::BlockHash, ConfirmedTxType, Vec<u8>)>
type ConfirmedTransactionsMap = MemoryMap<<N as Network>::TransactionID, (<N as Network>::BlockHash, ConfirmedTxType, Vec<u8>)>
The mapping of
transaction ID
to (block hash, confirmed tx type, confirmed blob)
.
TODO (howardwu): For mainnet - With recent DB changes, to prevent breaking compatibility,
include rejected (d or e) ID into ConfirmedTxType
, and change from Vec<u8>
to Vec<FinalizeOps>
.Source§type RejectedDeploymentOrExecutionMap = MemoryMap<Field<N>, Rejected<N>>
type RejectedDeploymentOrExecutionMap = MemoryMap<Field<N>, Rejected<N>>
The rejected deployment or execution map.
Source§type TransactionStorage = TransactionMemory<N>
type TransactionStorage = TransactionMemory<N>
The transaction storage.
Source§type TransitionStorage = TransitionMemory<N>
type TransitionStorage = TransitionMemory<N>
The transition storage.
Source§fn transition_store(&self) -> &TransitionStore<N, Self::TransitionStorage>
fn transition_store(&self) -> &TransitionStore<N, Self::TransitionStorage>
Returns the transition store.
Source§fn storage_mode(&self) -> &StorageMode
fn storage_mode(&self) -> &StorageMode
Returns the storage mode.
Source§fn start_atomic(&self)
fn start_atomic(&self)
Starts an atomic batch write operation.
Source§fn is_atomic_in_progress(&self) -> bool
fn is_atomic_in_progress(&self) -> bool
Checks if an atomic batch is in progress.
Source§fn atomic_checkpoint(&self)
fn atomic_checkpoint(&self)
Checkpoints the atomic batch.
Source§fn clear_latest_checkpoint(&self)
fn clear_latest_checkpoint(&self)
Clears the latest atomic batch checkpoint.
Source§fn atomic_rewind(&self)
fn atomic_rewind(&self)
Rewinds the atomic batch to the previous checkpoint.
Source§fn abort_atomic(&self)
fn abort_atomic(&self)
Aborts an atomic batch write operation.
Source§fn insert(
&self,
state_root: <N as Network>::StateRoot,
block: &Block<N>,
) -> Result<(), Error>
fn insert( &self, state_root: <N as Network>::StateRoot, block: &Block<N>, ) -> Result<(), Error>
Stores the given
(state root, block)
pair into storage.Source§fn remove(&self, block_hash: &<N as Network>::BlockHash) -> Result<(), Error>
fn remove(&self, block_hash: &<N as Network>::BlockHash) -> Result<(), Error>
Removes the block for the given
block hash
.Source§fn contains_transaction_id(
&self,
transaction_id: &<N as Network>::TransactionID,
) -> Result<bool, Error>
fn contains_transaction_id( &self, transaction_id: &<N as Network>::TransactionID, ) -> Result<bool, Error>
Returns
true
if the given transaction ID exists.Source§fn contains_rejected_or_aborted_transaction_id(
&self,
transaction_id: &<N as Network>::TransactionID,
) -> Result<bool, Error>
fn contains_rejected_or_aborted_transaction_id( &self, transaction_id: &<N as Network>::TransactionID, ) -> Result<bool, Error>
Returns
true
if the given rejected transaction ID or aborted transaction ID exists.Source§fn contains_rejected_deployment_or_execution_id(
&self,
rejected_id: &Field<N>,
) -> Result<bool, Error>
fn contains_rejected_deployment_or_execution_id( &self, rejected_id: &Field<N>, ) -> Result<bool, Error>
Returns
true
if the given rejected deployment or execution ID.Source§fn find_block_height_from_state_root(
&self,
state_root: <N as Network>::StateRoot,
) -> Result<Option<u32>, Error>
fn find_block_height_from_state_root( &self, state_root: <N as Network>::StateRoot, ) -> Result<Option<u32>, Error>
Returns the block height that contains the given
state root
.Source§fn find_block_hash(
&self,
transaction_id: &<N as Network>::TransactionID,
) -> Result<Option<<N as Network>::BlockHash>, Error>
fn find_block_hash( &self, transaction_id: &<N as Network>::TransactionID, ) -> Result<Option<<N as Network>::BlockHash>, Error>
Returns the block hash that contains the given
transaction ID
.Source§fn find_block_height_from_puzzle_commitment(
&self,
puzzle_commitment: &PuzzleCommitment<N>,
) -> Result<Option<u32>, Error>
fn find_block_height_from_puzzle_commitment( &self, puzzle_commitment: &PuzzleCommitment<N>, ) -> Result<Option<u32>, Error>
Returns the block height that contains the given
puzzle commitment
.Source§fn get_state_root(
&self,
block_height: u32,
) -> Result<Option<<N as Network>::StateRoot>, Error>
fn get_state_root( &self, block_height: u32, ) -> Result<Option<<N as Network>::StateRoot>, Error>
Returns the state root that contains the given
block height
.Source§fn get_state_path_for_commitment(
&self,
commitment: &Field<N>,
block_tree: &MerkleTree<N, BHP<N, 8, 54>, BHP<N, 6, 43>, snarkvm_console_program::::state_path::configuration::BlockTree::{constant#0}>,
) -> Result<StatePath<N>, Error>
fn get_state_path_for_commitment( &self, commitment: &Field<N>, block_tree: &MerkleTree<N, BHP<N, 8, 54>, BHP<N, 6, 43>, snarkvm_console_program::::state_path::configuration::BlockTree::{constant#0}>, ) -> Result<StatePath<N>, Error>
Returns a state path for the given
commitment
.Source§fn get_previous_block_hash(
&self,
height: u32,
) -> Result<Option<<N as Network>::BlockHash>, Error>
fn get_previous_block_hash( &self, height: u32, ) -> Result<Option<<N as Network>::BlockHash>, Error>
Returns the previous block hash of the given
block height
.Source§fn get_block_hash(
&self,
height: u32,
) -> Result<Option<<N as Network>::BlockHash>, Error>
fn get_block_hash( &self, height: u32, ) -> Result<Option<<N as Network>::BlockHash>, Error>
Returns the block hash for the given
block height
.Source§fn get_block_height(
&self,
block_hash: &<N as Network>::BlockHash,
) -> Result<Option<u32>, Error>
fn get_block_height( &self, block_hash: &<N as Network>::BlockHash, ) -> Result<Option<u32>, Error>
Returns the block height for the given
block hash
.Source§fn get_block_header(
&self,
block_hash: &<N as Network>::BlockHash,
) -> Result<Option<Header<N>>, Error>
fn get_block_header( &self, block_hash: &<N as Network>::BlockHash, ) -> Result<Option<Header<N>>, Error>
Returns the block header for the given
block hash
.Returns the block authority for the given
block hash
.Source§fn get_batch_certificate(
&self,
certificate_id: &Field<N>,
) -> Result<Option<BatchCertificate<N>>, Error>
fn get_batch_certificate( &self, certificate_id: &Field<N>, ) -> Result<Option<BatchCertificate<N>>, Error>
Returns the batch certificate for the given
certificate ID
.Source§fn get_block_ratifications(
&self,
block_hash: &<N as Network>::BlockHash,
) -> Result<Option<Ratifications<N>>, Error>
fn get_block_ratifications( &self, block_hash: &<N as Network>::BlockHash, ) -> Result<Option<Ratifications<N>>, Error>
Returns the block ratifications for the given
block hash
.Source§fn get_block_solutions(
&self,
block_hash: &<N as Network>::BlockHash,
) -> Result<Option<CoinbaseSolution<N>>, Error>
fn get_block_solutions( &self, block_hash: &<N as Network>::BlockHash, ) -> Result<Option<CoinbaseSolution<N>>, Error>
Returns the block solutions for the given
block hash
.Source§fn get_solution(
&self,
puzzle_commitment: &PuzzleCommitment<N>,
) -> Result<ProverSolution<N>, Error>
fn get_solution( &self, puzzle_commitment: &PuzzleCommitment<N>, ) -> Result<ProverSolution<N>, Error>
Returns the prover solution for the given solution ID.
Source§fn get_block_transactions(
&self,
block_hash: &<N as Network>::BlockHash,
) -> Result<Option<Transactions<N>>, Error>
fn get_block_transactions( &self, block_hash: &<N as Network>::BlockHash, ) -> Result<Option<Transactions<N>>, Error>
Returns the block transactions for the given
block hash
.Source§fn get_block_aborted_transaction_ids(
&self,
block_hash: &<N as Network>::BlockHash,
) -> Result<Option<Vec<<N as Network>::TransactionID>>, Error>
fn get_block_aborted_transaction_ids( &self, block_hash: &<N as Network>::BlockHash, ) -> Result<Option<Vec<<N as Network>::TransactionID>>, Error>
Returns the block aborted transaction IDs for the given
block hash
.Source§fn get_transaction(
&self,
transaction_id: &<N as Network>::TransactionID,
) -> Result<Option<Transaction<N>>, Error>
fn get_transaction( &self, transaction_id: &<N as Network>::TransactionID, ) -> Result<Option<Transaction<N>>, Error>
Returns the transaction for the given
transaction ID
.Source§fn get_confirmed_transaction(
&self,
transaction_id: <N as Network>::TransactionID,
) -> Result<Option<ConfirmedTransaction<N>>, Error>
fn get_confirmed_transaction( &self, transaction_id: <N as Network>::TransactionID, ) -> Result<Option<ConfirmedTransaction<N>>, Error>
Returns the confirmed transaction for the given
transaction ID
.Source§fn get_unconfirmed_transaction(
&self,
transaction_id: &<N as Network>::TransactionID,
) -> Result<Option<Transaction<N>>, Error>
fn get_unconfirmed_transaction( &self, transaction_id: &<N as Network>::TransactionID, ) -> Result<Option<Transaction<N>>, Error>
Returns the unconfirmed transaction for the given
transaction ID
.Source§impl<N> Clone for BlockMemory<N>
impl<N> Clone for BlockMemory<N>
Source§fn clone(&self) -> BlockMemory<N>
fn clone(&self) -> BlockMemory<N>
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<N> Freeze for BlockMemory<N>
impl<N> !RefUnwindSafe for BlockMemory<N>
impl<N> Send for BlockMemory<N>
impl<N> Sync for BlockMemory<N>
impl<N> Unpin for BlockMemory<N>where
N: Unpin,
impl<N> !UnwindSafe for BlockMemory<N>
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> 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 more