Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
A view of the transaction submission protocol from the point of view of the client.
This provides a view that uses less complex types and should be easier to use than the underlying typed protocol itself.
For execution,
txSubmissionClientPeer
is provided for conversion
into the typed protocol.
Synopsis
-
newtype
TxSubmissionClient
txid tx m a =
TxSubmissionClient
{
- runTxSubmissionClient :: m ( ClientStIdle txid tx m a)
-
data
ClientStIdle
txid tx m a =
ClientStIdle
{
- recvMsgRequestTxIds :: forall blocking. TokBlockingStyle blocking -> Word16 -> Word16 -> m ( ClientStTxIds blocking txid tx m a)
- recvMsgRequestTxs :: [txid] -> m ( ClientStTxs txid tx m a)
-
data
ClientStTxIds
blocking txid tx m a
where
- SendMsgReplyTxIds :: BlockingReplyList blocking (txid, TxSizeInBytes ) -> ClientStIdle txid tx m a -> ClientStTxIds blocking txid tx m a
- SendMsgDone :: a -> ClientStTxIds StBlocking txid tx m a
-
data
ClientStTxs
txid tx m a
where
- SendMsgReplyTxs :: [tx] -> ClientStIdle txid tx m a -> ClientStTxs txid tx m a
- type TxSizeInBytes = Word32
- data TokBlockingStyle (k :: StBlockingStyle ) where
-
data
BlockingReplyList
(blocking ::
StBlockingStyle
) a
where
- BlockingReply :: NonEmpty a -> BlockingReplyList StBlocking a
- NonBlockingReply :: [a] -> BlockingReplyList StNonBlocking a
- txSubmissionClientPeer :: forall txid tx m a. Monad m => TxSubmissionClient txid tx m a -> Peer ( TxSubmission2 txid tx) AsClient StInit m a
Protocol type for the client
The protocol states from the point of view of the client.
newtype TxSubmissionClient txid tx m a Source #
The client side of the transaction submission protocol.
The peer in the client role submits transactions to the peer in the server role.
TxSubmissionClient | |
|
data ClientStIdle txid tx m a Source #
In the
StIdle
protocol state, the client does not have agency. Instead
it is waiting for:
- a request for transaction ids (blocking or non-blocking)
- a request for a given list of transactions
- a termination message
It must be prepared to handle any of these.
ClientStIdle | |
|
data ClientStTxIds blocking txid tx m a where Source #
SendMsgReplyTxIds :: BlockingReplyList blocking (txid, TxSizeInBytes ) -> ClientStIdle txid tx m a -> ClientStTxIds blocking txid tx m a | |
SendMsgDone :: a -> ClientStTxIds StBlocking txid tx m a |
In the blocking case, the client can terminate the protocol. This could be used when the client knows there will be no more transactions to submit. |
data ClientStTxs txid tx m a where Source #
SendMsgReplyTxs :: [tx] -> ClientStIdle txid tx m a -> ClientStTxs txid tx m a |
type TxSizeInBytes = Word32 Source #
Transactions are typically not big, but in principle in future we could have ones over 64k large.
data TokBlockingStyle (k :: StBlockingStyle ) where Source #
The value level equivalent of
StBlockingStyle
.
This is also used in
MsgRequestTxIds
where it is interpreted (and can be
encoded) as a
Bool
with
True
for blocking, and
False
for non-blocking.
Instances
Eq ( TokBlockingStyle b) Source # | |
Defined in Ouroboros.Network.Protocol.TxSubmission2.Type (==) :: TokBlockingStyle b -> TokBlockingStyle b -> Bool Source # (/=) :: TokBlockingStyle b -> TokBlockingStyle b -> Bool Source # |
|
Show ( TokBlockingStyle b) Source # | |
|
data BlockingReplyList (blocking :: StBlockingStyle ) a where Source #
We have requests for lists of things. In the blocking case the corresponding reply must be non-empty, whereas in the non-blocking case and empty reply is fine.
BlockingReply :: NonEmpty a -> BlockingReplyList StBlocking a | |
NonBlockingReply :: [a] -> BlockingReplyList StNonBlocking a |
Instances
Eq a => Eq ( BlockingReplyList blocking a) Source # | |
Defined in Ouroboros.Network.Protocol.TxSubmission2.Type (==) :: BlockingReplyList blocking a -> BlockingReplyList blocking a -> Bool Source # (/=) :: BlockingReplyList blocking a -> BlockingReplyList blocking a -> Bool Source # |
|
Show a => Show ( BlockingReplyList blocking a) Source # | |
|
Execution as a typed protocol
txSubmissionClientPeer :: forall txid tx m a. Monad m => TxSubmissionClient txid tx m a -> Peer ( TxSubmission2 txid tx) AsClient StInit m a Source #
A non-pipelined
Peer
representing the
TxSubmissionClient
.