diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/ChainDB/Impl/LgrDB.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/ChainDB/Impl/LgrDB.hs index decdef1104..c3d6ae008a 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/ChainDB/Impl/LgrDB.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/ChainDB/Impl/LgrDB.hs @@ -222,7 +222,6 @@ initFromDisk :: initFromDisk LgrDbArgs { lgrHasFS = hasFS, .. } replayTracer immutableDB = wrapFailure (Proxy @blk) $ do - let LedgerDB.DiskPolicyArgs _ _ doDiskSnapshotChecksum = lgrDiskPolicyArgs (_initLog, db, replayed) <- LedgerDB.initLedgerDB replayTracer @@ -237,6 +236,7 @@ initFromDisk LgrDbArgs { lgrHasFS = hasFS, .. } return (db, replayed) where ccfg = configCodec $ getExtLedgerCfg $ LedgerDB.ledgerDbCfg lgrConfig + LedgerDB.DiskPolicyArgs _ _ doDiskSnapshotChecksum = lgrDiskPolicyArgs -- | For testing purposes mkLgrDB :: StrictTVar m (LedgerDB' blk) diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/DiskPolicy.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/DiskPolicy.hs index cdc69de526..44c17b06ed 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/DiskPolicy.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/DiskPolicy.hs @@ -32,7 +32,7 @@ import Ouroboros.Consensus.Util (Flag (..)) -- a snapshot is taken. It can be: -- -- 1. either explicitly provided by user in seconds --- 2. or default value can be requested - the specific DiskPolicy determines +-- 2. or default value can be requested - the specific @'DiskPolicy'@ determines -- what that is exactly, see `mkDiskPolicy` as an example data SnapshotInterval = DefaultSnapshotInterval @@ -40,17 +40,21 @@ data SnapshotInterval = deriving stock (Eq, Generic, Show) -- | Number of snapshots to be stored on disk. This is either the default value --- as determined by the DiskPolicy, or it is provided by the user. See the --- `DiskPolicy` documentation for more information. +-- as determined by the @'DiskPolicy'@, or it is provided by the user. See the +-- @'DiskPolicy'@ documentation for more information. data NumOfDiskSnapshots = DefaultNumOfDiskSnapshots | RequestedNumOfDiskSnapshots Word deriving stock (Eq, Generic, Show) +-- | Type-safe flag to regulate the checksum policy of the ledger state snapshots. +-- +-- These patterns are exposed to cardano-node and will be passed as part of @'DiskPolicy'@. pattern DoDiskSnapshotChecksum, NoDoDiskSnapshotChecksum :: Flag "DoDiskSnapshotChecksum" pattern DoDiskSnapshotChecksum = Flag True pattern NoDoDiskSnapshotChecksum = Flag False +-- | The components used by cardano-node to construct a @'DiskPolicy'@. data DiskPolicyArgs = DiskPolicyArgs SnapshotInterval NumOfDiskSnapshots (Flag "DoDiskSnapshotChecksum") -- | On-disk policy diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/Snapshots.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/Snapshots.hs index 13d806ed90..e3c335b065 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/Snapshots.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/Snapshots.hs @@ -163,7 +163,7 @@ trimSnapshots tracer hasFS DiskPolicy{..} = do -- | Name of a disk snapshot. -- --- The snapshot itself does not have to exist. +-- The snapshot itself might not yet exist on disk. data DiskSnapshot = DiskSnapshot { -- | Snapshots are numbered. We will try the snapshots with the highest -- number first.