Safe Haskell | None |
---|---|
Language | Haskell2010 |
Drivers for running Peer
s.
Synopsis
- data ProtocolSizeLimits ps bytes = ProtocolSizeLimits {
- sizeLimitForState :: forall (st :: ps). ActiveState st => StateToken st -> Word
- dataSize :: bytes -> Word
- newtype ProtocolTimeLimits ps = ProtocolTimeLimits {
- timeLimitForState :: forall (st :: ps). ActiveState st => StateToken st -> Maybe DiffTime
- data ProtocolLimitFailure where
- ExceededSizeLimit :: forall ps (st :: ps). (Show (StateToken st), ShowProxy ps, ActiveState st) => StateToken st -> ProtocolLimitFailure
- ExceededTimeLimit :: forall ps (st :: ps). (Show (StateToken st), ShowProxy ps, ActiveState st) => StateToken st -> ProtocolLimitFailure
- 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)
- 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)
- data TraceSendRecv ps where
- TraceSendMsg :: forall ps. AnyMessage ps -> TraceSendRecv ps
- TraceRecvMsg :: forall ps. AnyMessage ps -> TraceSendRecv ps
- 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
- 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)
- 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)
Limits
data ProtocolSizeLimits ps bytes #
ProtocolSizeLimits | |
|
newtype ProtocolTimeLimits ps #
ProtocolTimeLimits | |
|
data ProtocolLimitFailure where #
ExceededSizeLimit :: forall ps (st :: ps). (Show (StateToken st), ShowProxy ps, ActiveState st) => StateToken st -> ProtocolLimitFailure | |
ExceededTimeLimit :: forall ps (st :: ps). (Show (StateToken st), ShowProxy ps, ActiveState st) => StateToken st -> ProtocolLimitFailure |
Instances
Exception ProtocolLimitFailure | |
Show ProtocolLimitFailure | |
Defined in Ouroboros.Network.Protocol.Limits showsPrec :: Int -> ProtocolLimitFailure -> ShowS # show :: ProtocolLimitFailure -> String # showList :: [ProtocolLimitFailure] -> ShowS # |
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 #
TraceSendMsg :: forall ps. AnyMessage ps -> TraceSendRecv ps | |
TraceRecvMsg :: forall ps. AnyMessage ps -> TraceSendRecv ps |
Instances
Show (AnyMessage ps) => Show (TraceSendRecv ps) Source # | |
Defined in Ouroboros.Network.Driver.Simple showsPrec :: Int -> TraceSendRecv ps -> ShowS # show :: TraceSendRecv ps -> String # showList :: [TraceSendRecv ps] -> ShowS # |
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 Peer
s via a pair of connected Channel
s 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 Peer
s via a pair of connected Channel
s 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
.