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

Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB.Status

Contents

Description

LMDB resource status with read-append-write locking

Synopsis

Status

data Status Source #

Whether a resource is open or closed.

Resources that we keep track of are: (i) the full LMDB backing store, and (ii) each of the LMDB backing store value handles.

Constructors

Open 
Closed 

Instances

Instances details
Generic Status Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB.Status

Associated Types

type Rep Status 
Instance details

Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB.Status

type Rep Status = D1 ('MetaData "Status" "Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB.Status" "ouroboros-consensus-0.26.0.0-inplace" 'False) (C1 ('MetaCons "Open" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "Closed" 'PrefixI 'False) (U1TypeType))

Methods

fromStatusRep Status x #

toRep Status x → Status #

Show Status Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB.Status

Methods

showsPrecIntStatusShowS #

showStatusString #

showList ∷ [Status] → ShowS #

Eq Status Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB.Status

Methods

(==)StatusStatusBool #

(/=)StatusStatusBool #

NoThunks Status Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB.Status

type Rep Status Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB.Status

type Rep Status = D1 ('MetaData "Status" "Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB.Status" "ouroboros-consensus-0.26.0.0-inplace" 'False) (C1 ('MetaCons "Open" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "Closed" 'PrefixI 'False) (U1TypeType))

data StatusLock (m ∷ TypeType) Source #

Locks

newIOLike m ⇒ Status → m (StatusLock m) Source #

Create a new StatusLock.

withReadAccess Source #

Arguments

IOLike m 
StatusLock m 
→ m a

Action to perform when closed

→ m a

Action to perform when open

→ m a 

A variant of withReadAccess that throws an exception if Status == Closed.

Note: contrary to withReadAccess, the action to perform with the acquired lock is not of type Status -> a. The Status is known to be Open, or an exception would have been thrown.

withWriteAccess Source #

Arguments

IOLike m 
StatusLock m 
→ m a

Action to perform if closed

→ m (a, Status)

Action to perform if open, possibly updating the Status

→ m a 

A variant of withWriteAccess that throws an exception if Status == Closed.

Note: contrary to withWriteAccess, the action to perform with the acquired lock is not of type Status -> (Status, a). The Status is known to be Open, or an exception would have been thrown.