ouroboros-consensus-diffusion-0.18.0.0: Integration for the Ouroboros Network layer
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Consensus.Node

Description

Run the whole Node

Intended for qualified import.

Synopsis

Documentation

run ∷ ∀ blk p2p. RunNode blk ⇒ RunNodeArgs IO RemoteAddress LocalAddress blk p2p → StdRunNodeArgs IO blk p2p → IO () Source #

Combination of runWith and stdLowLevelRunArgsIO

runWith ∷ ∀ m addrNTN addrNTC versionDataNTN versionDataNTC blk p2p. (RunNode blk, IOLike m, Hashable addrNTN, NetworkIO m, NetworkAddr addrNTN) ⇒ RunNodeArgs m addrNTN addrNTC blk p2p → (NodeToNodeVersion → addrNTN → Encoding) → (NodeToNodeVersion → ∀ s. Decoder s addrNTN) → LowLevelRunNodeArgs m addrNTN addrNTC versionDataNTN versionDataNTC blk p2p → m () Source #

Start a node.

This opens the ChainDB, sets up the NodeKernel and initialises the network layer.

This function runs forever unless an exception is thrown.

Standard arguments

data StdRunNodeArgs m blk (p2p ∷ P2P) Source #

Higher-level arguments that can determine the LowLevelRunNodeArgs under some usual assumptions for realistic use cases such as in cardano-node.

See stdLowLevelRunNodeArgsIO.

Constructors

StdRunNodeArgs 

Fields

stdLowLevelRunNodeArgsIO ∷ ∀ blk p2p. RunNode blk ⇒ RunNodeArgs IO RemoteAddress LocalAddress blk p2p → StdRunNodeArgs IO blk p2p → IO (LowLevelRunNodeArgs IO RemoteAddress LocalAddress NodeToNodeVersionData NodeToClientVersionData blk p2p) Source #

Conveniently packaged LowLevelRunNodeArgs arguments from a standard non-testing invocation.

stdMkChainDbHasFSFilePathRelativeMountPointSomeHasFS IO Source #

How to locate the ChainDB on disk

stdWithCheckedDB Source #

Arguments

∷ ∀ blk a. (StandardHash blk, Typeable blk) 
Proxy blk 
Tracer IO (TraceEvent blk) 
FilePath 
NetworkMagic 
→ (LastShutDownWasClean → (ChainDB IO blk → IO a → IO a) → IO a)

Body action with last shutdown was clean.

IO a 

Check the DB marker, lock the DB and look for the clean shutdown marker.

Run the body action with the DB locked.

P2P Switch

data NetworkP2PMode (p2p ∷ P2P) where Source #

P2P Switch

Instances

Instances details
Show (NetworkP2PMode p2p) Source # 
Instance details

Defined in Ouroboros.Consensus.Node

Methods

showsPrecIntNetworkP2PMode p2p → ShowS #

showNetworkP2PMode p2p → String #

showList ∷ [NetworkP2PMode p2p] → ShowS #

Eq (NetworkP2PMode p2p) Source # 
Instance details

Defined in Ouroboros.Consensus.Node

Methods

(==)NetworkP2PMode p2p → NetworkP2PMode p2p → Bool #

(/=)NetworkP2PMode p2p → NetworkP2PMode p2p → Bool #

Exposed by run et al

newtype RelativeMountPoint Source #

A relative path for a MountPoint

The root is determined by context.

data TraceEvent blk Source #

Trace type for the various events of the ChainDB.

Instances

Instances details
Generic (TraceEvent blk) 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Associated Types

type Rep (TraceEvent blk) ∷ TypeType #

Methods

fromTraceEvent blk → Rep (TraceEvent blk) x #

toRep (TraceEvent blk) x → TraceEvent blk #

(Show (Header blk), LedgerSupportsProtocol blk, InspectLedger blk) ⇒ Show (TraceEvent blk) 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Methods

showsPrecIntTraceEvent blk → ShowS #

showTraceEvent blk → String #

showList ∷ [TraceEvent blk] → ShowS #

(Eq (Header blk), LedgerSupportsProtocol blk, InspectLedger blk) ⇒ Eq (TraceEvent blk) 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Methods

(==)TraceEvent blk → TraceEvent blk → Bool #

(/=)TraceEvent blk → TraceEvent blk → Bool #

type Rep (TraceEvent blk) 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (TraceEvent blk) = D1 ('MetaData "TraceEvent" "Ouroboros.Consensus.Storage.ChainDB.Impl.Types" "ouroboros-consensus-0.21.0.0-inplace" 'False) (((C1 ('MetaCons "TraceAddBlockEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceAddBlockEvent blk))) :+: (C1 ('MetaCons "TraceFollowerEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceFollowerEvent blk))) :+: C1 ('MetaCons "TraceCopyToImmutableDBEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceCopyToImmutableDBEvent blk))))) :+: (C1 ('MetaCons "TraceGCEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceGCEvent blk))) :+: (C1 ('MetaCons "TraceInitChainSelEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceInitChainSelEvent blk))) :+: C1 ('MetaCons "TraceOpenEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceOpenEvent blk)))))) :+: ((C1 ('MetaCons "TraceIteratorEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceIteratorEvent blk))) :+: (C1 ('MetaCons "TraceSnapshotEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceSnapshotEvent blk))) :+: C1 ('MetaCons "TraceLedgerReplayEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceReplayEvent blk))))) :+: (C1 ('MetaCons "TraceImmutableDBEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceEvent blk))) :+: (C1 ('MetaCons "TraceVolatileDBEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceEvent blk))) :+: C1 ('MetaCons "TraceLastShutdownUnclean" 'PrefixI 'False) (U1TypeType)))))

data ChainDbArgs (f ∷ TypeType) (m ∷ TypeType) blk Source #

Constructors

ChainDbArgs 

data DiskPolicyArgs Source #

The components used by cardano-node to construct a DiskPolicy.

Constructors

DiskPolicyArgs SnapshotInterval NumOfDiskSnapshots (Flag "DoDiskSnapshotChecksum") 

data HardForkBlockchainTimeArgs (m ∷ TypeType) blk Source #

Constructors

HardForkBlockchainTimeArgs 

Fields

newtype LastShutDownWasClean Source #

Did the ChainDB already have existing clean-shutdown marker on disk?

data LowLevelRunNodeArgs m addrNTN addrNTC versionDataNTN versionDataNTC blk (p2p ∷ P2P) Source #

Arguments that usually only tests directly specify.

A non-testing invocation probably wouldn't explicitly provide these values to runWith. The cardano-node, for example, instead calls the run abbreviation, which uses stdLowLevelRunNodeArgsIO to indirectly specify these low-level values from the higher-level StdRunNodeArgs.

Constructors

LowLevelRunNodeArgs 

Fields

data MempoolCapacityBytesOverride Source #

An override for the default MempoolCapacityBytes which is 2x the maximum transaction capacity

Constructors

NoMempoolCapacityBytesOverride

Use 2x the maximum transaction capacity of a block. This will change dynamically with the protocol parameters adopted in the current ledger.

MempoolCapacityBytesOverride !ByteSize32

Use the least multiple of the block capacity that is no less than this size.

data NodeDatabasePaths Source #

Constructors

OnePathForAllDbs FilePath

Databases will be stored under this path, such that given a path /foo, databases will be in foo{immutable,volatile,...}.

MultipleDbPaths 

Fields

  • FilePath

    Immutable path, usually pointing to a non-necessarily performant volume. ImmutableDB will be stored under this path, so given /foo, the ImmutableDB will be in fooimmutable.

  • FilePath

    Non-immutable (volatile data) path, usually pointing to a performant volume. Databases other than the ImmutableDB will be stored under this path, so given /bar, it will contain bar{volatile,ledger,...}.

data NodeKernel m addrNTN addrNTC blk Source #

Interface against running relay node

Constructors

NodeKernel 

Fields

data ProtocolInfo b Source #

Data required to run the specified protocol.

Constructors

ProtocolInfo 

data RunNodeArgs m addrNTN addrNTC blk (p2p ∷ P2P) Source #

Arguments expected from any invocation of runWith, whether by deployed code, tests, etc.

Constructors

RunNodeArgs 

Fields

type Tracers m remotePeer localPeer blk = Tracers' remotePeer localPeer blk (Tracer m) Source #

A record of Tracers for the node.

data Tracers' remotePeer localPeer blk f Source #

Instances

Instances details
(∀ a. Semigroup (f a)) ⇒ Semigroup (Tracers' remotePeer localPeer blk f) Source # 
Instance details

Defined in Ouroboros.Consensus.Node.Tracers

Methods

(<>)Tracers' remotePeer localPeer blk f → Tracers' remotePeer localPeer blk f → Tracers' remotePeer localPeer blk f #

sconcatNonEmpty (Tracers' remotePeer localPeer blk f) → Tracers' remotePeer localPeer blk f #

stimesIntegral b ⇒ b → Tracers' remotePeer localPeer blk f → Tracers' remotePeer localPeer blk f #

pattern DoDiskSnapshotChecksumFlag "DoDiskSnapshotChecksum" Source #

Type-safe flag to regulate the checksum policy of the ledger state snapshots.

These patterns are exposed to cardano-node and will be passed as part of DiskPolicy.

pattern NoDoDiskSnapshotChecksumFlag "DoDiskSnapshotChecksum" Source #

Type-safe flag to regulate the checksum policy of the ledger state snapshots.

These patterns are exposed to cardano-node and will be passed as part of DiskPolicy.

Internal helpers

mkNodeKernelArgs ∷ ∀ m addrNTN addrNTC blk. (RunNode blk, IOLike m) ⇒ ResourceRegistry m → IntStdGenStdGenTopLevelConfig blk → Tracers m (ConnectionId addrNTN) (ConnectionId addrNTC) blk → BlockchainTime m → SomeHeaderInFutureCheck m blk → (m GsmStateHistoricityCheck m blk) → ChainDB m blk → NominalDiffTimeMaybe (WrapDurationUntilTooOld m blk) → MarkerFileView m → STM m UseBootstrapPeersStrictTVar m (PublicPeerSelectionState addrNTN) → GenesisNodeKernelArgs m blk → DiffusionPipeliningSupport → m (NodeKernelArgs m addrNTN (ConnectionId addrNTC) blk) Source #

nodeKernelArgsEnforceInvariantsNodeKernelArgs m addrNTN (ConnectionId addrNTC) blk → NodeKernelArgs m addrNTN (ConnectionId addrNTC) blk Source #

We allow the user running the node to customise the NodeKernelArgs through $sel:llrnCustomiseNodeKernelArgs:LowLevelRunNodeArgs, but there are some limits to some values. This function makes sure we don't exceed those limits and that the values are consistent.

openChainDB Source #

Arguments

∷ ∀ m blk. (RunNode blk, IOLike m) 
ResourceRegistry m 
TopLevelConfig blk 
ExtLedgerState blk

Initial ledger

→ (RelativeMountPointSomeHasFS m)

Immutable FS, see NodeDatabasePaths

→ (RelativeMountPointSomeHasFS m)

Volatile FS, see NodeDatabasePaths

Incomplete ChainDbArgs m blk

A set of default arguments (possibly modified from defaultArgs)

→ (Complete ChainDbArgs m blk → Complete ChainDbArgs m blk)

Customise the ChainDbArgs

→ m (ChainDB m blk, Complete ChainDbArgs m blk)