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

Ouroboros.Consensus.Storage.VolatileDB.Impl.Parser

Contents

Synopsis

Documentation

data ParseError blk Source #

Note that we recover from the error, and thus never throw it as an Exception.

Defined here instead of in the Parser module because TraceEvent depends on it.

Constructors

BlockReadErr ReadIncrementalErr

A block could not be parsed.

BlockCorruptedErr (HeaderHash blk)

A block was corrupted, e.g., checking its signature and/or hash failed.

DuplicatedBlock (HeaderHash blk) FsPath FsPath

A block with the same hash occurred twice in the VolatileDB files.

We include the file in which it occurred first and the file in which it occured the second time. The two files can be the same.

Instances

Instances details
StandardHash blk ⇒ Show (ParseError blk) Source # 
Instance details

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

Methods

showsPrecIntParseError blk → ShowS #

showParseError blk → String #

showList ∷ [ParseError blk] → ShowS #

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

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

Methods

(==)ParseError blk → ParseError blk → Bool #

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

data ParsedBlockInfo blk Source #

Information returned by the parser about a single block.

The parser returns for each block, its offset, its size and its BlockInfo

The fields of this record are strict to make sure that by evaluating this record to WHNF, we no longer hold on to the entire block. Otherwise, we might accidentally keep all blocks in a single file in memory during parsing.

parseBlockFile ∷ ∀ m blk h. (IOLike m, GetPrevHash blk, HasBinaryBlockInfo blk, HasNestedContent Header blk, DecodeDisk blk (ByteString → blk)) ⇒ CodecConfig blk → HasFS m h → (blk → Bool) → BlockValidationPolicyFsPath → m ([ParsedBlockInfo blk], Maybe (ParseError blk, BlockOffset)) Source #

Parse the given file containing blocks.

Return the ParsedBlockInfo for all the valid blocks in the file. Stop when encountering an error and include the offset to truncate to.

Auxiliary