Skip to content

Commit

Permalink
WIP code-review
Browse files Browse the repository at this point in the history
  • Loading branch information
jasagredo committed Nov 26, 2024
1 parent 1a3bbc6 commit 86f9db0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
5 changes: 4 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@ if(os(windows))
bitvec -simd

-- https://github.com/ulidtko/cabal-doctest/issues/85
constraints: Cabal < 3.13
constraints:
Cabal < 3.13
, quickcheck-instances < 0.3.32
, data-default < 0.8
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ data LedgerDbFlavorArgs f m = V2Args HandleArgs

data HandleArgs =
InMemoryHandleArgs
| LSMHandleArgs !Void
| LSMHandleArgs Void
deriving (Generic, NoThunks)

data FlavorImplSpecificTrace =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import qualified Data.Map.Strict as Map
import Data.Maybe (isJust)
import Data.Set (Set)
import qualified Data.Set as Set
import Data.Void
import Data.Word
import Ouroboros.Consensus.Block
import Ouroboros.Consensus.Config
Expand Down Expand Up @@ -116,15 +117,15 @@ mkInitDb args flavArgs getBlock =
emptyF st =
empty' st $ case bss of
InMemoryHandleArgs -> InMemory.newInMemoryLedgerTablesHandle lgrHasFS
--TODO LSMHandleArgs -> LSM.newLSMLedgerTablesHandle
LSMHandleArgs x -> absurd x

loadSnapshot :: CodecConfig blk
-> SomeHasFS m
-> DiskSnapshot
-> m (Either (SnapshotFailure blk) (LedgerSeq' m blk, RealPoint blk))
loadSnapshot = case bss of
InMemoryHandleArgs -> InMemory.loadSnapshot lgrRegistry
--TODO LSMHandleArgs -> LSM.loadSnapshot
LSMHandleArgs x -> absurd x

implMkLedgerDb ::
forall m l blk.
Expand Down Expand Up @@ -202,7 +203,7 @@ mkInternals bss h = TestInternals {
-> m (Maybe (DiskSnapshot, RealPoint blk))
takeSnapshot = case bss of
InMemoryHandleArgs -> InMemory.takeSnapshot
--TODO LSMHandleArgs -> LSM.takeSnapshot
LSMHandleArgs x -> absurd x

-- | Testing only! Truncate all snapshots in the DB.
implIntTruncateSnapshots :: MonadThrow m => SomeHasFS m -> m ()
Expand Down Expand Up @@ -337,7 +338,7 @@ implTryTakeSnapshot bss env mTime nrBlocks =
-> m (Maybe (DiskSnapshot, RealPoint blk))
takeSnapshot config trcr fs ref = case bss of
InMemoryHandleArgs -> InMemory.takeSnapshot config trcr fs Nothing ref
--TODO LSMHandleArgs -> LSM.takeSnapshot config trcr fs Nothing ref
LSMHandleArgs x -> absurd x

-- In the first version of the LedgerDB for UTxO-HD, there is a need to
-- periodically flush the accumulated differences to the disk. However, in the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ samples = 1000

tests :: TestTree
tests = testGroup "DbChangelog"
[ testProperty "flushing" $ verboseShrinking $ withMaxSuccess samples $ conjoin
[ testProperty "flushing" $ withMaxSuccess samples $ conjoin
[ counterexample "flushing keeps immutable tip"
prop_flushingSplitsTheChangelog
]
Expand Down

0 comments on commit 86f9db0

Please sign in to comment.