Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data ChainDbArgs f m blk = ChainDbArgs {
- cdbImmDbArgs ∷ ImmutableDbArgs f m blk
- cdbVolDbArgs ∷ VolatileDbArgs f m blk
- cdbLgrDbArgs ∷ LgrDbArgs f m blk
- cdbsArgs ∷ ChainDbSpecificArgs f m blk
- class (ImmutableDbSerialiseConstraints blk, LgrDbSerialiseConstraints blk, VolatileDbSerialiseConstraints blk, EncodeDiskDep (NestedCtxt Header) blk) ⇒ SerialiseDiskConstraints blk
- defaultArgs ∷ ∀ m blk. Monad m ⇒ Incomplete ChainDbArgs m blk
- openDB ∷ ∀ m blk. (IOLike m, LedgerSupportsProtocol blk, BlockSupportsDiffusionPipelining blk, InspectLedger blk, HasHardForkHistory blk, ConvertRawHash blk, SerialiseDiskConstraints blk) ⇒ ChainDbArgs Identity m blk → m (ChainDB m blk)
- withDB ∷ ∀ m blk a. (IOLike m, LedgerSupportsProtocol blk, BlockSupportsDiffusionPipelining blk, InspectLedger blk, HasHardForkHistory blk, ConvertRawHash blk, SerialiseDiskConstraints blk) ⇒ ChainDbArgs Identity m blk → (ChainDB m blk → m a) → m a
- data TraceReplayEvent blk
- data SelectionChangedInfo blk = SelectionChangedInfo {
- newTipPoint ∷ RealPoint blk
- newTipEpoch ∷ EpochNo
- newTipSlotInEpoch ∷ Word64
- newTipTrigger ∷ RealPoint blk
- newTipSelectView ∷ SelectView (BlockProtocol blk)
- oldTipSelectView ∷ Maybe (SelectView (BlockProtocol blk))
- data TraceAddBlockEvent blk
- = IgnoreBlockOlderThanK (RealPoint blk)
- | IgnoreBlockAlreadyInVolatileDB (RealPoint blk)
- | IgnoreInvalidBlock (RealPoint blk) (ExtValidationError blk)
- | AddedBlockToQueue (RealPoint blk) (Enclosing' Word)
- | PoppedBlockFromQueue (Enclosing' (RealPoint blk))
- | AddedReprocessLoEBlocksToQueue
- | PoppedReprocessLoEBlocksFromQueue
- | AddedBlockToVolatileDB (RealPoint blk) BlockNo IsEBB Enclosing
- | TryAddToCurrentChain (RealPoint blk)
- | TrySwitchToAFork (RealPoint blk) (ChainDiff (HeaderFields blk))
- | StoreButDontChange (RealPoint blk)
- | ChainSelectionLoEDebug (AnchoredFragment (Header blk)) (LoE (AnchoredFragment (Header blk)))
- | AddedToCurrentChain [LedgerEvent blk] (SelectionChangedInfo blk) (AnchoredFragment (Header blk)) (AnchoredFragment (Header blk))
- | SwitchedToAFork [LedgerEvent blk] (SelectionChangedInfo blk) (AnchoredFragment (Header blk)) (AnchoredFragment (Header blk))
- | AddBlockValidation (TraceValidationEvent blk)
- | PipeliningEvent (TracePipeliningEvent blk)
- | ChangingSelection (Point blk)
- data TraceCopyToImmutableDBEvent blk
- data TraceEvent blk
- = TraceAddBlockEvent (TraceAddBlockEvent blk)
- | TraceFollowerEvent (TraceFollowerEvent blk)
- | TraceCopyToImmutableDBEvent (TraceCopyToImmutableDBEvent blk)
- | TraceGCEvent (TraceGCEvent blk)
- | TraceInitChainSelEvent (TraceInitChainSelEvent blk)
- | TraceOpenEvent (TraceOpenEvent blk)
- | TraceIteratorEvent (TraceIteratorEvent blk)
- | TraceSnapshotEvent (TraceSnapshotEvent blk)
- | TraceLedgerReplayEvent (TraceReplayEvent blk)
- | TraceImmutableDBEvent (TraceEvent blk)
- | TraceVolatileDBEvent (TraceEvent blk)
- | TraceLastShutdownUnclean
- data TraceFollowerEvent blk
- = NewFollower
- | FollowerNoLongerInMem (FollowerRollState blk)
- | FollowerSwitchToMem (Point blk) (WithOrigin SlotNo)
- | FollowerNewImmIterator (Point blk) (WithOrigin SlotNo)
- data TraceGCEvent blk
- data TraceInitChainSelEvent blk
- data TraceIteratorEvent blk
- = UnknownRangeRequested (UnknownRange blk)
- | StreamFromVolatileDB (StreamFrom blk) (StreamTo blk) [RealPoint blk]
- | StreamFromImmutableDB (StreamFrom blk) (StreamTo blk)
- | StreamFromBoth (StreamFrom blk) (StreamTo blk) [RealPoint blk]
- | BlockMissingFromVolatileDB (RealPoint blk)
- | BlockWasCopiedToImmutableDB (RealPoint blk)
- | BlockGCedFromVolatileDB (RealPoint blk)
- | SwitchBackToVolatileDB
- data TraceOpenEvent blk
- = StartedOpeningDB
- | OpenedDB (Point blk) (Point blk)
- | ClosedDB (Point blk) (Point blk)
- | StartedOpeningImmutableDB
- | OpenedImmutableDB (Point blk) ChunkNo
- | StartedOpeningVolatileDB
- | OpenedVolatileDB MaxSlotNo
- | StartedOpeningLgrDB
- | OpenedLgrDB
- data TracePipeliningEvent blk
- = SetTentativeHeader (Header blk) Enclosing
- | TrapTentativeHeader (Header blk)
- | OutdatedTentativeHeader (Header blk)
- data TraceValidationEvent blk
- = InvalidBlock (ExtValidationError blk) (RealPoint blk)
- | ValidCandidate (AnchoredFragment (Header blk))
- | UpdateLedgerDbTraceEvent (UpdateLedgerDbTraceEvent blk)
- newtype RelativeMountPoint = RelativeMountPoint FilePath
- type ImmutableDbSerialiseConstraints blk = (EncodeDisk blk blk, DecodeDisk blk (ByteString → blk), DecodeDiskDep (NestedCtxt Header) blk, ReconstructNestedCtxt Header blk, HasBinaryBlockInfo blk)
- type LgrDbSerialiseConstraints blk = (Serialise (HeaderHash blk), EncodeDisk blk (LedgerState blk), DecodeDisk blk (LedgerState blk), EncodeDisk blk (AnnTip blk), DecodeDisk blk (AnnTip blk), EncodeDisk blk (ChainDepState (BlockProtocol blk)), DecodeDisk blk (ChainDepState (BlockProtocol blk)))
- type VolatileDbSerialiseConstraints blk = (EncodeDisk blk blk, DecodeDisk blk (ByteString → blk), DecodeDiskDep (NestedCtxt Header) blk, HasNestedContent Header blk, HasBinaryBlockInfo blk)
- data Internal m blk = Internal {
- intCopyToImmutableDB ∷ m (WithOrigin SlotNo)
- intGarbageCollect ∷ SlotNo → m ()
- intUpdateLedgerSnapshots ∷ m ()
- intAddBlockRunner ∷ m Void
- intKillBgThreads ∷ StrictTVar m (m ())
- openDBInternal ∷ ∀ m blk. (IOLike m, LedgerSupportsProtocol blk, BlockSupportsDiffusionPipelining blk, InspectLedger blk, HasHardForkHistory blk, ConvertRawHash blk, SerialiseDiskConstraints blk) ⇒ ChainDbArgs Identity m blk → Bool → m (ChainDB m blk, Internal m blk)
Initialization
data ChainDbArgs f m blk Source #
ChainDbArgs | |
|
class (ImmutableDbSerialiseConstraints blk, LgrDbSerialiseConstraints blk, VolatileDbSerialiseConstraints blk, EncodeDiskDep (NestedCtxt Header) blk) ⇒ SerialiseDiskConstraints blk Source #
All the serialisation related constraints needed by the ChainDB.
Instances
defaultArgs ∷ ∀ m blk. Monad m ⇒ Incomplete ChainDbArgs m blk Source #
Default arguments
See defaultArgs
, defaultArgs
, defaultArgs
,
and defaultSpecificArgs
for a list of which fields are not given a default
and must therefore be set explicitly.
openDB ∷ ∀ m blk. (IOLike m, LedgerSupportsProtocol blk, BlockSupportsDiffusionPipelining blk, InspectLedger blk, HasHardForkHistory blk, ConvertRawHash blk, SerialiseDiskConstraints blk) ⇒ ChainDbArgs Identity m blk → m (ChainDB m blk) Source #
withDB ∷ ∀ m blk a. (IOLike m, LedgerSupportsProtocol blk, BlockSupportsDiffusionPipelining blk, InspectLedger blk, HasHardForkHistory blk, ConvertRawHash blk, SerialiseDiskConstraints blk) ⇒ ChainDbArgs Identity m blk → (ChainDB m blk → m a) → m a Source #
Trace types
data TraceReplayEvent blk Source #
Events traced while replaying blocks against the ledger to bring it up to date w.r.t. the tip of the ImmutableDB during initialisation. As this process takes a while, we trace events to inform higher layers of our progress.
Instances
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.
SelectionChangedInfo | |
|
Instances
data TraceAddBlockEvent blk Source #
Trace type for the various events that occur when adding a block.
IgnoreBlockOlderThanK (RealPoint blk) | A block with a |
IgnoreBlockAlreadyInVolatileDB (RealPoint blk) | A block that is already in the Volatile DB was ignored. |
IgnoreInvalidBlock (RealPoint blk) (ExtValidationError 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. |
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. |
PipeliningEvent (TracePipeliningEvent blk) | The tentative header (in the context of diffusion pipelining) has been updated. |
ChangingSelection (Point blk) | Herald of |
Instances
data TraceCopyToImmutableDBEvent blk Source #
CopiedBlockToImmutableDB (Point blk) | A block was successfully copied to the ImmutableDB. |
NoBlocksToCopyToImmutableDB | There are no block to copy to the ImmutableDB. |
Instances
data TraceEvent blk Source #
Trace type for the various events of the ChainDB.
Instances
data TraceFollowerEvent blk Source #
NewFollower | A new follower was created. |
FollowerNoLongerInMem (FollowerRollState blk) | The follower was in the |
FollowerSwitchToMem | The follower was in the |
| |
FollowerNewImmIterator | The follower is in the |
|
Instances
data TraceGCEvent blk Source #
ScheduledGC SlotNo Time | A garbage collection for the given |
PerformedGC SlotNo | A garbage collection for the given |
Instances
data TraceInitChainSelEvent blk Source #
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
data TraceIteratorEvent blk Source #
UnknownRangeRequested (UnknownRange blk) | An unknown range was requested, see |
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
data TraceOpenEvent blk Source #
StartedOpeningDB | The ChainDB started the process of opening. |
OpenedDB | The ChainDB was opened. |
ClosedDB | The ChainDB was closed. |
StartedOpeningImmutableDB | The ImmutableDB started the process of opening. |
OpenedImmutableDB | The ImmutableDB was opened. |
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
data TracePipeliningEvent blk Source #
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. |
Instances
Show (Header blk) ⇒ Show (TracePipeliningEvent blk) Source # | |
Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types showsPrec ∷ Int → TracePipeliningEvent blk → ShowS # show ∷ TracePipeliningEvent blk → String # showList ∷ [TracePipeliningEvent blk] → ShowS # | |
Eq (Header blk) ⇒ Eq (TracePipeliningEvent blk) Source # | |
Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types (==) ∷ TracePipeliningEvent blk → TracePipeliningEvent blk → Bool # (/=) ∷ TracePipeliningEvent blk → TracePipeliningEvent blk → Bool # |
data TraceValidationEvent blk Source #
InvalidBlock (ExtValidationError blk) (RealPoint blk) | A point was found to be invalid. |
ValidCandidate (AnchoredFragment (Header blk)) | A candidate chain was valid. |
UpdateLedgerDbTraceEvent (UpdateLedgerDbTraceEvent blk) |
Instances
Re-exported for convenience
newtype RelativeMountPoint Source #
A relative path for a MountPoint
The root is determined by context.
type ImmutableDbSerialiseConstraints blk = (EncodeDisk blk blk, DecodeDisk blk (ByteString → blk), DecodeDiskDep (NestedCtxt Header) blk, ReconstructNestedCtxt Header blk, HasBinaryBlockInfo blk) Source #
EncodeDisk
and DecodeDisk
constraints needed for the ImmutableDB.
type LgrDbSerialiseConstraints blk = (Serialise (HeaderHash blk), EncodeDisk blk (LedgerState blk), DecodeDisk blk (LedgerState blk), EncodeDisk blk (AnnTip blk), DecodeDisk blk (AnnTip blk), EncodeDisk blk (ChainDepState (BlockProtocol blk)), DecodeDisk blk (ChainDepState (BlockProtocol blk))) Source #
EncodeDisk
and DecodeDisk
constraints needed for the LgrDB.
type VolatileDbSerialiseConstraints blk = (EncodeDisk blk blk, DecodeDisk blk (ByteString → blk), DecodeDiskDep (NestedCtxt Header) blk, HasNestedContent Header blk, HasBinaryBlockInfo blk) Source #
EncodeDisk
and DecodeDisk
constraints needed for the VolatileDB.
Internals for testing purposes
Internal | |
|
∷ ∀ m blk. (IOLike m, LedgerSupportsProtocol blk, BlockSupportsDiffusionPipelining blk, InspectLedger blk, HasHardForkHistory blk, ConvertRawHash blk, SerialiseDiskConstraints blk) | |
⇒ ChainDbArgs Identity m blk | |
→ Bool |
|
→ m (ChainDB m blk, Internal m blk) |