Skip to content

Commit 8750ad8

Browse files
committed
Cleanup
1 parent 8316f5f commit 8750ad8

File tree

4 files changed

+15
-19
lines changed

4 files changed

+15
-19
lines changed

ouroboros-consensus/ouroboros-consensus.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,6 @@ library ouroboros-consensus-lsm
377377
build-depends:
378378
base >=4.14 && <4.22,
379379
blockio,
380-
cardano-binary,
381380
containers >=0.5 && <0.8,
382381
contra-tracer,
383382
filepath,

ouroboros-consensus/src/ouroboros-consensus-lsm/Ouroboros/Consensus/Storage/LedgerDB/V2/LSM.hs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
{-# LANGUAGE TypeApplications #-}
1515
{-# LANGUAGE TypeFamilies #-}
1616
{-# LANGUAGE UndecidableInstances #-}
17+
{-# LANGUAGE ViewPatterns #-}
1718
-- Needed for @NoThunks (Table m k v b)@
1819
{-# OPTIONS_GHC -Wno-orphans #-}
1920

@@ -72,7 +73,6 @@ import Ouroboros.Consensus.Ledger.Tables.Utils
7273
import Ouroboros.Consensus.Storage.LedgerDB.API
7374
import Ouroboros.Consensus.Storage.LedgerDB.Args
7475
import Ouroboros.Consensus.Storage.LedgerDB.Snapshots
75-
import Ouroboros.Consensus.Storage.LedgerDB.V2
7676
import Ouroboros.Consensus.Storage.LedgerDB.V2.Backend
7777
import Ouroboros.Consensus.Storage.LedgerDB.V2.LedgerSeq
7878
import Ouroboros.Consensus.Util (chunks)
@@ -170,7 +170,7 @@ newLSMLedgerTablesHandle ::
170170
(ResourceKey m, UTxOTable m) ->
171171
m (LedgerTablesHandle m l)
172172
newLSMLedgerTablesHandle tracer rr (resKey, t) = do
173-
traceWith tracer V2.TraceLedgerTablesHandleCreate
173+
traceWith tracer TraceLedgerTablesHandleCreate
174174
pure
175175
LedgerTablesHandle
176176
{ close = implClose resKey
@@ -201,16 +201,17 @@ implDuplicate ::
201201
) =>
202202
ResourceRegistry m ->
203203
UTxOTable m ->
204-
Tracer m V2.FlavorImplSpecificTrace ->
204+
Tracer m LedgerDBV2Trace ->
205205
m (LedgerTablesHandle m l)
206206
implDuplicate rr t tracer = do
207207
table <-
208208
allocate
209209
rr
210210
(\_ -> LSM.duplicate t)
211211
( \t' -> do
212-
traceWith tracer V2.TraceLedgerTablesHandleClose
212+
traceWith tracer TraceLedgerTablesHandleClose
213213
LSM.closeTable t'
214+
)
214215
newLSMLedgerTablesHandle tracer rr table
215216

216217
implRead ::
@@ -451,7 +452,7 @@ loadSnapshot tracer rr ccfg fs session ds =
451452
(LSM.SnapshotLabel $ Text.pack $ "UTxO table")
452453
)
453454
( \t -> do
454-
traceWith tracer V2.TraceLedgerTablesHandleClose
455+
traceWith tracer TraceLedgerTablesHandleClose
455456
LSM.closeTable t
456457
)
457458
Monad.when
@@ -467,7 +468,7 @@ loadSnapshot tracer rr ccfg fs session ds =
467468
tableFromValuesMK ::
468469
forall m l.
469470
(IOLike m, IndexedMemPack (l EmptyMK) (TxOut l), MemPack (TxIn l)) =>
470-
Tracer m V2.FlavorImplSpecificTrace ->
471+
Tracer m LedgerDBV2Trace ->
471472
ResourceRegistry m ->
472473
Session m ->
473474
l EmptyMK ->
@@ -481,7 +482,7 @@ tableFromValuesMK tracer rr session st (LedgerTables (ValuesMK values)) = do
481482
LSM.newTableWith (LSM.defaultTableConfig{LSM.confFencePointerIndex = LSM.OrdinaryIndex}) session
482483
)
483484
( \tb -> do
484-
traceWith tracer V2.TraceLedgerTablesHandleClose
485+
traceWith tracer TraceLedgerTablesHandleClose
485486
LSM.closeTable tb
486487
)
487488
mapM_ (go table) $ chunks 1000 $ Map.toList values

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V2.hs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{-# LANGUAGE TypeOperators #-}
1212
{-# LANGUAGE UndecidableInstances #-}
1313

14-
module Ouroboros.Consensus.Storage.LedgerDB.V2 (mkInitDb, snapshotToStatePath) where
14+
module Ouroboros.Consensus.Storage.LedgerDB.V2 (mkInitDb) where
1515

1616
import Control.Arrow ((>>>))
1717
import qualified Control.Monad as Monad (join, void)
@@ -240,11 +240,6 @@ implIntTruncateSnapshots snapManager (SomeHasFS fs) = do
240240
\pre -> withFile fs (snapshotToStatePath pre) (AppendMode AllowExisting) $
241241
\h -> hTruncate fs h 0
242242

243-
-- | The path within the LedgerDB's filesystem to the file that contains the
244-
-- snapshot's serialized ledger state
245-
snapshotToStatePath :: DiskSnapshot -> FsPath
246-
snapshotToStatePath = mkFsPath . (\x -> [x, "state"]) . snapshotToDirName
247-
248243
implGetVolatileTip ::
249244
(MonadSTM m, GetTip l) =>
250245
LedgerDBEnv m l blk ->

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V2/InMemory.hs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ module Ouroboros.Consensus.Storage.LedgerDB.V2.InMemory
2323
, mkInMemoryArgs
2424
) where
2525

26+
import Cardano.Binary as CBOR
2627
import Cardano.Slotting.Slot
2728
import Codec.CBOR.Read
2829
import qualified Codec.CBOR.Write as CBOR
@@ -128,13 +129,13 @@ newInMemoryLedgerTablesHandle tracer someFS@(SomeHasFS hasFS) l = do
128129

129130
implClose ::
130131
IOLike m =>
131-
Tracer m V2.FlavorImplSpecificTrace ->
132+
Tracer m LedgerDBV2Trace ->
132133
StrictTVar m (LedgerTablesHandleState l) ->
133134
m ()
134135
implClose tracer tv = do
135136
p <- atomically $ swapTVar tv LedgerTablesHandleClosed
136137
case p of
137-
LedgerTablesHandleOpen{} -> traceWith tracer V2.TraceLedgerTablesHandleClose
138+
LedgerTablesHandleOpen{} -> traceWith tracer TraceLedgerTablesHandleClose
138139
_ -> pure ()
139140

140141
implDuplicate ::
@@ -143,7 +144,7 @@ implDuplicate ::
143144
, CanUpgradeLedgerTables l
144145
, SerializeTablesWithHint l
145146
) =>
146-
Tracer m V2.FlavorImplSpecificTrace ->
147+
Tracer m LedgerDBV2Trace ->
147148
StrictTVar m (LedgerTablesHandleState l) ->
148149
SomeHasFS m ->
149150
m (LedgerTablesHandle m l)
@@ -226,7 +227,7 @@ implTakeHandleSnapshot tv hasFS hint snapshotName = do
226227
h <- readTVarIO tv
227228
guardClosed h $
228229
\values ->
229-
withFile hasFS (mkFsPath [snapshotName, "tables", "tvar"]) (WriteMode MustBeNew) $ \hf ->
230+
withFile hasFS (mkFsPath [snapshotName, "tables"]) (WriteMode MustBeNew) $ \hf ->
230231
fmap (Just . snd) $
231232
hPutAllCRC hasFS hf $
232233
CBOR.toLazyByteString $
@@ -337,7 +338,7 @@ loadSnapshot tracer _rr ccfg fs ds = do
337338
(valuesMKDecoder extLedgerSt)
338339
( fsPathFromList $
339340
fsPathToList (snapshotToDirPath ds)
340-
<> [fromString "tables", fromString "tvar"]
341+
<> [fromString "tables"]
341342
)
342343
let computedCRC = crcOfConcat checksumAsRead crcTables
343344
Monad.when (computedCRC /= snapshotChecksum snapshotMeta) $

0 commit comments

Comments
 (0)