Safe Haskell | None |
---|---|
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 :: Type -> Type) a = TxSubmissionClient {
- runTxSubmissionClient :: m (ClientStIdle txid tx m a)
- data ClientStIdle txid tx (m :: Type -> Type) a = ClientStIdle {
- recvMsgRequestTxIds :: forall (blocking :: StBlockingStyle). SingBlockingStyle blocking -> NumTxIdsToAck -> NumTxIdsToReq -> m (ClientStTxIds blocking txid tx m a)
- recvMsgRequestTxs :: [txid] -> m (ClientStTxs txid tx m a)
- data ClientStTxIds (blocking :: StBlockingStyle) txid tx (m :: Type -> Type) a where
- SendMsgReplyTxIds :: forall (blocking :: StBlockingStyle) txid tx (m :: Type -> Type) a. BlockingReplyList blocking (txid, SizeInBytes) -> ClientStIdle txid tx m a -> ClientStTxIds blocking txid tx m a
- SendMsgDone :: forall a txid tx (m :: Type -> Type). a -> ClientStTxIds 'StBlocking txid tx m a
- data ClientStTxs txid tx (m :: Type -> Type) a where
- SendMsgReplyTxs :: forall tx txid (m :: Type -> Type) a. [tx] -> ClientStIdle txid tx m a -> ClientStTxs txid tx m a
- type TxSizeInBytes = SizeInBytes
- data SingBlockingStyle (k :: StBlockingStyle) where
- data BlockingReplyList (blocking :: StBlockingStyle) a where
- BlockingReply :: forall a. NonEmpty a -> BlockingReplyList 'StBlocking a
- NonBlockingReply :: forall a. [a] -> BlockingReplyList 'StNonBlocking a
- txSubmissionClientPeer :: forall txid tx (m :: Type -> Type) a. Monad m => TxSubmissionClient txid tx m a -> Client (TxSubmission2 txid tx) 'NonPipelined ('StInit :: TxSubmission2 txid tx) m a
Protocol type for the client
The protocol states from the point of view of the client.
newtype TxSubmissionClient txid tx (m :: Type -> Type) 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 :: Type -> Type) 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 :: StBlockingStyle) txid tx (m :: Type -> Type) a where Source #
SendMsgReplyTxIds :: forall (blocking :: StBlockingStyle) txid tx (m :: Type -> Type) a. BlockingReplyList blocking (txid, SizeInBytes) -> ClientStIdle txid tx m a -> ClientStTxIds blocking txid tx m a | |
SendMsgDone :: forall a txid tx (m :: Type -> Type). 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 :: Type -> Type) a where Source #
SendMsgReplyTxs :: forall tx txid (m :: Type -> Type) a. [tx] -> ClientStIdle txid tx m a -> ClientStTxs txid tx m a |
type TxSizeInBytes = SizeInBytes Source #
Deprecated: Use SizeInBytes
instead
Transactions are typically not big, but in principle in future we could have ones over 64k large.
data SingBlockingStyle (k :: StBlockingStyle) where Source #
The value level equivalent of BlockingStyle
.
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
NFData (SingBlockingStyle b) Source # | |
Defined in Ouroboros.Network.Protocol.TxSubmission2.Type rnf :: SingBlockingStyle b -> () # | |
Show (SingBlockingStyle b) Source # | |
Defined in Ouroboros.Network.Protocol.TxSubmission2.Type showsPrec :: Int -> SingBlockingStyle b -> ShowS # show :: SingBlockingStyle b -> String # showList :: [SingBlockingStyle b] -> ShowS # | |
Eq (SingBlockingStyle b) Source # | |
Defined in Ouroboros.Network.Protocol.TxSubmission2.Type (==) :: SingBlockingStyle b -> SingBlockingStyle b -> Bool # (/=) :: SingBlockingStyle b -> SingBlockingStyle b -> Bool # |
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 :: forall a. NonEmpty a -> BlockingReplyList 'StBlocking a | |
NonBlockingReply :: forall a. [a] -> BlockingReplyList 'StNonBlocking a |
Instances
NFData a => NFData (BlockingReplyList blocking a) Source # | |
Defined in Ouroboros.Network.Protocol.TxSubmission2.Type rnf :: BlockingReplyList blocking a -> () # | |
Show a => Show (BlockingReplyList blocking a) Source # | |
Defined in Ouroboros.Network.Protocol.TxSubmission2.Type showsPrec :: Int -> BlockingReplyList blocking a -> ShowS # show :: BlockingReplyList blocking a -> String # showList :: [BlockingReplyList blocking a] -> ShowS # | |
Eq a => Eq (BlockingReplyList blocking a) Source # | |
Defined in Ouroboros.Network.Protocol.TxSubmission2.Type (==) :: BlockingReplyList blocking a -> BlockingReplyList blocking a -> Bool # (/=) :: BlockingReplyList blocking a -> BlockingReplyList blocking a -> Bool # |
Execution as a typed protocol
txSubmissionClientPeer :: forall txid tx (m :: Type -> Type) a. Monad m => TxSubmissionClient txid tx m a -> Client (TxSubmission2 txid tx) 'NonPipelined ('StInit :: TxSubmission2 txid tx) m a Source #
A non-pipelined Peer
representing the TxSubmissionClient
.