Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Consensus.Storage.ChainDB.Impl.Query
Contents
Description
Queries
Synopsis
- getBlockComponent ∷ IOLike m ⇒ ChainDbEnv m blk → BlockComponent blk b → RealPoint blk → m (Maybe b)
- getCurrentChain ∷ ∀ (m ∷ Type → Type) blk. (IOLike m, HasHeader (Header blk), ConsensusProtocol (BlockProtocol blk)) ⇒ ChainDbEnv m blk → STM m (AnchoredFragment (Header blk))
- getCurrentLedger ∷ ∀ (m ∷ Type → Type) blk. ChainDbEnv m blk → STM m (ExtLedgerState blk EmptyMK)
- getHeaderStateHistory ∷ ∀ (m ∷ Type → Type) blk. ChainDbEnv m blk → STM m (HeaderStateHistory blk)
- getImmutableLedger ∷ ∀ (m ∷ Type → Type) blk. ChainDbEnv m blk → STM m (ExtLedgerState blk EmptyMK)
- getIsFetched ∷ ∀ (m ∷ Type → Type) blk. (IOLike m, HasHeader blk) ⇒ ChainDbEnv m blk → STM m (Point blk → Bool)
- getIsInvalidBlock ∷ ∀ (m ∷ Type → Type) blk. (IOLike m, HasHeader blk) ⇒ ChainDbEnv m blk → STM m (WithFingerprint (HeaderHash blk → Maybe (ExtValidationError blk)))
- getIsValid ∷ ∀ (m ∷ Type → Type) blk. (IOLike m, HasHeader blk) ⇒ ChainDbEnv m blk → STM m (RealPoint blk → Maybe Bool)
- getLedgerTablesAtFor ∷ IOLike m ⇒ ChainDbEnv m blk → Point blk → LedgerTables (ExtLedgerState blk) KeysMK → m (Maybe (LedgerTables (ExtLedgerState blk) ValuesMK))
- getMaxSlotNo ∷ ∀ (m ∷ Type → Type) blk. (IOLike m, HasHeader (Header blk)) ⇒ ChainDbEnv m blk → STM m MaxSlotNo
- getPastLedger ∷ ∀ (m ∷ Type → Type) blk. ChainDbEnv m blk → Point blk → STM m (Maybe (ExtLedgerState blk EmptyMK))
- getReadOnlyForkerAtPoint ∷ IOLike m ⇒ ChainDbEnv m blk → ResourceRegistry m → Target (Point blk) → m (Either GetForkerError (ReadOnlyForker' m blk))
- getStatistics ∷ IOLike m ⇒ ChainDbEnv m blk → m (Maybe Statistics)
- getTipBlock ∷ (IOLike m, HasHeader blk, HasHeader (Header blk)) ⇒ ChainDbEnv m blk → m (Maybe blk)
- getTipHeader ∷ (IOLike m, HasHeader blk, HasHeader (Header blk)) ⇒ ChainDbEnv m blk → m (Maybe (Header blk))
- getTipPoint ∷ ∀ (m ∷ Type → Type) blk. (IOLike m, HasHeader (Header blk)) ⇒ ChainDbEnv m blk → STM m (Point blk)
- getAnyBlockComponent ∷ IOLike m ⇒ ImmutableDB m blk → VolatileDB m blk → BlockComponent blk b → RealPoint blk → m (Maybe b)
- getAnyKnownBlock ∷ (IOLike m, HasHeader blk) ⇒ ImmutableDB m blk → VolatileDB m blk → RealPoint blk → m blk
- getAnyKnownBlockComponent ∷ (IOLike m, HasHeader blk) ⇒ ImmutableDB m blk → VolatileDB m blk → BlockComponent blk b → RealPoint blk → m b
- getChainSelStarvation ∷ ∀ (m ∷ Type → Type) blk. IOLike m ⇒ ChainDbEnv m blk → STM m ChainSelStarvation
Queries
getBlockComponent ∷ IOLike m ⇒ ChainDbEnv m blk → BlockComponent blk b → RealPoint blk → m (Maybe b) Source #
getCurrentChain ∷ ∀ (m ∷ Type → Type) 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 ∷ ∀ (m ∷ Type → Type) blk. ChainDbEnv m blk → STM m (ExtLedgerState blk EmptyMK) Source #
Get current ledger
getHeaderStateHistory ∷ ∀ (m ∷ Type → Type) blk. ChainDbEnv m blk → STM m (HeaderStateHistory blk) Source #
Get a HeaderStateHistory
populated with the HeaderState
s of the
last k
blocks of the current chain.
getImmutableLedger ∷ ∀ (m ∷ Type → Type) blk. ChainDbEnv m blk → STM m (ExtLedgerState blk EmptyMK) Source #
Get the immutable ledger, i.e., typically k
blocks back.
getIsFetched ∷ ∀ (m ∷ Type → Type) blk. (IOLike m, HasHeader blk) ⇒ ChainDbEnv m blk → STM m (Point blk → Bool) Source #
getIsInvalidBlock ∷ ∀ (m ∷ Type → Type) blk. (IOLike m, HasHeader blk) ⇒ ChainDbEnv m blk → STM m (WithFingerprint (HeaderHash blk → Maybe (ExtValidationError blk))) Source #
getIsValid ∷ ∀ (m ∷ Type → Type) blk. (IOLike m, HasHeader blk) ⇒ ChainDbEnv m blk → STM m (RealPoint blk → Maybe Bool) Source #
getLedgerTablesAtFor ∷ IOLike m ⇒ ChainDbEnv m blk → Point blk → LedgerTables (ExtLedgerState blk) KeysMK → m (Maybe (LedgerTables (ExtLedgerState blk) ValuesMK)) Source #
getMaxSlotNo ∷ ∀ (m ∷ Type → Type) blk. (IOLike m, HasHeader (Header blk)) ⇒ ChainDbEnv m blk → STM m MaxSlotNo Source #
getPastLedger ∷ ∀ (m ∷ Type → Type) blk. ChainDbEnv m blk → Point blk → STM m (Maybe (ExtLedgerState blk EmptyMK)) Source #
Get the ledger for the given point.
When the given point is not among the last k
blocks of the current
chain (i.e., older than k
or not on the current chain), Nothing
is
returned.
getReadOnlyForkerAtPoint ∷ IOLike m ⇒ ChainDbEnv m blk → ResourceRegistry m → Target (Point blk) → m (Either GetForkerError (ReadOnlyForker' m blk)) Source #
getStatistics ∷ IOLike m ⇒ ChainDbEnv m blk → m (Maybe Statistics) Source #
getTipBlock ∷ (IOLike m, HasHeader blk, HasHeader (Header blk)) ⇒ ChainDbEnv m blk → m (Maybe blk) Source #
getTipHeader ∷ (IOLike m, HasHeader blk, HasHeader (Header blk)) ⇒ ChainDbEnv m blk → m (Maybe (Header blk)) Source #
getTipPoint ∷ ∀ (m ∷ Type → Type) blk. (IOLike m, HasHeader (Header blk)) ⇒ ChainDbEnv m blk → STM m (Point blk) Source #
Low-level queries
getAnyBlockComponent ∷ IOLike m ⇒ ImmutableDB m blk → VolatileDB m blk → BlockComponent blk b → RealPoint blk → m (Maybe b) Source #
getAnyKnownBlock ∷ (IOLike m, HasHeader blk) ⇒ ImmutableDB m blk → VolatileDB m blk → RealPoint blk → m blk Source #
Variant of getAnyBlockComponent
instantiated with GetBlock
.
getAnyKnownBlockComponent ∷ (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.
getChainSelStarvation ∷ ∀ (m ∷ Type → Type) blk. IOLike m ⇒ ChainDbEnv m blk → STM m ChainSelStarvation Source #