ouroboros-consensus-0.18.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Consensus.Storage.Common

Synopsis

Indexing

PrefixLen

newtype PrefixLen Source #

Number of bytes from the start of a block needed to reconstruct the nested context.

See reconstructPrefixLen.

Constructors

PrefixLen 

Fields

Instances

Instances details
Generic PrefixLen Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.Common

Associated Types

type Rep PrefixLenTypeType #

Methods

fromPrefixLenRep PrefixLen x #

toRep PrefixLen x → PrefixLen #

Show PrefixLen Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.Common

Methods

showsPrecIntPrefixLenShowS #

showPrefixLenString #

showList ∷ [PrefixLen] → ShowS #

Eq PrefixLen Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.Common

Methods

(==)PrefixLenPrefixLenBool #

(/=)PrefixLenPrefixLenBool #

Ord PrefixLen Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.Common

NoThunks PrefixLen Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.Common

type Rep PrefixLen Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.Common

type Rep PrefixLen = D1 ('MetaData "PrefixLen" "Ouroboros.Consensus.Storage.Common" "ouroboros-consensus-0.18.0.0-inplace" 'True) (C1 ('MetaCons "PrefixLen" 'PrefixI 'True) (S1 ('MetaSel ('Just "getPrefixLen") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8)))

BinaryBlockInfo

data BinaryBlockInfo Source #

Information about the serialised block.

Constructors

BinaryBlockInfo 

Fields

  • headerOffset ∷ !Word16

    The offset within the serialised block at which the header starts.

  • headerSize ∷ !Word16

    How many bytes the header is long. Extracting the headerSize bytes from serialised block starting from headerOffset should yield the header. Before passing the extracted bytes to the decoder for headers, an envelope can be around using nodeAddHeaderEnvelope.

Instances

Instances details
Generic BinaryBlockInfo Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.Common

Associated Types

type Rep BinaryBlockInfoTypeType #

Show BinaryBlockInfo Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.Common

Eq BinaryBlockInfo Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.Common

type Rep BinaryBlockInfo Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.Common

type Rep BinaryBlockInfo = D1 ('MetaData "BinaryBlockInfo" "Ouroboros.Consensus.Storage.Common" "ouroboros-consensus-0.18.0.0-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)))

extractHeaderBinaryBlockInfoByteStringByteString 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 StreamFromExclusive genesisPoint to start streaming from Genesis.

Instances

Instances details
Generic (StreamFrom blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.Common

Associated Types

type Rep (StreamFrom blk) ∷ TypeType #

Methods

fromStreamFrom blk → Rep (StreamFrom blk) x #

toRep (StreamFrom blk) x → StreamFrom blk #

StandardHash blk ⇒ Show (StreamFrom blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.Common

Methods

showsPrecIntStreamFrom blk → ShowS #

showStreamFrom blk → String #

showList ∷ [StreamFrom blk] → ShowS #

StandardHash blk ⇒ Eq (StreamFrom blk) Source # 
Instance details

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 # 
Instance details

Defined in Ouroboros.Consensus.Storage.Common

type Rep (StreamFrom blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.Common

type Rep (StreamFrom blk) = D1 ('MetaData "StreamFrom" "Ouroboros.Consensus.Storage.Common" "ouroboros-consensus-0.18.0.0-inplace" 'False) (C1 ('MetaCons "StreamFromInclusive" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (RealPoint blk))) :+: C1 ('MetaCons "StreamFromExclusive" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Point blk))))

newtype StreamTo blk Source #

Constructors

StreamToInclusive (RealPoint blk) 

Instances

Instances details
Generic (StreamTo blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.Common

Associated Types

type Rep (StreamTo blk) ∷ TypeType #

Methods

fromStreamTo blk → Rep (StreamTo blk) x #

toRep (StreamTo blk) x → StreamTo blk #

StandardHash blk ⇒ Show (StreamTo blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.Common

Methods

showsPrecIntStreamTo blk → ShowS #

showStreamTo blk → String #

showList ∷ [StreamTo blk] → ShowS #

StandardHash blk ⇒ Eq (StreamTo blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.Common

Methods

(==)StreamTo blk → StreamTo blk → Bool #

(/=)StreamTo blk → StreamTo blk → Bool #

(StandardHash blk, Typeable blk) ⇒ NoThunks (StreamTo blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.Common

type Rep (StreamTo blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.Common

type Rep (StreamTo blk) = D1 ('MetaData "StreamTo" "Ouroboros.Consensus.Storage.Common" "ouroboros-consensus-0.18.0.0-inplace" 'True) (C1 ('MetaCons "StreamToInclusive" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RealPoint blk))))

validBoundsStandardHash 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

GetVerifiedBlockBlockComponent 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.

GetBlockBlockComponent blk blk 
GetRawBlockBlockComponent blk ByteString 
GetHeaderBlockComponent blk (Header blk) 
GetRawHeaderBlockComponent blk ByteString 
GetHashBlockComponent blk (HeaderHash blk) 
GetSlotBlockComponent blk SlotNo 
GetIsEBBBlockComponent blk IsEBB 
GetBlockSizeBlockComponent blk SizeInBytes 
GetHeaderSizeBlockComponent blk Word16 
GetNestedCtxtBlockComponent blk (SomeSecond (NestedCtxt Header) blk) 
GetPure ∷ a → BlockComponent blk a 
GetApplyBlockComponent blk (a → b) → BlockComponent blk a → BlockComponent blk b 

Instances

Instances details
Applicative (BlockComponent blk) Source # 
Instance details

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 # 
Instance details

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

Instances details
Enum SizeInBytes 
Instance details

Defined in Ouroboros.Network.SizeInBytes

Num SizeInBytes 
Instance details

Defined in Ouroboros.Network.SizeInBytes

Integral SizeInBytes 
Instance details

Defined in Ouroboros.Network.SizeInBytes

Real SizeInBytes 
Instance details

Defined in Ouroboros.Network.SizeInBytes

Show SizeInBytes 
Instance details

Defined in Ouroboros.Network.SizeInBytes

NFData SizeInBytes 
Instance details

Defined in Ouroboros.Network.SizeInBytes

Methods

rnfSizeInBytes → () #

Eq SizeInBytes 
Instance details

Defined in Ouroboros.Network.SizeInBytes

Ord SizeInBytes 
Instance details

Defined in Ouroboros.Network.SizeInBytes

NoThunks SizeInBytes 
Instance details

Defined in Ouroboros.Network.SizeInBytes