pub struct BlockStore<N: Network, B: BlockStorage<N>> { /* private fields */ }
Expand description

The block store.

Implementations§

source§

impl<N: Network, B: BlockStorage<N>> BlockStore<N, B>

source

pub fn open(dev: Option<u16>) -> Result<Self>

Initializes the block store.

source

pub fn insert(&self, block: &Block<N>) -> Result<()>

Stores the given block into storage.

source

pub fn remove_last_n(&self, n: u32) -> Result<()>

Removes the last ‘n’ blocks from storage.

source

pub fn transaction_store(&self) -> &TransactionStore<N, B::TransactionStorage>

Returns the transaction store.

source

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

Returns the transition store.

source

pub fn start_atomic(&self)

Starts an atomic batch write operation.

source

pub fn is_atomic_in_progress(&self) -> bool

Checks if an atomic batch is in progress.

source

pub fn atomic_checkpoint(&self)

Checkpoints the atomic batch.

source

pub fn clear_latest_checkpoint(&self)

Clears the latest atomic batch checkpoint.

source

pub fn atomic_rewind(&self)

Rewinds the atomic batch to the previous checkpoint.

source

pub fn abort_atomic(&self)

Aborts an atomic batch write operation.

source

pub fn finish_atomic(&self) -> Result<()>

Finishes an atomic batch write operation.

source

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

Returns the optional development ID.

source§

impl<N: Network, B: BlockStorage<N>> BlockStore<N, B>

source

pub fn find_block_height_from_state_root( &self, state_root: N::StateRoot ) -> Result<Option<u32>>

Returns the block height that contains the given state root.

source

pub fn find_block_hash( &self, transaction_id: &N::TransactionID ) -> Result<Option<N::BlockHash>>

Returns the block hash that contains the given transaction ID.

source

pub fn find_block_height_from_puzzle_commitment( &self, puzzle_commitment: &PuzzleCommitment<N> ) -> Result<Option<u32>>

Returns the block height that contains the given puzzle commitment.

source§

impl<N: Network, B: BlockStorage<N>> BlockStore<N, B>

source

pub fn current_state_root(&self) -> N::StateRoot

Returns the current state root.

source

pub fn get_state_root(&self, block_height: u32) -> Result<Option<N::StateRoot>>

Returns the state root that contains the given block height.

source

pub fn get_state_path_for_commitment( &self, commitment: &Field<N> ) -> Result<StatePath<N>>

Returns a state path for the given commitment.

source

pub fn get_previous_block_hash( &self, height: u32 ) -> Result<Option<N::BlockHash>>

Returns the previous block hash of the given block height.

source

pub fn get_block_hash(&self, height: u32) -> Result<Option<N::BlockHash>>

Returns the block hash for the given block height.

source

pub fn get_block_height(&self, block_hash: &N::BlockHash) -> Result<Option<u32>>

Returns the block height for the given block hash.

source

pub fn get_block_header( &self, block_hash: &N::BlockHash ) -> Result<Option<Header<N>>>

Returns the block header for the given block hash.

source

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

Returns the block authority for the given block hash.

source

pub fn get_block_ratifications( &self, block_hash: &N::BlockHash ) -> Result<Option<Ratifications<N>>>

Returns the block ratifications for the given block hash.

source

pub fn get_block_solutions( &self, block_hash: &N::BlockHash ) -> Result<Option<CoinbaseSolution<N>>>

Returns the block solutions for the given block hash.

source

pub fn get_solution( &self, solution_id: &PuzzleCommitment<N> ) -> Result<ProverSolution<N>>

Returns the prover solution for the given solution ID.

source

pub fn get_block_transactions( &self, block_hash: &N::BlockHash ) -> Result<Option<Transactions<N>>>

Returns the block transactions for the given block hash.

source

pub fn get_block_aborted_transaction_ids( &self, block_hash: &N::BlockHash ) -> Result<Option<Vec<N::TransactionID>>>

Returns the block aborted transaction IDs for the given block hash.

source

pub fn get_transaction( &self, transaction_id: &N::TransactionID ) -> Result<Option<Transaction<N>>>

Returns the transaction for the given transaction ID.

source

pub fn get_confirmed_transaction( &self, transaction_id: &N::TransactionID ) -> Result<Option<ConfirmedTransaction<N>>>

Returns the confirmed transaction for the given transaction ID.

source

pub fn get_unconfirmed_transaction( &self, transaction_id: &N::TransactionID ) -> Result<Option<Transaction<N>>>

Returns the unconfirmed transaction for the given transaction ID.

source

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

Returns the block for the given block hash.

source

pub fn get_program( &self, program_id: &ProgramID<N> ) -> Result<Option<Program<N>>>

Returns the program for the given program ID.

source

pub fn get_batch_certificate( &self, certificate_id: &Field<N> ) -> Result<Option<BatchCertificate<N>>>

Returns the batch certificate for the given certificate ID.

source§

impl<N: Network, B: BlockStorage<N>> BlockStore<N, B>

source

pub fn contains_state_root(&self, state_root: &N::StateRoot) -> Result<bool>

Returns true if the given state root exists.

source

pub fn contains_block_height(&self, height: u32) -> Result<bool>

Returns true if the given block height exists.

source

pub fn contains_block_hash(&self, block_hash: &N::BlockHash) -> Result<bool>

Returns true if the given block hash exists.

source

pub fn contains_transaction_id( &self, transaction_id: &N::TransactionID ) -> Result<bool>

Returns true if the given transaction ID exists.

source

pub fn contains_rejected_or_aborted_transaction_id( &self, transaction_id: &N::TransactionID ) -> Result<bool>

Returns true if the given rejected transaction ID or aborted transaction ID exists.

source

pub fn contains_rejected_deployment_or_execution_id( &self, rejected_id: &Field<N> ) -> Result<bool>

Returns true if the given rejected deployment or execution ID.

source

pub fn contains_certificate(&self, certificate_id: &Field<N>) -> Result<bool>

Returns true if the given certificate ID exists.

source

pub fn contains_puzzle_commitment( &self, puzzle_commitment: &PuzzleCommitment<N> ) -> Result<bool>

Returns true if the given puzzle commitment exists.

source§

impl<N: Network, B: BlockStorage<N>> BlockStore<N, B>

source

pub fn state_roots(&self) -> impl '_ + Iterator<Item = Cow<'_, N::StateRoot>>

Returns an iterator over the state roots, for all blocks in self.

source

pub fn heights(&self) -> impl '_ + Iterator<Item = Cow<'_, u32>>

Returns an iterator over the block heights, for all blocks in self.

source

pub fn hashes(&self) -> impl '_ + Iterator<Item = Cow<'_, N::BlockHash>>

Returns an iterator over the block hashes, for all blocks in self.

source

pub fn puzzle_commitments( &self ) -> impl '_ + Iterator<Item = Cow<'_, PuzzleCommitment<N>>>

Returns an iterator over the puzzle commitments, for all blocks in self.

Trait Implementations§

source§

impl<N: Clone + Network, B: Clone + BlockStorage<N>> Clone for BlockStore<N, B>

source§

fn clone(&self) -> BlockStore<N, B>

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, B> !RefUnwindSafe for BlockStore<N, B>

§

impl<N, B> Send for BlockStore<N, B>

§

impl<N, B> Sync for BlockStore<N, B>

§

impl<N, B> Unpin for BlockStore<N, B>where B: Unpin,

§

impl<N, B> !UnwindSafe for BlockStore<N, B>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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.

source§

impl<T, U> Into<U> for Twhere 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 Twhere 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 Twhere 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 Twhere 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 Twhere V: MultiLane<T>,

§

fn vzip(self) -> V