| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB
Description
A BackingStore implementation based on LMDB.
Synopsis
- data LMDB
- class Backend (m ∷ Type → Type) backend (l ∷ LedgerStateKind) where
- data Args (m ∷ Type → Type) backend
- data Trace (m ∷ Type → Type) backend
- isRightBackendForSnapshot ∷ Proxy l → Args m backend → SnapshotBackend → Bool
- newBackingStoreInitialiser ∷ Tracer m SomeBackendTrace → Args m backend → SnapshotsFS m → BackingStoreInitialiser m l
- data family Args (m ∷ Type → Type) backend
- data LMDBLimits where
- pattern LMDBLimits ∷ Int → Int → Int → LMDBLimits
- mkLMDBArgs ∷ ∀ (m ∷ Type → Type) blk a. (MonadIOPrim m, HasLedgerTables (LedgerState blk), IOLike m) ⇒ FlushFrequency → FilePath → LMDBLimits → a → (LedgerDbBackendArgs m blk, a)
- data family YieldArgs (m ∷ Type → Type) backend (l ∷ (Type → Type → Type) → Type)
- mkLMDBYieldArgs ∷ (HasCallStack, HasLedgerTables l, MemPackIdx l EmptyMK ~ l EmptyMK) ⇒ FilePath → LMDBLimits → l EmptyMK → ResourceRegistry IO → IO (YieldArgs IO LMDB l)
- data family SinkArgs (m ∷ Type → Type) backend (l ∷ (Type → Type → Type) → Type)
- mkLMDBSinkArgs ∷ (HasCallStack, HasLedgerTables l, MemPackIdx l EmptyMK ~ l EmptyMK) ⇒ FilePath → LMDBLimits → l EmptyMK → ResourceRegistry IO → IO (SinkArgs IO LMDB l)
- data LMDBErr
- = LMDBErrNoDbSeqNo
- | LMDBErrNonMonotonicSeq !(WithOrigin SlotNo) !(WithOrigin SlotNo)
- | LMDBErrInitialisingNonEmpty !String
- | LMDBErrInitialisingAlreadyHasState
- | LMDBErrNoValueHandle !Int
- | LMDBErrUnableToReadSeqNo
- | LMDBErrBadRead
- | LMDBErrBadRangeRead
- | LMDBErrDirExists !FilePath
- | LMDBErrDirDoesntExist !FilePath
- | LMDBErrDirIsNotLMDB !FilePath
- | LMDBErrNotADir !FsPath
- | LMDBErrClosed
Opening a database
Instances
| (Ord (TxIn l), GetTip l, Monad m) ⇒ StreamingBackend m LMDB l Source # | |||||||||
Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB Associated Types
| |||||||||
| (HasLedgerTables l, MonadIO m, IOLike m, MemPackIdx l EmptyMK ~ l EmptyMK) ⇒ Backend m LMDB l Source # | |||||||||
Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB Associated Types
Methods isRightBackendForSnapshot ∷ Proxy l → Args m LMDB → SnapshotBackend → Bool Source # newBackingStoreInitialiser ∷ Tracer m SomeBackendTrace → Args m LMDB → SnapshotsFS m → BackingStoreInitialiser m l Source # | |||||||||
| Show (Trace m LMDB) Source # | |||||||||
| Eq (Trace m LMDB) Source # | |||||||||
| data SinkArgs m LMDB l Source # | |||||||||
| data YieldArgs m LMDB l Source # | |||||||||
| data Args m LMDB Source # | |||||||||
| data Trace m LMDB Source # | |||||||||
class Backend (m ∷ Type → Type) backend (l ∷ LedgerStateKind) where Source #
Methods
isRightBackendForSnapshot ∷ Proxy l → Args m backend → SnapshotBackend → Bool Source #
newBackingStoreInitialiser ∷ Tracer m SomeBackendTrace → Args m backend → SnapshotsFS m → BackingStoreInitialiser m l Source #
Instances
| (IOLike m, HasLedgerTables l, CanUpgradeLedgerTables l, SerializeTablesWithHint l) ⇒ Backend m Mem l | |||||||||
Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.InMemory Associated Types
Methods isRightBackendForSnapshot ∷ Proxy l → Args m Mem → SnapshotBackend → Bool Source # newBackingStoreInitialiser ∷ Tracer m SomeBackendTrace → Args m Mem → SnapshotsFS m → BackingStoreInitialiser m l Source # | |||||||||
| (HasLedgerTables l, MonadIO m, IOLike m, MemPackIdx l EmptyMK ~ l EmptyMK) ⇒ Backend m LMDB l Source # | |||||||||
Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB Associated Types
Methods isRightBackendForSnapshot ∷ Proxy l → Args m LMDB → SnapshotBackend → Bool Source # newBackingStoreInitialiser ∷ Tracer m SomeBackendTrace → Args m LMDB → SnapshotsFS m → BackingStoreInitialiser m l Source # | |||||||||
data family Args (m ∷ Type → Type) backend Source #
Instances
| data Args m Mem | |
| data Args m LMDB Source # | |
data LMDBLimits where Source #
Bundled Patterns
| pattern LMDBLimits ∷ Int → Int → Int → LMDBLimits | Configuration to use for LMDB backing store initialisation. Keep the following in mind:
|
Instances
| Show LMDBLimits Source # | |
Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB Methods showsPrec ∷ Int → LMDBLimits → ShowS # show ∷ LMDBLimits → String # showList ∷ [LMDBLimits] → ShowS # | |
| Eq LMDBLimits Source # | |
mkLMDBArgs ∷ ∀ (m ∷ Type → Type) blk a. (MonadIOPrim m, HasLedgerTables (LedgerState blk), IOLike m) ⇒ FlushFrequency → FilePath → LMDBLimits → a → (LedgerDbBackendArgs m blk, a) Source #
Create arguments for initializing the LedgerDB using the LMDB backend.
Streaming
data family YieldArgs (m ∷ Type → Type) backend (l ∷ (Type → Type → Type) → Type) Source #
mkLMDBYieldArgs ∷ (HasCallStack, HasLedgerTables l, MemPackIdx l EmptyMK ~ l EmptyMK) ⇒ FilePath → LMDBLimits → l EmptyMK → ResourceRegistry IO → IO (YieldArgs IO LMDB l) Source #
Create Yield args for LMDB
data family SinkArgs (m ∷ Type → Type) backend (l ∷ (Type → Type → Type) → Type) Source #
mkLMDBSinkArgs ∷ (HasCallStack, HasLedgerTables l, MemPackIdx l EmptyMK ~ l EmptyMK) ⇒ FilePath → LMDBLimits → l EmptyMK → ResourceRegistry IO → IO (SinkArgs IO LMDB l) Source #
Create Sink args for LMDB
Exposed for testing
Errors that can be thrown by LMDB.
WARNING: these errors will be thrown in IO as having a corrupt database is critical for the functioning of Consensus.
Constructors
| LMDBErrNoDbSeqNo | The database state can not be found on-disk. |
| LMDBErrNonMonotonicSeq !(WithOrigin SlotNo) !(WithOrigin SlotNo) | The sequence number of a |
| LMDBErrInitialisingNonEmpty !String | The database table that is being initialised is non-empty. |
| LMDBErrInitialisingAlreadyHasState | The database that is being initialized already had a DbSeqNo table |
| LMDBErrNoValueHandle !Int | Trying to use a non-existing value handle. |
| LMDBErrUnableToReadSeqNo | Couldn't create a value handle because we couldn't read the sequence number |
| LMDBErrBadRead | Failed to read a value from a database table. |
| LMDBErrBadRangeRead | Failed to read a range of values from a database table. |
| LMDBErrDirExists !FilePath | A database directory should not exist already. |
| LMDBErrDirDoesntExist !FilePath | A database directory should exist already. |
| LMDBErrDirIsNotLMDB !FilePath | The directory exists but is not an LMDB directory! |
| LMDBErrNotADir !FsPath | What should be a directory is in fact a file |
| LMDBErrClosed | The database has been closed, so all backing store operations should throw an error. |
Instances
| Exception LMDBErr Source # | |
Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB Methods toException ∷ LMDBErr → SomeException # fromException ∷ SomeException → Maybe LMDBErr # displayException ∷ LMDBErr → String # backtraceDesired ∷ LMDBErr → Bool # | |
| Show LMDBErr Source # | Show instance for pretty printing |