File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -304,7 +304,14 @@ data TestInternals m l blk = TestInternals
304
304
{ wipeLedgerDB :: m ()
305
305
, takeSnapshotNOW :: WhereToTakeSnapshot -> Maybe String -> m ()
306
306
, push :: ExtLedgerState blk DiffMK -> m ()
307
+ -- ^ Push a ledger state, and prune the 'LedgerDB' w.r.t. the security parameter.
308
+ --
309
+ -- This does not modify the set of previously applied points.
307
310
, reapplyThenPushNOW :: blk -> m ()
311
+ -- ^ Apply block to the tip ledger state (using reapplication), and prune the
312
+ -- 'LedgerDB' w.r.t. the security parameter.
313
+ --
314
+ -- This does not modify the set of previously applied points.
308
315
, truncateSnapshots :: m ()
309
316
, closeLedgerDB :: m ()
310
317
, getNumLedgerTablesHandles :: m Word64
Original file line number Diff line number Diff line change @@ -212,8 +212,9 @@ mkInternals bss h =
212
212
eFrk <- newForkerAtTarget h reg VolatileTip
213
213
case eFrk of
214
214
Left {} -> error " Unreachable, Volatile tip MUST be in LedgerDB"
215
- Right frk ->
215
+ Right frk -> do
216
216
forkerPush frk st >> atomically (forkerCommit frk) >> forkerClose frk
217
+ getEnv h pruneLedgerSeq
217
218
, reapplyThenPushNOW = \ blk -> getEnv h $ \ env -> withRegistry $ \ reg -> do
218
219
eFrk <- newForkerAtTarget h reg VolatileTip
219
220
case eFrk of
@@ -228,6 +229,7 @@ mkInternals bss h =
228
229
blk
229
230
(st `withLedgerTables` tables)
230
231
forkerPush frk st' >> atomically (forkerCommit frk) >> forkerClose frk
232
+ pruneLedgerSeq env
231
233
, wipeLedgerDB = getEnv h $ destroySnapshots . ldbHasFS
232
234
, closeLedgerDB =
233
235
let LDBHandle tvar = h
@@ -250,6 +252,12 @@ mkInternals bss h =
250
252
InMemoryHandleArgs -> InMemory. takeSnapshot
251
253
LSMHandleArgs x -> absurd x
252
254
255
+ pruneLedgerSeq :: LedgerDBEnv m (ExtLedgerState blk ) blk -> m ()
256
+ pruneLedgerSeq env =
257
+ join $ atomically $ stateTVar (ldbSeq env) $ prune (LedgerDbPruneKeeping k)
258
+ where
259
+ k = ledgerDbCfgSecParam $ ldbCfg env
260
+
253
261
-- | Testing only! Truncate all snapshots in the DB.
254
262
implIntTruncateSnapshots :: MonadThrow m => SomeHasFS m -> m ()
255
263
implIntTruncateSnapshots sfs@ (SomeHasFS fs) = do
You can’t perform that action at this time.
0 commit comments