Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Ouroboros.Consensus.Network.NodeToNode
Description
Intended for qualified import
Synopsis
- data Handlers m addr blk = Handlers {
- hChainSyncClient ∷ ConnectionId addr → IsBigLedgerPeer → DynamicEnv m blk → ChainSyncClientPipelined (Header blk) (Point blk) (Tip blk) m ChainSyncClientResult
- hChainSyncServer ∷ ConnectionId addr → NodeToNodeVersion → Follower m blk (WithPoint blk (SerialisedHeader blk)) → ChainSyncServer (SerialisedHeader blk) (Point blk) (Tip blk) m ()
- hBlockFetchClient ∷ NodeToNodeVersion → ControlMessageSTM m → FetchedMetricsTracer m → BlockFetchClient (Header blk) blk m ()
- hBlockFetchServer ∷ ConnectionId addr → NodeToNodeVersion → ResourceRegistry m → BlockFetchServer (Serialised blk) (Point blk) m ()
- hTxSubmissionClient ∷ NodeToNodeVersion → ControlMessageSTM m → ConnectionId addr → TxSubmissionClient (GenTxId blk) (GenTx blk) m ()
- hTxSubmissionServer ∷ NodeToNodeVersion → ConnectionId addr → TxSubmissionServerPipelined (GenTxId blk) (GenTx blk) m ()
- hKeepAliveClient ∷ NodeToNodeVersion → ControlMessageSTM m → ConnectionId addr → StrictTVar m (Map (ConnectionId addr) PeerGSV) → KeepAliveInterval → KeepAliveClient m ()
- hKeepAliveServer ∷ NodeToNodeVersion → ConnectionId addr → KeepAliveServer m ()
- hPeerSharingClient ∷ NodeToNodeVersion → ControlMessageSTM m → ConnectionId addr → PeerSharingController addr m → m (PeerSharingClient addr m ())
- hPeerSharingServer ∷ NodeToNodeVersion → ConnectionId addr → PeerSharingServer addr m
- mkHandlers ∷ ∀ m blk addrNTN addrNTC. (IOLike m, MonadTime m, MonadTimer m, LedgerSupportsMempool blk, HasTxId (GenTx blk), LedgerSupportsProtocol blk, Ord addrNTN, Hashable addrNTN) ⇒ NodeKernelArgs m addrNTN addrNTC blk → NodeKernel m addrNTN addrNTC blk → Handlers m addrNTN blk
- data Codecs blk addr e m bCS bSCS bBF bSBF bTX bKA bPS = Codecs {
- cChainSyncCodec ∷ Codec (ChainSync (Header blk) (Point blk) (Tip blk)) e m bCS
- cChainSyncCodecSerialised ∷ Codec (ChainSync (SerialisedHeader blk) (Point blk) (Tip blk)) e m bSCS
- cBlockFetchCodec ∷ Codec (BlockFetch blk (Point blk)) e m bBF
- cBlockFetchCodecSerialised ∷ Codec (BlockFetch (Serialised blk) (Point blk)) e m bSBF
- cTxSubmission2Codec ∷ Codec (TxSubmission2 (GenTxId blk) (GenTx blk)) e m bTX
- cKeepAliveCodec ∷ Codec KeepAlive e m bKA
- cPeerSharingCodec ∷ Codec (PeerSharing addr) e m bPS
- defaultCodecs ∷ ∀ m 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
- identityCodecs ∷ 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 KeepAlive) (AnyMessage (PeerSharing addr))
- data ByteLimits bCS bBF bTX bKA
- byteLimits ∷ ByteLimits ByteString ByteString ByteString ByteString
- noByteLimits ∷ ByteLimits bCS bBF bTX bKA
- type Tracers m ntnAddr blk e = Tracers' (ConnectionId ntnAddr) ntnAddr blk e (Tracer m)
- data Tracers' peer ntnAddr blk e f = Tracers {
- tChainSyncTracer ∷ f (TraceLabelPeer peer (TraceSendRecv (ChainSync (Header blk) (Point blk) (Tip blk))))
- tChainSyncSerialisedTracer ∷ f (TraceLabelPeer peer (TraceSendRecv (ChainSync (SerialisedHeader blk) (Point blk) (Tip blk))))
- tBlockFetchTracer ∷ f (TraceLabelPeer peer (TraceSendRecv (BlockFetch blk (Point blk))))
- tBlockFetchSerialisedTracer ∷ f (TraceLabelPeer peer (TraceSendRecv (BlockFetch (Serialised blk) (Point blk))))
- tTxSubmission2Tracer ∷ f (TraceLabelPeer peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
- tKeepAliveTracer ∷ f (TraceLabelPeer peer (TraceSendRecv KeepAlive))
- tPeerSharingTracer ∷ f (TraceLabelPeer peer (TraceSendRecv (PeerSharing ntnAddr)))
- nullTracers ∷ Monad m ⇒ Tracers m ntnAddr blk e
- showTracers ∷ (Show blk, Show ntnAddr, Show (Header blk), Show (GenTx blk), Show (GenTxId blk), HasHeader blk, HasNestedContent Header blk) ⇒ Tracer m String → Tracers m ntnAddr blk e
- data Apps m addr bCS bBF bTX bKA bPS a b = Apps {
- aChainSyncClient ∷ ClientApp m addr bCS a
- aChainSyncServer ∷ ServerApp m addr bCS b
- aBlockFetchClient ∷ ClientApp m addr bBF a
- aBlockFetchServer ∷ ServerApp m addr bBF b
- aTxSubmission2Client ∷ ClientApp m addr bTX a
- aTxSubmission2Server ∷ ServerApp m addr bTX b
- aKeepAliveClient ∷ ClientApp m addr bKA a
- aKeepAliveServer ∷ ServerApp m addr bKA b
- aPeerSharingClient ∷ ClientApp m addr bPS a
- aPeerSharingServer ∷ ServerApp m addr bPS b
- type ClientApp m addr bytes a = NodeToNodeVersion → ExpandedInitiatorContext addr m → Channel m bytes → m (a, Maybe bytes)
- type ServerApp m addr bytes a = NodeToNodeVersion → ResponderContext addr → Channel m bytes → m (a, Maybe bytes)
- mkApps ∷ ∀ m addrNTN addrNTC blk e bCS bBF bTX bKA bPS. (IOLike m, MonadTimer m, Ord addrNTN, Exception e, LedgerSupportsProtocol blk, ShowProxy blk, ShowProxy (Header blk), ShowProxy (TxId (GenTx blk)), ShowProxy (GenTx blk)) ⇒ NodeKernel m addrNTN addrNTC blk → Tracers m addrNTN blk e → (NodeToNodeVersion → Codecs blk addrNTN e m bCS bCS bBF bBF bTX bKA bPS) → ByteLimits bCS bBF bTX bKA → m ChainSyncTimeout → ChainSyncLoPBucketConfig → CSJConfig → ReportPeerMetrics m (ConnectionId addrNTN) → Handlers m addrNTN blk → Apps m addrNTN bCS bBF bTX bKA bPS NodeToNodeInitiatorResult ()
- initiator ∷ MiniProtocolParameters → NodeToNodeVersion → NodeToNodeVersionData → Apps m addr b b b b b a c → OuroborosBundleWithExpandedCtx 'InitiatorMode addr b m a Void
- initiatorAndResponder ∷ MiniProtocolParameters → NodeToNodeVersion → NodeToNodeVersionData → Apps m addr b b b b b a c → OuroborosBundleWithExpandedCtx 'InitiatorResponderMode addr b m a c
- data ChainSyncTimeout = ChainSyncTimeout {}
Handlers
data Handlers m addr blk Source #
Protocol handlers for node-to-node (remote) communication
Constructors
mkHandlers ∷ ∀ m blk addrNTN addrNTC. (IOLike m, MonadTime m, MonadTimer m, LedgerSupportsMempool blk, HasTxId (GenTx blk), LedgerSupportsProtocol blk, Ord addrNTN, Hashable addrNTN) ⇒ NodeKernelArgs m addrNTN addrNTC blk → NodeKernel m addrNTN addrNTC blk → Handlers m addrNTN blk Source #
Codecs
data Codecs blk addr e m bCS bSCS bBF bSBF bTX bKA bPS Source #
Node-to-node protocol codecs needed to run Handlers
.
Constructors
Codecs | |
Fields
|
defaultCodecs ∷ ∀ m 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 Source #
Protocol codecs for the node-to-node protocols
identityCodecs ∷ 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 KeepAlive) (AnyMessage (PeerSharing addr)) Source #
Identity codecs used in tests.
Byte Limits
data ByteLimits bCS bBF bTX bKA 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 bKA Source #
Tracers
type Tracers m ntnAddr blk e = Tracers' (ConnectionId ntnAddr) ntnAddr blk e (Tracer m) Source #
A record of Tracer
s for the different protocols.
data Tracers' peer ntnAddr blk e f Source #
Constructors
Tracers | |
Fields
|
nullTracers ∷ Monad m ⇒ Tracers m ntnAddr blk e Source #
Use a nullTracer
for each protocol.
showTracers ∷ (Show blk, Show ntnAddr, Show (Header blk), Show (GenTx blk), Show (GenTxId blk), HasHeader blk, HasNestedContent Header blk) ⇒ Tracer m String → Tracers m ntnAddr blk e Source #
Applications
data Apps m addr bCS bBF bTX bKA bPS a b Source #
Applications for the node-to-node protocols
See MuxApplication
Constructors
Apps | |
Fields
|
type ClientApp m addr bytes a = NodeToNodeVersion → ExpandedInitiatorContext addr m → Channel m bytes → m (a, Maybe bytes) Source #
A node-to-node application
type ServerApp m addr bytes a = NodeToNodeVersion → ResponderContext addr → Channel m bytes → m (a, Maybe bytes) Source #
Arguments
∷ ∀ m addrNTN addrNTC blk e bCS bBF bTX bKA bPS. (IOLike m, MonadTimer m, Ord addrNTN, Exception e, LedgerSupportsProtocol blk, ShowProxy blk, ShowProxy (Header blk), ShowProxy (TxId (GenTx blk)), ShowProxy (GenTx blk)) | |
⇒ NodeKernel m addrNTN addrNTC blk | Needed for bracketing only |
→ Tracers m addrNTN blk e | |
→ (NodeToNodeVersion → Codecs blk addrNTN e m bCS bCS bBF bBF bTX bKA bPS) | |
→ ByteLimits bCS bBF bTX bKA | |
→ m ChainSyncTimeout | |
→ ChainSyncLoPBucketConfig | |
→ CSJConfig | |
→ ReportPeerMetrics m (ConnectionId addrNTN) | |
→ Handlers m addrNTN blk | |
→ Apps m addrNTN bCS bBF bTX bKA bPS NodeToNodeInitiatorResult () |
Construct the NetworkApplication
for the node-to-node protocols
Projections
initiator ∷ MiniProtocolParameters → NodeToNodeVersion → NodeToNodeVersionData → Apps m addr b b b b b a c → OuroborosBundleWithExpandedCtx 'InitiatorMode addr 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 ∷ MiniProtocolParameters → NodeToNodeVersion → NodeToNodeVersionData → Apps m addr b b b b b a c → OuroborosBundleWithExpandedCtx 'InitiatorResponderMode addr 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.
Re-exports
data ChainSyncTimeout Source #
Configurable timeouts
These are configurable for at least the following reasons.
o So that deployment and testing can use different values.
o So that a net running Praos can better cope with streaks of empty slots.
(See intersectmbo/ouroboros-network#2245
.)
Constructors
ChainSyncTimeout | |