ouroboros-consensus:diffusion
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Network.NodeToNode

Description

Intended for qualified import

Synopsis

Handlers

data Handlers (m ∷ Type → Type) addr blk Source #

Protocol handlers for node-to-node (remote) communication

Constructors

Handlers 

Fields

mkHandlers ∷ ∀ (m ∷ Type → Type) blk addrNTN addrNTC. (IOLike m, MonadTime m, MonadTimer m, HasTxId (GenTx blk), BlockSupportsPeras blk, LedgerSupportsMempool blk, LedgerSupportsProtocol blk, Ord addrNTN, Hashable addrNTN) ⇒ NodeKernelArgs m addrNTN addrNTC blk → NodeKernel m addrNTN addrNTC blk → TxSubmissionLogicVersion → Handlers m addrNTN blk Source #

Codecs

data Codecs blk addr e (m ∷ Type → Type) bCS bSCS bBF bSBF bTX bPCD bPVD bKA bPS Source #

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

Constructors

Codecs 

Fields

defaultCodecs ∷ ∀ (m ∷ Type → Type) blk addr. (IOLike m, SerialiseNodeToNodeConstraints blk) ⇒ CodecConfig blk → BlockNodeToNodeVersion blk → (NodeToNodeVersion → addr → Encoding) → (NodeToNodeVersion → ∀ s. Decoder s addr) → NodeToNodeVersion → Codecs blk addr DeserialiseFailure m ByteString ByteString ByteString ByteString ByteString ByteString ByteString ByteString ByteString Source #

Protocol codecs for the node-to-node protocols

identityCodecs ∷ ∀ (m ∷ Type → Type) blk addr. Monad m ⇒ Codecs blk addr CodecFailure m (AnyMessage (ChainSync (Header blk) (Point blk) (Tip blk))) (AnyMessage (ChainSync (SerialisedHeader blk) (Point blk) (Tip blk))) (AnyMessage (BlockFetch blk (Point blk))) (AnyMessage (BlockFetch (Serialised blk) (Point blk))) (AnyMessage (TxSubmission2 (GenTxId blk) (GenTx blk))) (AnyMessage (PerasCertDiffusion blk)) (AnyMessage (PerasVoteDiffusion blk)) (AnyMessage KeepAlive) (AnyMessage (PeerSharing addr)) Source #

Identity codecs used in tests.

Byte Limits

data ByteLimits bCS bBF bTX bPCD bPVD bKA bPS Source #

Per mini-protocol byte limits; For each mini-protocol they provide per-state byte size limits, i.e. how much data can arrive from the network.

They don't depend on the instantiation of the protocol parameters (which block type is used, etc.), hence the use of RankNTypes.

noByteLimits ∷ ByteLimits bCS bBF bTX bPCD bPVD bKA bPS Source #

Tracers

type Tracers (m ∷ Type → Type) ntnAddr blk e = Tracers' (ConnectionId ntnAddr) ntnAddr blk e (Tracer m) Source #

A record of Tracers for the different protocols.

data Tracers' peer ntnAddr blk e (f ∷ Type → Type) Source #

Constructors

Tracers 

Fields

Instances

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

Defined in Ouroboros.Consensus.Network.NodeToNode

Methods

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

sconcat ∷ NonEmpty (Tracers' peer ntnAddr blk e f) → Tracers' peer ntnAddr blk e f #

stimes ∷ Integral b ⇒ b → Tracers' peer ntnAddr blk e f → Tracers' peer ntnAddr blk e f #

nullTracers ∷ ∀ (m ∷ Type → Type) ntnAddr blk e. Monad m ⇒ Tracers m ntnAddr blk e Source #

Use a nullTracer for each protocol.

showTracers ∷ ∀ (m ∷ Type → Type) blk ntnAddr e. (Monad m, Show blk, Show ntnAddr, Show (Header blk), Show (GenTx blk), Show (GenTxId blk), Show (PerasVote blk), Show (PerasCert blk), HasHeader blk, HasNestedContent Header blk) ⇒ Tracer m String → Tracers m ntnAddr blk e Source #

Applications

data Apps (m ∷ Type → Type) addr bCS bBF bTX bPCD bPVD bKA bPS a b Source #

Applications for the node-to-node protocols

See MuxApplication

Constructors

Apps 

Fields

type ClientApp (m ∷ Type → Type) addr bytes a = NodeToNodeVersion → ExpandedInitiatorContext addr PeerTrustable m → Channel m bytes → m (a, Maybe bytes) Source #

A node-to-node application

type ServerApp (m ∷ Type → Type) addr bytes a = NodeToNodeVersion → ResponderContext addr → Channel m bytes → m (a, Maybe bytes) Source #

mkApps Source #

Arguments

∷ ∀ (m ∷ Type → Type) addrNTN addrNTC blk e bCS bBF bTX bPCD bPVD bKA bPS. (IOLike m, MonadTimer m, Ord addrNTN, Exception e, NFData e, LedgerSupportsProtocol blk, BlockSupportsPeras blk, ShowProxy blk, ShowProxy (Header blk), ShowProxy (TxId (GenTx blk)), ShowProxy (GenTx blk), ShowProxy (PerasVote blk), ShowProxy (PerasCert blk), Show addrNTN, LedgerSupportsMempool blk, HasTxId (GenTx blk), HasRawTxId (GenTxId blk)) 
⇒ NodeKernel m addrNTN addrNTC blk

Needed for bracketing only

→ StdGen 
→ Tracers m addrNTN blk e 
→ (NodeToNodeVersion → Codecs blk addrNTN e m bCS bCS bBF bBF bTX bPCD bPVD bKA bPS) 
→ ByteLimits bCS bBF bTX bPCD bPVD bKA bPS 
→ (∀ header. PeerTrustable → ProtocolTimeLimitsWithRnd (ChainSync header (Point blk) (Tip blk))) 
→ ChainSyncLoPBucketConfig 
→ CSJConfig 
→ ReportPeerMetrics m (ConnectionId addrNTN) 
→ Handlers m addrNTN blk 
→ Apps m addrNTN bCS bBF bTX bPCD bPVD bKA bPS NodeToNodeInitiatorResult () 

Construct the NetworkApplication for the node-to-node protocols

Projections

initiator ∷ ∀ (m ∷ Type → Type) addr b a c. Set CardanoFeatureFlag → MiniProtocolParameters → NodeToNodeVersion → NodeToNodeVersionData → Apps m addr b b b b b b b a c → OuroborosBundleWithExpandedCtx 'InitiatorMode addr PeerTrustable b m a Void Source #

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

Implementation note: network currently doesn't enable protocols conditional on the protocol version, but it eventually may; this is why _version is currently unused.

initiatorAndResponder ∷ ∀ (m ∷ Type → Type) addr b a c. Set CardanoFeatureFlag → MiniProtocolParameters → NodeToNodeVersion → NodeToNodeVersionData → Apps m addr b b b b b b b a c → OuroborosBundleWithExpandedCtx 'InitiatorResponderMode addr PeerTrustable b m a c Source #

A bi-directional network application.

Implementation note: network currently doesn't enable protocols conditional on the protocol version, but it eventually may; this is why _version is currently unused.