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,

source§

fn open(dev: Option<u16>) -> Result<BlockMemory<N>, Error>

Initializes the block storage.

source§

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

Returns the reverse state root map.

source§

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

Returns the reverse ID map.

source§

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

Returns the certificate map.

source§

fn authority_map(&self) -> &<BlockMemory<N> as BlockStorage<N>>::AuthorityMap

Returns the authority map.

source§

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

Returns the solutions map.

source§

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

Returns the transactions map.

source§

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

Returns the rejected transaction ID or aborted transaction ID map.

source§

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

Returns the rejected deployment or execution map.

source§

fn transaction_store( &self ) -> &TransactionStore<N, <BlockMemory<N> as BlockStorage<N>>::TransactionStorage>

Returns the transaction store.

§

type StateRootMap = MemoryMap<u32, <N as Network>::StateRoot>

The mapping of block height to state root.
§

type ReverseStateRootMap = MemoryMap<<N as Network>::StateRoot, u32>

The mapping of state root to block height.
§

type IDMap = MemoryMap<u32, <N as Network>::BlockHash>

The mapping of block height to block hash.
§

type ReverseIDMap = MemoryMap<<N as Network>::BlockHash, u32>

The mapping of block hash to block height.
§

type HeaderMap = MemoryMap<<N as Network>::BlockHash, Header<N>>

The mapping of block hash to block header.
§

type AuthorityMap = MemoryMap<<N as Network>::BlockHash, Authority<N>>

The mapping of block hash to block authority.
§

type CertificateMap = MemoryMap<Field<N>, (u32, u64)>

The mapping of certificate ID to (block height, round height).
§

type RatificationsMap = MemoryMap<<N as Network>::BlockHash, Ratifications<N>>

The mapping of block hash to block ratifications.
§

type SolutionsMap = MemoryMap<<N as Network>::BlockHash, Option<CoinbaseSolution<N>>>

The mapping of block hash to block solutions.
§

type PuzzleCommitmentsMap = MemoryMap<PuzzleCommitment<N>, u32>

The mapping of puzzle commitment to block height.
§

type TransactionsMap = MemoryMap<<N as Network>::BlockHash, Vec<<N as Network>::TransactionID>>

The mapping of block hash to [transaction ID].
§

type AbortedTransactionIDsMap = MemoryMap<<N as Network>::BlockHash, Vec<<N as Network>::TransactionID>>

The mapping of block hash to [aborted transaction ID].
§

type RejectedOrAbortedTransactionIDMap = MemoryMap<<N as Network>::TransactionID, <N as Network>::BlockHash>

The mapping of rejected or aborted transaction ID to block hash.
§

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>.
§

type RejectedDeploymentOrExecutionMap = MemoryMap<Field<N>, Rejected<N>>

The rejected deployment or execution map.
§

type TransactionStorage = TransactionMemory<N>

The transaction storage.
§

type TransitionStorage = TransitionMemory<N>

The transition storage.
source§

fn transition_store(&self) -> &TransitionStore<N, Self::TransitionStorage>

Returns the transition store.
source§

fn dev(&self) -> Option<u16>

Returns the optional development ID.
source§

fn start_atomic(&self)

Starts an atomic batch write operation.
source§

fn is_atomic_in_progress(&self) -> bool

Checks if an atomic batch is in progress.
source§

fn atomic_checkpoint(&self)

Checkpoints the atomic batch.
source§

fn clear_latest_checkpoint(&self)

Clears the latest atomic batch checkpoint.
source§

fn atomic_rewind(&self)

Rewinds the atomic batch to the previous checkpoint.
source§

fn abort_atomic(&self)

Aborts an atomic batch write operation.
source§

fn finish_atomic(&self) -> Result<(), Error>

Finishes an atomic batch write operation.
source§

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>

Removes the block for the given block hash.
source§

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>

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>

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>

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>

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>

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>

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>

Returns a state path for the given commitment.
source§

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>

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>

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>

Returns the block header for the given block hash.
source§

fn get_block_authority( &self, block_hash: &<N as Network>::BlockHash ) -> Result<Option<Authority<N>>, Error>

Returns the block authority for the given block hash.
source§

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>

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>

Returns the block solutions for the given block hash.
source§

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>

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>

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>

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>

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>

Returns the unconfirmed transaction for the given transaction ID.
source§

fn get_block( &self, block_hash: &<N as Network>::BlockHash ) -> Result<Option<Block<N>>, Error>

Returns the block for the given block hash.
source§

impl<N> Clone for BlockMemory<N>

source§

fn clone(&self) -> BlockMemory<N>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more