Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- tipIsGenesis :: WithOrigin r -> Bool
- newtype PrefixLen = PrefixLen { }
- addPrefixLen :: Word8 -> PrefixLen -> PrefixLen
- takePrefix :: PrefixLen -> ByteString -> ShortByteString
-
data
BinaryBlockInfo
=
BinaryBlockInfo
{
- headerOffset :: ! Word16
- headerSize :: ! Word16
- extractHeader :: BinaryBlockInfo -> ByteString -> ByteString
-
data
StreamFrom
blk
- = StreamFromInclusive !( RealPoint blk)
- | StreamFromExclusive !( Point blk)
- newtype StreamTo blk = StreamToInclusive ( RealPoint blk)
- validBounds :: StandardHash blk => StreamFrom blk -> StreamTo blk -> Bool
-
data
BlockComponent
blk a
where
- GetVerifiedBlock :: BlockComponent blk blk
- GetBlock :: BlockComponent blk blk
- GetRawBlock :: BlockComponent blk ByteString
- GetHeader :: BlockComponent blk ( Header blk)
- GetRawHeader :: BlockComponent blk ByteString
- GetHash :: BlockComponent blk ( HeaderHash blk)
- GetSlot :: BlockComponent blk SlotNo
- GetIsEBB :: BlockComponent blk IsEBB
- GetBlockSize :: BlockComponent blk Word32
- GetHeaderSize :: BlockComponent blk Word16
- GetNestedCtxt :: BlockComponent blk ( SomeSecond ( NestedCtxt Header ) blk)
- GetPure :: a -> BlockComponent blk a
- GetApply :: BlockComponent blk (a -> b) -> BlockComponent blk a -> BlockComponent blk b
- type SizeInBytes = Word32
Indexing
tipIsGenesis :: WithOrigin r -> Bool Source #
PrefixLen
Number of bytes from the start of a block needed to reconstruct the nested context.
See
reconstructPrefixLen
.
Instances
Eq PrefixLen Source # | |
Ord PrefixLen Source # | |
Defined in Ouroboros.Consensus.Storage.Common |
|
Show PrefixLen Source # | |
Generic PrefixLen Source # | |
NoThunks PrefixLen Source # | |
type Rep PrefixLen Source # | |
Defined in Ouroboros.Consensus.Storage.Common
type
Rep
PrefixLen
=
D1
('
MetaData
"PrefixLen" "Ouroboros.Consensus.Storage.Common" "ouroboros-consensus-0.1.0.1-DT4Cvwf63DZKctsEvaJqCU" '
True
) (
C1
('
MetaCons
"PrefixLen" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"getPrefixLen") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
Word8
)))
|
takePrefix :: PrefixLen -> ByteString -> ShortByteString Source #
BinaryBlockInfo
data BinaryBlockInfo Source #
Information about the serialised block.
BinaryBlockInfo | |
|
Instances
Eq BinaryBlockInfo Source # | |
Defined in Ouroboros.Consensus.Storage.Common (==) :: BinaryBlockInfo -> BinaryBlockInfo -> Bool Source # (/=) :: BinaryBlockInfo -> BinaryBlockInfo -> Bool Source # |
|
Show BinaryBlockInfo Source # | |
Defined in Ouroboros.Consensus.Storage.Common |
|
Generic BinaryBlockInfo Source # | |
Defined in Ouroboros.Consensus.Storage.Common from :: BinaryBlockInfo -> Rep BinaryBlockInfo x Source # to :: Rep BinaryBlockInfo x -> BinaryBlockInfo Source # |
|
type Rep BinaryBlockInfo Source # | |
Defined in Ouroboros.Consensus.Storage.Common
type
Rep
BinaryBlockInfo
=
D1
('
MetaData
"BinaryBlockInfo" "Ouroboros.Consensus.Storage.Common" "ouroboros-consensus-0.1.0.1-DT4Cvwf63DZKctsEvaJqCU" '
False
) (
C1
('
MetaCons
"BinaryBlockInfo" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"headerOffset") '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
Word16
)
:*:
S1
('
MetaSel
('
Just
"headerSize") '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
Word16
)))
|
extractHeader :: BinaryBlockInfo -> ByteString -> ByteString Source #
Extract the header from the given
ByteString
using the
BinaryBlockInfo
.
Iterator bounds
data StreamFrom blk Source #
The lower bound for an iterator
Hint: use
to start streaming from
Genesis.
StreamFromExclusive
genesisPoint
StreamFromInclusive !( RealPoint blk) | |
StreamFromExclusive !( Point blk) |
Instances
StreamToInclusive ( RealPoint blk) |
Instances
StandardHash blk => Eq ( StreamTo blk) Source # | |
StandardHash blk => Show ( StreamTo blk) Source # | |
Generic ( StreamTo blk) Source # | |
( StandardHash blk, Typeable blk) => NoThunks ( StreamTo blk) Source # | |
type Rep ( StreamTo blk) Source # | |
Defined in Ouroboros.Consensus.Storage.Common
type
Rep
(
StreamTo
blk) =
D1
('
MetaData
"StreamTo" "Ouroboros.Consensus.Storage.Common" "ouroboros-consensus-0.1.0.1-DT4Cvwf63DZKctsEvaJqCU" '
True
) (
C1
('
MetaCons
"StreamToInclusive" '
PrefixI
'
False
) (
S1
('
MetaSel
('
Nothing
::
Maybe
Symbol
) '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
(
RealPoint
blk))))
|
validBounds :: StandardHash blk => StreamFrom blk -> StreamTo blk -> Bool Source #
Check whether the bounds make sense
An example of bounds that don't make sense:
StreamFromExclusive (BlockPoint 3 ..) StreamToInclusive (RealPoint 3 ..)
This function does not check whether the bounds correspond to existing blocks.
BlockComponent
data BlockComponent blk a where Source #
Which component of the block to read from a database: the whole block, its header, its hash, the block size, ..., or combinations thereof.
NOTE: when requesting multiple components, we will not optimise/cache them.
GetVerifiedBlock :: BlockComponent blk blk |
Verify the integrity of the block by checking its signature and/or hashes. The interpreter should throw an exception when the block does not pass the check. |
GetBlock :: BlockComponent blk blk | |
GetRawBlock :: BlockComponent blk ByteString | |
GetHeader :: BlockComponent blk ( Header blk) | |
GetRawHeader :: BlockComponent blk ByteString | |
GetHash :: BlockComponent blk ( HeaderHash blk) | |
GetSlot :: BlockComponent blk SlotNo | |
GetIsEBB :: BlockComponent blk IsEBB | |
GetBlockSize :: BlockComponent blk Word32 | |
GetHeaderSize :: BlockComponent blk Word16 | |
GetNestedCtxt :: BlockComponent blk ( SomeSecond ( NestedCtxt Header ) blk) | |
GetPure :: a -> BlockComponent blk a | |
GetApply :: BlockComponent blk (a -> b) -> BlockComponent blk a -> BlockComponent blk b |
Instances
Functor ( BlockComponent blk) Source # | |
Defined in Ouroboros.Consensus.Storage.Common fmap :: (a -> b) -> BlockComponent blk a -> BlockComponent blk b Source # (<$) :: a -> BlockComponent blk b -> BlockComponent blk a Source # |
|
Applicative ( BlockComponent blk) Source # | |
Defined in Ouroboros.Consensus.Storage.Common pure :: a -> BlockComponent blk a Source # (<*>) :: BlockComponent blk (a -> b) -> BlockComponent blk a -> BlockComponent blk b Source # liftA2 :: (a -> b -> c) -> BlockComponent blk a -> BlockComponent blk b -> BlockComponent blk c Source # (*>) :: BlockComponent blk a -> BlockComponent blk b -> BlockComponent blk b Source # (<*) :: BlockComponent blk a -> BlockComponent blk b -> BlockComponent blk a Source # |
Re-exports
type SizeInBytes = Word32 Source #