| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Storage.LedgerDB.V2.LSM
Description
Implementation of the LedgerTablesHandle interface with LSM trees.
Synopsis
- data LSM
- class NoThunks (Resources m backend) ⇒ Backend (m ∷ Type → Type) backend blk where
- data Args (m ∷ Type → Type) backend
- data Resources (m ∷ Type → Type) backend
- data Trace (m ∷ Type → Type) backend
- mkResources ∷ Proxy blk → Tracer m LedgerDBV2Trace → Args m backend → ResourceRegistry m → SomeHasFS m → m (Resources m backend)
- releaseResources ∷ Proxy blk → Resources m backend → m ()
- newHandleFromValues ∷ Tracer m LedgerDBV2Trace → ResourceRegistry m → Resources m backend → ExtLedgerState blk ValuesMK → m (LedgerTablesHandle m (ExtLedgerState blk))
- newHandleFromSnapshot ∷ Tracer m LedgerDBV2Trace → ResourceRegistry m → CodecConfig blk → SomeHasFS m → Resources m backend → DiskSnapshot → ExceptT (SnapshotFailure blk) m (LedgerSeq' m blk, RealPoint blk)
- snapshotManager ∷ Proxy blk → Resources m backend → CodecConfig blk → Tracer m (TraceSnapshotEvent blk) → SomeHasFS m → SnapshotManager m m blk (StateRef m (ExtLedgerState blk))
- data family Args (m ∷ Type → Type) backend
- mkLSMArgs ∷ (LedgerSupportsProtocol blk, LedgerDbSerialiseConstraints blk) ⇒ Proxy blk → FilePath → FilePath → StdGen → (LedgerDbBackendArgs IO blk, StdGen)
- stdMkBlockIOFS ∷ FilePath → ResourceRegistry IO → IO (ResourceKey IO, SomeHasFSAndBlockIO IO)
- data family YieldArgs (m ∷ Type → Type) backend (l ∷ (Type → Type → Type) → Type)
- mkLSMYieldArgs ∷ (IOLike m, HasLedgerTables l, IndexedMemPack (l EmptyMK) (TxOut l)) ⇒ FilePath → String → (FilePath → ResourceRegistry m → m (a, SomeHasFSAndBlockIO m)) → m StdGen → l EmptyMK → ResourceRegistry m → m (YieldArgs m LSM l)
- data family SinkArgs (m ∷ Type → Type) backend (l ∷ (Type → Type → Type) → Type)
- mkLSMSinkArgs ∷ IOLike m ⇒ FilePath → String → (FilePath → ResourceRegistry m → m (a, SomeHasFSAndBlockIO m)) → m StdGen → l EmptyMK → ResourceRegistry m → m (SinkArgs m LSM l)
- type Salt = Word64
- data SomeHasFSAndBlockIO (m ∷ Type → Type) where
- SomeHasFSAndBlockIO ∷ ∀ h (m ∷ Type → Type). (Eq h, Typeable h) ⇒ HasFS m h → HasBlockIO m h → SomeHasFSAndBlockIO m
Backend API
Instances
class NoThunks (Resources m backend) ⇒ Backend (m ∷ Type → Type) backend blk where Source #
Operations needed to open and operate a LedgerDB V2
Associated Types
data Args (m ∷ Type → Type) backend Source #
The Arguments that will be used initially to create the Resources.
data Resources (m ∷ Type → Type) backend Source #
The Resources that will be stored in the LedgerDB environment and given to the handle operations.
data Trace (m ∷ Type → Type) backend Source #
A trace dependent on the particular backend.
Methods
mkResources ∷ Proxy blk → Tracer m LedgerDBV2Trace → Args m backend → ResourceRegistry m → SomeHasFS m → m (Resources m backend) Source #
releaseResources ∷ Proxy blk → Resources m backend → m () Source #
Release the acquired resources.
newHandleFromValues ∷ Tracer m LedgerDBV2Trace → ResourceRegistry m → Resources m backend → ExtLedgerState blk ValuesMK → m (LedgerTablesHandle m (ExtLedgerState blk)) Source #
Create a new handle from the given values. This will only be called when starting Consensus from Genesis.
newHandleFromSnapshot ∷ Tracer m LedgerDBV2Trace → ResourceRegistry m → CodecConfig blk → SomeHasFS m → Resources m backend → DiskSnapshot → ExceptT (SnapshotFailure blk) m (LedgerSeq' m blk, RealPoint blk) Source #
Create a new handle from a snapshot.
snapshotManager ∷ Proxy blk → Resources m backend → CodecConfig blk → Tracer m (TraceSnapshotEvent blk) → SomeHasFS m → SnapshotManager m m blk (StateRef m (ExtLedgerState blk)) Source #
Instantiate the SnapshotManager for this backend.
Instances
| (IOLike m, LedgerDbSerialiseConstraints blk, LedgerSupportsProtocol blk, LedgerSupportsInMemoryLedgerDB (LedgerState blk)) ⇒ Backend m Mem blk | |||||||||||||
Defined in Ouroboros.Consensus.Storage.LedgerDB.V2.InMemory Methods mkResources ∷ Proxy blk → Tracer m LedgerDBV2Trace → Args m Mem → ResourceRegistry m → SomeHasFS m → m (Resources m Mem) Source # releaseResources ∷ Proxy blk → Resources m Mem → m () Source # newHandleFromValues ∷ Tracer m LedgerDBV2Trace → ResourceRegistry m → Resources m Mem → ExtLedgerState blk ValuesMK → m (LedgerTablesHandle m (ExtLedgerState blk)) Source # newHandleFromSnapshot ∷ Tracer m LedgerDBV2Trace → ResourceRegistry m → CodecConfig blk → SomeHasFS m → Resources m Mem → DiskSnapshot → ExceptT (SnapshotFailure blk) m (LedgerSeq' m blk, RealPoint blk) Source # snapshotManager ∷ Proxy blk → Resources m Mem → CodecConfig blk → Tracer m (TraceSnapshotEvent blk) → SomeHasFS m → SnapshotManager m m blk (StateRef m (ExtLedgerState blk)) Source # | |||||||||||||
| (LedgerSupportsProtocol blk, IOLike m, LedgerDbSerialiseConstraints blk, HasLedgerTables (LedgerState blk)) ⇒ Backend m LSM blk Source # | |||||||||||||
Defined in Ouroboros.Consensus.Storage.LedgerDB.V2.LSM Associated Types
Methods mkResources ∷ Proxy blk → Tracer m LedgerDBV2Trace → Args m LSM → ResourceRegistry m → SomeHasFS m → m (Resources m LSM) Source # releaseResources ∷ Proxy blk → Resources m LSM → m () Source # newHandleFromValues ∷ Tracer m LedgerDBV2Trace → ResourceRegistry m → Resources m LSM → ExtLedgerState blk ValuesMK → m (LedgerTablesHandle m (ExtLedgerState blk)) Source # newHandleFromSnapshot ∷ Tracer m LedgerDBV2Trace → ResourceRegistry m → CodecConfig blk → SomeHasFS m → Resources m LSM → DiskSnapshot → ExceptT (SnapshotFailure blk) m (LedgerSeq' m blk, RealPoint blk) Source # snapshotManager ∷ Proxy blk → Resources m LSM → CodecConfig blk → Tracer m (TraceSnapshotEvent blk) → SomeHasFS m → SnapshotManager m m blk (StateRef m (ExtLedgerState blk)) Source # | |||||||||||||
data family Args (m ∷ Type → Type) backend Source #
The Arguments that will be used initially to create the Resources.
Instances
| data Args m Mem | |
| data Args m LSM Source # | |
Defined in Ouroboros.Consensus.Storage.LedgerDB.V2.LSM data Args m LSM = LSMArgs FsPath Salt (ResourceRegistry m → m (ResourceKey m, SomeHasFSAndBlockIO m)) | |
mkLSMArgs ∷ (LedgerSupportsProtocol blk, LedgerDbSerialiseConstraints blk) ⇒ Proxy blk → FilePath → FilePath → StdGen → (LedgerDbBackendArgs IO blk, StdGen) Source #
Create arguments for initializing the LedgerDB using the LSM-trees backend.
stdMkBlockIOFS ∷ FilePath → ResourceRegistry IO → IO (ResourceKey IO, SomeHasFSAndBlockIO IO) Source #
Streaming
data family YieldArgs (m ∷ Type → Type) backend (l ∷ (Type → Type → Type) → Type) Source #
Arguments
| ∷ (IOLike m, HasLedgerTables l, IndexedMemPack (l EmptyMK) (TxOut l)) | |
| ⇒ FilePath | The filepath in which the LSM database lives. Must not have a trailing slash! |
| → String | The complete name of the snapshot to open, so |
| → (FilePath → ResourceRegistry m → m (a, SomeHasFSAndBlockIO m)) | Usually |
| → m StdGen | Usually |
| → l EmptyMK | |
| → ResourceRegistry m | |
| → m (YieldArgs m LSM l) |
Create Yield arguments for LSM
data family SinkArgs (m ∷ Type → Type) backend (l ∷ (Type → Type → Type) → Type) Source #
Arguments
| ∷ IOLike m | |
| ⇒ FilePath | The filepath in which the LSM database should be opened. Must not have a trailing slash! |
| → String | The complete name of the snapshot to be created, so |
| → (FilePath → ResourceRegistry m → m (a, SomeHasFSAndBlockIO m)) | Usually |
| → m StdGen | Usually |
| → l EmptyMK | |
| → ResourceRegistry m | |
| → m (SinkArgs m LSM l) |
Create Sink arguments for LSM
Exported for tests
The session salt is used to secure the hash operations in the Bloom filters.
The value of the salt must be kept secret. Otherwise, there are no restrictions on the value.
data SomeHasFSAndBlockIO (m ∷ Type → Type) where Source #
Constructors
| SomeHasFSAndBlockIO ∷ ∀ h (m ∷ Type → Type). (Eq h, Typeable h) ⇒ HasFS m h → HasBlockIO m h → SomeHasFSAndBlockIO m |