Skip to content

Commit ddd698f

Browse files
committed
Adapt node initialization to use types from the sublibraries
1 parent e48572a commit ddd698f

File tree

1 file changed

+8
-25
lines changed
  • ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus

1 file changed

+8
-25
lines changed

ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/Node.hs

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ module Ouroboros.Consensus.Node
5353
, pattern DoDiskSnapshotChecksum
5454
, pattern NoDoDiskSnapshotChecksum
5555
, ChainSyncIdleTimeout (..)
56-
, LedgerDbBackendArgs (..)
5756

5857
-- * Internal helpers
5958
, mkNodeKernelArgs
@@ -127,8 +126,6 @@ import qualified Ouroboros.Consensus.Storage.ChainDB as ChainDB
127126
import qualified Ouroboros.Consensus.Storage.ChainDB.Impl.Args as ChainDB
128127
import Ouroboros.Consensus.Storage.LedgerDB.Args
129128
import Ouroboros.Consensus.Storage.LedgerDB.Snapshots
130-
import qualified Ouroboros.Consensus.Storage.LedgerDB.V2.Args as V2
131-
import qualified Ouroboros.Consensus.Storage.LedgerDB.V2.LSM as LSM
132129
import Ouroboros.Consensus.Util.Args
133130
import Ouroboros.Consensus.Util.IOLike
134131
import Ouroboros.Consensus.Util.Orphans ()
@@ -176,11 +173,11 @@ import Ouroboros.Network.Protocol.ChainSync.Codec (timeLimitsChainSync)
176173
import Ouroboros.Network.RethrowPolicy
177174
import qualified SafeWildCards
178175
import System.Exit (ExitCode (..))
179-
import System.FS.API (SomeHasFS (..), mkFsPath)
176+
import System.FS.API (SomeHasFS (..))
180177
import System.FS.API.Types (MountPoint (..))
181178
import System.FS.IO (ioHasFS)
182-
import System.FilePath (splitDirectories, (</>))
183-
import System.Random (StdGen, genWord64, newStdGen, randomIO, split)
179+
import System.FilePath ((</>))
180+
import System.Random (StdGen, newStdGen, randomIO, split)
184181

185182
{-------------------------------------------------------------------------------
186183
The arguments to the Consensus Layer node functionality
@@ -320,7 +317,7 @@ data LowLevelRunNodeArgs m addrNTN addrNTC blk
320317
, llrnMaxClockSkew :: InFutureCheck.ClockSkew
321318
-- ^ Maximum clock skew
322319
, llrnPublicPeerSelectionStateVar :: StrictSTM.StrictTVar m (PublicPeerSelectionState addrNTN)
323-
, llrnLdbFlavorArgs :: Complete LedgerDbFlavorArgs m
320+
, llrnLdbFlavorArgs :: LedgerDbBackendArgs m blk
324321
-- ^ The flavor arguments
325322
}
326323

@@ -378,7 +375,7 @@ data
378375
, -- Ad hoc values to replace default ChainDB configurations
379376
srnSnapshotPolicyArgs :: SnapshotPolicyArgs
380377
, srnQueryBatchSize :: QueryBatchSize
381-
, srnLedgerDbBackendArgs :: LedgerDbBackendArgs m
378+
, srnLedgerDbBackendArgs :: LedgerDbBackendArgs m blk
382379
}
383380

384381
{-------------------------------------------------------------------------------
@@ -819,7 +816,7 @@ openChainDB ::
819816
(ChainDB.RelativeMountPoint -> SomeHasFS m) ->
820817
-- | Volatile FS, see 'NodeDatabasePaths'
821818
(ChainDB.RelativeMountPoint -> SomeHasFS m) ->
822-
Complete LedgerDbFlavorArgs m ->
819+
LedgerDbBackendArgs m blk ->
823820
-- | A set of default arguments (possibly modified from 'defaultArgs')
824821
Incomplete ChainDbArgs m blk ->
825822
-- | Customise the 'ChainDbArgs'
@@ -1007,7 +1004,7 @@ stdLowLevelRunNodeArgsIO
10071004
}
10081005
$(SafeWildCards.fields 'StdRunNodeArgs) = do
10091006
llrnBfcSalt <- stdBfcSaltIO
1010-
(lsmSalt, llrnRng) <- genWord64 <$> newStdGen
1007+
llrnRng <- newStdGen
10111008
pure
10121009
LowLevelRunNodeArgs
10131010
{ llrnBfcSalt
@@ -1052,21 +1049,7 @@ stdLowLevelRunNodeArgsIO
10521049
InFutureCheck.defaultClockSkew
10531050
, llrnPublicPeerSelectionStateVar =
10541051
Diffusion.dcPublicPeerSelectionVar srnDiffusionConfiguration
1055-
, llrnLdbFlavorArgs =
1056-
case srnLedgerDbBackendArgs of
1057-
V1LMDB args -> LedgerDbFlavorArgsV1 args
1058-
V2InMemory -> LedgerDbFlavorArgsV2 (V2.V2Args V2.InMemoryHandleArgs)
1059-
V2LSM path ->
1060-
LedgerDbFlavorArgsV2
1061-
( V2.V2Args
1062-
( V2.LSMHandleArgs
1063-
( V2.LSMArgs
1064-
(mkFsPath $ splitDirectories path)
1065-
lsmSalt
1066-
(LSM.stdMkBlockIOFS (nonImmutableDbPath srnDatabasePath))
1067-
)
1068-
)
1069-
)
1052+
, llrnLdbFlavorArgs = srnLedgerDbBackendArgs
10701053
}
10711054
where
10721055
networkMagic :: NetworkMagic

0 commit comments

Comments
 (0)