Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data ParseError blk
- data ParsedBlockInfo blk = ParsedBlockInfo {
- pbiBlockOffset ∷ !BlockOffset
- pbiBlockSize ∷ !BlockSize
- pbiBlockInfo ∷ !(BlockInfo blk)
- pbiNestedCtxt ∷ !(SomeSecond (NestedCtxt Header) blk)
- parseBlockFile ∷ ∀ m blk h. (IOLike m, GetPrevHash blk, HasBinaryBlockInfo blk, HasNestedContent Header blk, DecodeDisk blk (ByteString → blk)) ⇒ CodecConfig blk → HasFS m h → (blk → Bool) → BlockValidationPolicy → FsPath → m ([ParsedBlockInfo blk], Maybe (ParseError blk, BlockOffset))
- extractBlockInfo ∷ (GetPrevHash blk, HasBinaryBlockInfo blk) ⇒ blk → BlockInfo blk
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.
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
StandardHash blk ⇒ Show (ParseError blk) Source # | |
Defined in Ouroboros.Consensus.Storage.VolatileDB.Impl.Types showsPrec ∷ Int → ParseError blk → ShowS # show ∷ ParseError blk → String # showList ∷ [ParseError blk] → ShowS # | |
StandardHash blk ⇒ Eq (ParseError blk) Source # | |
Defined in Ouroboros.Consensus.Storage.VolatileDB.Impl.Types (==) ∷ 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.
ParsedBlockInfo | |
|
parseBlockFile ∷ ∀ m blk h. (IOLike m, GetPrevHash blk, HasBinaryBlockInfo blk, HasNestedContent Header blk, DecodeDisk blk (ByteString → blk)) ⇒ CodecConfig blk → HasFS m h → (blk → Bool) → BlockValidationPolicy → FsPath → 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
extractBlockInfo ∷ (GetPrevHash blk, HasBinaryBlockInfo blk) ⇒ blk → BlockInfo blk Source #