Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.API
Description
The BackingStore
is the component of the LedgerDB V1 implementation that
stores a key-value map with the LedgerTable
s at a specific slot on the
chain.
It is used for storing LedgerState
data
structures, and updating them with Diff
s produced by
executing the Ledger rules.
See Ouroboros.Consensus.Storage.LedgerDB.BackingStore for the implementations provided.
Synopsis
- newtype LiveLMDBFS (m โท Type โ Type) = LiveLMDBFS {
- liveLMDBFs โท SomeHasFS m
- newtype SnapshotsFS (m โท Type โ Type) = SnapshotsFS {
- snapshotsFs โท SomeHasFS m
- data BackingStore (m โท Type โ Type) keys values diff = BackingStore {
- bsClose โท !(m ())
- bsCopy โท !(SerializeTablesHint values โ FsPath โ m ())
- bsValueHandle โท !(m (BackingStoreValueHandle m keys values))
- bsWrite โท !(SlotNo โ WriteHint diff โ diff โ m ())
- bsSnapshotBackend โท !SnapshotBackend
- type BackingStore' (m โท Type โ Type) blk = LedgerBackingStore m (ExtLedgerState blk)
- data DiffsToFlush (l โท LedgerStateKind) = DiffsToFlush {
- toFlushDiffs โท !(LedgerTables l DiffMK)
- toFlushState โท !(l EmptyMK, l EmptyMK)
- toFlushSlot โท !SlotNo
- data InitFrom values
- = InitFromValues !(WithOrigin SlotNo) !(InitHint values) !values
- | InitFromCopy !(InitHint values) !FsPath
- type family InitHint values
- type LedgerBackingStore (m โท Type โ Type) (l โท LedgerStateKind) = BackingStore m (LedgerTables l KeysMK) (LedgerTables l ValuesMK) (LedgerTables l DiffMK)
- type family ReadHint values
- type family WriteHint diffs
- data BackingStoreValueHandle (m โท Type โ Type) keys values = BackingStoreValueHandle {
- bsvhAtSlot โท !(WithOrigin SlotNo)
- bsvhClose โท !(m ())
- bsvhRangeRead โท !(ReadHint values โ RangeQuery keys โ m values)
- bsvhReadAll โท !(ReadHint values โ m values)
- bsvhRead โท !(ReadHint values โ keys โ m values)
- bsvhStat โท !(m Statistics)
- type BackingStoreValueHandle' (m โท Type โ Type) blk = LedgerBackingStoreValueHandle m (ExtLedgerState blk)
- type LedgerBackingStoreValueHandle (m โท Type โ Type) (l โท LedgerStateKind) = BackingStoreValueHandle m (LedgerTables l KeysMK) (LedgerTables l ValuesMK)
- castBackingStoreValueHandle โท โ (m โท Type โ Type) values values' keys' keys. (Functor m, ReadHint values ~ ReadHint values') โ (values โ values') โ (keys' โ keys) โ BackingStoreValueHandle m keys values โ BackingStoreValueHandle m keys' values'
- withBsValueHandle โท MonadThrow m โ BackingStore m keys values diff โ (BackingStoreValueHandle m keys values โ m a) โ m a
- data RangeQuery keys = RangeQuery {}
- data Statistics = Statistics {
- sequenceNumber โท !(WithOrigin SlotNo)
- numEntries โท !Int
- data BackingStoreTrace
- = BSOpening
- | BSOpened !(Maybe FsPath)
- | BSInitialisingFromCopy !FsPath
- | BSInitialisedFromCopy !FsPath
- | BSInitialisingFromValues !(WithOrigin SlotNo)
- | BSInitialisedFromValues !(WithOrigin SlotNo)
- | BSClosing
- | BSAlreadyClosed
- | BSClosed
- | BSCopying !FsPath
- | BSCopied !FsPath
- | BSCreatingValueHandle
- | BSValueHandleTrace !(Maybe Int) !BackingStoreValueHandleTrace
- | BSCreatedValueHandle
- | BSWriting !SlotNo
- | BSWritten !(WithOrigin SlotNo) !SlotNo
- data BackingStoreValueHandleTrace
- bsRead โท MonadThrow m โ BackingStore m keys values diff โ ReadHint values โ keys โ m (WithOrigin SlotNo, values)
- bsReadAll โท MonadThrow m โ BackingStore m keys values diff โ ReadHint values โ m values
FileSystem newtypes
newtype LiveLMDBFS (m โท Type โ Type) Source #
The LMDB file system. Typically pointing to db-path/vol-db-path/lmdb
.
Constructors
LiveLMDBFS | |
Fields
|
Instances
newtype SnapshotsFS (m โท Type โ Type) Source #
The LedgerDB file system. Typically pointing to db-path/vol-db-path/ledger
.
Constructors
SnapshotsFS | |
Fields
|
Instances
Generic (SnapshotsFS m) Source # | |||||
Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.API Associated Types
Methods from โท SnapshotsFS m โ Rep (SnapshotsFS m) x # to โท Rep (SnapshotsFS m) x โ SnapshotsFS m # | |||||
NoThunks (SnapshotsFS m) Source # | |||||
type Rep (SnapshotsFS m) Source # | |||||
Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.API type Rep (SnapshotsFS m) = D1 ('MetaData "SnapshotsFS" "Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.API" "ouroboros-consensus-0.26.0.0-inplace" 'True) (C1 ('MetaCons "SnapshotsFS" 'PrefixI 'True) (S1 ('MetaSel ('Just "snapshotsFs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SomeHasFS m)))) |
Backing store
data BackingStore (m โท Type โ Type) keys values diff Source #
Constructors
BackingStore | |
Fields
|
Instances
NoThunks (BackingStore m keys values diff) Source # | |
type BackingStore' (m โท Type โ Type) blk = LedgerBackingStore m (ExtLedgerState blk) Source #
data DiffsToFlush (l โท LedgerStateKind) Source #
A container for differences that are inteded to be flushed to a
BackingStore
Constructors
DiffsToFlush | |
Fields
|
Choose how to initialize the backing store
Constructors
InitFromValues !(WithOrigin SlotNo) !(InitHint values) !values | Initialize from a set of values, at the given slot. |
InitFromCopy !(InitHint values) !FsPath | Use a snapshot at the given path to overwrite the set of values in the opened database. |
type family InitHint values Source #
Instances
type InitHint (LedgerTables l ValuesMK) Source # | |
type LedgerBackingStore (m โท Type โ Type) (l โท LedgerStateKind) = BackingStore m (LedgerTables l KeysMK) (LedgerTables l ValuesMK) (LedgerTables l DiffMK) Source #
type family ReadHint values Source #
Instances
type ReadHint (LedgerTables l ValuesMK) Source # | |
type family WriteHint diffs Source #
Instances
type WriteHint (LedgerTables l DiffMK) Source # | |
Value handle
data BackingStoreValueHandle (m โท Type โ Type) keys values Source #
An ephemeral handle to an immutable value of the entire database
The performance cost is usually minimal unless this handle is held open too
long. We expect clients of the BackingStore
to not retain handles for a
long time.
Constructors
BackingStoreValueHandle | |
Fields
|
Instances
NoThunks (BackingStoreValueHandle m keys values) Source # | |
type BackingStoreValueHandle' (m โท Type โ Type) blk = LedgerBackingStoreValueHandle m (ExtLedgerState blk) Source #
type LedgerBackingStoreValueHandle (m โท Type โ Type) (l โท LedgerStateKind) = BackingStoreValueHandle m (LedgerTables l KeysMK) (LedgerTables l ValuesMK) Source #
castBackingStoreValueHandle โท โ (m โท Type โ Type) values values' keys' keys. (Functor m, ReadHint values ~ ReadHint values') โ (values โ values') โ (keys' โ keys) โ BackingStoreValueHandle m keys values โ BackingStoreValueHandle m keys' values' Source #
withBsValueHandle โท MonadThrow m โ BackingStore m keys values diff โ (BackingStoreValueHandle m keys values โ m a) โ m a Source #
A bracket
ed bsValueHandle
Query
data RangeQuery keys Source #
The arguments for a query to the backing store, it is up to the particular function that is performing the query to construct a value of this type, run the query and, if appropriate, repeat this process to do a subsequent query.
Constructors
RangeQuery | |
Fields
|
Instances
Show keys โ Show (RangeQuery keys) Source # | |
Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.API Methods showsPrec โท Int โ RangeQuery keys โ ShowS # show โท RangeQuery keys โ String # showList โท [RangeQuery keys] โ ShowS # | |
Eq keys โ Eq (RangeQuery keys) Source # | |
Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.API Methods (==) โท RangeQuery keys โ RangeQuery keys โ Bool # (/=) โท RangeQuery keys โ RangeQuery keys โ Bool # |
Statistics
data Statistics Source #
Statistics for a key-value store.
Using bsvhStat
on a value handle only provides statistics for the on-disk
state of a key-value store. Combine this with information from a
DbChangelog
to obtain statistics about a "logical" state of the key-value
store. See getStatistics
.
Constructors
Statistics | |
Fields
|
Instances
Show Statistics Source # | |
Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.API Methods showsPrec โท Int โ Statistics โ ShowS # show โท Statistics โ String # showList โท [Statistics] โ ShowS # | |
Eq Statistics Source # | |
Tracing
data BackingStoreTrace Source #
Constructors
BSOpening | |
BSOpened !(Maybe FsPath) | |
BSInitialisingFromCopy !FsPath | |
BSInitialisedFromCopy !FsPath | |
BSInitialisingFromValues !(WithOrigin SlotNo) | |
BSInitialisedFromValues !(WithOrigin SlotNo) | |
BSClosing | |
BSAlreadyClosed | |
BSClosed | |
BSCopying !FsPath | |
BSCopied !FsPath | |
BSCreatingValueHandle | |
BSValueHandleTrace | |
Fields
| |
BSCreatedValueHandle | |
BSWriting !SlotNo | |
BSWritten !(WithOrigin SlotNo) !SlotNo |
Instances
Show BackingStoreTrace Source # | |
Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.API Methods showsPrec โท Int โ BackingStoreTrace โ ShowS # show โท BackingStoreTrace โ String # showList โท [BackingStoreTrace] โ ShowS # | |
Eq BackingStoreTrace Source # | |
Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.API Methods (==) โท BackingStoreTrace โ BackingStoreTrace โ Bool # (/=) โท BackingStoreTrace โ BackingStoreTrace โ Bool # |
data BackingStoreValueHandleTrace Source #
Constructors
BSVHClosing | |
BSVHAlreadyClosed | |
BSVHClosed | |
BSVHRangeReading | |
BSVHRangeRead | |
BSVHReading | |
BSVHRead | |
BSVHStatting | |
BSVHStatted |
Instances
Show BackingStoreValueHandleTrace Source # | |
Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.API Methods showsPrec โท Int โ BackingStoreValueHandleTrace โ ShowS # show โท BackingStoreValueHandleTrace โ String # showList โท [BackingStoreValueHandleTrace] โ ShowS # | |
Eq BackingStoreValueHandleTrace Source # | |
Defined in Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.API Methods (==) โท BackingStoreValueHandleTrace โ BackingStoreValueHandleTrace โ Bool # (/=) โท BackingStoreValueHandleTrace โ BackingStoreValueHandleTrace โ Bool # |
๐งช Testing
bsRead โท MonadThrow m โ BackingStore m keys values diff โ ReadHint values โ keys โ m (WithOrigin SlotNo, values) Source #
A combination of bsValueHandle
and bsvhRead
bsReadAll โท MonadThrow m โ BackingStore m keys values diff โ ReadHint values โ m values Source #