| 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 {
- 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.
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 | |
takePrefix :: PrefixLen -> ByteString -> ShortByteString Source #
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
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.0-GfJNvFcM6lj2s5utKAUPEp" '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 # (<$) :: a -> BlockComponent blk b -> BlockComponent blk a # | |
| 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 # | |
Re-exports
type SizeInBytes = Word32 #