ouroboros-network-framework
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Driver.Limits

Description

Drivers for running Peers.

Synopsis

Limits

data ProtocolSizeLimits ps bytes #

Constructors

ProtocolSizeLimits 

Fields

newtype ProtocolTimeLimits ps #

Constructors

ProtocolTimeLimits 

Fields

Normal peers

runPeerWithLimits :: forall ps (st :: ps) (pr :: PeerRole) failure bytes m a. (MonadAsync m, MonadFork m, MonadMask m, MonadThrow (STM m), MonadTimer m, ShowProxy ps, forall (st' :: ps) stok. stok ~ StateToken st' => Show stok, Show failure) => Tracer m (TraceSendRecv ps) -> Codec ps failure m bytes -> ProtocolSizeLimits ps bytes -> ProtocolTimeLimits ps -> Channel m bytes -> Peer ps pr 'NonPipelined st m a -> m (a, Maybe bytes) Source #

runPipelinedPeerWithLimits :: forall ps (st :: ps) (pr :: PeerRole) failure bytes m a. (MonadAsync m, MonadFork m, MonadMask m, MonadTimer m, MonadThrow (STM m), ShowProxy ps, forall (st' :: ps) stok. stok ~ StateToken st' => Show stok, Show failure) => Tracer m (TraceSendRecv ps) -> Codec ps failure m bytes -> ProtocolSizeLimits ps bytes -> ProtocolTimeLimits ps -> Channel m bytes -> PeerPipelined ps pr st m a -> m (a, Maybe bytes) Source #

Run a pipelined peer with the given channel via the given codec.

This runs the peer to completion (if the protocol allows for termination).

Unlike normal peers, running pipelined peers rely on concurrency, hence the MonadAsync constraint.

data TraceSendRecv ps where Source #

Structured Tracer output for runPeer and derivitives.

Constructors

TraceSendMsg :: forall ps. AnyMessage ps -> TraceSendRecv ps 
TraceRecvMsg :: forall ps. AnyMessage ps -> TraceSendRecv ps 

Instances

Instances details
Show (AnyMessage ps) => Show (TraceSendRecv ps) Source # 
Instance details

Defined in Ouroboros.Network.Driver.Simple

Driver utilities

driverWithLimits :: forall ps (pr :: PeerRole) failure bytes (m :: Type -> Type). (MonadThrow m, ShowProxy ps, forall (st' :: ps) tok. tok ~ StateToken st' => Show tok, Show failure) => Tracer m (TraceSendRecv ps) -> TimeoutFn m -> Codec ps failure m bytes -> ProtocolSizeLimits ps bytes -> ProtocolTimeLimits ps -> Channel m bytes -> Driver ps pr (Maybe bytes) m Source #

runConnectedPeersWithLimits :: forall ps (pr :: PeerRole) (st :: ps) failure bytes m a b. (MonadAsync m, MonadFork m, MonadMask m, MonadTimer m, MonadThrow (STM m), Exception failure, ShowProxy ps, forall (st' :: ps) sing. sing ~ StateToken st' => Show sing) => m (Channel m bytes, Channel m bytes) -> Tracer m (Role, TraceSendRecv ps) -> Codec ps failure m bytes -> ProtocolSizeLimits ps bytes -> ProtocolTimeLimits ps -> Peer ps pr 'NonPipelined st m a -> Peer ps (FlipAgency pr) 'NonPipelined st m b -> m (a, b) Source #

Run two Peers via a pair of connected Channels and a common Codec. The client side is using driverWithLimits.

This is useful for tests and quick experiments.

The first argument is expected to create two channels that are connected, for example createConnectedChannels.

runConnectedPipelinedPeersWithLimits :: forall ps (pr :: PeerRole) (st :: ps) failure bytes m a b. (MonadAsync m, MonadFork m, MonadMask m, MonadTimer m, MonadThrow (STM m), Exception failure, ShowProxy ps, forall (st' :: ps) sing. sing ~ StateToken st' => Show sing) => m (Channel m bytes, Channel m bytes) -> Tracer m (Role, TraceSendRecv ps) -> Codec ps failure m bytes -> ProtocolSizeLimits ps bytes -> ProtocolTimeLimits ps -> PeerPipelined ps pr st m a -> Peer ps (FlipAgency pr) 'NonPipelined st m b -> m (a, b) Source #

Run two Peers via a pair of connected Channels and a common Codec. The client side is using driverWithLimits.

This is useful for tests and quick experiments.

The first argument is expected to create two channels that are connected, for example createConnectedChannels.