Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Consensus.Storage.LedgerDB.Forker
Synopsis
- data ExceededRollback = ExceededRollback {}
- data Forker (m ∷ Type → Type) (l ∷ LedgerStateKind) blk = Forker {
- forkerClose ∷ !(m ())
- forkerReadTables ∷ !(LedgerTables l KeysMK → m (LedgerTables l ValuesMK))
- forkerRangeReadTables ∷ !(RangeQueryPrevious l → m (LedgerTables l ValuesMK))
- forkerGetLedgerState ∷ !(STM m (l EmptyMK))
- forkerReadStatistics ∷ !(m (Maybe Statistics))
- forkerPush ∷ !(l DiffMK → m ())
- forkerCommit ∷ !(STM m ())
- type Forker' (m ∷ Type → Type) blk = Forker m (ExtLedgerState blk) blk
- newtype ForkerKey = ForkerKey Word16
- data GetForkerError
- data RangeQuery (l ∷ LedgerStateKind) = RangeQuery {
- rqPrev ∷ !(RangeQueryPrevious l)
- rqCount ∷ !Int
- data RangeQueryPrevious (l ∷ LedgerStateKind)
- newtype Statistics = Statistics {}
- forkerCurrentPoint ∷ ∀ (l ∷ LedgerStateKind) blk (m ∷ Type → Type). (GetTip l, HeaderHash l ~ HeaderHash blk, Functor (STM m)) ⇒ Forker m l blk → STM m (Point blk)
- data ReadOnlyForker (m ∷ Type → Type) (l ∷ LedgerStateKind) blk = ReadOnlyForker {
- roforkerClose ∷ !(m ())
- roforkerReadTables ∷ !(LedgerTables l KeysMK → m (LedgerTables l ValuesMK))
- roforkerRangeReadTables ∷ !(RangeQueryPrevious l → m (LedgerTables l ValuesMK))
- roforkerGetLedgerState ∷ !(STM m (l EmptyMK))
- roforkerReadStatistics ∷ !(m (Maybe Statistics))
- type ReadOnlyForker' (m ∷ Type → Type) blk = ReadOnlyForker m (ExtLedgerState blk) blk
- readOnlyForker ∷ ∀ (m ∷ Type → Type) (l ∷ LedgerStateKind) blk. Forker m l blk → ReadOnlyForker m l blk
- data TraceForkerEvent
- data TraceForkerEventWithKey = TraceForkerEventWithKey ForkerKey TraceForkerEvent
- data AnnLedgerError (m ∷ Type → Type) (l ∷ LedgerStateKind) blk = AnnLedgerError {
- annLedgerState ∷ Forker m l blk
- annLedgerErrRef ∷ RealPoint blk
- annLedgerErr ∷ LedgerErr l
- type AnnLedgerError' (m ∷ Type → Type) blk = AnnLedgerError m (ExtLedgerState blk) blk
- type ResolveBlock (m ∷ Type → Type) blk = RealPoint blk → m blk
- data ValidateArgs (m ∷ Type → Type) blk = ValidateArgs {
- resolve ∷ !(ResolveBlock m blk)
- validateConfig ∷ !(TopLevelConfig blk)
- addPrevApplied ∷ !([RealPoint blk] → STM m ())
- prevApplied ∷ !(STM m (Set (RealPoint blk)))
- forkerAtFromTip ∷ !(ResourceRegistry m → Word64 → m (Either GetForkerError (Forker' m blk)))
- resourceReg ∷ !(ResourceRegistry m)
- trace ∷ !(TraceValidateEvent blk → m ())
- blockCache ∷ BlockCache blk
- numRollbacks ∷ Word64
- hdrs ∷ [Header blk]
- data ValidateResult (m ∷ Type → Type) (l ∷ LedgerStateKind) blk
- = ValidateSuccessful (Forker m l blk)
- | ValidateLedgerError (AnnLedgerError m l blk)
- | ValidateExceededRollBack ExceededRollback
- validate ∷ (IOLike m, LedgerSupportsProtocol blk, HasCallStack) ⇒ ComputeLedgerEvents → ValidateArgs m blk → m (ValidateResult' m blk)
- newtype PushGoal blk = PushGoal {
- unPushGoal ∷ RealPoint blk
- newtype PushStart blk = PushStart {
- unPushStart ∷ RealPoint blk
- newtype Pushing blk = Pushing {}
- data TraceValidateEvent blk = StartedPushingBlockToTheLedgerDb !(PushStart blk) (PushGoal blk) !(Pushing blk)
Forker API
data ExceededRollback Source #
Exceeded maximum rollback supported by the current ledger DB state
Under normal circumstances this will not arise. It can really only happen in the presence of data corruption (or when switching to a shorter fork, but that is disallowed by all currently known Ouroboros protocols).
Records both the supported and the requested rollback.
Constructors
ExceededRollback | |
Fields |
Instances
Show ExceededRollback Source # | |
Defined in Ouroboros.Consensus.Storage.LedgerDB.Forker Methods showsPrec ∷ Int → ExceededRollback → ShowS # show ∷ ExceededRollback → String # showList ∷ [ExceededRollback] → ShowS # | |
Eq ExceededRollback Source # | |
Defined in Ouroboros.Consensus.Storage.LedgerDB.Forker Methods |
data Forker (m ∷ Type → Type) (l ∷ LedgerStateKind) blk Source #
An independent handle to a point in the LedgerDB, which can be advanced to evaluate forks in the chain.
Constructors
Forker | |
Fields
|
Instances
(GetTip l, HeaderHash l ~ HeaderHash blk, MonadSTM m) ⇒ GetTipSTM m (Forker m l blk) Source # | |
type HeaderHash (Forker m l blk ∷ Type) Source # | |
Defined in Ouroboros.Consensus.Storage.LedgerDB.Forker |
An identifier for a Forker
. See ldbForkers
.
Instances
data GetForkerError Source #
Errors that can be thrown while acquiring forkers.
Constructors
PointNotOnChain | The requested point was not found in the LedgerDB, but the point is recent enough that the point is not in the immutable part of the chain, i.e. it belongs to an unselected fork. |
PointTooOld !(Maybe ExceededRollback) | The requested point was not found in the LedgerDB because the point older than the immutable tip. |
Instances
Show GetForkerError Source # | |
Defined in Ouroboros.Consensus.Storage.LedgerDB.Forker Methods showsPrec ∷ Int → GetForkerError → ShowS # show ∷ GetForkerError → String # showList ∷ [GetForkerError] → ShowS # | |
Eq GetForkerError Source # | |
Defined in Ouroboros.Consensus.Storage.LedgerDB.Forker Methods (==) ∷ GetForkerError → GetForkerError → Bool # (/=) ∷ GetForkerError → GetForkerError → Bool # |
data RangeQuery (l ∷ LedgerStateKind) Source #
Constructors
RangeQuery | |
Fields
|
data RangeQueryPrevious (l ∷ LedgerStateKind) Source #
Constructors
NoPreviousQuery | |
PreviousQueryWasFinal | |
PreviousQueryWasUpTo (TxIn l) |
newtype Statistics Source #
This type captures the size of the ledger tables at a particular point in the LedgerDB.
This is for now the only metric that was requested from other components, but this type might be augmented in the future with more statistics.
Constructors
Statistics | |
Fields |
forkerCurrentPoint ∷ ∀ (l ∷ LedgerStateKind) blk (m ∷ Type → Type). (GetTip l, HeaderHash l ~ HeaderHash blk, Functor (STM m)) ⇒ Forker m l blk → STM m (Point blk) Source #
Read only
data ReadOnlyForker (m ∷ Type → Type) (l ∷ LedgerStateKind) blk Source #
Read-only Forker
.
These forkers are not allowed to commit. They are used everywhere except in Chain Selection. In particular they are now used in:
- LocalStateQuery server, via
getReadOnlyForkerAtPoint
- Forging loop.
- Mempool.
Constructors
ReadOnlyForker | |
Fields
|
Instances
type HeaderHash (ReadOnlyForker m l blk ∷ Type) Source # | |
Defined in Ouroboros.Consensus.Storage.LedgerDB.Forker |
type ReadOnlyForker' (m ∷ Type → Type) blk = ReadOnlyForker m (ExtLedgerState blk) blk Source #
readOnlyForker ∷ ∀ (m ∷ Type → Type) (l ∷ LedgerStateKind) blk. Forker m l blk → ReadOnlyForker m l blk Source #
Tracing
data TraceForkerEvent Source #
Constructors
ForkerOpen | |
ForkerCloseUncommitted | |
ForkerCloseCommitted | |
ForkerReadTablesStart | |
ForkerReadTablesEnd | |
ForkerRangeReadTablesStart | |
ForkerRangeReadTablesEnd | |
ForkerReadStatistics | |
ForkerPushStart | |
ForkerPushEnd |
Instances
Show TraceForkerEvent Source # | |
Defined in Ouroboros.Consensus.Storage.LedgerDB.Forker Methods showsPrec ∷ Int → TraceForkerEvent → ShowS # show ∷ TraceForkerEvent → String # showList ∷ [TraceForkerEvent] → ShowS # | |
Eq TraceForkerEvent Source # | |
Defined in Ouroboros.Consensus.Storage.LedgerDB.Forker Methods |
data TraceForkerEventWithKey Source #
Constructors
TraceForkerEventWithKey ForkerKey TraceForkerEvent |
Instances
Validation
data AnnLedgerError (m ∷ Type → Type) (l ∷ LedgerStateKind) blk Source #
Annotated ledger errors
Constructors
AnnLedgerError | |
Fields
|
type AnnLedgerError' (m ∷ Type → Type) blk = AnnLedgerError m (ExtLedgerState blk) blk Source #
type ResolveBlock (m ∷ Type → Type) blk = RealPoint blk → m blk Source #
Resolve a block
Resolving a block reference to the actual block lives in m
because
it might need to read the block from disk (and can therefore not be
done inside an STM transaction).
NOTE: The ledger DB will only ask the ChainDB
for blocks it knows
must exist. If the ChainDB
is unable to fulfill the request, data
corruption must have happened and the ChainDB
should trigger
validation mode.
data ValidateArgs (m ∷ Type → Type) blk Source #
Constructors
ValidateArgs | |
Fields
|
data ValidateResult (m ∷ Type → Type) (l ∷ LedgerStateKind) blk Source #
When validating a sequence of blocks, these are the possible outcomes.
Constructors
ValidateSuccessful (Forker m l blk) | |
ValidateLedgerError (AnnLedgerError m l blk) | |
ValidateExceededRollBack ExceededRollback |
validate ∷ (IOLike m, LedgerSupportsProtocol blk, HasCallStack) ⇒ ComputeLedgerEvents → ValidateArgs m blk → m (ValidateResult' m blk) Source #
Tracing
Constructors
PushGoal | |
Fields
|
Instances
StandardHash blk ⇒ Show (PushGoal blk) Source # | |
StandardHash blk ⇒ Eq (PushGoal blk) Source # | |
newtype PushStart blk Source #
Constructors
PushStart | |
Fields
|
Instances
StandardHash blk ⇒ Show (PushStart blk) Source # | |
StandardHash blk ⇒ Eq (PushStart blk) Source # | |
Instances
StandardHash blk ⇒ Show (Pushing blk) Source # | |
StandardHash blk ⇒ Eq (Pushing blk) Source # | |
data TraceValidateEvent blk Source #
Constructors
StartedPushingBlockToTheLedgerDb | Event fired when we are about to push a block to a forker |