|
12 | 12 |
|
13 | 13 | module Cardano.Node.Configuration.POM
|
14 | 14 | ( NodeConfiguration (..)
|
15 |
| - , NCForkPolicy (..) |
| 15 | + , ResponderCoreAffinityPolicy (..) |
16 | 16 | , NetworkP2PMode (..)
|
17 | 17 | , SomeNetworkP2PMode (..)
|
18 | 18 | , PartialNodeConfiguration(..)
|
@@ -51,7 +51,7 @@ import Ouroboros.Consensus.Storage.LedgerDB.Snapshots (NumOfDiskSnapsh
|
51 | 51 | import Ouroboros.Consensus.Storage.LedgerDB.V1.Args (FlushFrequency (..))
|
52 | 52 | import Ouroboros.Network.Diffusion.Configuration as Configuration
|
53 | 53 | import qualified Ouroboros.Network.Diffusion.Configuration as Ouroboros
|
54 |
| -import Ouroboros.Network.Mux (ForkPolicy, noBindForkPolicy, responderForkPolicy) |
| 54 | +import qualified Ouroboros.Network.Mux as Mux |
55 | 55 | import qualified Ouroboros.Network.PeerSelection.Governor as PeerSelection
|
56 | 56 |
|
57 | 57 | import Control.Concurrent (getNumCapabilities)
|
@@ -199,20 +199,22 @@ data NodeConfiguration
|
199 | 199 | -- Ouroboros Genesis
|
200 | 200 | , ncGenesisConfig :: GenesisConfig
|
201 | 201 |
|
202 |
| - , ncForkPolicy :: NCForkPolicy |
| 202 | + , ncResponderCoreAffinityPolicy :: ResponderCoreAffinityPolicy |
203 | 203 | } deriving (Eq, Show)
|
204 | 204 |
|
205 | 205 | -- | We expose the `Ouroboros.Network.Mux.ForkPolicy` as a `NodeConfiguration` field.
|
206 |
| --- * `NoBindForkPolicy` corresponds to `Ouroboros.Network.Mux.noBindForkPolicy` |
207 |
| --- * `ResponderForkPolicy` corresponds to `Ouroboros.Network.Mux.responderForkPolicy` |
208 |
| --- with a `randomIO` generated salt and `getNumCapabilities` |
209 |
| -data NCForkPolicy = NoBindForkPolicy | ResponderForkPolicy deriving (Eq, Show, Generic, FromJSON) |
| 206 | +-- |
| 207 | +-- * `NoResponderCoreAffinity` corresponds to `Ouroboros.Network.Mux.noBindForkPolicy` |
| 208 | +-- * `ResponderCoreAffinity` corresponds to `Ouroboros.Network.Mux.responderForkPolicy` |
| 209 | +-- with a `randomIO` generated salt and `getNumCapabilities`. |
| 210 | +-- |
| 211 | +data ResponderCoreAffinityPolicy = NoResponderCoreAffinity | ResponderCoreAffinity deriving (Eq, Show, Generic, FromJSON) |
210 | 212 |
|
211 | 213 | -- | Convert `NCForkPolicy` to a `Ouroboros.Network.Mux.ForkPolicy`
|
212 |
| -getForkPolicy :: Hashable peerAddr => NCForkPolicy -> IO (ForkPolicy peerAddr) |
| 214 | +getForkPolicy :: Hashable peerAddr => ResponderCoreAffinityPolicy -> IO (Mux.ForkPolicy peerAddr) |
213 | 215 | getForkPolicy = \case
|
214 |
| - NoBindForkPolicy -> pure noBindForkPolicy |
215 |
| - ResponderForkPolicy -> responderForkPolicy <$> randomIO <*> getNumCapabilities |
| 216 | + NoResponderCoreAffinity -> pure Mux.noBindForkPolicy |
| 217 | + ResponderCoreAffinity -> Mux.responderForkPolicy <$> randomIO <*> getNumCapabilities |
216 | 218 |
|
217 | 219 | data PartialNodeConfiguration
|
218 | 220 | = PartialNodeConfiguration
|
@@ -291,7 +293,7 @@ data PartialNodeConfiguration
|
291 | 293 | -- Ouroboros Genesis
|
292 | 294 | , pncGenesisConfigFlags :: !(Last GenesisConfigFlags)
|
293 | 295 |
|
294 |
| - , pncForkPolicy :: !(Last NCForkPolicy) |
| 296 | + , pncResponderCoreAffinityPolicy :: !(Last ResponderCoreAffinityPolicy) |
295 | 297 | } deriving (Eq, Generic, Show)
|
296 | 298 |
|
297 | 299 | instance AdjustFilePaths PartialNodeConfiguration where
|
@@ -402,7 +404,10 @@ instance FromJSON PartialNodeConfiguration where
|
402 | 404 | -- pncConsensusMode determines whether Genesis is enabled in the first place.
|
403 | 405 | pncGenesisConfigFlags <- Last <$> v .:? "LowLevelGenesisOptions"
|
404 | 406 |
|
405 |
| - pncForkPolicy <- Last <$> v .:? "ForkPolicy" |
| 407 | + pncResponderCoreAffinityPolicy <- |
| 408 | + (\a b -> Last a <> Last b) |
| 409 | + <$> v .:? "ResponderCoreAffinityPolicy" |
| 410 | + <*> v .:? "ForkPolicy" -- deprecated |
406 | 411 |
|
407 | 412 | pure PartialNodeConfiguration {
|
408 | 413 | pncProtocolConfig
|
@@ -445,7 +450,7 @@ instance FromJSON PartialNodeConfiguration where
|
445 | 450 | , pncEnableP2P
|
446 | 451 | , pncPeerSharing
|
447 | 452 | , pncGenesisConfigFlags
|
448 |
| - , pncForkPolicy |
| 453 | + , pncResponderCoreAffinityPolicy |
449 | 454 | }
|
450 | 455 | where
|
451 | 456 | parseMempoolCapacityBytesOverride v = parseNoOverride <|> parseOverride
|
@@ -682,7 +687,7 @@ defaultPartialNodeConfiguration =
|
682 | 687 | , pncEnableP2P = Last (Just EnabledP2PMode)
|
683 | 688 | , pncPeerSharing = Last (Just Ouroboros.defaultPeerSharing)
|
684 | 689 | , pncGenesisConfigFlags = Last (Just defaultGenesisConfigFlags)
|
685 |
| - , pncForkPolicy = Last $ Just NoBindForkPolicy |
| 690 | + , pncResponderCoreAffinityPolicy = Last $ Just NoResponderCoreAffinity |
686 | 691 | }
|
687 | 692 | where
|
688 | 693 | PeerSelectionTargets {
|
@@ -792,7 +797,7 @@ makeNodeConfiguration pnc = do
|
792 | 797 | $ pncGenesisConfigFlags pnc
|
793 | 798 | let ncGenesisConfig = mkGenesisConfig mGenesisConfigFlags
|
794 | 799 |
|
795 |
| - ncForkPolicy <- lastToEither "Missing ForkPolicy" $ pncForkPolicy pnc |
| 800 | + ncResponderCoreAffinityPolicy <- lastToEither "Missing ResponderCoreAffinityPolicy" $ pncResponderCoreAffinityPolicy pnc |
796 | 801 |
|
797 | 802 | let deadlineTargets =
|
798 | 803 | PeerSelectionTargets {
|
@@ -874,7 +879,7 @@ makeNodeConfiguration pnc = do
|
874 | 879 | , ncPeerSharing
|
875 | 880 | , ncConsensusMode
|
876 | 881 | , ncGenesisConfig
|
877 |
| - , ncForkPolicy |
| 882 | + , ncResponderCoreAffinityPolicy |
878 | 883 | }
|
879 | 884 |
|
880 | 885 | ncProtocol :: NodeConfiguration -> Protocol
|
|
0 commit comments