ouroboros-network
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.TxSubmission.Inbound.V2.Registry

Synopsis

Documentation

newtype TxChannels (m :: Type -> Type) peeraddr txid tx Source #

Communication channels between TxSubmission client mini-protocol and decision logic.

Constructors

TxChannels 

Fields

type TxChannelsVar (m :: Type -> Type) peeraddr txid tx = StrictMVar m (TxChannels m peeraddr txid tx) Source #

data TxMempoolSem (m :: Type -> Type) Source #

type SharedTxStateVar (m :: Type -> Type) peeraddr txid tx = StrictTVar m (SharedTxState peeraddr txid tx) Source #

newSharedTxStateVar :: MonadSTM m => StdGen -> m (SharedTxStateVar m peeraddr txid tx) Source #

newTxChannelsVar :: MonadMVar m => m (TxChannelsVar m peeraddr txid tx) Source #

data PeerTxAPI (m :: Type -> Type) txid tx Source #

API to access PeerTxState inside PeerTxStateVar.

Constructors

PeerTxAPI 

Fields

decisionLogicThreads :: (MonadDelay m, MonadMVar m, MonadMask m, MonadAsync m, MonadFork m, Ord peeraddr, Ord txid, Hashable peeraddr) => Tracer m (TraceTxLogic peeraddr txid tx) -> Tracer m TxSubmissionCounters -> TxDecisionPolicy -> TxChannelsVar m peeraddr txid tx -> SharedTxStateVar m peeraddr txid tx -> m Void Source #

Run decisionLogicThread and drainRejectionThread.

withPeer Source #

Arguments

:: forall tx peeraddr txid idx m a. (MonadMask m, MonadMVar m, MonadSTM m, MonadMonotonicTime m, Ord txid, Show txid, Typeable txid, Ord peeraddr, Show peeraddr) 
=> Tracer m (TraceTxLogic peeraddr txid tx) 
-> TxChannelsVar m peeraddr txid tx 
-> TxMempoolSem m 
-> TxDecisionPolicy 
-> SharedTxStateVar m peeraddr txid tx 
-> TxSubmissionMempoolReader txid tx idx m 
-> TxSubmissionMempoolWriter txid tx idx m 
-> (tx -> SizeInBytes) 
-> peeraddr 
-> (PeerTxAPI m txid tx -> m a)

callback which gives access to PeerTxStateAPI

-> m a 

A bracket function which registers / de-registers a new peer in SharedTxStateVar and PeerTxStateVars, which exposes PeerTxStateAPI. PeerTxStateAPI is only safe inside the withPeer scope.