| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Storage.ImmutableDB.Chunks.Layout
Description
Layout of individual chunks on disk
This module is not re-exported from the public Chunks API, since it's only relevant internally in the immutable DB.
Synopsis
- data RelativeSlot
- maxRelativeSlot :: ChunkInfo -> ChunkNo -> RelativeSlot
- relativeSlotIsEBB :: RelativeSlot -> IsEBB
- nthBlockOrEBB :: (HasCallStack, Integral a) => ChunkInfo -> ChunkNo -> a -> RelativeSlot
- firstBlockOrEBB :: ChunkInfo -> ChunkNo -> RelativeSlot
- data NextRelativeSlot
- nextRelativeSlot :: HasCallStack => RelativeSlot -> NextRelativeSlot
- unsafeNextRelativeSlot :: HasCallStack => RelativeSlot -> RelativeSlot
- chunkIndexOfSlot :: ChunkInfo -> SlotNo -> ChunkNo
- data ChunkSlot = UnsafeChunkSlot {}
- pattern ChunkSlot :: ChunkNo -> RelativeSlot -> ChunkSlot
- chunkSlotForUnknownBlock :: HasCallStack => ChunkInfo -> SlotNo -> (ChunkNo, Maybe ChunkSlot, ChunkSlot)
- chunkSlotForRegularBlock :: ChunkInfo -> SlotNo -> ChunkSlot
- chunkSlotForBoundaryBlock :: HasCallStack => ChunkInfo -> EpochNo -> ChunkSlot
- chunkSlotForBlockOrEBB :: ChunkInfo -> BlockOrEBB -> ChunkSlot
- chunkSlotForTip :: ChunkInfo -> Tip blk -> ChunkSlot
- chunkSlotForRelativeSlot :: ChunkNo -> RelativeSlot -> ChunkSlot
- chunkSlotToSlot :: ChunkInfo -> ChunkSlot -> SlotNo
- chunkSlotToBlockOrEBB :: ChunkInfo -> ChunkSlot -> BlockOrEBB
- slotNoOfEBB :: HasCallStack => ChunkInfo -> EpochNo -> SlotNo
- slotMightBeEBB :: ChunkInfo -> SlotNo -> Maybe EpochNo
- slotNoOfBlockOrEBB :: ChunkInfo -> BlockOrEBB -> SlotNo
Relative slots
data RelativeSlot Source #
A relative slot within a chunk
Instances
maxRelativeSlot :: ChunkInfo -> ChunkNo -> RelativeSlot Source #
The last relative slot within a chunk of the given size
relativeSlotIsEBB :: RelativeSlot -> IsEBB Source #
Is this relative slot reserved for an EBB?
nthBlockOrEBB :: (HasCallStack, Integral a) => ChunkInfo -> ChunkNo -> a -> RelativeSlot Source #
The n'th relative slot for an arbitrary block
NOTE: Offset 0 refers to an EBB only if the ChunkSize supports it.
firstBlockOrEBB :: ChunkInfo -> ChunkNo -> RelativeSlot Source #
The first relative slot
NOTE: This refers to an EBB only if the ChunkSize supports it.
data NextRelativeSlot Source #
Result of nextRelativeSlot
Constructors
| NextRelativeSlot RelativeSlot | There is a next negative slot |
| NoMoreRelativeSlots | We reached the end of the chunk |
nextRelativeSlot :: HasCallStack => RelativeSlot -> NextRelativeSlot Source #
Next relative slot
unsafeNextRelativeSlot :: HasCallStack => RelativeSlot -> RelativeSlot Source #
Variation on nextRelativeSlot where the caller knows that there must
be a next slot
Throws an assertion failure (if assertions are enabled) if there is no next slot.
Chunks
Slots within a chunk
Uniquely identify a block within the immutable DB
Constructor marked as Unsafe; construction should normally happen inside
this module only (though see the ChunkSlot pattern synonym).
Constructors
| UnsafeChunkSlot | |
Fields
| |
Instances
| Eq ChunkSlot Source # | |
| Ord ChunkSlot Source # | We provide a manual |
Defined in Ouroboros.Consensus.Storage.ImmutableDB.Chunks.Layout | |
| Show ChunkSlot Source # | |
| Generic ChunkSlot Source # | |
| NoThunks ChunkSlot Source # | |
| type Rep ChunkSlot Source # | |
Defined in Ouroboros.Consensus.Storage.ImmutableDB.Chunks.Layout type Rep ChunkSlot = D1 ('MetaData "ChunkSlot" "Ouroboros.Consensus.Storage.ImmutableDB.Chunks.Layout" "ouroboros-consensus-0.1.0.0-GfJNvFcM6lj2s5utKAUPEp" 'False) (C1 ('MetaCons "UnsafeChunkSlot" 'PrefixI 'True) (S1 ('MetaSel ('Just "chunkIndex") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChunkNo) :*: S1 ('MetaSel ('Just "chunkRelative") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RelativeSlot))) | |
Translation to ChunkSlot
chunkSlotForUnknownBlock :: HasCallStack => ChunkInfo -> SlotNo -> (ChunkNo, Maybe ChunkSlot, ChunkSlot) Source #
chunkSlotForRegularBlock :: ChunkInfo -> SlotNo -> ChunkSlot Source #
Chunk slot for a regular block (i.e., not an EBB)
chunkSlotForBoundaryBlock :: HasCallStack => ChunkInfo -> EpochNo -> ChunkSlot Source #
Chunk slot for EBB
chunkSlotForBlockOrEBB :: ChunkInfo -> BlockOrEBB -> ChunkSlot Source #
Chunk slot for BlockOrEBB
Translation from ChunkSlot
chunkSlotToSlot :: ChunkInfo -> ChunkSlot -> SlotNo Source #
From relative to absolute slot
This can be used for EBBs and regular blocks, since they don't share a relative slot.
chunkSlotToBlockOrEBB :: ChunkInfo -> ChunkSlot -> BlockOrEBB Source #
Support for EBBs
slotNoOfEBB :: HasCallStack => ChunkInfo -> EpochNo -> SlotNo Source #
slotNoOfBlockOrEBB :: ChunkInfo -> BlockOrEBB -> SlotNo Source #