Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB
Description
A BackingStore
implementation based on LMDB.
Synopsis
- data LMDBLimits where
- pattern LMDBLimits ∷ Int → Int → Int → LMDBLimits
- newLMDBBackingStore ∷ ∀ m (l ∷ LedgerStateKind). (HasCallStack, HasLedgerTables l, MonadIO m, IOLike m, MemPackIdx l EmptyMK ~ l EmptyMK) ⇒ Tracer m BackingStoreTrace → LMDBLimits → LiveLMDBFS m → SnapshotsFS m → InitFrom (LedgerTables l ValuesMK) → m (LedgerBackingStore m 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
- newtype DbSeqNo = DbSeqNo {}
- data LMDBMK k v = LMDBMK !String !(Database k v)
- getDb ∷ ∀ (mode ∷ Mode) k v. IsMode mode ⇒ K2 String k v → Transaction mode (LMDBMK k v)
- initLMDBTable ∷ (IndexedMemPack idx v, MemPack k) ⇒ idx → LMDBMK k v → ValuesMK k v → Transaction 'ReadWrite (EmptyMK k v)
- withDbSeqNoRWMaybeNull ∷ Database () DbSeqNo → (Maybe DbSeqNo → Transaction 'ReadWrite (a, DbSeqNo)) → Transaction 'ReadWrite a
Opening a database
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 # | |
Arguments
∷ ∀ m (l ∷ LedgerStateKind). (HasCallStack, HasLedgerTables l, MonadIO m, IOLike m, MemPackIdx l EmptyMK ~ l EmptyMK) | |
⇒ Tracer m BackingStoreTrace | |
→ LMDBLimits | Configuration parameters for the LMDB database that we initialise. In case we initialise the LMDB database from an existing LMDB database, we use these same configuration parameters to open the existing LMDB database. |
→ LiveLMDBFS m | The FS for the LMDB live database |
→ SnapshotsFS m | |
→ InitFrom (LedgerTables l ValuesMK) | |
→ m (LedgerBackingStore m l) |
Initialise a backing store.
Errors
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 |
Internals exposed for snapshot-converter
The database state consists of only the database sequence number dbsSeq
.
dbsSeq
represents the slot up to which we have flushed changes to disk.
Note that we only flush changes to disk if they have become immutable.
Constructors
DbSeqNo | |
Fields |
Instances
Generic DbSeqNo Source # | |||||
Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB Associated Types
| |||||
Show DbSeqNo Source # | |||||
Serialise DbSeqNo Source # | |||||
type Rep DbSeqNo Source # | |||||
Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB type Rep DbSeqNo = D1 ('MetaData "DbSeqNo" "Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB" "ouroboros-consensus-0.26.0.0-inplace" 'True) (C1 ('MetaCons "DbSeqNo" 'PrefixI 'True) (S1 ('MetaSel ('Just "dbsSeq") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (WithOrigin SlotNo)))) |
A MapKind
that represents an LMDB database handle
initLMDBTable ∷ (IndexedMemPack idx v, MemPack k) ⇒ idx → LMDBMK k v → ValuesMK k v → Transaction 'ReadWrite (EmptyMK k v) Source #
withDbSeqNoRWMaybeNull ∷ Database () DbSeqNo → (Maybe DbSeqNo → Transaction 'ReadWrite (a, DbSeqNo)) → Transaction 'ReadWrite a Source #