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

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

Description

A BackingStore implementation based on LMDB.

Synopsis

Opening a database

data LMDB Source #

Instances

Instances details
(Ord (TxIn l), GetTip l, Monad m) ⇒ StreamingBackend m LMDB l Source # 
Instance details

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

Methods

yieldProxy LMDBYieldArgs m LMDB l → Yield m l Source #

sinkProxy LMDBSinkArgs m LMDB l → Sink m l Source #

(HasLedgerTables l, MonadIO m, IOLike m, MemPackIdx l EmptyMK ~ l EmptyMK) ⇒ Backend m LMDB l Source # 
Instance details

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

Show (Trace m LMDB) Source # 
Instance details

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

Methods

showsPrecIntTrace m LMDBShowS #

showTrace m LMDBString #

showList ∷ [Trace m LMDB] → ShowS #

Eq (Trace m LMDB) Source # 
Instance details

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

Methods

(==)Trace m LMDBTrace m LMDBBool #

(/=)Trace m LMDBTrace m LMDBBool #

data SinkArgs m LMDB l Source # 
Instance details

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

data SinkArgs m LMDB l = SinkLMDB Int (SlotNo → (l EmptyMK, l EmptyMK) → LedgerTables l DiffMK → m ()) (l EmptyMK → m ())
data YieldArgs m LMDB l Source # 
Instance details

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

data Args m LMDB Source # 
Instance details

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

data Trace m LMDB Source # 
Instance details

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

class Backend (m ∷ TypeType) backend (l ∷ LedgerStateKind) where Source #

Associated Types

data Args (m ∷ TypeType) backend Source #

data Trace (m ∷ TypeType) backend Source #

Methods

isRightBackendForSnapshotProxy l → Args m backend → SnapshotBackendBool Source #

newBackingStoreInitialiserTracer m SomeBackendTraceArgs m backend → SnapshotsFS m → BackingStoreInitialiser m l Source #

Instances

Instances details
(IOLike m, HasLedgerTables l, CanUpgradeLedgerTables l, SerializeTablesWithHint l) ⇒ Backend m Mem l 
Instance details

Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.InMemory

Methods

isRightBackendForSnapshotProxy l → Args m Mem → SnapshotBackendBool Source #

newBackingStoreInitialiserTracer m SomeBackendTraceArgs m Mem → SnapshotsFS m → BackingStoreInitialiser m l Source #

(HasLedgerTables l, MonadIO m, IOLike m, MemPackIdx l EmptyMK ~ l EmptyMK) ⇒ Backend m LMDB l Source # 
Instance details

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

data family Args (m ∷ TypeType) backend Source #

Instances

Instances details
data Args m Mem 
Instance details

Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.InMemory

data Args m Mem = InMemArgs
data Args m LMDB Source # 
Instance details

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

data LMDBLimits where Source #

Bundled Patterns

pattern LMDBLimitsIntIntIntLMDBLimits

Configuration to use for LMDB backing store initialisation.

Keep the following in mind:

  • lmdbMapSize should be a multiple of the OS page size.
  • lmdbMaxDatabases should be set to at least 2, since the backing store has 2 internal LMDB databases by default: 1 for the actual tables, and 1 for the database state DbSeqNo.

mkLMDBArgs ∷ ∀ (m ∷ TypeType) blk a. (MonadIOPrim m, HasLedgerTables (LedgerState blk), IOLike m) ⇒ FlushFrequencyFilePathLMDBLimits → a → (LedgerDbBackendArgs m blk, a) Source #

Create arguments for initializing the LedgerDB using the LMDB backend.

Streaming

data family YieldArgs (m ∷ TypeType) backend (l ∷ (TypeTypeType) → Type) Source #

data family SinkArgs (m ∷ TypeType) backend (l ∷ (TypeTypeType) → Type) Source #

Instances

Instances details
data SinkArgs m Mem l 
Instance details

Defined in Ouroboros.Consensus.Storage.LedgerDB.V2.InMemory

data SinkArgs m LMDB l Source # 
Instance details

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

data SinkArgs m LMDB l = SinkLMDB Int (SlotNo → (l EmptyMK, l EmptyMK) → LedgerTables l DiffMK → m ()) (l EmptyMK → m ())

Exposed for testing

data LMDBErr Source #

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 Db should be monotonically increasing across calls to bsWrite, since we use bsWrite to flush immutable changes. That is, we can only flush with a newer sequence number because the changes should be immutable. Note that this does not mean that values can not be changed in the future, only that we can not change values in the past.

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

Instances details
Exception LMDBErr Source # 
Instance details

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

Show LMDBErr Source #

Show instance for pretty printing LMDBErrs as error messages that include: (i) an indication of the probable cause of the error, and (ii) a descriptive error message for the specific LMDBErr.

Instance details

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

Methods

showsPrecIntLMDBErrShowS #

showLMDBErrString #

showList ∷ [LMDBErr] → ShowS #