Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Consensus.Storage.Common
Synopsis
- tipIsGenesis ∷ WithOrigin r → Bool
- newtype PrefixLen = PrefixLen {}
- addPrefixLen ∷ Word8 → PrefixLen → PrefixLen
- takePrefix ∷ PrefixLen → ByteString → ShortByteString
- data BinaryBlockInfo = BinaryBlockInfo {}
- 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
- data SizeInBytes
Indexing
tipIsGenesis ∷ WithOrigin r → Bool Source #
PrefixLen
Number of bytes from the start of a block needed to reconstruct the nested context.
See reconstructPrefixLen
.
Constructors
PrefixLen | |
Fields |
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 |
BinaryBlockInfo
data BinaryBlockInfo Source #
Information about the serialised block.
Constructors
BinaryBlockInfo | |
Fields
|
Instances
Eq BinaryBlockInfo Source # | |
Defined in Ouroboros.Consensus.Storage.Common Methods | |
Show BinaryBlockInfo Source # | |
Defined in Ouroboros.Consensus.Storage.Common | |
Generic BinaryBlockInfo Source # | |
Defined in Ouroboros.Consensus.Storage.Common Methods 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.2-inplace" '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
Constructors
StreamFromInclusive !(RealPoint blk) | |
StreamFromExclusive !(Point blk) |
Instances
Constructors
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.2-inplace" '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.
Constructors
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 Methods 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 Methods 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
data SizeInBytes Source #