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 ∷ ∀ blk. BlockComponent blk blk
- GetBlock ∷ ∀ blk. BlockComponent blk blk
- GetRawBlock ∷ ∀ blk. BlockComponent blk ByteString
- GetHeader ∷ ∀ blk. BlockComponent blk (Header blk)
- GetRawHeader ∷ ∀ blk. BlockComponent blk ByteString
- GetHash ∷ ∀ blk. BlockComponent blk (HeaderHash blk)
- GetSlot ∷ ∀ blk. BlockComponent blk SlotNo
- GetIsEBB ∷ ∀ blk. BlockComponent blk IsEBB
- GetBlockSize ∷ ∀ blk. BlockComponent blk SizeInBytes
- GetHeaderSize ∷ ∀ blk. BlockComponent blk Word16
- GetNestedCtxt ∷ ∀ blk. BlockComponent blk (SomeSecond (NestedCtxt Header) blk)
- GetPure ∷ ∀ a blk. a → BlockComponent blk a
- GetApply ∷ ∀ blk a1 a. BlockComponent blk (a1 → a) → BlockComponent blk a1 → BlockComponent blk a
- 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
Generic PrefixLen Source # | |||||
Defined in Ouroboros.Consensus.Storage.Common Associated Types
| |||||
Show PrefixLen Source # | |||||
Eq PrefixLen Source # | |||||
Ord PrefixLen Source # | |||||
Defined in Ouroboros.Consensus.Storage.Common | |||||
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
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
Generic (StreamFrom blk) Source # | |||||
Defined in Ouroboros.Consensus.Storage.Common Associated Types
Methods from ∷ StreamFrom blk → Rep (StreamFrom blk) x # to ∷ Rep (StreamFrom blk) x → StreamFrom blk # | |||||
StandardHash blk ⇒ Show (StreamFrom blk) Source # | |||||
Defined in Ouroboros.Consensus.Storage.Common Methods showsPrec ∷ Int → StreamFrom blk → ShowS # show ∷ StreamFrom blk → String # showList ∷ [StreamFrom blk] → ShowS # | |||||
StandardHash blk ⇒ Eq (StreamFrom blk) Source # | |||||
Defined in Ouroboros.Consensus.Storage.Common Methods (==) ∷ StreamFrom blk → StreamFrom blk → Bool # (/=) ∷ StreamFrom blk → StreamFrom blk → Bool # | |||||
(StandardHash blk, Typeable blk) ⇒ NoThunks (StreamFrom blk) Source # | |||||
Defined in Ouroboros.Consensus.Storage.Common | |||||
type Rep (StreamFrom blk) Source # | |||||
Defined in Ouroboros.Consensus.Storage.Common type Rep (StreamFrom blk) = D1 ('MetaData "StreamFrom" "Ouroboros.Consensus.Storage.Common" "ouroboros-consensus-0.26.0.0-inplace" 'False) (C1 ('MetaCons "StreamFromInclusive" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (RealPoint blk))) :+: C1 ('MetaCons "StreamFromExclusive" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Point blk)))) |
Constructors
StreamToInclusive (RealPoint blk) |
Instances
Generic (StreamTo blk) Source # | |||||
Defined in Ouroboros.Consensus.Storage.Common Associated Types
| |||||
StandardHash blk ⇒ Show (StreamTo blk) Source # | |||||
StandardHash blk ⇒ Eq (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.26.0.0-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 ∷ ∀ blk. 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 ∷ ∀ blk. BlockComponent blk blk | |
GetRawBlock ∷ ∀ blk. BlockComponent blk ByteString | |
GetHeader ∷ ∀ blk. BlockComponent blk (Header blk) | |
GetRawHeader ∷ ∀ blk. BlockComponent blk ByteString | |
GetHash ∷ ∀ blk. BlockComponent blk (HeaderHash blk) | |
GetSlot ∷ ∀ blk. BlockComponent blk SlotNo | |
GetIsEBB ∷ ∀ blk. BlockComponent blk IsEBB | |
GetBlockSize ∷ ∀ blk. BlockComponent blk SizeInBytes | |
GetHeaderSize ∷ ∀ blk. BlockComponent blk Word16 | |
GetNestedCtxt ∷ ∀ blk. BlockComponent blk (SomeSecond (NestedCtxt Header) blk) | |
GetPure ∷ ∀ a blk. a → BlockComponent blk a | |
GetApply ∷ ∀ blk a1 a. BlockComponent blk (a1 → a) → BlockComponent blk a1 → BlockComponent blk a |
Instances
Applicative (BlockComponent blk) Source # | |
Defined in Ouroboros.Consensus.Storage.Common Methods pure ∷ a → BlockComponent blk a # (<*>) ∷ BlockComponent blk (a → b) → BlockComponent blk a → BlockComponent blk b # liftA2 ∷ (a → b → c) → BlockComponent blk a → BlockComponent blk b → BlockComponent blk c # (*>) ∷ BlockComponent blk a → BlockComponent blk b → BlockComponent blk b # (<*) ∷ BlockComponent blk a → BlockComponent blk b → BlockComponent blk a # | |
Functor (BlockComponent blk) Source # | |
Defined in Ouroboros.Consensus.Storage.Common Methods fmap ∷ (a → b) → BlockComponent blk a → BlockComponent blk b # (<$) ∷ a → BlockComponent blk b → BlockComponent blk a # |
Re-exports
data SizeInBytes Source #
Instances
NFData SizeInBytes | |||||
Defined in Ouroboros.Network.SizeInBytes Methods rnf ∷ SizeInBytes → () # | |||||
Monoid SizeInBytes | |||||
Defined in Ouroboros.Network.SizeInBytes | |||||
Semigroup SizeInBytes | |||||
Defined in Ouroboros.Network.SizeInBytes Methods (<>) ∷ SizeInBytes → SizeInBytes → SizeInBytes # sconcat ∷ NonEmpty SizeInBytes → SizeInBytes # stimes ∷ Integral b ⇒ b → SizeInBytes → SizeInBytes # | |||||
Enum SizeInBytes | |||||
Defined in Ouroboros.Network.SizeInBytes Methods succ ∷ SizeInBytes → SizeInBytes # pred ∷ SizeInBytes → SizeInBytes # toEnum ∷ Int → SizeInBytes # fromEnum ∷ SizeInBytes → Int # enumFrom ∷ SizeInBytes → [SizeInBytes] # enumFromThen ∷ SizeInBytes → SizeInBytes → [SizeInBytes] # enumFromTo ∷ SizeInBytes → SizeInBytes → [SizeInBytes] # enumFromThenTo ∷ SizeInBytes → SizeInBytes → SizeInBytes → [SizeInBytes] # | |||||
Generic SizeInBytes | |||||
Defined in Ouroboros.Network.SizeInBytes Associated Types
| |||||
Num SizeInBytes | |||||
Defined in Ouroboros.Network.SizeInBytes Methods (+) ∷ SizeInBytes → SizeInBytes → SizeInBytes # (-) ∷ SizeInBytes → SizeInBytes → SizeInBytes # (*) ∷ SizeInBytes → SizeInBytes → SizeInBytes # negate ∷ SizeInBytes → SizeInBytes # abs ∷ SizeInBytes → SizeInBytes # | |||||
Integral SizeInBytes | |||||
Defined in Ouroboros.Network.SizeInBytes Methods quot ∷ SizeInBytes → SizeInBytes → SizeInBytes # rem ∷ SizeInBytes → SizeInBytes → SizeInBytes # div ∷ SizeInBytes → SizeInBytes → SizeInBytes # mod ∷ SizeInBytes → SizeInBytes → SizeInBytes # quotRem ∷ SizeInBytes → SizeInBytes → (SizeInBytes, SizeInBytes) # divMod ∷ SizeInBytes → SizeInBytes → (SizeInBytes, SizeInBytes) # toInteger ∷ SizeInBytes → Integer # | |||||
Real SizeInBytes | |||||
Defined in Ouroboros.Network.SizeInBytes Methods | |||||
Show SizeInBytes | |||||
Defined in Ouroboros.Network.SizeInBytes Methods showsPrec ∷ Int → SizeInBytes → ShowS # show ∷ SizeInBytes → String # showList ∷ [SizeInBytes] → ShowS # | |||||
Eq SizeInBytes | |||||
Defined in Ouroboros.Network.SizeInBytes | |||||
Ord SizeInBytes | |||||
Defined in Ouroboros.Network.SizeInBytes Methods compare ∷ SizeInBytes → SizeInBytes → Ordering # (<) ∷ SizeInBytes → SizeInBytes → Bool # (<=) ∷ SizeInBytes → SizeInBytes → Bool # (>) ∷ SizeInBytes → SizeInBytes → Bool # (>=) ∷ SizeInBytes → SizeInBytes → Bool # max ∷ SizeInBytes → SizeInBytes → SizeInBytes # min ∷ SizeInBytes → SizeInBytes → SizeInBytes # | |||||
BoundedMeasure SizeInBytes | |||||
Defined in Ouroboros.Network.SizeInBytes Methods | |||||
Measure SizeInBytes | |||||
Defined in Ouroboros.Network.SizeInBytes Methods plus ∷ SizeInBytes → SizeInBytes → SizeInBytes Source # min ∷ SizeInBytes → SizeInBytes → SizeInBytes Source # max ∷ SizeInBytes → SizeInBytes → SizeInBytes Source # | |||||
NoThunks SizeInBytes | |||||
Defined in Ouroboros.Network.SizeInBytes | |||||
type Rep SizeInBytes | |||||
Defined in Ouroboros.Network.SizeInBytes type Rep SizeInBytes = D1 ('MetaData "SizeInBytes" "Ouroboros.Network.SizeInBytes" "ouroboros-network-api-0.13.0.0-5343a8071b3f542ab81b06c59cf16dafcc55f3756ea92962f719c77a1536151d" 'True) (C1 ('MetaCons "SizeInBytes" 'PrefixI 'True) (S1 ('MetaSel ('Just "getSizeInBytes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word32))) |