ouroboros-network-0.1.0.0: A networking layer for the Ouroboros blockchain protocol
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Protocol.TxSubmission2.Server

Description

A view of the transaction submission protocol from the point of view of the server.

This provides a view that uses less complex types and should be easier to use than the underlying typed protocol itself.

For execution, a conversion into the typed protocol is provided.

Synopsis

Protocol type for the server

The protocol states from the point of view of the server.

data TxSubmissionServerPipelined txid tx m a where Source #

Constructors

TxSubmissionServerPipelined ∷ m (ServerStIdle Z txid tx m a) → TxSubmissionServerPipelined txid tx m a 

data ServerStIdle (n ∷ N) txid tx m a where Source #

Constructors

SendMsgRequestTxIdsBlocking 

Fields

SendMsgRequestTxIdsPipelinedWord16Word16 → m (ServerStIdle (S n) txid tx m a) → ServerStIdle n txid tx m a 
SendMsgRequestTxsPipelined ∷ [txid] → m (ServerStIdle (S n) txid tx m a) → ServerStIdle n txid tx m a 
CollectPipelinedMaybe (ServerStIdle (S n) txid tx m a) → (Collect txid tx → m (ServerStIdle n txid tx m a)) → ServerStIdle (S n) txid tx m a

Collect a pipelined result.

data Collect txid tx Source #

This is the type of the pipelined results, collected by CollectPipelined. This protocol can pipeline requests for transaction ids and transactions, so we use a sum of either for collecting the responses.

Constructors

CollectTxIds Word16 [(txid, TxSizeInBytes)]

The result of SendMsgRequestTxIdsPipelined. It also carries the number of txids originally requested.

CollectTxs [txid] [tx]

The result of SendMsgRequestTxsPipelined. The actual reply only contains the transactions sent, but this pairs them up with the transactions requested. This is because the peer can determine that some transactions are no longer needed.

type TxSizeInBytes = Word32 Source #

Transactions are typically not big, but in principle in future we could have ones over 64k large.

Execution as a typed protocol

txSubmissionServerPeerPipelined ∷ ∀ txid tx m a. Functor m ⇒ TxSubmissionServerPipelined txid tx m a → PeerPipelined (TxSubmission2 txid tx) AsServer StInit m a Source #

Transform a TxSubmissionServerPipelined into a PeerPipelined.