Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data ChunkInfo = UniformChunkSize !ChunkSize
- chunkInfoSupportsEBBs ∷ ChunkInfo → Bool
- simpleChunkInfo ∷ EpochSize → ChunkInfo
- singleChunkInfo ∷ ChunkSize → ChunkInfo
- newtype ChunkNo = ChunkNo {}
- chunkNoFromInt ∷ Int → ChunkNo
- chunkNoToInt ∷ ChunkNo → Int
- chunksBetween ∷ ChunkNo → ChunkNo → [ChunkNo]
- countChunks ∷ ChunkNo → ChunkNo → Word64
- firstChunkNo ∷ ChunkNo
- nextChunkNo ∷ ChunkNo → ChunkNo
- prevChunkNo ∷ ChunkNo → Maybe ChunkNo
- unsafeChunkNoToEpochNo ∷ ChunkNo → EpochNo
- unsafeEpochNoToChunkNo ∷ EpochNo → ChunkNo
- data ChunkSize = ChunkSize {}
- getChunkSize ∷ ChunkInfo → ChunkNo → ChunkSize
- data RelativeSlot = RelativeSlot {}
- assertRelativeSlotInChunk ∷ HasCallStack ⇒ ChunkNo → RelativeSlot → Word64
- compareRelativeSlot ∷ HasCallStack ⇒ RelativeSlot → RelativeSlot → Ordering
- maxRelativeIndex ∷ ChunkSize → Word64
- mkRelativeSlot ∷ HasCallStack ⇒ ChunkInfo → ChunkNo → Word64 → RelativeSlot
- data ChunkAssertionFailure
- assertChunkCanContainEBB ∷ HasCallStack ⇒ ChunkNo → ChunkSize → a → a
- assertSameChunk ∷ HasCallStack ⇒ ChunkNo → ChunkNo → a → a
- assertWithinBounds ∷ HasCallStack ⇒ Word64 → ChunkSize → a → a
Documentation
Size of the chunks of the immutable DB
This is the key data structure that drives all layout functions.
TODO: Add support for non-uniform ChunkInfo
https://github.com/IntersectMBO/ouroboros-network/issues/1754
UniformChunkSize !ChunkSize | A single, uniform, chunk size If EBBs are present, the chunk size must line up precisely with the epoch size (that is, the number of regular blocks in the chunk must equal the number of regular blocks in an epoch). |
Instances
Generic ChunkInfo Source # | |
Show ChunkInfo Source # | |
NoThunks ChunkInfo Source # | |
type Rep ChunkInfo Source # | |
Defined in Ouroboros.Consensus.Storage.ImmutableDB.Chunks.Internal type Rep ChunkInfo = D1 ('MetaData "ChunkInfo" "Ouroboros.Consensus.Storage.ImmutableDB.Chunks.Internal" "ouroboros-consensus-0.21.0.0-inplace" 'False) (C1 ('MetaCons "UniformChunkSize" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChunkSize))) |
singleChunkInfo ∷ ChunkSize → ChunkInfo Source #
ChunkInfo
for a single ChunkSize
See also simpleChunkInfo
.
Chunk number
Chunk number
chunkNoFromInt ∷ Int → ChunkNo Source #
See chunkNoToInt
for motivation.
chunkNoToInt ∷ ChunkNo → Int Source #
chunksBetween ∷ ChunkNo → ChunkNo → [ChunkNo] Source #
Enumerate all chunks
chunksBetween x x == [x] chunksBetween x (nextChunkNo x) == [x, nextChunkNo x]
countChunks ∷ ChunkNo → ChunkNo → Word64 Source #
Count number of chunks between two indices
countChunks x x == 0 countChunks x (nextChunkNo x) == 1
firstChunkNo ∷ ChunkNo Source #
First chunk
nextChunkNo ∷ ChunkNo → ChunkNo Source #
unsafeChunkNoToEpochNo ∷ ChunkNo → EpochNo Source #
This should ONLY be used for chunks that contain EBBs.
See unsafeEpochNoToChunkNo
and ChunkInfo
for details.
Chunk size
Size of a chunk
The total number of slots available in a chunk is equal to numRegularBlocks
if not
chunkCanContainEBB
, and numRegularBlocks
+ 1
otherwise.
ChunkSize | |
|
Instances
Generic ChunkSize Source # | |
Show ChunkSize Source # | |
NoThunks ChunkSize Source # | |
type Rep ChunkSize Source # | |
Defined in Ouroboros.Consensus.Storage.ImmutableDB.Chunks.Internal type Rep ChunkSize = D1 ('MetaData "ChunkSize" "Ouroboros.Consensus.Storage.ImmutableDB.Chunks.Internal" "ouroboros-consensus-0.21.0.0-inplace" 'False) (C1 ('MetaCons "ChunkSize" 'PrefixI 'True) (S1 ('MetaSel ('Just "chunkCanContainEBB") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "numRegularBlocks") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64))) |
Layout
data RelativeSlot Source #
A relative slot within a chunk
RelativeSlot | |
|
Instances
compareRelativeSlot ∷ HasCallStack ⇒ RelativeSlot → RelativeSlot → Ordering Source #
RelativeSlot
is partially ordered, not totally ordered
It makes no sense to compare RelativeSlots
from different chunks. Doing so
will result in an assertion failure.
maxRelativeIndex ∷ ChunkSize → Word64 Source #
Maximum relative index within a chunk
mkRelativeSlot ∷ HasCallStack ⇒ ChunkInfo → ChunkNo → Word64 → RelativeSlot Source #
Smart constructor for RelativeSlot
Assertions
data ChunkAssertionFailure Source #
assertChunkCanContainEBB ∷ HasCallStack ⇒ ChunkNo → ChunkSize → a → a Source #
assertSameChunk ∷ HasCallStack ⇒ ChunkNo → ChunkNo → a → a Source #
assertWithinBounds ∷ HasCallStack ⇒ Word64 → ChunkSize → a → a Source #