ouroboros-network
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.NodeToNode

Description

This is the starting point for a module that will bring together the overall node to node protocol, as a collection of mini-protocols.

Synopsis

Documentation

nodeToNodeProtocols Source #

Arguments

:: forall (muxMode :: Mode) initiatorCtx responderCtx bytes (m :: Type -> Type) a b. MiniProtocolParameters 
-> NodeToNodeProtocols muxMode initiatorCtx responderCtx bytes m a b 
-> NodeToNodeVersion 
-> PeerSharing

Node's own PeerSharing value

-> OuroborosBundle muxMode initiatorCtx responderCtx bytes m a b 

Make an OuroborosApplication for the bundle of mini-protocols that make up the overall node-to-node protocol.

This function specifies the wire format protocol numbers.

The application specific protocol numbers start from 2. The MiniProtocolNum 0 is reserved for the Handshake protocol, while MiniProtocolNum 1 is reserved for DeltaQ messages. Handshake protocol is not included in NodeToNodeProtocols as it runs before mux is started but it reusing MuxBearer to send and receive messages. Only when the handshake protocol succeeds, we will know which protocols to run / multiplex.

These are chosen to not overlap with the node to client protocol numbers (and the handshake protocol number). This is not essential for correctness, but is helpful to allow a single shared implementation of tools that can analyse both protocols, e.g. wireshark plugins.

data NodeToNodeProtocols (appType :: Mode) initiatorCtx responderCtx bytes (m :: Type -> Type) a b Source #

Constructors

NodeToNodeProtocols 

Fields

type NodeToNodeProtocolsWithExpandedCtx (appType :: Mode) ntnAddr bytes (m :: Type -> Type) a b = NodeToNodeProtocols appType (ExpandedInitiatorContext ntnAddr m) (ResponderContext ntnAddr) bytes m a b Source #

type NodeToNodeProtocolsWithMinimalCtx (appType :: Mode) ntnAddr bytes (m :: Type -> Type) a b = NodeToNodeProtocols appType (MinimalInitiatorContext ntnAddr) (ResponderContext ntnAddr) bytes m a b Source #

data MiniProtocolParameters Source #

Constructors

MiniProtocolParameters 

Fields

data NodeToNodeVersion #

Enumeration of node to node protocol versions.

Constructors

NodeToNodeV_13

NodeToNodeV_8 -- ^ Changes: -- -- * Enable block diffusion pipelining in ChainSync and BlockFetch logic. | NodeToNodeV_9 -- ^ Changes: -- -- * Enable CardanoNodeToNodeVersion6, i.e., Babbage | NodeToNodeV_10 -- ^ Changes: -- -- * Enable full duplex connections. | NodeToNodeV_11 -- ^ Changes: -- -- * Adds a new extra parameter to handshake: PeerSharing -- This version is needed to support the new Peer Sharing miniprotocol -- older versions that are negotiated will appear as not participating -- in Peer Sharing to newer versions. -- * Adds query to NodeToClientVersionData. | NodeToNodeV_12 -- ^ No changes. -- -- (In the past, this enabled Conway, but the negotiated NodeToNodeVersion -- no longer en-/disables eras.)

NodeToNodeV_14

Chang+1 HF

Instances

Instances details
NFData NodeToNodeVersion 
Instance details

Defined in Ouroboros.Network.NodeToNode.Version

Methods

rnf :: NodeToNodeVersion -> () #

Bounded NodeToNodeVersion 
Instance details

Defined in Ouroboros.Network.NodeToNode.Version

Enum NodeToNodeVersion 
Instance details

Defined in Ouroboros.Network.NodeToNode.Version

Generic NodeToNodeVersion 
Instance details

Defined in Ouroboros.Network.NodeToNode.Version

Associated Types

type Rep NodeToNodeVersion 
Instance details

Defined in Ouroboros.Network.NodeToNode.Version

type Rep NodeToNodeVersion = D1 ('MetaData "NodeToNodeVersion" "Ouroboros.Network.NodeToNode.Version" "ouroboros-network-api-0.11.0.0-inplace" 'False) (C1 ('MetaCons "NodeToNodeV_13" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NodeToNodeV_14" 'PrefixI 'False) (U1 :: Type -> Type))
Show NodeToNodeVersion 
Instance details

Defined in Ouroboros.Network.NodeToNode.Version

Eq NodeToNodeVersion 
Instance details

Defined in Ouroboros.Network.NodeToNode.Version

Ord NodeToNodeVersion 
Instance details

Defined in Ouroboros.Network.NodeToNode.Version

type Rep NodeToNodeVersion 
Instance details

Defined in Ouroboros.Network.NodeToNode.Version

type Rep NodeToNodeVersion = D1 ('MetaData "NodeToNodeVersion" "Ouroboros.Network.NodeToNode.Version" "ouroboros-network-api-0.11.0.0-inplace" 'False) (C1 ('MetaCons "NodeToNodeV_13" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NodeToNodeV_14" 'PrefixI 'False) (U1 :: Type -> Type))

data NetworkConnectTracers addr vNumber #

Tracer used by connectToNode (and derivatives, like connectTo or 'Ouroboros.Network.NodeToClient.connectTo).

Constructors

NetworkConnectTracers 

Fields

data NetworkServerTracers addr vNumber #

Tracers required by a server which handles inbound connections.

Constructors

NetworkServerTracers 

Fields

data NetworkMutableState addr #

Mutable state maintained by the network component.

Constructors

NetworkMutableState 

Fields

data AcceptedConnectionsLimit #

Policy which governs how to limit the number of accepted connections.

Constructors

AcceptedConnectionsLimit 

Fields

withServer Source #

Arguments

:: SocketSnocket 
-> NetworkServerTracers SockAddr NodeToNodeVersion 
-> NetworkMutableState SockAddr 
-> AcceptedConnectionsLimit 
-> Socket

a configured socket to be used be the server. The server will call bind and listen methods but it will not set any socket or tcp options on it.

-> Versions NodeToNodeVersion NodeToNodeVersionData (OuroborosApplicationWithMinimalCtx 'ResponderMode SockAddr ByteString IO a b) 
-> ErrorPolicies 
-> IO Void 

A specialised version of withServerNode. It forks a thread which runs an accept loop (server thread):

  • when the server thread throws an exception the main thread rethrows it (by wait)
  • when an async exception is thrown to kill the main thread the server thread will be cancelled as well (by withAsync)

P2P Governor

data PeerAdvertise #

Should this peer be advertised to other peers asking for known peers? For certain peers specified by configuration it would be an appropriate policy to keep them private.

Instances

Instances details
FromJSON PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

ToJSON PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

Generic PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

Associated Types

type Rep PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

type Rep PeerAdvertise = D1 ('MetaData "PeerAdvertise" "Ouroboros.Network.PeerSelection.PeerAdvertise" "ouroboros-network-api-0.11.0.0-inplace" 'False) (C1 ('MetaCons "DoNotAdvertisePeer" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DoAdvertisePeer" 'PrefixI 'False) (U1 :: Type -> Type))
Show PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

Eq PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

Ord PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

type Rep PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

type Rep PeerAdvertise = D1 ('MetaData "PeerAdvertise" "Ouroboros.Network.PeerSelection.PeerAdvertise" "ouroboros-network-api-0.11.0.0-inplace" 'False) (C1 ('MetaCons "DoNotAdvertisePeer" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DoAdvertisePeer" 'PrefixI 'False) (U1 :: Type -> Type))

data PeerSelectionTargets Source #

Adjustable targets for the peer selection mechanism.

These are used by the peer selection governor as targets. They are used by the peer churn governor loop as knobs to adjust, to influence the peer selection governor.

The known, established and active peer targets are targets both from below and from above: the governor will attempt to grow or shrink the sets to hit these targets.

Unlike the other targets, the root peer target is "one sided", it is only a target from below. The governor does not try to shrink the root set to hit it, it simply stops looking for more.

There is also an implicit target that enough local root peers are selected as active. This comes from the configuration for local roots, and is not an independently adjustable target.

Constructors

PeerSelectionTargets 

Fields

Subscription Workers

IP subscription worker

data IPSubscriptionTarget #

Constructors

IPSubscriptionTarget 

Fields

data NetworkSubscriptionTracers (withIPList :: Type -> Type) addr vNumber Source #

IP subscription tracers.

Constructors

NetworkSubscriptionTracers 

Fields

nullNetworkSubscriptionTracers :: forall (withIPList :: Type -> Type) addr vNumber. NetworkSubscriptionTracers withIPList addr vNumber Source #

data SubscriptionParams a target #

ipSubscriptionWorker and dnsSubscriptionWorker parameters

Constructors

SubscriptionParams 

Fields

DNS subscription worker

data NetworkDNSSubscriptionTracers vNumber addr Source #

DNS subscription tracers.

Constructors

NetworkDNSSubscriptionTracers 

Fields

Versions

newtype Versions vNum vData r #

The version map supported by the local agent keyed on the version identifier.

Each Version contains a function which takes negotiated version data and returns negotiated application (the r type variable).

If one needs to combine multiple versions the simplest way is to use one of the combinators: foldMapVersions, combineVersions or the Semigroup instance directly:

fold $ (simpleSingletonVersions ...)
      :| [ (simpleSingletonVersions ...)
         , (simpleSingletonVersions ...)
         , ...
         ]

Constructors

Versions 

Fields

Instances

Instances details
Functor (Versions vNum extra) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Version

Methods

fmap :: (a -> b) -> Versions vNum extra a -> Versions vNum extra b #

(<$) :: a -> Versions vNum extra b -> Versions vNum extra a #

Ord vNum => Semigroup (Versions vNum vData r) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Version

Methods

(<>) :: Versions vNum vData r -> Versions vNum vData r -> Versions vNum vData r #

sconcat :: NonEmpty (Versions vNum vData r) -> Versions vNum vData r #

stimes :: Integral b => b -> Versions vNum vData r -> Versions vNum vData r #

data DiffusionMode #

The flag which indicates whether the node runs only initiator or both initiator or responder node.

This data structure has two proposes:

  • instruct the diffusion layer if it should listen on incoming connections;
  • it is communicated via NodeToNodeVersionData during handshake negotiation. In non-p2p mode we always send InitiatorOnlyDiffusionMode, in p2p mode we send exactly what the diffusion is given. In non-p2p mode every connection outbound port is ephemeral, the remote side cannot connect to it, however in p2p mode the outbound port is actually the port on which the node is listening (if it runs in InitiatorAndResponderDiffusionMode).

simpleSingletonVersions :: vNum -> vData -> r -> Versions vNum vData r #

Singleton smart constructor for Versions.

foldMapVersions :: (Ord vNum, Foldable f, HasCallStack) => (x -> Versions vNum extra r) -> f x -> Versions vNum extra r #

Useful for folding multiple Versions.

A foldMap restricted to the Versions Semigroup.

PRECONDITION: f x is non-empty.

combineVersions :: (Ord vNum, Foldable f, HasCallStack) => f (Versions vNum extra r) -> Versions vNum extra r #

Codecs

nodeToNodeHandshakeCodec :: forall (m :: Type -> Type). MonadST m => Codec (Handshake NodeToNodeVersion Term) DeserialiseFailure m ByteString #

Handshake codec for the node-to-node protocol suite.

Re-exports

data ExpandedInitiatorContext addr (m :: Type -> Type) #

Context passed to initiator mini-protocol execution.

newtype MinimalInitiatorContext addr #

A context passed to initiator mini-protocol execution for non-p2p applications.

Instances

Instances details
Functor MinimalInitiatorContext 
Instance details

Defined in Ouroboros.Network.Context

newtype ResponderContext addr #

Context passed to each responder mini-protocol execution.

Constructors

ResponderContext 

Instances

Instances details
Functor ResponderContext 
Instance details

Defined in Ouroboros.Network.Context

Methods

fmap :: (a -> b) -> ResponderContext a -> ResponderContext b #

(<$) :: a -> ResponderContext b -> ResponderContext a #

data ConnectionId addr #

Connection is identified by local and remote address.

TODO: the type variable which this data type fills in is called peerid. We should renamed to connectionId.

Constructors

ConnectionId 

Fields

Instances

Instances details
Functor ConnectionId 
Instance details

Defined in Ouroboros.Network.ConnectionId

Methods

fmap :: (a -> b) -> ConnectionId a -> ConnectionId b #

(<$) :: a -> ConnectionId b -> ConnectionId a #

ShowProxy addr => ShowProxy (ConnectionId addr :: Type) 
Instance details

Defined in Ouroboros.Network.ConnectionId

Methods

showProxy :: Proxy (ConnectionId addr) -> String #

Generic (ConnectionId addr) 
Instance details

Defined in Ouroboros.Network.ConnectionId

Associated Types

type Rep (ConnectionId addr) 
Instance details

Defined in Ouroboros.Network.ConnectionId

type Rep (ConnectionId addr) = D1 ('MetaData "ConnectionId" "Ouroboros.Network.ConnectionId" "ouroboros-network-framework-0.14.0.0-inplace" 'False) (C1 ('MetaCons "ConnectionId" 'PrefixI 'True) (S1 ('MetaSel ('Just "localAddress") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 addr) :*: S1 ('MetaSel ('Just "remoteAddress") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 addr)))

Methods

from :: ConnectionId addr -> Rep (ConnectionId addr) x #

to :: Rep (ConnectionId addr) x -> ConnectionId addr #

Show addr => Show (ConnectionId addr) 
Instance details

Defined in Ouroboros.Network.ConnectionId

Methods

showsPrec :: Int -> ConnectionId addr -> ShowS #

show :: ConnectionId addr -> String #

showList :: [ConnectionId addr] -> ShowS #

Eq addr => Eq (ConnectionId addr) 
Instance details

Defined in Ouroboros.Network.ConnectionId

Methods

(==) :: ConnectionId addr -> ConnectionId addr -> Bool #

(/=) :: ConnectionId addr -> ConnectionId addr -> Bool #

Ord addr => Ord (ConnectionId addr)

Order first by remoteAddress then by localAddress.

Note: we relay on the fact that remoteAddress is an order preserving map (which allows us to use mapKeysMonotonic in some cases. We also relay on this particular order in liveConnections

Instance details

Defined in Ouroboros.Network.ConnectionId

Methods

compare :: ConnectionId addr -> ConnectionId addr -> Ordering #

(<) :: ConnectionId addr -> ConnectionId addr -> Bool #

(<=) :: ConnectionId addr -> ConnectionId addr -> Bool #

(>) :: ConnectionId addr -> ConnectionId addr -> Bool #

(>=) :: ConnectionId addr -> ConnectionId addr -> Bool #

max :: ConnectionId addr -> ConnectionId addr -> ConnectionId addr #

min :: ConnectionId addr -> ConnectionId addr -> ConnectionId addr #

Hashable a => Hashable (ConnectionId a) 
Instance details

Defined in Ouroboros.Network.ConnectionId

Typeable addr => NoThunks (ConnectionId addr) 
Instance details

Defined in Ouroboros.Network.ConnectionId

type Rep (ConnectionId addr) 
Instance details

Defined in Ouroboros.Network.ConnectionId

type Rep (ConnectionId addr) = D1 ('MetaData "ConnectionId" "Ouroboros.Network.ConnectionId" "ouroboros-network-framework-0.14.0.0-inplace" 'False) (C1 ('MetaCons "ConnectionId" 'PrefixI 'True) (S1 ('MetaSel ('Just "localAddress") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 addr) :*: S1 ('MetaSel ('Just "remoteAddress") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 addr)))

data ControlMessage #

Control signal sent to a mini-protocol. Expected to exit, on Continue it should continue its operation

Constructors

Continue

Continue operation.

Quiesce

Hold on, e.g. do not sent messages until resumed. This is not used for any hot protocol.

Terminate

The client is expected to terminate as soon as possible.

type ControlMessageSTM (m :: Type -> Type) = STM m ControlMessage #

ControlMessageSTM should depend on muxMode (we only need to schedule stop for initiator side). This is not done only because this would break tests, but once the old api is removed it should be possible.

data IsBigLedgerPeer #

A boolean like type. Big ledger peers are the largest SPOs which control 90% of staked stake.

Note that IsBigLedgerPeer indicates a role that peer plays in the eclipse evasion, e.g. that a peer was explicitly selected as a big ledger peer, e.g. IsNotBigLedgerPeer does not necessarily mean that the peer isn't a big ledger peer. This is because we select root peers from all ledger peers (including big ones).

newtype NumTxIdsToAck #

Constructors

NumTxIdsToAck 

Instances

Instances details
NFData NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Methods

rnf :: NumTxIdsToAck -> () #

Monoid NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Semigroup NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Bounded NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Enum NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Generic NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Associated Types

type Rep NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

type Rep NumTxIdsToAck = D1 ('MetaData "NumTxIdsToAck" "Ouroboros.Network.Protocol.TxSubmission2.Type" "ouroboros-network-protocols-0.12.0.0-inplace" 'True) (C1 ('MetaCons "NumTxIdsToAck" 'PrefixI 'True) (S1 ('MetaSel ('Just "getNumTxIdsToAck") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word16)))
Num NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Integral NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Real NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Show NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Eq NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Ord NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

NoThunks NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

type Rep NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

type Rep NumTxIdsToAck = D1 ('MetaData "NumTxIdsToAck" "Ouroboros.Network.Protocol.TxSubmission2.Type" "ouroboros-network-protocols-0.12.0.0-inplace" 'True) (C1 ('MetaCons "NumTxIdsToAck" 'PrefixI 'True) (S1 ('MetaSel ('Just "getNumTxIdsToAck") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word16)))

data Handshake (vNumber :: k) (vParams :: k1) #

The handshake mini-protocol is used initially to agree the version and associated parameters of the protocol to use for all subsequent communication.

Instances

Instances details
ShowProxy (Handshake vNumber vParams :: Type) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

Methods

showProxy :: Proxy (Handshake vNumber vParams) -> String #

(NFData vNumber, NFData vParams) => NFData (Message (Handshake vNumber vParams) from to) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

Methods

rnf :: Message (Handshake vNumber vParams) from to -> () #

(Show vNumber, Show vParams) => Show (Message (Handshake vNumber vParams) from to) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

Methods

showsPrec :: Int -> Message (Handshake vNumber vParams) from to -> ShowS #

show :: Message (Handshake vNumber vParams) from to -> String #

showList :: [Message (Handshake vNumber vParams) from to] -> ShowS #

Protocol (Handshake vNumber vParams) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

Associated Types

type StateToken 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

type StateToken = SingHandshake :: Handshake vNumber vParams -> Type
StateTokenI ('StConfirm :: Handshake vNumber vParams) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

Methods

stateToken :: StateToken ('StConfirm :: Handshake vNumber vParams) #

StateTokenI ('StDone :: Handshake vNumber vParams) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

Methods

stateToken :: StateToken ('StDone :: Handshake vNumber vParams) #

StateTokenI ('StPropose :: Handshake vNumber vParams) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

Methods

stateToken :: StateToken ('StPropose :: Handshake vNumber vParams) #

data Message (Handshake vNumber vParams) (from :: Handshake vNumber vParams) (to :: Handshake vNumber vParams) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

data Message (Handshake vNumber vParams) (from :: Handshake vNumber vParams) (to :: Handshake vNumber vParams) where
type StateToken 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

type StateToken = SingHandshake :: Handshake vNumber vParams -> Type
type StateAgency ('StConfirm :: Handshake vNumber vParams) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

type StateAgency ('StConfirm :: Handshake vNumber vParams) = 'ServerAgency
type StateAgency ('StDone :: Handshake vNumber vParams) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

type StateAgency ('StDone :: Handshake vNumber vParams) = 'NobodyAgency
type StateAgency ('StPropose :: Handshake vNumber vParams) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

type StateAgency ('StPropose :: Handshake vNumber vParams) = 'ClientAgency

data LocalAddresses addr #

Constructors

LocalAddresses 

Fields

  • laIpv4 :: Maybe addr

    Local IPv4 address to use, Nothing indicates don't use IPv4

  • laIpv6 :: Maybe addr

    Local IPv6 address to use, Nothing indicates don't use IPv6

  • laUnix :: Maybe addr

    Local Unix address to use, Nothing indicates don't use Unix sockets

Instances

Instances details
Semigroup (LocalAddresses addr) 
Instance details

Defined in Ouroboros.Network.Subscription.Worker

Show addr => Show (LocalAddresses addr) 
Instance details

Defined in Ouroboros.Network.Subscription.Worker

Eq addr => Eq (LocalAddresses addr) 
Instance details

Defined in Ouroboros.Network.Subscription.Worker

Methods

(==) :: LocalAddresses addr -> LocalAddresses addr -> Bool #

(/=) :: LocalAddresses addr -> LocalAddresses addr -> Bool #

data Socket #

Basic type for a socket.

Instances

Instances details
Show Socket 
Instance details

Defined in Network.Socket.Types

Eq Socket 
Instance details

Defined in Network.Socket.Types

Methods

(==) :: Socket -> Socket -> Bool #

(/=) :: Socket -> Socket -> Bool #

Exceptions

data ExceptionInHandler where #

Exception which where caught in the connection thread and were re-thrown in the main thread by the rethrowPolicy.

Constructors

ExceptionInHandler :: forall peerAddr. (Typeable peerAddr, Show peerAddr) => !peerAddr -> !SomeException -> ExceptionInHandler 

Error Policies and Peer state

data ErrorPolicies #

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

Constructors

ErrorPolicies 

Fields

remoteNetworkErrorPolicy :: ErrorPolicies Source #

A minimal error policy for remote peers, which only handles exceptions raised by `ouroboros-network`.

localNetworkErrorPolicy :: ErrorPolicies Source #

Error policy for local clients. This is equivalent to nullErrorPolicies, but explicit in the errors which can be caught.

We are very permissive here, and very strict in the networkErrorPolicy. After any failure the client will be killed and not penalised by this policy. This allows to restart the local client without a delay.

data ErrorPolicy where #

Constructors

ErrorPolicy 

Fields

Instances

Instances details
Show ErrorPolicy 
Instance details

Defined in Ouroboros.Network.ErrorPolicy

data SuspendDecision t #

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 
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)

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) 
Instance details

Defined in Ouroboros.Network.Subscription.PeerState

Eq t => Eq (SuspendDecision t) 
Instance details

Defined in Ouroboros.Network.Subscription.PeerState

Ord t => Ord (SuspendDecision t) 
Instance details

Defined in Ouroboros.Network.Subscription.PeerState

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

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

Traces

data TraceSendRecv ps where #

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) 
Instance details

Defined in Ouroboros.Network.Driver.Simple

data ErrorPolicyTrace #

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 
Instance details

Defined in Ouroboros.Network.ErrorPolicy

data WithIPList a #

Constructors

WithIPList 

Instances

Instances details
Show a => Show (WithIPList a) 
Instance details

Defined in Ouroboros.Network.Subscription.Ip

data WithDomainName a #

Constructors

WithDomainName 

Fields

Instances

Instances details
Show a => Show (WithDomainName a) 
Instance details

Defined in Ouroboros.Network.Subscription.Dns

data WithAddr addr a #

Constructors

WithAddr 

Fields

Instances

Instances details
(Show addr, Show a) => Show (WithAddr addr a) 
Instance details

Defined in Ouroboros.Network.ErrorPolicy

Methods

showsPrec :: Int -> WithAddr addr a -> ShowS #

show :: WithAddr addr a -> String #

showList :: [WithAddr addr a] -> ShowS #

type HandshakeTr ntnAddr ntnVersion = WithBearer (ConnectionId ntnAddr) (TraceSendRecv (Handshake ntnVersion Term)) Source #

For Consensus ThreadNet Tests

Orphan instances