ouroboros-consensus-0.18.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Description

Types used throughout the implementation: handle, state, environment, types, trace types, etc.

Synopsis

Documentation

data ChainDbEnv m blk Source #

Constructors

CDB 

Fields

  • cdbImmutableDB ∷ !(ImmutableDB m blk)
     
  • cdbVolatileDB ∷ !(VolatileDB m blk)
     
  • cdbLgrDB ∷ !(LgrDB m blk)
     
  • cdbChain ∷ !(StrictTVar m (AnchoredFragment (Header blk)))

    Contains the current chain fragment.

    INVARIANT: the anchor point of this fragment is the tip of the ImmutableDB. This implies that this fragment never contains any blocks that are stored in the immutable DB.

    Note that this fragment might be shorter than k headers when the whole chain is shorter than k or in case of corruption of the VolatileDB.

    Note that this fragment might also be longer than k headers, because the oldest blocks from the fragment might not yet have been copied from the VolatileDB to the ImmutableDB.

    The anchor point of this chain should be the most recent "immutable" block according to the protocol, i.e., a block that cannot be rolled back.

    Note that the "immutable" block isn't necessarily at the tip of the ImmutableDB, but could temporarily still be on the in-memory chain fragment. When the background thread that copies blocks to the ImmutableDB has caught up, the "immutable" block will be at the tip of the ImmutableDB again.

    Note that the "immutable" block might be less than k blocks from our tip in case the whole chain is shorter than k or in case of corruption of the VolatileDB.

    Note that the "immutable" block will never be more than k blocks back, as opposed to the anchor point of cdbChain.

  • cdbTentativeState ∷ !(StrictTVar m (TentativeHeaderState blk))
     
  • cdbTentativeHeader ∷ !(StrictTVar m (StrictMaybe (Header blk)))

    The tentative header, for diffusion pipelining.

    INVARIANT: It fits on top of the current chain, and its body is not known to be invalid, but might turn out to be.

  • cdbIterators ∷ !(StrictTVar m (Map IteratorKey (m ())))

    The iterators.

    This maps the IteratorKeys of each open Iterator to a function that, when called, closes the iterator. This is used when closing the ChainDB: the open file handles used by iterators can be closed, and the iterators themselves are closed so that it is impossible to use an iterator after closing the ChainDB itself.

  • cdbFollowers ∷ !(StrictTVar m (Map FollowerKey (FollowerHandle m blk)))

    The followers.

    A follower is open iff its FollowerKey is this Map.

    INVARIANT: the followerPoint of each follower is withinFragmentBounds of the current chain fragment (retrieved cdbGetCurrentChain, not by reading cdbChain directly).

  • cdbTopLevelConfig ∷ !(TopLevelConfig blk)
     
  • cdbInvalid ∷ !(StrictTVar m (WithFingerprint (InvalidBlocks blk)))

    See the docstring of InvalidBlocks.

    The Fingerprint changes every time a hash is added to the map, but not when hashes are garbage-collected from the map.

  • cdbNextIteratorKey ∷ !(StrictTVar m IteratorKey)
     
  • cdbNextFollowerKey ∷ !(StrictTVar m FollowerKey)
     
  • cdbCopyFuse ∷ !(Fuse m)
     
  • cdbChainSelFuse ∷ !(Fuse m)
     
  • cdbTracer ∷ !(Tracer m (TraceEvent blk))
     
  • cdbRegistry ∷ !(ResourceRegistry m)

    Resource registry that will be used to (re)start the background threads, see cdbBgThreads.

  • cdbGcDelay ∷ !DiffTime

    How long to wait between copying a block from the VolatileDB to ImmutableDB and garbage collecting it from the VolatileDB

  • cdbGcInterval ∷ !DiffTime

    Minimum time between two garbage collections. Is used to batch garbage collections.

  • cdbKillBgThreads ∷ !(StrictTVar m (m ()))

    A handle to kill the background threads.

  • cdbCheckInFuture ∷ !(CheckInFuture m blk)
     
  • cdbChainSelQueue ∷ !(ChainSelQueue m blk)

    Queue of blocks that still have to be added.

  • cdbFutureBlocks ∷ !(StrictTVar m (FutureBlocks m blk))

    Blocks from the future

    Blocks that were added to the ChainDB but that were from the future according to CheckInFuture, without exceeding the clock skew (inFutureExceedsClockSkew). Blocks exceeding the clock skew are considered to be invalid (InFutureExceedsClockSkew) and will be added cdbInvalid.

    Whenever a block is added to the ChainDB, we first trigger chain selection for all the blocks in this map so that blocks no longer from the future can get adopted. Note that when no blocks are added to the ChainDB, we will not actively trigger chain selection for the blocks in this map.

    The number of blocks from the future is bounded by the number of upstream peers multiplied by the max clock skew divided by the slot length.

  • cdbLoELoE (m (AnchoredFragment (Header blk)))

    Configure the Limit on Eagerness. If this is LoEEnabled, it contains an action that returns the LoE fragment, which indicates the latest rollback point, i.e. we are not allowed to select a chain from which we could not switch back to a chain containing it. The fragment is usually anchored at a recent immutable tip; if it does not, it will conservatively be treated as the empty fragment anchored in the current immutable tip.

Instances

Instances details
Generic (ChainDbEnv m blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Associated Types

type Rep (ChainDbEnv m blk) ∷ TypeType #

Methods

fromChainDbEnv m blk → Rep (ChainDbEnv m blk) x #

toRep (ChainDbEnv m blk) x → ChainDbEnv m blk #

(IOLike m, LedgerSupportsProtocol blk, BlockSupportsDiffusionPipelining blk) ⇒ NoThunks (ChainDbEnv m blk) Source #

We include blk in showTypeOf because it helps resolving type families (but avoid including m because we cannot impose Typeable m as a constraint and still have it work with the simulator)

Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (ChainDbEnv m blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (ChainDbEnv m blk) = D1 ('MetaData "ChainDbEnv" "Ouroboros.Consensus.Storage.ChainDB.Impl.Types" "ouroboros-consensus-0.18.0.0-inplace" 'False) (C1 ('MetaCons "CDB" 'PrefixI 'True) ((((S1 ('MetaSel ('Just "cdbImmutableDB") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (ImmutableDB m blk)) :*: S1 ('MetaSel ('Just "cdbVolatileDB") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (VolatileDB m blk))) :*: (S1 ('MetaSel ('Just "cdbLgrDB") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (LgrDB m blk)) :*: (S1 ('MetaSel ('Just "cdbChain") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictTVar m (AnchoredFragment (Header blk)))) :*: S1 ('MetaSel ('Just "cdbTentativeState") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictTVar m (TentativeHeaderState blk)))))) :*: ((S1 ('MetaSel ('Just "cdbTentativeHeader") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictTVar m (StrictMaybe (Header blk)))) :*: (S1 ('MetaSel ('Just "cdbIterators") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictTVar m (Map IteratorKey (m ())))) :*: S1 ('MetaSel ('Just "cdbFollowers") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictTVar m (Map FollowerKey (FollowerHandle m blk)))))) :*: (S1 ('MetaSel ('Just "cdbTopLevelConfig") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (TopLevelConfig blk)) :*: (S1 ('MetaSel ('Just "cdbInvalid") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictTVar m (WithFingerprint (InvalidBlocks blk)))) :*: S1 ('MetaSel ('Just "cdbNextIteratorKey") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictTVar m IteratorKey)))))) :*: (((S1 ('MetaSel ('Just "cdbNextFollowerKey") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictTVar m FollowerKey)) :*: (S1 ('MetaSel ('Just "cdbCopyFuse") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Fuse m)) :*: S1 ('MetaSel ('Just "cdbChainSelFuse") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Fuse m)))) :*: (S1 ('MetaSel ('Just "cdbTracer") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Tracer m (TraceEvent blk))) :*: (S1 ('MetaSel ('Just "cdbRegistry") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (ResourceRegistry m)) :*: S1 ('MetaSel ('Just "cdbGcDelay") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DiffTime)))) :*: ((S1 ('MetaSel ('Just "cdbGcInterval") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DiffTime) :*: (S1 ('MetaSel ('Just "cdbKillBgThreads") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictTVar m (m ()))) :*: S1 ('MetaSel ('Just "cdbCheckInFuture") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (CheckInFuture m blk)))) :*: (S1 ('MetaSel ('Just "cdbChainSelQueue") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (ChainSelQueue m blk)) :*: (S1 ('MetaSel ('Just "cdbFutureBlocks") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictTVar m (FutureBlocks m blk))) :*: S1 ('MetaSel ('Just "cdbLoE") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (LoE (m (AnchoredFragment (Header blk)))))))))))

newtype ChainDbHandle m blk Source #

A handle to the internal ChainDB state

Constructors

CDBHandle (StrictTVar m (ChainDbState m blk)) 

data ChainDbState m blk Source #

Constructors

ChainDbOpen !(ChainDbEnv m blk) 
ChainDbClosed 

Instances

Instances details
Generic (ChainDbState m blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Associated Types

type Rep (ChainDbState m blk) ∷ TypeType #

Methods

fromChainDbState m blk → Rep (ChainDbState m blk) x #

toRep (ChainDbState m blk) x → ChainDbState m blk #

(IOLike m, LedgerSupportsProtocol blk, BlockSupportsDiffusionPipelining blk) ⇒ NoThunks (ChainDbState m blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (ChainDbState m blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (ChainDbState m blk) = D1 ('MetaData "ChainDbState" "Ouroboros.Consensus.Storage.ChainDB.Impl.Types" "ouroboros-consensus-0.18.0.0-inplace" 'False) (C1 ('MetaCons "ChainDbOpen" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (ChainDbEnv m blk))) :+: C1 ('MetaCons "ChainDbClosed" 'PrefixI 'False) (U1TypeType))

class (ImmutableDbSerialiseConstraints blk, LgrDbSerialiseConstraints blk, VolatileDbSerialiseConstraints blk, EncodeDiskDep (NestedCtxt Header) blk) ⇒ SerialiseDiskConstraints blk Source #

All the serialisation related constraints needed by the ChainDB.

getEnv ∷ ∀ m blk r. (IOLike m, HasCallStack, HasHeader blk) ⇒ ChainDbHandle m blk → (ChainDbEnv m blk → m r) → m r Source #

Check if the ChainDB is open, if so, executing the given function on the ChainDbEnv, otherwise, throw a CloseDBError.

getEnv1 ∷ (IOLike m, HasCallStack, HasHeader blk) ⇒ ChainDbHandle m blk → (ChainDbEnv m blk → a → m r) → a → m r Source #

Variant 'of getEnv for functions taking one argument.

getEnv2 ∷ (IOLike m, HasCallStack, HasHeader blk) ⇒ ChainDbHandle m blk → (ChainDbEnv m blk → a → b → m r) → a → b → m r Source #

Variant 'of getEnv for functions taking two arguments.

getEnvSTM ∷ ∀ m blk r. (IOLike m, HasCallStack, HasHeader blk) ⇒ ChainDbHandle m blk → (ChainDbEnv m blk → STM m r) → STM m r Source #

Variant of getEnv that works in STM.

getEnvSTM1 ∷ ∀ m blk a r. (IOLike m, HasCallStack, HasHeader blk) ⇒ ChainDbHandle m blk → (ChainDbEnv m blk → a → STM m r) → a → STM m r Source #

Variant of getEnv1 that works in STM.

Exposed internals for testing purposes

data Internal m blk Source #

Constructors

Internal 

Fields

Iterator-related

newtype IteratorKey Source #

We use this internally to track iterators in a map (cdbIterators) in the ChainDB state so that we can remove them from the map when the iterator is closed.

We store them in the map so that the ChainDB can close all open iterators when it is closed itself.

Constructors

IteratorKey Word 

Instances

Instances details
Enum IteratorKey Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Show IteratorKey Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Eq IteratorKey Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Ord IteratorKey Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

NoThunks IteratorKey Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Follower-related

data FollowerHandle m blk Source #

Internal handle to a Follower without an explicit b (blk, Header blk, etc.) parameter so Followers with different' bs can be stored together in cdbFollowers.

Constructors

FollowerHandle 

Fields

  • fhChainTypeChainType

    Whether we follow the tentative chain.

  • fhSwitchForkPoint blk → Set (Point blk) → STM m ()

    When we have switched to a fork, all open Followers must be notified.

  • fhClose ∷ m ()

    When closing the ChainDB, we must also close all open Followers, as they might be holding on to resources.

    Call fhClose will release the resources used by the Follower.

    NOTE the Follower is not removed from cdbFollowers. (That is done by closeAllFollowers).

Instances

Instances details
NoThunks (FollowerHandle m blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

newtype FollowerKey Source #

We use this internally to track follower in a map (cdbFollowers) in the ChainDB state so that we can remove them from the map when the follower is closed.

We store them in the map so that the ChainDB can close all open followers when it is closed itself and to update the followers in case we switch to a different chain.

Constructors

FollowerKey Word 

Instances

Instances details
Enum FollowerKey Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Show FollowerKey Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Eq FollowerKey Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Ord FollowerKey Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

NoThunks FollowerKey Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

data FollowerRollState blk Source #

Similar to FollowerState.

Constructors

RollBackTo !(Point blk)

We don't know at which point the user is, but the next message we'll send is to roll back to this point.

RollForwardFrom !(Point blk)

We know that the follower is at this point and the next message we'll send is to roll forward to the point after this point on our chain.

Instances

Instances details
Generic (FollowerRollState blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Associated Types

type Rep (FollowerRollState blk) ∷ TypeType #

Methods

fromFollowerRollState blk → Rep (FollowerRollState blk) x #

toRep (FollowerRollState blk) x → FollowerRollState blk #

StandardHash blk ⇒ Show (FollowerRollState blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

StandardHash blk ⇒ Eq (FollowerRollState blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

StandardHash blk ⇒ NoThunks (FollowerRollState blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (FollowerRollState blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (FollowerRollState blk) = D1 ('MetaData "FollowerRollState" "Ouroboros.Consensus.Storage.ChainDB.Impl.Types" "ouroboros-consensus-0.18.0.0-inplace" 'False) (C1 ('MetaCons "RollBackTo" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Point blk))) :+: C1 ('MetaCons "RollForwardFrom" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Point blk))))

data FollowerState m blk b Source #

b corresponds to the BlockComponent that is being read.

Constructors

FollowerInit

The Follower is in its initial state. Its FollowerRollState is RollBackTo genesisPoint.

This is equivalent to having a FollowerInImmutableDB with the same FollowerRollState and an iterator streaming after genesis. Opening such an iterator has a cost (index files will have to be read). However, in most cases, right after opening a Follower, the user of the Follower will try to move it forward, moving it from genesis to a more recent point on the chain. So we incur the cost of opening the iterator while not even using it.

Therefore, we have this extra initial state, that avoids this cost. When the user doesn't move the Follower forward, an iterator is opened.

FollowerInImmutableDB !(FollowerRollState blk) !(Iterator m blk (Point blk, b))

The Follower is reading from the ImmutableDB.

Note that the iterator includes 'Point blk' in addition to b, as it is needed to keep track of where the iterator is.

INVARIANT: for all FollowerInImmutableDB rollState immIt: the predecessor of the next block streamed by immIt must be the block identified by followerRollStatePoint rollState. In other words: the iterator is positioned on followerRollStatePoint rollState.

FollowerInMem !(FollowerRollState blk)

The Follower is reading from the in-memory current chain fragment.

Instances

Instances details
Generic (FollowerState m blk b) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Associated Types

type Rep (FollowerState m blk b) ∷ TypeType #

Methods

fromFollowerState m blk b → Rep (FollowerState m blk b) x #

toRep (FollowerState m blk b) x → FollowerState m blk b #

StandardHash blk ⇒ NoThunks (FollowerState m blk b) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (FollowerState m blk b) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (FollowerState m blk b) = D1 ('MetaData "FollowerState" "Ouroboros.Consensus.Storage.ChainDB.Impl.Types" "ouroboros-consensus-0.18.0.0-inplace" 'False) (C1 ('MetaCons "FollowerInit" 'PrefixI 'False) (U1TypeType) :+: (C1 ('MetaCons "FollowerInImmutableDB" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (FollowerRollState blk)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Iterator m blk (Point blk, b)))) :+: C1 ('MetaCons "FollowerInMem" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (FollowerRollState blk)))))

followerRollStatePointFollowerRollState blk → Point blk Source #

Get the point the FollowerRollState should roll back to or roll forward from.

Invalid blocks

data InvalidBlockInfo blk Source #

In addition to the reason why a block is invalid, the slot number of the block is stored, so that whenever a garbage collection is performed on the VolatileDB for some slot s, the hashes older or equal to s can be removed from this map.

Instances

Instances details
Generic (InvalidBlockInfo blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Associated Types

type Rep (InvalidBlockInfo blk) ∷ TypeType #

Methods

fromInvalidBlockInfo blk → Rep (InvalidBlockInfo blk) x #

toRep (InvalidBlockInfo blk) x → InvalidBlockInfo blk #

LedgerSupportsProtocol blk ⇒ Show (InvalidBlockInfo blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

LedgerSupportsProtocol blk ⇒ Eq (InvalidBlockInfo blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Methods

(==)InvalidBlockInfo blk → InvalidBlockInfo blk → Bool #

(/=)InvalidBlockInfo blk → InvalidBlockInfo blk → Bool #

LedgerSupportsProtocol blk ⇒ NoThunks (InvalidBlockInfo blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (InvalidBlockInfo blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (InvalidBlockInfo blk) = D1 ('MetaData "InvalidBlockInfo" "Ouroboros.Consensus.Storage.ChainDB.Impl.Types" "ouroboros-consensus-0.18.0.0-inplace" 'False) (C1 ('MetaCons "InvalidBlockInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "invalidBlockReason") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (InvalidBlockReason blk)) :*: S1 ('MetaSel ('Just "invalidBlockSlotNo") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotNo)))

type InvalidBlocks blk = Map (HeaderHash blk) (InvalidBlockInfo blk) Source #

Hashes corresponding to invalid blocks. This is used to ignore these blocks during chain selection.

Future blocks

type FutureBlocks m blk = Map (HeaderHash blk) (Header blk, InvalidBlockPunishment m) Source #

Blocks from the future for which we still need to trigger chain selection.

See cdbFutureBlocks for more info.

Blocks to add

data BlockToAdd m blk Source #

Entry in the ChainSelQueue queue: a block together with the TMVars used to implement AddBlockPromise.

Constructors

BlockToAdd 

Fields

data ChainSelMessage m blk Source #

Different async tasks for triggering ChainSel

Constructors

ChainSelAddBlock !(BlockToAdd m blk)

Add a new block

ChainSelReprocessLoEBlocks

Reprocess blocks that have been postponed by the LoE

data ChainSelQueue m blk Source #

FIFO queue used to add blocks asynchronously to the ChainDB. Blocks are read from this queue by a background thread, which processes the blocks synchronously.

Instances

Instances details
NoThunks (ChainSelQueue m blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

addBlockToAdd ∷ (IOLike m, HasHeader blk) ⇒ Tracer m (TraceAddBlockEvent blk) → ChainSelQueue m blk → InvalidBlockPunishment m → blk → m (AddBlockPromise m blk) Source #

Add a block to the ChainSelQueue queue. Can block when the queue is full.

addReprocessLoEBlocksIOLike m ⇒ Tracer m (TraceAddBlockEvent blk) → ChainSelQueue m blk → m () Source #

Try to add blocks again that were postponed due to the LoE.

closeChainSelQueueIOLike m ⇒ ChainSelQueue m blk → STM m () Source #

Flush the ChainSelQueue queue and notify the waiting threads.

getChainSelMessageIOLike m ⇒ ChainSelQueue m blk → m (ChainSelMessage m blk) Source #

Get the oldest message from the ChainSelQueue queue. Can block when the queue is empty.

newChainSelQueueIOLike m ⇒ Word → m (ChainSelQueue m blk) Source #

Create a new ChainSelQueue with the given size.

Trace types

data SelectionChangedInfo blk Source #

Information on having changed our selection to a chain with a (necessarily) new tip.

NOTE: the fields of this record are intentionally lazy to prevent the forcing of this information in case it doesn't have to be traced. However, this means that the tracer processing this message must not hold on to it, otherwise it leaks memory.

Constructors

SelectionChangedInfo 

Fields

Instances

Instances details
Generic (SelectionChangedInfo blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Associated Types

type Rep (SelectionChangedInfo blk) ∷ TypeType #

(Show (SelectView (BlockProtocol blk)), StandardHash blk) ⇒ Show (SelectionChangedInfo blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

(Eq (SelectView (BlockProtocol blk)), StandardHash blk) ⇒ Eq (SelectionChangedInfo blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (SelectionChangedInfo blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (SelectionChangedInfo blk) = D1 ('MetaData "SelectionChangedInfo" "Ouroboros.Consensus.Storage.ChainDB.Impl.Types" "ouroboros-consensus-0.18.0.0-inplace" 'False) (C1 ('MetaCons "SelectionChangedInfo" 'PrefixI 'True) ((S1 ('MetaSel ('Just "newTipPoint") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RealPoint blk)) :*: (S1 ('MetaSel ('Just "newTipEpoch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 EpochNo) :*: S1 ('MetaSel ('Just "newTipSlotInEpoch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64))) :*: (S1 ('MetaSel ('Just "newTipTrigger") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RealPoint blk)) :*: (S1 ('MetaSel ('Just "newTipSelectView") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SelectView (BlockProtocol blk))) :*: S1 ('MetaSel ('Just "oldTipSelectView") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (SelectView (BlockProtocol blk))))))))

data TraceAddBlockEvent blk Source #

Trace type for the various events that occur when adding a block.

Constructors

IgnoreBlockOlderThanK (RealPoint blk)

A block with a BlockNo more than k back than the current tip was ignored.

IgnoreBlockAlreadyInVolatileDB (RealPoint blk)

A block that is already in the Volatile DB was ignored.

IgnoreInvalidBlock (RealPoint blk) (InvalidBlockReason blk)

A block that is know to be invalid was ignored.

AddedBlockToQueue (RealPoint blk) (Enclosing' Word)

The block was added to the queue and will be added to the ChainDB by the background thread. The size of the queue is included.

PoppedBlockFromQueue (Enclosing' (RealPoint blk))

The block popped from the queue and will imminently be added to the ChainDB.

AddedReprocessLoEBlocksToQueue

A message was added to the queue that requests that ChainSel reprocess blocks that were postponed by the LoE.

PoppedReprocessLoEBlocksFromQueue

ChainSel will reprocess blocks that were postponed by the LoE.

BlockInTheFuture (RealPoint blk) SlotNo

The block is from the future, i.e., its slot number is greater than the current slot (the second argument).

AddedBlockToVolatileDB (RealPoint blk) BlockNo IsEBB Enclosing

A block was added to the Volatile DB

TryAddToCurrentChain (RealPoint blk)

The block fits onto the current chain, we'll try to use it to extend our chain.

TrySwitchToAFork (RealPoint blk) (ChainDiff (HeaderFields blk))

The block fits onto some fork, we'll try to switch to that fork (if it is preferable to our chain).

StoreButDontChange (RealPoint blk)

The block doesn't fit onto any other block, so we store it and ignore it.

ChainSelectionLoEDebug (AnchoredFragment (Header blk)) (LoE (AnchoredFragment (Header blk)))

Debugging information about chain selection and LoE

AddedToCurrentChain [LedgerEvent blk] (SelectionChangedInfo blk) (AnchoredFragment (Header blk)) (AnchoredFragment (Header blk))

The new block fits onto the current chain (first fragment) and we have successfully used it to extend our (new) current chain (second fragment).

SwitchedToAFork [LedgerEvent blk] (SelectionChangedInfo blk) (AnchoredFragment (Header blk)) (AnchoredFragment (Header blk))

The new block fits onto some fork and we have switched to that fork (second fragment), as it is preferable to our (previous) current chain (first fragment).

AddBlockValidation (TraceValidationEvent blk)

An event traced during validating performed while adding a block.

ChainSelectionForFutureBlock (RealPoint blk)

Run chain selection for a block that was previously from the future. This is done for all blocks from the future each time a new block is added.

PipeliningEvent (TracePipeliningEvent blk)

The tentative header (in the context of diffusion pipelining) has been updated.

ChangingSelection (Point blk)

Herald of AddedToCurrentChain or SwitchedToAFork. Lists the tip of the new chain.

Instances

Instances details
Generic (TraceAddBlockEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Associated Types

type Rep (TraceAddBlockEvent blk) ∷ TypeType #

(Show (Header blk), LedgerSupportsProtocol blk, InspectLedger blk) ⇒ Show (TraceAddBlockEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

(Eq (Header blk), LedgerSupportsProtocol blk, InspectLedger blk) ⇒ Eq (TraceAddBlockEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (TraceAddBlockEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (TraceAddBlockEvent blk) = D1 ('MetaData "TraceAddBlockEvent" "Ouroboros.Consensus.Storage.ChainDB.Impl.Types" "ouroboros-consensus-0.18.0.0-inplace" 'False) ((((C1 ('MetaCons "IgnoreBlockOlderThanK" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RealPoint blk))) :+: C1 ('MetaCons "IgnoreBlockAlreadyInVolatileDB" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RealPoint blk)))) :+: (C1 ('MetaCons "IgnoreInvalidBlock" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RealPoint blk)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (InvalidBlockReason blk))) :+: C1 ('MetaCons "AddedBlockToQueue" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RealPoint blk)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Enclosing' Word))))) :+: ((C1 ('MetaCons "PoppedBlockFromQueue" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Enclosing' (RealPoint blk)))) :+: C1 ('MetaCons "AddedReprocessLoEBlocksToQueue" 'PrefixI 'False) (U1TypeType)) :+: (C1 ('MetaCons "PoppedReprocessLoEBlocksFromQueue" 'PrefixI 'False) (U1TypeType) :+: (C1 ('MetaCons "BlockInTheFuture" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RealPoint blk)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SlotNo)) :+: C1 ('MetaCons "AddedBlockToVolatileDB" 'PrefixI 'False) ((S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RealPoint blk)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BlockNo)) :*: (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IsEBB) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Enclosing))))))) :+: (((C1 ('MetaCons "TryAddToCurrentChain" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RealPoint blk))) :+: C1 ('MetaCons "TrySwitchToAFork" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RealPoint blk)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ChainDiff (HeaderFields blk))))) :+: (C1 ('MetaCons "StoreButDontChange" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RealPoint blk))) :+: (C1 ('MetaCons "ChainSelectionLoEDebug" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (AnchoredFragment (Header blk))) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (LoE (AnchoredFragment (Header blk))))) :+: C1 ('MetaCons "AddedToCurrentChain" 'PrefixI 'False) ((S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [LedgerEvent blk]) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SelectionChangedInfo blk))) :*: (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (AnchoredFragment (Header blk))) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (AnchoredFragment (Header blk)))))))) :+: ((C1 ('MetaCons "SwitchedToAFork" 'PrefixI 'False) ((S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [LedgerEvent blk]) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SelectionChangedInfo blk))) :*: (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (AnchoredFragment (Header blk))) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (AnchoredFragment (Header blk))))) :+: C1 ('MetaCons "AddBlockValidation" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceValidationEvent blk)))) :+: (C1 ('MetaCons "ChainSelectionForFutureBlock" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RealPoint blk))) :+: (C1 ('MetaCons "PipeliningEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TracePipeliningEvent blk))) :+: C1 ('MetaCons "ChangingSelection" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Point blk))))))))

data TraceCopyToImmutableDBEvent blk Source #

Constructors

CopiedBlockToImmutableDB (Point blk)

A block was successfully copied to the ImmutableDB.

NoBlocksToCopyToImmutableDB

There are no block to copy to the ImmutableDB.

Instances

Instances details
Generic (TraceCopyToImmutableDBEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Associated Types

type Rep (TraceCopyToImmutableDBEvent blk) ∷ TypeType #

StandardHash blk ⇒ Show (TraceCopyToImmutableDBEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

StandardHash blk ⇒ Eq (TraceCopyToImmutableDBEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (TraceCopyToImmutableDBEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (TraceCopyToImmutableDBEvent blk) = D1 ('MetaData "TraceCopyToImmutableDBEvent" "Ouroboros.Consensus.Storage.ChainDB.Impl.Types" "ouroboros-consensus-0.18.0.0-inplace" 'False) (C1 ('MetaCons "CopiedBlockToImmutableDB" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Point blk))) :+: C1 ('MetaCons "NoBlocksToCopyToImmutableDB" 'PrefixI 'False) (U1TypeType))

data TraceEvent blk Source #

Trace type for the various events of the ChainDB.

Instances

Instances details
Generic (TraceEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Associated Types

type Rep (TraceEvent blk) ∷ TypeType #

Methods

fromTraceEvent blk → Rep (TraceEvent blk) x #

toRep (TraceEvent blk) x → TraceEvent blk #

(Show (Header blk), LedgerSupportsProtocol blk, InspectLedger blk) ⇒ Show (TraceEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Methods

showsPrecIntTraceEvent blk → ShowS #

showTraceEvent blk → String #

showList ∷ [TraceEvent blk] → ShowS #

(Eq (Header blk), LedgerSupportsProtocol blk, InspectLedger blk) ⇒ Eq (TraceEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Methods

(==)TraceEvent blk → TraceEvent blk → Bool #

(/=)TraceEvent blk → TraceEvent blk → Bool #

type Rep (TraceEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (TraceEvent blk) = D1 ('MetaData "TraceEvent" "Ouroboros.Consensus.Storage.ChainDB.Impl.Types" "ouroboros-consensus-0.18.0.0-inplace" 'False) (((C1 ('MetaCons "TraceAddBlockEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceAddBlockEvent blk))) :+: C1 ('MetaCons "TraceFollowerEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceFollowerEvent blk)))) :+: (C1 ('MetaCons "TraceCopyToImmutableDBEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceCopyToImmutableDBEvent blk))) :+: (C1 ('MetaCons "TraceGCEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceGCEvent blk))) :+: C1 ('MetaCons "TraceInitChainSelEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceInitChainSelEvent blk)))))) :+: ((C1 ('MetaCons "TraceOpenEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceOpenEvent blk))) :+: (C1 ('MetaCons "TraceIteratorEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceIteratorEvent blk))) :+: C1 ('MetaCons "TraceSnapshotEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceSnapshotEvent blk))))) :+: (C1 ('MetaCons "TraceLedgerReplayEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceReplayEvent blk))) :+: (C1 ('MetaCons "TraceImmutableDBEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceEvent blk))) :+: C1 ('MetaCons "TraceVolatileDBEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceEvent blk)))))))

data TraceFollowerEvent blk Source #

Constructors

NewFollower

A new follower was created.

FollowerNoLongerInMem (FollowerRollState blk)

The follower was in the FollowerInMem state but its point is no longer on the in-memory chain fragment, so it has to switch to the FollowerInImmutableDB state.

FollowerSwitchToMem

The follower was in the FollowerInImmutableDB state and is switched to the FollowerInMem state.

Fields

FollowerNewImmIterator

The follower is in the FollowerInImmutableDB state but the iterator is exhausted while the ImmutableDB has grown, so we open a new iterator to stream these blocks too.

Fields

Instances

Instances details
Generic (TraceFollowerEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Associated Types

type Rep (TraceFollowerEvent blk) ∷ TypeType #

StandardHash blk ⇒ Show (TraceFollowerEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

StandardHash blk ⇒ Eq (TraceFollowerEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (TraceFollowerEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (TraceFollowerEvent blk) = D1 ('MetaData "TraceFollowerEvent" "Ouroboros.Consensus.Storage.ChainDB.Impl.Types" "ouroboros-consensus-0.18.0.0-inplace" 'False) ((C1 ('MetaCons "NewFollower" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "FollowerNoLongerInMem" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (FollowerRollState blk)))) :+: (C1 ('MetaCons "FollowerSwitchToMem" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Point blk)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (WithOrigin SlotNo))) :+: C1 ('MetaCons "FollowerNewImmIterator" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Point blk)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (WithOrigin SlotNo)))))

data TraceGCEvent blk Source #

Constructors

ScheduledGC SlotNo Time

A garbage collection for the given SlotNo was scheduled to happen at the given time.

PerformedGC SlotNo

A garbage collection for the given SlotNo was performed.

Instances

Instances details
Generic (TraceGCEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Associated Types

type Rep (TraceGCEvent blk) ∷ TypeType #

Methods

fromTraceGCEvent blk → Rep (TraceGCEvent blk) x #

toRep (TraceGCEvent blk) x → TraceGCEvent blk #

Show (TraceGCEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Methods

showsPrecIntTraceGCEvent blk → ShowS #

showTraceGCEvent blk → String #

showList ∷ [TraceGCEvent blk] → ShowS #

Eq (TraceGCEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Methods

(==)TraceGCEvent blk → TraceGCEvent blk → Bool #

(/=)TraceGCEvent blk → TraceGCEvent blk → Bool #

type Rep (TraceGCEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (TraceGCEvent blk) = D1 ('MetaData "TraceGCEvent" "Ouroboros.Consensus.Storage.ChainDB.Impl.Types" "ouroboros-consensus-0.18.0.0-inplace" 'False) (C1 ('MetaCons "ScheduledGC" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SlotNo) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Time)) :+: C1 ('MetaCons "PerformedGC" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SlotNo)))

data TraceInitChainSelEvent blk Source #

Constructors

StartedInitChainSelection

An event traced when inital chain selection has started during the initialization of ChainDB

InitialChainSelected

An event traced when inital chain has been selected

InitChainSelValidation (TraceValidationEvent blk)

An event traced during validation performed while performing initial chain selection.

Instances

Instances details
Generic (TraceInitChainSelEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Associated Types

type Rep (TraceInitChainSelEvent blk) ∷ TypeType #

(Show (Header blk), LedgerSupportsProtocol blk) ⇒ Show (TraceInitChainSelEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

(Eq (Header blk), LedgerSupportsProtocol blk) ⇒ Eq (TraceInitChainSelEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (TraceInitChainSelEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (TraceInitChainSelEvent blk) = D1 ('MetaData "TraceInitChainSelEvent" "Ouroboros.Consensus.Storage.ChainDB.Impl.Types" "ouroboros-consensus-0.18.0.0-inplace" 'False) (C1 ('MetaCons "StartedInitChainSelection" 'PrefixI 'False) (U1TypeType) :+: (C1 ('MetaCons "InitialChainSelected" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "InitChainSelValidation" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceValidationEvent blk)))))

data TraceIteratorEvent blk Source #

Constructors

UnknownRangeRequested (UnknownRange blk)

An unknown range was requested, see UnknownRange.

StreamFromVolatileDB (StreamFrom blk) (StreamTo blk) [RealPoint blk]

Stream only from the VolatileDB.

StreamFromImmutableDB (StreamFrom blk) (StreamTo blk)

Stream only from the ImmutableDB.

StreamFromBoth (StreamFrom blk) (StreamTo blk) [RealPoint blk]

Stream from both the VolatileDB and the ImmutableDB.

BlockMissingFromVolatileDB (RealPoint blk)

A block is no longer in the VolatileDB because it has been garbage collected. It might now be in the ImmutableDB if it was part of the current chain.

BlockWasCopiedToImmutableDB (RealPoint blk)

A block that has been garbage collected from the VolatileDB is now found and streamed from the ImmutableDB.

BlockGCedFromVolatileDB (RealPoint blk)

A block is no longer in the VolatileDB and isn't in the ImmutableDB either; it wasn't part of the current chain.

SwitchBackToVolatileDB

We have streamed one or more blocks from the ImmutableDB that were part of the VolatileDB when initialising the iterator. Now, we have to look back in the VolatileDB again because the ImmutableDB doesn't have the next block we're looking for.

Instances

Instances details
Generic (TraceIteratorEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Associated Types

type Rep (TraceIteratorEvent blk) ∷ TypeType #

StandardHash blk ⇒ Show (TraceIteratorEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

StandardHash blk ⇒ Eq (TraceIteratorEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (TraceIteratorEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (TraceIteratorEvent blk) = D1 ('MetaData "TraceIteratorEvent" "Ouroboros.Consensus.Storage.ChainDB.Impl.Types" "ouroboros-consensus-0.18.0.0-inplace" 'False) (((C1 ('MetaCons "UnknownRangeRequested" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UnknownRange blk))) :+: C1 ('MetaCons "StreamFromVolatileDB" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (StreamFrom blk)) :*: (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (StreamTo blk)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [RealPoint blk])))) :+: (C1 ('MetaCons "StreamFromImmutableDB" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (StreamFrom blk)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (StreamTo blk))) :+: C1 ('MetaCons "StreamFromBoth" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (StreamFrom blk)) :*: (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (StreamTo blk)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [RealPoint blk]))))) :+: ((C1 ('MetaCons "BlockMissingFromVolatileDB" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RealPoint blk))) :+: C1 ('MetaCons "BlockWasCopiedToImmutableDB" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RealPoint blk)))) :+: (C1 ('MetaCons "BlockGCedFromVolatileDB" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RealPoint blk))) :+: C1 ('MetaCons "SwitchBackToVolatileDB" 'PrefixI 'False) (U1TypeType))))

data TraceOpenEvent blk Source #

Constructors

StartedOpeningDB

The ChainDB started the process of opening.

OpenedDB

The ChainDB was opened.

Fields

  • (Point blk)

    Immutable tip

  • (Point blk)

    Tip of the current chain

ClosedDB

The ChainDB was closed.

Fields

  • (Point blk)

    Immutable tip

  • (Point blk)

    Tip of the current chain

StartedOpeningImmutableDB

The ImmutableDB started the process of opening.

OpenedImmutableDB

The ImmutableDB was opened.

Fields

  • (Point blk)

    Immutable tip

  • ChunkNo

    Chunk number of the immutable tip

StartedOpeningVolatileDB

The VolatileDB started opening.

OpenedVolatileDB MaxSlotNo

The VolatileDB was opened, with the highest seen slot number for any block currently in the DB.

StartedOpeningLgrDB

The LedgerDB started opening.

OpenedLgrDB

The LedgerDB was opened.

Instances

Instances details
Generic (TraceOpenEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Associated Types

type Rep (TraceOpenEvent blk) ∷ TypeType #

Methods

fromTraceOpenEvent blk → Rep (TraceOpenEvent blk) x #

toRep (TraceOpenEvent blk) x → TraceOpenEvent blk #

StandardHash blk ⇒ Show (TraceOpenEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Methods

showsPrecIntTraceOpenEvent blk → ShowS #

showTraceOpenEvent blk → String #

showList ∷ [TraceOpenEvent blk] → ShowS #

StandardHash blk ⇒ Eq (TraceOpenEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Methods

(==)TraceOpenEvent blk → TraceOpenEvent blk → Bool #

(/=)TraceOpenEvent blk → TraceOpenEvent blk → Bool #

type Rep (TraceOpenEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (TraceOpenEvent blk) = D1 ('MetaData "TraceOpenEvent" "Ouroboros.Consensus.Storage.ChainDB.Impl.Types" "ouroboros-consensus-0.18.0.0-inplace" 'False) (((C1 ('MetaCons "StartedOpeningDB" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "OpenedDB" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Point blk)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Point blk)))) :+: (C1 ('MetaCons "ClosedDB" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Point blk)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Point blk))) :+: C1 ('MetaCons "StartedOpeningImmutableDB" 'PrefixI 'False) (U1TypeType))) :+: ((C1 ('MetaCons "OpenedImmutableDB" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Point blk)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ChunkNo)) :+: C1 ('MetaCons "StartedOpeningVolatileDB" 'PrefixI 'False) (U1TypeType)) :+: (C1 ('MetaCons "OpenedVolatileDB" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MaxSlotNo)) :+: (C1 ('MetaCons "StartedOpeningLgrDB" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "OpenedLgrDB" 'PrefixI 'False) (U1TypeType)))))

data TracePipeliningEvent blk Source #

Constructors

SetTentativeHeader (Header blk) Enclosing

A new tentative header got set.

TrapTentativeHeader (Header blk)

The body of tentative block turned out to be invalid.

OutdatedTentativeHeader (Header blk)

We selected a new (better) chain, which cleared the previous tentative header.

data TraceValidationEvent blk Source #

Constructors

InvalidBlock (ExtValidationError blk) (RealPoint blk)

A point was found to be invalid.

ValidCandidate (AnchoredFragment (Header blk))

A candidate chain was valid.

CandidateContainsFutureBlocks

Candidate contains headers from the future which do no exceed the clock skew.

Fields

  • (AnchoredFragment (Header blk))

    Candidate chain containing headers from the future

  • [Header blk]

    Headers from the future, not exceeding clock skew

CandidateContainsFutureBlocksExceedingClockSkew

Candidate contains headers from the future which exceed the clock skew, making them invalid.

Fields

UpdateLedgerDbTraceEvent (UpdateLedgerDbTraceEvent blk) 

Instances

Instances details
Generic (TraceValidationEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Associated Types

type Rep (TraceValidationEvent blk) ∷ TypeType #

(Show (Header blk), LedgerSupportsProtocol blk) ⇒ Show (TraceValidationEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

(Eq (Header blk), LedgerSupportsProtocol blk) ⇒ Eq (TraceValidationEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (TraceValidationEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (TraceValidationEvent blk) = D1 ('MetaData "TraceValidationEvent" "Ouroboros.Consensus.Storage.ChainDB.Impl.Types" "ouroboros-consensus-0.18.0.0-inplace" 'False) ((C1 ('MetaCons "InvalidBlock" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ExtValidationError blk)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RealPoint blk))) :+: C1 ('MetaCons "ValidCandidate" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (AnchoredFragment (Header blk))))) :+: (C1 ('MetaCons "CandidateContainsFutureBlocks" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (AnchoredFragment (Header blk))) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Header blk])) :+: (C1 ('MetaCons "CandidateContainsFutureBlocksExceedingClockSkew" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (AnchoredFragment (Header blk))) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Header blk])) :+: C1 ('MetaCons "UpdateLedgerDbTraceEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UpdateLedgerDbTraceEvent blk))))))