Struct explorer::db::ExplorerDb
source · pub struct ExplorerDb {
multiverse: Multiverse,
longest_chain_tip: Tip,
pub blockchain_config: BlockchainConfig,
stable_store: StableIndex,
tip_broadcast: Sender<(HeaderId, Ref)>,
}
Fields§
§multiverse: Multiverse
Structure that keeps all the known states to allow easy branch management
each new block is indexed by getting its previous State
from the multiverse
and inserted a new updated one.
longest_chain_tip: Tip
This keeps track of the longest chain seen until now. All the queries are performed using the state of this branch, the HeaderHash is used as key for the multiverse, and the ChainLength is used in the updating process.
blockchain_config: BlockchainConfig
§stable_store: StableIndex
§tip_broadcast: Sender<(HeaderId, Ref)>
Implementations§
source§impl ExplorerDb
impl ExplorerDb
pub fn bootstrap(block0: Block) -> Result<Self, Error>
sourcepub async fn apply_block(&self, block: Block) -> Result<Ref, Error>
pub async fn apply_block(&self, block: Block) -> Result<Ref, Error>
Try to add a new block to the indexes, this can fail if the parent of the block is not processed. This doesn’t perform any validation on the given block and the previous state, it is assumed that the Block is valid
pub async fn get_block( &self, block_id: &HeaderHash ) -> Option<Arc<ExplorerBlock>>
pub async fn set_tip(&self, hash: HeaderHash) -> Result<(), BlockNotFound>
pub async fn get_block_with_branches( &self, block_id: &HeaderHash ) -> Option<(Arc<ExplorerBlock>, Vec<(HeaderHash, Ref)>)>
pub async fn get_epoch(&self, epoch: Epoch) -> Option<EpochData>
pub async fn is_block_confirmed(&self, block_id: &HeaderHash) -> bool
pub async fn find_blocks_by_chain_length( &self, chain_length: ChainLength ) -> Vec<HeaderHash>
pub async fn find_blocks_by_transaction( &self, transaction_id: &FragmentId ) -> Vec<HeaderHash>
pub async fn get_stake_pool_blocks( &self, pool: &PoolId ) -> Option<Arc<PersistentSequence<HeaderHash>>>
pub async fn get_stake_pool_data( &self, pool: &PoolId ) -> Option<Arc<StakePoolData>>
pub async fn get_vote_plan_by_id( &self, vote_plan_id: &VotePlanId ) -> Option<Arc<ExplorerVotePlan>>
pub async fn get_branch(&self, hash: &HeaderHash) -> Option<Ref>
pub async fn get_tip(&self) -> (HeaderHash, Ref)
pub async fn get_branches(&self) -> Vec<(HeaderHash, Ref)>
pub fn tip_subscription( &self ) -> impl Stream<Item = Result<(HeaderHash, Ref), BroadcastStreamRecvError>>
Trait Implementations§
source§impl Clone for ExplorerDb
impl Clone for ExplorerDb
source§fn clone(&self) -> ExplorerDb
fn clone(&self) -> ExplorerDb
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 !RefUnwindSafe for ExplorerDb
impl Send for ExplorerDb
impl Sync for ExplorerDb
impl Unpin for ExplorerDb
impl !UnwindSafe for ExplorerDb
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request