ouroboros-consensus-0.1.0.2: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Synopsis

Documentation

newtype BlockOffset Source #

Constructors

BlockOffset 

Fields

Instances

Instances details
Enum BlockOffset Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Eq BlockOffset Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Integral BlockOffset Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Num BlockOffset Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Ord BlockOffset Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Real BlockOffset Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Show BlockOffset Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Storable BlockOffset Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Binary BlockOffset Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

NoThunks BlockOffset Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Methods

noThunks ∷ Context → BlockOffsetIO (Maybe ThunkInfo) #

wNoThunks ∷ Context → BlockOffsetIO (Maybe ThunkInfo) #

showTypeOfProxy BlockOffsetString #

data BlockSize Source #

Constructors

BlockSize Word32 
LastEntry

In case of the last entry, we don't have any entry and thus block offset after it that we can use to calculate the size of the block.

Instances

Instances details
Eq BlockSize Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Show BlockSize Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Generic BlockSize Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Associated Types

type Rep BlockSizeTypeType Source #

NoThunks BlockSize Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Methods

noThunks ∷ Context → BlockSizeIO (Maybe ThunkInfo) #

wNoThunks ∷ Context → BlockSizeIO (Maybe ThunkInfo) #

showTypeOfProxy BlockSizeString #

type Rep BlockSize Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

type Rep BlockSize = D1 ('MetaData "BlockSize" "Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary" "ouroboros-consensus-0.1.0.2-inplace" 'False) (C1 ('MetaCons "BlockSize" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word32)) :+: C1 ('MetaCons "LastEntry" 'PrefixI 'False) (U1TypeType))

data Entry blk Source #

Instances

Instances details
StandardHash blk ⇒ Eq (Entry blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Methods

(==)Entry blk → Entry blk → Bool Source #

(/=)Entry blk → Entry blk → Bool Source #

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

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Methods

showsPrecIntEntry blk → ShowS Source #

showEntry blk → String Source #

showList ∷ [Entry blk] → ShowS Source #

Generic (Entry blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Associated Types

type Rep (Entry blk) ∷ TypeType Source #

Methods

fromEntry blk → Rep (Entry blk) x Source #

toRep (Entry blk) x → Entry blk Source #

StandardHash blk ⇒ NoThunks (Entry blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Methods

noThunks ∷ Context → Entry blk → IO (Maybe ThunkInfo) #

wNoThunks ∷ Context → Entry blk → IO (Maybe ThunkInfo) #

showTypeOfProxy (Entry blk) → String #

type Rep (Entry blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

type Rep (Entry blk) = D1 ('MetaData "Entry" "Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary" "ouroboros-consensus-0.1.0.2-inplace" 'False) (C1 ('MetaCons "Entry" 'PrefixI 'True) ((S1 ('MetaSel ('Just "blockOffset") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 BlockOffset) :*: (S1 ('MetaSel ('Just "headerOffset") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 HeaderOffset) :*: S1 ('MetaSel ('Just "headerSize") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 HeaderSize))) :*: (S1 ('MetaSel ('Just "checksum") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 CRC) :*: (S1 ('MetaSel ('Just "headerHash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (HeaderHash blk)) :*: S1 ('MetaSel ('Just "blockOrEBB") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 BlockOrEBB)))))

newtype HeaderOffset Source #

Constructors

HeaderOffset 

Instances

Instances details
Eq HeaderOffset Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Show HeaderOffset Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Storable HeaderOffset Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Binary HeaderOffset Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

NoThunks HeaderOffset Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Methods

noThunks ∷ Context → HeaderOffsetIO (Maybe ThunkInfo) #

wNoThunks ∷ Context → HeaderOffsetIO (Maybe ThunkInfo) #

showTypeOfProxy HeaderOffsetString #

newtype HeaderSize Source #

Constructors

HeaderSize 

Fields

Instances

Instances details
Eq HeaderSize Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Show HeaderSize Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Storable HeaderSize Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Binary HeaderSize Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

NoThunks HeaderSize Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ImmutableDB.Impl.Index.Secondary

Methods

noThunks ∷ Context → HeaderSizeIO (Maybe ThunkInfo) #

wNoThunks ∷ Context → HeaderSizeIO (Maybe ThunkInfo) #

showTypeOfProxy HeaderSizeString #

appendEntry Source #

Arguments

∷ ∀ m blk h. (HasCallStack, ConvertRawHash blk, MonadThrow m) 
HasFS m h 
Handle h 
Entry blk 
→ m Word64

The number of bytes written

readAllEntries Source #

Arguments

∷ ∀ m blk h. (HasCallStack, ConvertRawHash blk, MonadThrow m, StandardHash blk, Typeable blk) 
HasFS m h 
SecondaryOffset

Start from this offset

ChunkNo 
→ (Entry blk → Bool)

Stop condition: stop after this entry

Word64

The size of the chunk file, used to compute the size of the last block.

IsEBB

Is the first entry to read an EBB?

→ m [WithBlockSize (Entry blk)] 

Read all entries in a secondary index file, starting from the given SecondaryOffset until the stop condition is true or until the end of the file is reached. The entry for which the stop condition is true will be the last in the returned list of entries.

readEntries ∷ ∀ m blk h t. (HasCallStack, ConvertRawHash blk, MonadThrow m, StandardHash blk, Typeable blk, Traversable t) ⇒ HasFS m h → ChunkNo → t (IsEBB, SecondaryOffset) → m (t (Entry blk, BlockSize)) Source #

Same as readEntry, but for multiple entries.

NOTE: only use this for a few entries, as we will seek (pread) for each entry. Use readAllEntries if you want to read all entries in the secondary index file.

readEntry ∷ ∀ m blk h. (HasCallStack, ConvertRawHash blk, MonadThrow m, StandardHash blk, Typeable blk) ⇒ HasFS m h → ChunkNoIsEBBSecondaryOffset → m (Entry blk, BlockSize) Source #

Read the entry at the given SecondaryOffset. Interpret it as an EBB depending on the given IsEBB.

truncateToEntry ∷ ∀ m blk h. (HasCallStack, ConvertRawHash blk, MonadThrow m) ⇒ Proxy blk → HasFS m h → ChunkNoSecondaryOffset → m () Source #

Remove all entries after the entry at the given SecondaryOffset. That entry will now be the last entry in the secondary index file.

writeAllEntries ∷ ∀ m blk h. (HasCallStack, ConvertRawHash blk, MonadThrow m) ⇒ HasFS m h → ChunkNo → [Entry blk] → m () Source #