ouroboros-network-protocols
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Protocol.TxSubmission2.Client

Description

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

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.

Constructors

TxSubmissionClient 

Fields

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.

Constructors

ClientStIdle 

Fields

data ClientStTxIds (blocking :: StBlockingStyle) txid tx (m :: Type -> Type) a where Source #

Constructors

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 #

Constructors

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.

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.

Constructors

BlockingReply :: forall a. NonEmpty a -> BlockingReplyList 'StBlocking a 
NonBlockingReply :: forall a. [a] -> BlockingReplyList 'StNonBlocking a 

Instances

Instances details
NFData a => NFData (BlockingReplyList blocking a) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Methods

rnf :: BlockingReplyList blocking a -> () #

Show a => Show (BlockingReplyList blocking a) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Methods

showsPrec :: Int -> BlockingReplyList blocking a -> ShowS #

show :: BlockingReplyList blocking a -> String #

showList :: [BlockingReplyList blocking a] -> ShowS #

Eq a => Eq (BlockingReplyList blocking a) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Methods

(==) :: 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.