ouroboros-network-framework-0.1.0.1
Safe Haskell None
Language Haskell2010

Ouroboros.Network.ErrorPolicy

Description

Error policies, and integration with SuspendDecision -semigroup action on PeerState .

Synopsis

Documentation

data ErrorPolicies Source #

List of error policies for exception handling and a policy for handing application return values.

Constructors

ErrorPolicies

Fields

data ErrorPolicy where Source #

Constructors

ErrorPolicy

Fields

evalErrorPolicies :: forall e. Exception e => e -> [ ErrorPolicy ] -> Maybe ( SuspendDecision DiffTime ) Source #

Evaluate a list of ErrorPolicy s; If none of them applies this function returns Nothing , in this case the exception will be traced and not thrown.

type CompleteApplication m s addr r = Result addr r -> s -> STM m ( CompleteApplicationResult m addr s) Source #

Complete a connection, which receive application result (or exception).

data Result addr r where Source #

Result of the connection thread. It's either result of an application, or an exception thrown by it.

Constructors

ApplicationResult :: ! Time -> !addr -> !r -> Result addr r
Connected :: ! Time -> !addr -> Result addr r
ConnectionError :: Exception e => ! Time -> !addr -> !e -> Result addr r
ApplicationError :: Exception e => ! Time -> !addr -> !e -> Result addr r

Traces

data ErrorPolicyTrace Source #

Trace data for error policies

Constructors

ErrorPolicySuspendPeer ( Maybe (ConnectionOrApplicationExceptionTrace SomeException )) DiffTime DiffTime

suspending peer with a given exception until

ErrorPolicySuspendConsumer ( Maybe (ConnectionOrApplicationExceptionTrace SomeException )) DiffTime

suspending consumer until

ErrorPolicyLocalNodeError (ConnectionOrApplicationExceptionTrace SomeException )

caught a local exception

ErrorPolicyResumePeer

resume a peer (both consumer and producer)

ErrorPolicyKeepSuspended

consumer was suspended until producer will resume

ErrorPolicyResumeConsumer

resume consumer

ErrorPolicyResumeProducer

resume producer

ErrorPolicyUnhandledApplicationException SomeException

an application throwed an exception, which was not handled by any ErrorPolicy .

ErrorPolicyUnhandledConnectionException SomeException

connect throwed an exception, which was not handled by any ErrorPolicy .

ErrorPolicyAcceptException IOException

accept throwed an exception

Re-exports of PeerState

data SuspendDecision t Source #

Semigroup of commands which acts on PeerState . The t variable might be initiated to DiffTime or Time m .

This semigroup allows to either suspend both consumer and producer or just the consumer part.

Constructors

SuspendPeer !t !t

peer is suspend; The first t is the time until which a local producer is suspended, the second one is the time until which a local consumer is suspended.

SuspendConsumer !t

suspend local consumer / initiator side until t (this mean we are not allowing to communicate with the producer / responder of a remote peer).

Throw

throw an error from the main thread.

Instances

Instances details
Functor SuspendDecision Source #
Instance details

Defined in Ouroboros.Network.Subscription.PeerState

Eq t => Eq ( SuspendDecision t) Source #
Instance details

Defined in Ouroboros.Network.Subscription.PeerState

Ord t => Ord ( SuspendDecision t) Source #
Instance details

Defined in Ouroboros.Network.Subscription.PeerState

Show t => Show ( SuspendDecision t) Source #
Instance details

Defined in Ouroboros.Network.Subscription.PeerState

Ord t => Semigroup ( SuspendDecision t) Source #

The semigroup instance. Note that composing SuspendPeer with SuspendConsumer gives SuspendPeer . SuspendPeer and SuspendConsumer form a sub-semigroup.

Instance details

Defined in Ouroboros.Network.Subscription.PeerState

SAct ( SuspendDecision Time ) ( Maybe ( PeerState m)) Source #

Action of SuspendDecision on Maybe PeerState . We use this action together with alter function.

Note: SuspendDecision does not act on PeerState , only the sub-semigroup generated by SuspendConsumer and SuspendPeer does.

Instance details

Defined in Ouroboros.Network.Subscription.PeerState