| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Network.NodeToClient
Description
Intended for qualified import
Synopsis
- data Handlers m peer blk = Handlers {
- hChainSyncServer :: ResourceRegistry m -> ChainSyncServer (Serialised blk) (Point blk) (Tip blk) m ()
- hTxSubmissionServer :: LocalTxSubmissionServer (GenTx blk) (ApplyTxErr blk) m ()
- hStateQueryServer :: LocalStateQueryServer blk (Point blk) (Query blk) m ()
- mkHandlers :: forall m blk remotePeer localPeer. (IOLike m, LedgerSupportsMempool blk, QueryLedger blk) => NodeArgs m remotePeer localPeer blk -> NodeKernel m remotePeer localPeer blk -> Handlers m localPeer blk
- data Codecs' blk serialisedBlk e m bCS bTX bSQ = Codecs {
- cChainSyncCodec :: Codec (ChainSync serialisedBlk (Point blk) (Tip blk)) e m bCS
- cTxSubmissionCodec :: Codec (LocalTxSubmission (GenTx blk) (ApplyTxErr blk)) e m bTX
- cStateQueryCodec :: Codec (LocalStateQuery blk (Point blk) (Query blk)) e m bSQ
- type Codecs blk e m bCS bTX bSQ = Codecs' blk (Serialised blk) e m bCS bTX bSQ
- type DefaultCodecs blk m = Codecs' blk (Serialised blk) DeserialiseFailure m ByteString ByteString ByteString
- type ClientCodecs blk m = Codecs' blk blk DeserialiseFailure m ByteString ByteString ByteString
- defaultCodecs :: forall m blk. (MonadST m, SerialiseNodeToClientConstraints blk, ShowQuery (Query blk)) => CodecConfig blk -> BlockNodeToClientVersion blk -> DefaultCodecs blk m
- clientCodecs :: forall m blk. (MonadST m, SerialiseNodeToClientConstraints blk, ShowQuery (Query blk)) => CodecConfig blk -> BlockNodeToClientVersion blk -> ClientCodecs blk m
- identityCodecs :: (Monad m, QueryLedger 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)))
- type Tracers m peer blk e = Tracers' peer blk e (Tracer m)
- data Tracers' peer blk e f = Tracers {
- tChainSyncTracer :: f (TraceLabelPeer peer (TraceSendRecv (ChainSync (Serialised blk) (Point blk) (Tip blk))))
- tTxSubmissionTracer :: f (TraceLabelPeer peer (TraceSendRecv (LocalTxSubmission (GenTx blk) (ApplyTxErr blk))))
- tStateQueryTracer :: f (TraceLabelPeer peer (TraceSendRecv (LocalStateQuery blk (Point blk) (Query blk))))
- nullTracers :: Monad m => Tracers m peer blk e
- showTracers :: (Show peer, Show (GenTx blk), Show (ApplyTxErr blk), ShowQuery (Query blk), HasHeader blk) => Tracer m String -> Tracers m peer blk e
- type App m peer bytes a = peer -> Channel m bytes -> m (a, Maybe bytes)
- data Apps m peer bCS bTX bSQ a = Apps {
- aChainSyncServer :: App m peer bCS a
- aTxSubmissionServer :: App m peer bTX a
- aStateQueryServer :: App m peer bSQ a
- mkApps :: forall m peer blk e bCS bTX bSQ. (IOLike m, Exception e, ShowProxy blk, ShowProxy (ApplyTxErr blk), ShowProxy (Query blk), ShowProxy (GenTx blk), ShowQuery (Query blk)) => Tracers m peer blk e -> Codecs blk e m bCS bTX bSQ -> Handlers m peer blk -> Apps m peer bCS bTX bSQ ()
- responder :: NodeToClientVersion -> Apps m (ConnectionId peer) b b b a -> OuroborosApplication 'ResponderMode peer b m Void a
Handlers
data Handlers m peer blk Source #
Protocol handlers for node-to-client (local) communication
Constructors
| Handlers | |
Fields
| |
mkHandlers :: forall m blk remotePeer localPeer. (IOLike m, LedgerSupportsMempool blk, QueryLedger blk) => NodeArgs m remotePeer localPeer blk -> NodeKernel m remotePeer localPeer blk -> Handlers m localPeer blk Source #
Codecs
data Codecs' blk serialisedBlk e m bCS bTX bSQ Source #
Node-to-client protocol codecs needed to run Handlers.
Constructors
| Codecs | |
Fields
| |
type DefaultCodecs blk m = Codecs' blk (Serialised blk) DeserialiseFailure m ByteString ByteString ByteString Source #
type ClientCodecs blk m = Codecs' blk blk DeserialiseFailure m ByteString ByteString ByteString Source #
defaultCodecs :: forall m blk. (MonadST m, SerialiseNodeToClientConstraints blk, ShowQuery (Query blk)) => CodecConfig blk -> BlockNodeToClientVersion blk -> DefaultCodecs 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.
clientCodecs :: forall m blk. (MonadST m, SerialiseNodeToClientConstraints blk, ShowQuery (Query blk)) => CodecConfig blk -> BlockNodeToClientVersion blk -> ClientCodecs blk m Source #
Protocol codecs for the node-to-client protocols which serialise deserialise blocks in chain-sync/ protocol.
identityCodecs :: (Monad m, QueryLedger 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))) 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 #
Constructors
| Tracers | |
Fields
| |
nullTracers :: Monad m => Tracers m peer blk e Source #
Use a nullTracer for each protocol.
showTracers :: (Show peer, Show (GenTx blk), Show (ApplyTxErr blk), ShowQuery (Query blk), HasHeader blk) => Tracer m String -> Tracers 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 a Source #
Applications for the node-to-client (i.e., local) protocols
See MuxApplication
Constructors
| Apps | |
Fields
| |
mkApps :: forall m peer blk e bCS bTX bSQ. (IOLike m, Exception e, ShowProxy blk, ShowProxy (ApplyTxErr blk), ShowProxy (Query blk), ShowProxy (GenTx blk), ShowQuery (Query blk)) => Tracers m peer blk e -> Codecs blk e m bCS bTX bSQ -> Handlers m peer blk -> Apps m peer bCS bTX bSQ () Source #
Construct the NetworkApplication for the node-to-client protocols
Projections
responder :: NodeToClientVersion -> Apps m (ConnectionId peer) b b b a -> OuroborosApplication 'ResponderMode peer b m Void a Source #
A projection from NetworkApplication to a server-side
OuroborosApplication for the node-to-client protocols.