ouroboros-network-framework-0.13.1.0: Ouroboros network framework
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

Instances

Instances details
Show ErrorPolicy Source # 
Instance details

Defined in Ouroboros.Network.ErrorPolicy

evalErrorPolicies ∷ ∀ e. Exception e ⇒ e → [ErrorPolicy] → Maybe (SuspendDecision DiffTime) Source #

Evaluate a list of ErrorPolicys; 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 CompleteApplicationResult m addr s Source #

Constructors

CompleteApplicationResult 

Fields

Instances

Instances details
Functor (CompleteApplicationResult m addr) Source # 
Instance details

Defined in Ouroboros.Network.ErrorPolicy

Methods

fmap ∷ (a → b) → CompleteApplicationResult m addr a → CompleteApplicationResult m addr b #

(<$) ∷ a → CompleteApplicationResult m addr b → CompleteApplicationResult m addr a #

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 
ConnectionErrorException e ⇒ !Time → !addr → !e → Result addr r 
ApplicationErrorException e ⇒ !Time → !addr → !e → Result addr r 

completeApplicationTx ∷ ∀ m addr a. (MonadAsync m, Ord addr, Ord (Async m ())) ⇒ ErrorPoliciesCompleteApplication m (PeerStates m addr) addr a Source #

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

Instances

Instances details
Show ErrorPolicyTrace Source # 
Instance details

Defined in Ouroboros.Network.ErrorPolicy

traceErrorPolicyEither (ConnectionOrApplicationExceptionTrace SomeException) r → SuspendDecision DiffTimeMaybe ErrorPolicyTrace Source #

data WithAddr addr a Source #

Constructors

WithAddr 

Fields

Instances

Instances details
(Show addr, Show a) ⇒ Show (WithAddr addr a) Source # 
Instance details

Defined in Ouroboros.Network.ErrorPolicy

Methods

showsPrecIntWithAddr addr a → ShowS #

showWithAddr addr a → String #

showList ∷ [WithAddr addr a] → ShowS #

Re-exports of PeerState

data PeerStates m addr Source #

Map from addresses to PeerStates; it will be be shared in a StrictTVar.

Abstracting t is useful for tests, the IO version will use Time IO.

Instances

Instances details
Show addr ⇒ Show (PeerStates IO addr) Source # 
Instance details

Defined in Ouroboros.Network.Subscription.PeerState

Methods

showsPrecIntPeerStates IO addr → ShowS #

showPeerStates IO addr → String #

showList ∷ [PeerStates IO addr] → ShowS #

Eq addr ⇒ Eq (PeerStates IO addr) Source # 
Instance details

Defined in Ouroboros.Network.Subscription.PeerState

Methods

(==)PeerStates IO addr → PeerStates IO addr → Bool #

(/=)PeerStates IO addr → PeerStates IO addr → Bool #

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

Methods

fmap ∷ (a → b) → SuspendDecision a → SuspendDecision b #

(<$) ∷ a → SuspendDecision b → SuspendDecision a #

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

Show t ⇒ Show (SuspendDecision t) 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

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