Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Consensus.Storage.VolatileDB.Impl.Parser
Contents
Synopsis
-
data
ParseError
blk
- = BlockReadErr ReadIncrementalErr
- | BlockCorruptedErr ( HeaderHash blk)
- | DuplicatedBlock ( HeaderHash blk) FsPath FsPath
-
data
ParsedBlockInfo
blk =
ParsedBlockInfo
{
- pbiBlockOffset :: ! BlockOffset
- pbiBlockSize :: ! BlockSize
- pbiBlockInfo :: !( BlockInfo blk)
- pbiNestedCtxt :: !( SomeSecond ( NestedCtxt Header ) blk)
- parseBlockFile :: forall 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.
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
StandardHash blk => Eq ( ParseError blk) Source # | |
Defined in Ouroboros.Consensus.Storage.VolatileDB.Impl.Types Methods (==) :: ParseError blk -> ParseError blk -> Bool Source # (/=) :: ParseError blk -> ParseError blk -> Bool Source # |
|
StandardHash blk => Show ( ParseError blk) Source # | |
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.
Constructors
ParsedBlockInfo | |
Fields
|
parseBlockFile :: forall 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 #