ouroboros-consensus-0.1.0.1: Consensus layer for the Ouroboros blockchain protocol
Safe Haskell None
Language Haskell2010

Ouroboros.Consensus.Storage.VolatileDB.Impl.State

Synopsis

Tracing

data TraceEvent blk Source #

Instances

Instances details
StandardHash blk => Eq ( TraceEvent blk) Source #
Instance details

Defined in Ouroboros.Consensus.Storage.VolatileDB.Impl.Types

StandardHash blk => Show ( TraceEvent blk) Source #
Instance details

Defined in Ouroboros.Consensus.Storage.VolatileDB.Impl.Types

Generic ( TraceEvent blk) Source #
Instance details

Defined in Ouroboros.Consensus.Storage.VolatileDB.Impl.Types

Associated Types

type Rep ( TraceEvent blk) :: Type -> Type Source #

type Rep ( TraceEvent blk) Source #
Instance details

Defined in Ouroboros.Consensus.Storage.VolatileDB.Impl.Types

State types

newtype BlockOffset Source #

The offset at which a block is stored in a file.

Instances

Instances details
Eq BlockOffset Source #
Instance details

Defined in Ouroboros.Consensus.Storage.VolatileDB.Impl.Types

Show BlockOffset Source #
Instance details

Defined in Ouroboros.Consensus.Storage.VolatileDB.Impl.Types

Generic BlockOffset Source #
Instance details

Defined in Ouroboros.Consensus.Storage.VolatileDB.Impl.Types

NoThunks BlockOffset Source #
Instance details

Defined in Ouroboros.Consensus.Storage.VolatileDB.Impl.Types

type Rep BlockOffset Source #
Instance details

Defined in Ouroboros.Consensus.Storage.VolatileDB.Impl.Types

type Rep BlockOffset = D1 (' MetaData "BlockOffset" "Ouroboros.Consensus.Storage.VolatileDB.Impl.Types" "ouroboros-consensus-0.1.0.1-DT4Cvwf63DZKctsEvaJqCU" ' True ) ( C1 (' MetaCons "BlockOffset" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "unBlockOffset") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Word64 )))

newtype BlockSize Source #

type FileId = Int Source #

The FileId is the unique identifier of each file found in the db. For example, the file blocks-42.dat has FileId 42 .

data OpenState blk h Source #

Internal state when the database is open.

Constructors

OpenState

Fields

Instances

Instances details
Generic ( OpenState blk h) Source #
Instance details

Defined in Ouroboros.Consensus.Storage.VolatileDB.Impl.State

Associated Types

type Rep ( OpenState blk h) :: Type -> Type Source #

( StandardHash blk, Typeable blk) => NoThunks ( OpenState blk h) Source #
Instance details

Defined in Ouroboros.Consensus.Storage.VolatileDB.Impl.State

type Rep ( OpenState blk h) Source #
Instance details

Defined in Ouroboros.Consensus.Storage.VolatileDB.Impl.State

type ReverseIndex blk = Map ( HeaderHash blk) ( InternalBlockInfo blk) Source #

We map the header hash of each block to the InternalBlockInfo .

type SuccessorsIndex blk = Map ( ChainHash blk) ( Set ( HeaderHash blk)) Source #

For each block, we store the set of all blocks which have this block as a predecessor (set of successors).

State helpers

appendOpenState :: forall blk m a. ( IOLike m, Typeable blk, StandardHash blk) => VolatileDBEnv m blk -> ( forall h. Eq h => HasFS m h -> ModifyOpenState m blk h a) -> m a Source #

Append to the open state. Reads can happen concurrently with this operation.

NOTE: This is safe in terms of throwing FsErrors.

closeOpenHandles :: HasFS m h -> OpenState blk h -> m () Source #

Close the handles in the OpenState .

Idempotent, as closing a handle is idempotent.

NOTE: does not wrap FsError s and must be called within wrapFsError or tryVolatileDB .

withOpenState :: forall blk m r. ( IOLike m, StandardHash blk, Typeable blk) => VolatileDBEnv m blk -> ( forall h. HasFS m h -> OpenState blk h -> m r) -> m r Source #

Perform an action that accesses the internal state of an open database.

In case the database is closed, a ClosedDBError is thrown.

In case an UnexpectedFailure is thrown while the action is being run, the database is closed to prevent further appending to a database in a potentially inconsistent state. All other exceptions will leave the database open.

writeOpenState :: forall blk m a. ( IOLike m, Typeable blk, StandardHash blk) => VolatileDBEnv m blk -> ( forall h. Eq h => HasFS m h -> ModifyOpenState m blk h a) -> m a Source #

Write to the open state. No reads or appends can concurrently with this operation.

NOTE: This is safe in terms of throwing FsErrors.