File tree Expand file tree Collapse file tree 4 files changed +9
-1
lines changed
src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB
test/storage-test/Test/Ouroboros/Storage/LedgerDB Expand file tree Collapse file tree 4 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -302,6 +302,9 @@ data TestInternals m l blk = TestInternals
302302 , reapplyThenPushNOW :: blk -> m ()
303303 , truncateSnapshots :: m ()
304304 , closeLedgerDB :: m ()
305+ , getNumLedgerTablesHandles :: m Word64
306+ -- ^ Get the number of referenced 'LedgerTablesHandle's for V2. For V1, this
307+ -- always returns 0.
305308 }
306309 deriving NoThunks via OnlyCheckWhnfNamed " TestInternals" (TestInternals m l blk )
307310
Original file line number Diff line number Diff line change @@ -353,6 +353,7 @@ mkInternals h =
353353 , wipeLedgerDB = getEnv h $ void . destroySnapshots . snapshotsFs . ldbHasFS
354354 , closeLedgerDB = getEnv h $ bsClose . ldbBackingStore
355355 , truncateSnapshots = getEnv h $ void . implIntTruncateSnapshots . ldbHasFS
356+ , getNumLedgerTablesHandles = pure 0
356357 }
357358
358359-- | Testing only! Truncate all snapshots in the DB.
Original file line number Diff line number Diff line change @@ -231,6 +231,10 @@ mkInternals bss h =
231231 let LDBHandle tvar = h
232232 in atomically (writeTVar tvar LedgerDBClosed )
233233 , truncateSnapshots = getEnv h $ implIntTruncateSnapshots . ldbHasFS
234+ , getNumLedgerTablesHandles = getEnv h $ \ env -> do
235+ l <- readTVarIO (ldbSeq env)
236+ -- We always have a state at the anchor.
237+ pure $ 1 + maxRollback l
234238 }
235239 where
236240 takeSnapshot ::
Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ initialEnvironment fsOps getLmdbDir mkTestArguments cdb = do
132132 pure $
133133 Environment
134134 undefined
135- (TestInternals undefined undefined undefined undefined undefined (pure () ))
135+ (TestInternals undefined undefined undefined undefined undefined (pure () ) ( pure 0 ) )
136136 cdb
137137 (flip mkTestArguments lmdbDir)
138138 sfs
You can’t perform that action at this time.
0 commit comments