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

Ouroboros.Consensus.Network.NodeToClient

Description

Intended for qualified import

Synopsis

Handlers

data Handlers m peer blk Source #

Protocol handlers for node-to-client (local) communication

mkHandlers ∷ ∀ m blk addrNTN addrNTC. (IOLike m, LedgerSupportsMempool blk, LedgerSupportsProtocol blk, BlockSupportsLedgerQuery blk, ConfigSupportsNode blk) ⇒ NodeKernelArgs m addrNTN addrNTC blk → NodeKernel m addrNTN addrNTC blk → Handlers m addrNTC blk Source #

Codecs

type Codecs blk e m bCS bTX bSQ bTM = Codecs' blk (Serialised blk) e m bCS bTX bSQ bTM Source #

data Codecs' blk serialisedBlk e m bCS bTX bSQ bTM Source #

Node-to-client protocol codecs needed to run Handlers.

Constructors

Codecs 

Fields

clientCodecs ∷ ∀ m blk. (MonadST m, SerialiseNodeToClientConstraints blk, ShowQuery (BlockQuery blk), StandardHash blk, Serialise (HeaderHash blk)) ⇒ CodecConfig blk → BlockNodeToClientVersion blk → NodeToClientVersionClientCodecs blk m Source #

Protocol codecs for the node-to-client protocols which serialise deserialise blocks in chain-sync/ protocol.

defaultCodecs ∷ ∀ m blk. (MonadST m, SerialiseNodeToClientConstraints blk, ShowQuery (BlockQuery blk), StandardHash blk, Serialise (HeaderHash blk)) ⇒ CodecConfig blk → BlockNodeToClientVersion blk → NodeToClientVersionDefaultCodecs blk m Source #

Protocol codecs for the node-to-client protocols

We pass the BlockConfig here, even though it is currently unused. If at any point we want to introduce local protocols that for example send Byron blocks or headers across, we will need to have the epoch size, which comes from the Byron config. Unlike the full TopLevelConfig, it should not be difficult for a wallet to construct the BlockConfig.

NOTE: Somewhat confusingly, pcChainSyncCodec currently does send Byron blocks across, but it does not deserialize them (the user of the codec is itself responsible for doing that), which is why it currently does not need the config.

Implementation mode: currently none of the consensus encoders/decoders do anything different based on the version, so _version is unused; it's just that not all codecs are used, depending on the version number.

identityCodecs ∷ (Monad m, BlockSupportsLedgerQuery blk) ⇒ Codecs blk CodecFailure m (AnyMessage (ChainSync (Serialised blk) (Point blk) (Tip blk))) (AnyMessage (LocalTxSubmission (GenTx blk) (ApplyTxErr blk))) (AnyMessage (LocalStateQuery blk (Point blk) (Query blk))) (AnyMessage (LocalTxMonitor (GenTxId blk) (GenTx blk) SlotNo)) Source #

Identity codecs used in tests.

ClientCodecs

Tracers

type Tracers m peer blk e = Tracers' peer blk e (Tracer m) Source #

A record of Tracers for the different protocols.

data Tracers' peer blk e f Source #

Instances

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

Defined in Ouroboros.Consensus.Network.NodeToClient

Methods

(<>)Tracers' peer blk e f → Tracers' peer blk e f → Tracers' peer blk e f #

sconcatNonEmpty (Tracers' peer blk e f) → Tracers' peer blk e f #

stimesIntegral b ⇒ b → Tracers' peer blk e f → Tracers' peer blk e f #

nullTracersMonad m ⇒ Tracers m peer blk e Source #

Use a nullTracer for each protocol.

showTracers ∷ (Show peer, Show (GenTx blk), Show (GenTxId blk), Show (ApplyTxErr blk), ShowQuery (BlockQuery blk), HasHeader blk) ⇒ Tracer m StringTracers m peer blk e Source #

Applications

type App m peer bytes a = peer → Channel m bytes → m (a, Maybe bytes) Source #

A node-to-client application

data Apps m peer bCS bTX bSQ bTM a Source #

Applications for the node-to-client (i.e., local) protocols

See MuxApplication

Constructors

Apps 

Fields

mkApps ∷ ∀ m addrNTN addrNTC blk e bCS bTX bSQ bTM. (IOLike m, Exception e, ShowProxy blk, ShowProxy (ApplyTxErr blk), ShowProxy (BlockQuery blk), ShowProxy (GenTx blk), ShowProxy (GenTxId blk), ShowQuery (BlockQuery blk)) ⇒ NodeKernel m addrNTN addrNTC blk → Tracers m addrNTC blk e → Codecs blk e m bCS bTX bSQ bTM → Handlers m addrNTC blk → Apps m addrNTC bCS bTX bSQ bTM () Source #

Construct the NetworkApplication for the node-to-client protocols

Projections

responderNodeToClientVersionApps m (ConnectionId peer) b b b b a → OuroborosApplicationWithMinimalCtx 'ResponderMode peer b m Void a Source #

A projection from NetworkApplication to a server-side OuroborosApplication for the node-to-client protocols.