| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Storage.ChainDB.Impl.Query
Contents
Description
Queries
Synopsis
- getCurrentChain :: forall m blk. (IOLike m, HasHeader (Header blk), ConsensusProtocol (BlockProtocol blk)) => ChainDbEnv m blk -> STM m (AnchoredFragment (Header blk))
- getCurrentLedger :: IOLike m => ChainDbEnv m blk -> STM m (ExtLedgerState blk)
- getPastLedger :: (HasHeader blk, IOLike m) => ChainDbEnv m blk -> Point blk -> STM m (Maybe (ExtLedgerState blk))
- getHeaderStateHistory :: IOLike m => ChainDbEnv m blk -> STM m (HeaderStateHistory blk)
- getTipBlock :: forall m blk. (IOLike m, HasHeader blk, HasHeader (Header blk)) => ChainDbEnv m blk -> m (Maybe blk)
- getTipHeader :: forall m blk. (IOLike m, HasHeader blk, HasHeader (Header blk)) => ChainDbEnv m blk -> m (Maybe (Header blk))
- getTipPoint :: forall m blk. (IOLike m, HasHeader (Header blk)) => ChainDbEnv m blk -> STM m (Point blk)
- getBlockComponent :: forall m blk b. IOLike m => ChainDbEnv m blk -> BlockComponent blk b -> RealPoint blk -> m (Maybe b)
- getIsFetched :: forall m blk. IOLike m => ChainDbEnv m blk -> STM m (Point blk -> Bool)
- getIsValid :: forall m blk. (IOLike m, HasHeader blk) => ChainDbEnv m blk -> STM m (RealPoint blk -> Maybe Bool)
- getIsInvalidBlock :: forall m blk. (IOLike m, HasHeader blk) => ChainDbEnv m blk -> STM m (WithFingerprint (HeaderHash blk -> Maybe (InvalidBlockReason blk)))
- getMaxSlotNo :: forall m blk. (IOLike m, HasHeader (Header blk)) => ChainDbEnv m blk -> STM m MaxSlotNo
- getAnyKnownBlock :: forall m blk. (IOLike m, HasHeader blk) => ImmutableDB m blk -> VolatileDB m blk -> RealPoint blk -> m blk
- getAnyKnownBlockComponent :: forall m blk b. (IOLike m, HasHeader blk) => ImmutableDB m blk -> VolatileDB m blk -> BlockComponent blk b -> RealPoint blk -> m b
- getAnyBlockComponent :: forall m blk b. IOLike m => ImmutableDB m blk -> VolatileDB m blk -> BlockComponent blk b -> RealPoint blk -> m (Maybe b)
Queries
getCurrentChain :: forall m blk. (IOLike m, HasHeader (Header blk), ConsensusProtocol (BlockProtocol blk)) => ChainDbEnv m blk -> STM m (AnchoredFragment (Header blk)) Source #
Return the last k headers.
While the in-memory fragment (cdbChain) might temporarily be longer than
k (until the background thread has copied those blocks to the
ImmutableDB), this function will never return a fragment longer than k.
The anchor point of the returned fragment will be the most recent
"immutable" block, i.e. a block that cannot be rolled back. In
ChainDB.md, we call this block i.
Note that the returned fragment may be shorter than k in case the whole
chain itself is shorter than k or in case the VolatileDB was corrupted.
In the latter case, we don't take blocks already in the ImmutableDB into
account, as we know they must have been "immutable" at some point, and,
therefore, must still be "immutable".
getCurrentLedger :: IOLike m => ChainDbEnv m blk -> STM m (ExtLedgerState blk) Source #
getPastLedger :: (HasHeader blk, IOLike m) => ChainDbEnv m blk -> Point blk -> STM m (Maybe (ExtLedgerState blk)) Source #
getHeaderStateHistory :: IOLike m => ChainDbEnv m blk -> STM m (HeaderStateHistory blk) Source #
getTipBlock :: forall m blk. (IOLike m, HasHeader blk, HasHeader (Header blk)) => ChainDbEnv m blk -> m (Maybe blk) Source #
getTipHeader :: forall m blk. (IOLike m, HasHeader blk, HasHeader (Header blk)) => ChainDbEnv m blk -> m (Maybe (Header blk)) Source #
getTipPoint :: forall m blk. (IOLike m, HasHeader (Header blk)) => ChainDbEnv m blk -> STM m (Point blk) Source #
getBlockComponent :: forall m blk b. IOLike m => ChainDbEnv m blk -> BlockComponent blk b -> RealPoint blk -> m (Maybe b) Source #
getIsFetched :: forall m blk. IOLike m => ChainDbEnv m blk -> STM m (Point blk -> Bool) Source #
getIsValid :: forall m blk. (IOLike m, HasHeader blk) => ChainDbEnv m blk -> STM m (RealPoint blk -> Maybe Bool) Source #
getIsInvalidBlock :: forall m blk. (IOLike m, HasHeader blk) => ChainDbEnv m blk -> STM m (WithFingerprint (HeaderHash blk -> Maybe (InvalidBlockReason blk))) Source #
getMaxSlotNo :: forall m blk. (IOLike m, HasHeader (Header blk)) => ChainDbEnv m blk -> STM m MaxSlotNo Source #
Low-level queries
getAnyKnownBlock :: forall m blk. (IOLike m, HasHeader blk) => ImmutableDB m blk -> VolatileDB m blk -> RealPoint blk -> m blk Source #
Variant of getAnyBlockComponent instantiated with GetBlock.
getAnyKnownBlockComponent :: forall m blk b. (IOLike m, HasHeader blk) => ImmutableDB m blk -> VolatileDB m blk -> BlockComponent blk b -> RealPoint blk -> m b Source #
Wrapper around getAnyBlockComponent for blocks we know should exist.
If the block does not exist, this indicates disk failure.
getAnyBlockComponent :: forall m blk b. IOLike m => ImmutableDB m blk -> VolatileDB m blk -> BlockComponent blk b -> RealPoint blk -> m (Maybe b) Source #