ouroboros-network-protocols:testlib
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Protocol.TxSubmission2.Examples

Synopsis

Documentation

txSubmissionClient Source #

Arguments

:: forall txid tx (m :: Type -> Type). (Ord txid, Show txid, Monad m) 
=> Tracer m (TraceEventClient txid tx) 
-> (tx -> txid) 
-> (tx -> SizeInBytes) 
-> Word16

Maximum number of unacknowledged txids allowed

-> [tx] 
-> TxSubmissionClient txid tx m () 

An example TxSubmissionClient which sends transactions from a fixed list of transactions.

It is intended to illustrate the protocol or for use in tests. The client enforces aspects of the protocol. It will fail with a protocol error if the peer asks for a transaction which is not in the unacknowledged set. The unacknowledged set is managed such that things are removed after having been requested. The net effect is that the peer can only ask for * If a server will ask for the same transaction twice.

txSubmissionServer Source #

Arguments

:: forall txid tx (m :: Type -> Type). (Ord txid, Monad m) 
=> Tracer m (TraceEventServer txid tx) 
-> (tx -> txid) 
-> Word16

Maximum number of unacknowledged txids

-> Word16

Maximum number of txids to request in any one go

-> Word16

Maximum number of txs to request in any one go

-> TxSubmissionServerPipelined txid tx m [tx] 

An example transaction submission server.

It collects and returns all the transactions that the client submits. This is suitable for tests and using as a starting template for a full version.

Note that this example does not respect any overall byte limit on pipelining and does not make any delta-Q info to optimises the pipelining decisions.

data TraceEventClient txid tx Source #

Constructors

EventRecvMsgRequestTxIds (StrictSeq txid) (Map txid tx) [tx] NumTxIdsToAck NumTxIdsToReq 
EventRecvMsgRequestTxs (StrictSeq txid) (Map txid tx) [tx] [txid] 

Instances

Instances details
(Show txid, Show tx) => Show (TraceEventClient txid tx) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Examples

Methods

showsPrec :: Int -> TraceEventClient txid tx -> ShowS #

show :: TraceEventClient txid tx -> String #

showList :: [TraceEventClient txid tx] -> ShowS #

data TraceEventServer txid tx Source #

Constructors

EventRequestTxIdsBlocking (ServerState txid tx) NumTxIdsToAck NumTxIdsToReq 
EventRequestTxIdsPipelined (ServerState txid tx) NumTxIdsToAck NumTxIdsToReq 
EventRequestTxsPipelined (ServerState txid tx) [txid] 

Instances

Instances details
(Show txid, Show tx) => Show (TraceEventServer txid tx) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Examples

Methods

showsPrec :: Int -> TraceEventServer txid tx -> ShowS #

show :: TraceEventServer txid tx -> String #

showList :: [TraceEventServer txid tx] -> ShowS #