Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
- nodeToNodeProtocols ∷ MiniProtocolParameters → NodeToNodeProtocols muxMode initiatorCtx responderCtx bytes m a b → NodeToNodeVersion → PeerSharing → OuroborosBundle muxMode initiatorCtx responderCtx bytes m a b
- data NodeToNodeProtocols appType initiatorCtx responderCtx bytes m a b = NodeToNodeProtocols {
- chainSyncProtocol ∷ RunMiniProtocol appType initiatorCtx responderCtx bytes m a b
- blockFetchProtocol ∷ RunMiniProtocol appType initiatorCtx responderCtx bytes m a b
- txSubmissionProtocol ∷ RunMiniProtocol appType initiatorCtx responderCtx bytes m a b
- keepAliveProtocol ∷ RunMiniProtocol appType initiatorCtx responderCtx bytes m a b
- peerSharingProtocol ∷ RunMiniProtocol appType initiatorCtx responderCtx bytes m a b
- type NodeToNodeProtocolsWithExpandedCtx appType ntnAddr bytes m a b = NodeToNodeProtocols appType (ExpandedInitiatorContext ntnAddr m) (ResponderContext ntnAddr) bytes m a b
- type NodeToNodeProtocolsWithMinimalCtx appType ntnAddr bytes m a b = NodeToNodeProtocols appType (MinimalInitiatorContext ntnAddr) (ResponderContext ntnAddr) bytes m a b
- data MiniProtocolParameters = MiniProtocolParameters {}
- chainSyncProtocolLimits ∷ MiniProtocolParameters → MiniProtocolLimits
- blockFetchProtocolLimits ∷ MiniProtocolParameters → MiniProtocolLimits
- txSubmissionProtocolLimits ∷ MiniProtocolParameters → MiniProtocolLimits
- keepAliveProtocolLimits ∷ MiniProtocolParameters → MiniProtocolLimits
- defaultMiniProtocolParameters ∷ MiniProtocolParameters
- data NodeToNodeVersion
- data NodeToNodeVersionData = NodeToNodeVersionData {}
- data NetworkConnectTracers addr vNumber = NetworkConnectTracers {
- nctMuxTracer ∷ Tracer IO (WithMuxBearer (ConnectionId addr) MuxTrace)
- nctHandshakeTracer ∷ Tracer IO (WithMuxBearer (ConnectionId addr) (TraceSendRecv (Handshake vNumber Term)))
- nullNetworkConnectTracers ∷ NetworkConnectTracers addr vNumber
- connectTo ∷ Snocket IO Socket SockAddr → NetworkConnectTracers SockAddr NodeToNodeVersion → Versions NodeToNodeVersion NodeToNodeVersionData (OuroborosApplicationWithMinimalCtx InitiatorMode SockAddr ByteString IO a b) → Maybe SockAddr → SockAddr → IO ()
- data NetworkServerTracers addr vNumber = NetworkServerTracers {
- nstMuxTracer ∷ Tracer IO (WithMuxBearer (ConnectionId addr) MuxTrace)
- nstHandshakeTracer ∷ Tracer IO (WithMuxBearer (ConnectionId addr) (TraceSendRecv (Handshake vNumber Term)))
- nstErrorPolicyTracer ∷ Tracer IO (WithAddr addr ErrorPolicyTrace)
- nstAcceptPolicyTracer ∷ Tracer IO AcceptConnectionsPolicyTrace
- nullNetworkServerTracers ∷ NetworkServerTracers addr vNumber
- data NetworkMutableState addr = NetworkMutableState {
- nmsConnectionTable ∷ ConnectionTable IO addr
- nmsPeerStates ∷ StrictTVar IO (PeerStates IO addr)
- data AcceptedConnectionsLimit = AcceptedConnectionsLimit {}
- newNetworkMutableState ∷ IO (NetworkMutableState addr)
- newNetworkMutableStateSTM ∷ STM (NetworkMutableState addr)
- cleanNetworkMutableState ∷ NetworkMutableState addr → IO ()
- withServer ∷ SocketSnocket → NetworkServerTracers SockAddr NodeToNodeVersion → NetworkMutableState SockAddr → AcceptedConnectionsLimit → Socket → Versions NodeToNodeVersion NodeToNodeVersionData (OuroborosApplicationWithMinimalCtx ResponderMode SockAddr ByteString IO a b) → ErrorPolicies → IO Void
- data PeerAdvertise
- data PeerSelectionTargets = PeerSelectionTargets {}
- data IPSubscriptionTarget = IPSubscriptionTarget {
- ispIps ∷ ![SockAddr]
- ispValency ∷ !Int
- type NetworkIPSubscriptionTracers addr vNumber = NetworkSubscriptionTracers WithIPList addr vNumber
- data NetworkSubscriptionTracers withIPList addr vNumber = NetworkSubscriptionTracers {
- nsMuxTracer ∷ Tracer IO (WithMuxBearer (ConnectionId addr) MuxTrace)
- nsHandshakeTracer ∷ Tracer IO (WithMuxBearer (ConnectionId addr) (TraceSendRecv (Handshake vNumber Term)))
- nsErrorPolicyTracer ∷ Tracer IO (WithAddr addr ErrorPolicyTrace)
- nsSubscriptionTracer ∷ Tracer IO (withIPList (SubscriptionTrace addr))
- nullNetworkSubscriptionTracers ∷ NetworkSubscriptionTracers withIPList addr vNumber
- data SubscriptionParams a target = SubscriptionParams {}
- type IPSubscriptionParams a = SubscriptionParams a IPSubscriptionTarget
- ipSubscriptionWorker ∷ ∀ mode x y. HasInitiator mode ~ True ⇒ SocketSnocket → NetworkIPSubscriptionTracers SockAddr NodeToNodeVersion → NetworkMutableState SockAddr → IPSubscriptionParams () → Versions NodeToNodeVersion NodeToNodeVersionData (OuroborosApplicationWithMinimalCtx mode SockAddr ByteString IO x y) → IO Void
- data DnsSubscriptionTarget = DnsSubscriptionTarget {
- dstDomain ∷ !Domain
- dstPort ∷ !PortNumber
- dstValency ∷ !Int
- type DnsSubscriptionParams a = SubscriptionParams a DnsSubscriptionTarget
- data NetworkDNSSubscriptionTracers vNumber addr = NetworkDNSSubscriptionTracers {
- ndstMuxTracer ∷ Tracer IO (WithMuxBearer (ConnectionId addr) MuxTrace)
- ndstHandshakeTracer ∷ Tracer IO (WithMuxBearer (ConnectionId addr) (TraceSendRecv (Handshake vNumber Term)))
- ndstErrorPolicyTracer ∷ Tracer IO (WithAddr addr ErrorPolicyTrace)
- ndstSubscriptionTracer ∷ Tracer IO (WithDomainName (SubscriptionTrace addr))
- ndstDnsTracer ∷ Tracer IO (WithDomainName DnsTrace)
- nullNetworkDNSSubscriptionTracers ∷ NetworkDNSSubscriptionTracers vNumber peerid
- dnsSubscriptionWorker ∷ ∀ mode x y. HasInitiator mode ~ True ⇒ SocketSnocket → NetworkDNSSubscriptionTracers NodeToNodeVersion SockAddr → NetworkMutableState SockAddr → DnsSubscriptionParams () → Versions NodeToNodeVersion NodeToNodeVersionData (OuroborosApplicationWithMinimalCtx mode SockAddr ByteString IO x y) → IO Void
- newtype Versions vNum vData r = Versions {
- getVersions ∷ Map vNum (Version vData r)
- data DiffusionMode
- simpleSingletonVersions ∷ vNum → vData → r → Versions vNum vData r
- foldMapVersions ∷ (Ord vNum, Foldable f, HasCallStack) ⇒ (x → Versions vNum extra r) → f x → Versions vNum extra r
- combineVersions ∷ (Ord vNum, Foldable f, HasCallStack) ⇒ f (Versions vNum extra r) → Versions vNum extra r
- nodeToNodeHandshakeCodec ∷ ∀ (m ∷ Type → Type). MonadST m ⇒ Codec (Handshake NodeToNodeVersion Term) DeserialiseFailure m ByteString
- nodeToNodeVersionCodec ∷ CodecCBORTerm (Text, Maybe Int) NodeToNodeVersion
- nodeToNodeCodecCBORTerm ∷ NodeToNodeVersion → CodecCBORTerm Text NodeToNodeVersionData
- data ExpandedInitiatorContext addr (m ∷ Type → Type) = ExpandedInitiatorContext {}
- newtype MinimalInitiatorContext addr = MinimalInitiatorContext {
- micConnectionId ∷ ConnectionId addr
- newtype ResponderContext addr = ResponderContext {
- rcConnectionId ∷ ConnectionId addr
- data ConnectionId addr = ConnectionId {
- localAddress ∷ !addr
- remoteAddress ∷ !addr
- data ControlMessage
- type ControlMessageSTM (m ∷ Type → Type) = STM m ControlMessage
- type RemoteAddress = SockAddr
- type RemoteConnectionId = ConnectionId RemoteAddress
- data IsBigLedgerPeer
- data ProtocolLimitFailure
- data Handshake (vNumber ∷ k) (vParams ∷ k1)
- data LocalAddresses addr = LocalAddresses {}
- data Socket
- data ExceptionInHandler where
- ExceptionInHandler ∷ ∀ peerAddr. (Typeable peerAddr, Show peerAddr) ⇒ !peerAddr → !SomeException → ExceptionInHandler
- data ErrorPolicies = ErrorPolicies {}
- remoteNetworkErrorPolicy ∷ ErrorPolicies
- localNetworkErrorPolicy ∷ ErrorPolicies
- nullErrorPolicies ∷ ErrorPolicies
- data ErrorPolicy where
- ErrorPolicy ∷ ∀ e. Exception e ⇒ (e → Maybe (SuspendDecision DiffTime)) → ErrorPolicy
- data SuspendDecision t
- = SuspendPeer !t !t
- | SuspendConsumer !t
- | Throw
- data AcceptConnectionsPolicyTrace
- data TraceSendRecv ps where
- TraceSendMsg ∷ ∀ ps. AnyMessageAndAgency ps → TraceSendRecv ps
- TraceRecvMsg ∷ ∀ ps. AnyMessageAndAgency ps → TraceSendRecv ps
- data SubscriptionTrace addr
- = SubscriptionTraceConnectStart addr
- | SubscriptionTraceConnectEnd addr ConnectResult
- | Exception e ⇒ SubscriptionTraceSocketAllocationException addr e
- | Exception e ⇒ SubscriptionTraceConnectException addr e
- | Exception e ⇒ SubscriptionTraceApplicationException addr e
- | SubscriptionTraceTryConnectToPeer addr
- | SubscriptionTraceSkippingPeer addr
- | SubscriptionTraceSubscriptionRunning
- | SubscriptionTraceSubscriptionWaiting Int
- | SubscriptionTraceSubscriptionFailed
- | SubscriptionTraceSubscriptionWaitingNewConnection DiffTime
- | SubscriptionTraceStart Int
- | SubscriptionTraceRestart DiffTime Int Int
- | SubscriptionTraceConnectionExist addr
- | SubscriptionTraceUnsupportedRemoteAddr addr
- | SubscriptionTraceMissingLocalAddress
- | SubscriptionTraceAllocateSocket addr
- | SubscriptionTraceCloseSocket addr
- data DnsTrace
- data ErrorPolicyTrace
- = ErrorPolicySuspendPeer (Maybe (ConnectionOrApplicationExceptionTrace SomeException)) DiffTime DiffTime
- | ErrorPolicySuspendConsumer (Maybe (ConnectionOrApplicationExceptionTrace SomeException)) DiffTime
- | ErrorPolicyLocalNodeError (ConnectionOrApplicationExceptionTrace SomeException)
- | ErrorPolicyResumePeer
- | ErrorPolicyKeepSuspended
- | ErrorPolicyResumeConsumer
- | ErrorPolicyResumeProducer
- | ErrorPolicyUnhandledApplicationException SomeException
- | ErrorPolicyUnhandledConnectionException SomeException
- | ErrorPolicyAcceptException IOException
- data WithIPList a = WithIPList {}
- data WithDomainName a = WithDomainName {}
- data WithAddr addr a = WithAddr {}
- type HandshakeTr ntnAddr ntnVersion = WithMuxBearer (ConnectionId ntnAddr) (TraceSendRecv (Handshake ntnVersion Term))
- chainSyncMiniProtocolNum ∷ MiniProtocolNum
- blockFetchMiniProtocolNum ∷ MiniProtocolNum
- txSubmissionMiniProtocolNum ∷ MiniProtocolNum
- keepAliveMiniProtocolNum ∷ MiniProtocolNum
- peerSharingMiniProtocolNum ∷ MiniProtocolNum
Documentation
∷ 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
is reserved for the MiniProtocolNum
0Handshake
protocol, while
is reserved for DeltaQ messages.
MiniProtocolNum
1Handshake
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 initiatorCtx responderCtx bytes m a b Source #
NodeToNodeProtocols | |
|
type NodeToNodeProtocolsWithExpandedCtx appType ntnAddr bytes m a b = NodeToNodeProtocols appType (ExpandedInitiatorContext ntnAddr m) (ResponderContext ntnAddr) bytes m a b Source #
type NodeToNodeProtocolsWithMinimalCtx appType ntnAddr bytes m a b = NodeToNodeProtocols appType (MinimalInitiatorContext ntnAddr) (ResponderContext ntnAddr) bytes m a b Source #
data MiniProtocolParameters Source #
MiniProtocolParameters | |
|
data NodeToNodeVersion Source #
Enumeration of node to node protocol versions.
NodeToNodeV_7 | Changes:
|
NodeToNodeV_8 | Changes:
|
NodeToNodeV_9 | Changes:
|
NodeToNodeV_10 | Changes:
|
NodeToNodeV_11 | Changes:
|
NodeToNodeV_12 | No changes. (In the past, this enabled Conway, but the negotiated |
NodeToNodeV_13 | Changes:
|
Instances
data NodeToNodeVersionData Source #
Version data for NodeToNode protocol
data NetworkConnectTracers addr vNumber Source #
Tracer used by connectToNode
(and derivatives, like
connectTo
or
'Ouroboros.Network.NodeToClient.connectTo).
NetworkConnectTracers | |
|
nullNetworkConnectTracers ∷ NetworkConnectTracers addr vNumber Source #
connectTo ∷ Snocket IO Socket SockAddr → NetworkConnectTracers SockAddr NodeToNodeVersion → Versions NodeToNodeVersion NodeToNodeVersionData (OuroborosApplicationWithMinimalCtx InitiatorMode SockAddr ByteString IO a b) → Maybe SockAddr → SockAddr → IO () Source #
A specialised version of
.connectToNode
data NetworkServerTracers addr vNumber Source #
Tracers required by a server which handles inbound connections.
NetworkServerTracers | |
|
nullNetworkServerTracers ∷ NetworkServerTracers addr vNumber Source #
data NetworkMutableState addr Source #
Mutable state maintained by the network component.
NetworkMutableState | |
|
data AcceptedConnectionsLimit Source #
Policy which governs how to limit the number of accepted connections.
AcceptedConnectionsLimit | |
|
Instances
newNetworkMutableState ∷ IO (NetworkMutableState addr) Source #
cleanNetworkMutableState ∷ NetworkMutableState addr → IO () Source #
Clean PeerStates
within NetworkMutableState
every 200s
∷ SocketSnocket | |
→ NetworkServerTracers SockAddr NodeToNodeVersion | |
→ NetworkMutableState SockAddr | |
→ AcceptedConnectionsLimit | |
→ Socket | a configured socket to be used be the server. The server will call
|
→ Versions NodeToNodeVersion NodeToNodeVersionData (OuroborosApplicationWithMinimalCtx ResponderMode SockAddr ByteString IO a b) | |
→ ErrorPolicies | |
→ IO Void |
A specialised version of
.
It forks a thread which runs an accept loop (server thread):withServerNode
- 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 Source #
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
FromJSON PeerAdvertise | |
ToJSON PeerAdvertise | |
Generic PeerAdvertise | |
Defined in Ouroboros.Network.PeerSelection.PeerAdvertise type Rep PeerAdvertise ∷ Type → Type # from ∷ PeerAdvertise → Rep PeerAdvertise x # to ∷ Rep PeerAdvertise x → PeerAdvertise # | |
Show PeerAdvertise | |
Defined in Ouroboros.Network.PeerSelection.PeerAdvertise showsPrec ∷ Int → PeerAdvertise → ShowS # show ∷ PeerAdvertise → String # showList ∷ [PeerAdvertise] → ShowS # | |
Eq PeerAdvertise | |
Defined in Ouroboros.Network.PeerSelection.PeerAdvertise (==) ∷ PeerAdvertise → PeerAdvertise → Bool # (/=) ∷ PeerAdvertise → PeerAdvertise → Bool # | |
Ord PeerAdvertise | |
Defined in Ouroboros.Network.PeerSelection.PeerAdvertise compare ∷ PeerAdvertise → PeerAdvertise → Ordering # (<) ∷ PeerAdvertise → PeerAdvertise → Bool # (<=) ∷ PeerAdvertise → PeerAdvertise → Bool # (>) ∷ PeerAdvertise → PeerAdvertise → Bool # (>=) ∷ PeerAdvertise → PeerAdvertise → Bool # | |
type Rep PeerAdvertise | |
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.
PeerSelectionTargets | |
|
Instances
Subscription Workers
IP subscription worker
data IPSubscriptionTarget Source #
IPSubscriptionTarget | |
|
Instances
type NetworkIPSubscriptionTracers addr vNumber = NetworkSubscriptionTracers WithIPList addr vNumber Source #
data NetworkSubscriptionTracers withIPList addr vNumber Source #
IP subscription tracers.
NetworkSubscriptionTracers | |
|
nullNetworkSubscriptionTracers ∷ NetworkSubscriptionTracers withIPList addr vNumber Source #
data SubscriptionParams a target Source #
ipSubscriptionWorker
and dnsSubscriptionWorker
parameters
SubscriptionParams | |
|
ipSubscriptionWorker ∷ ∀ mode x y. HasInitiator mode ~ True ⇒ SocketSnocket → NetworkIPSubscriptionTracers SockAddr NodeToNodeVersion → NetworkMutableState SockAddr → IPSubscriptionParams () → Versions NodeToNodeVersion NodeToNodeVersionData (OuroborosApplicationWithMinimalCtx mode SockAddr ByteString IO x y) → IO Void Source #
ipSubscriptionWorker
which starts given application versions on each
established connection.
DNS subscription worker
data DnsSubscriptionTarget Source #
Instances
data NetworkDNSSubscriptionTracers vNumber addr Source #
DNS subscription tracers.
NetworkDNSSubscriptionTracers | |
|
nullNetworkDNSSubscriptionTracers ∷ NetworkDNSSubscriptionTracers vNumber peerid Source #
dnsSubscriptionWorker ∷ ∀ mode x y. HasInitiator mode ~ True ⇒ SocketSnocket → NetworkDNSSubscriptionTracers NodeToNodeVersion SockAddr → NetworkMutableState SockAddr → DnsSubscriptionParams () → Versions NodeToNodeVersion NodeToNodeVersionData (OuroborosApplicationWithMinimalCtx mode SockAddr ByteString IO x y) → IO Void Source #
dnsSubscriptionWorker
which starts given application versions on each
established connection.
Versions
newtype Versions vNum vData r Source #
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 ...) , ... ]
Versions | |
|
data DiffusionMode Source #
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 sendInitiatorOnlyDiffusionMode
, 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 inInitiatorAndResponderDiffusionMode
).
Instances
Show DiffusionMode | |
Defined in Ouroboros.Network.NodeToNode.Version showsPrec ∷ Int → DiffusionMode → ShowS # show ∷ DiffusionMode → String # showList ∷ [DiffusionMode] → ShowS # | |
Eq DiffusionMode | |
Defined in Ouroboros.Network.NodeToNode.Version (==) ∷ DiffusionMode → DiffusionMode → Bool # (/=) ∷ DiffusionMode → DiffusionMode → Bool # | |
Ord DiffusionMode | |
Defined in Ouroboros.Network.NodeToNode.Version compare ∷ DiffusionMode → DiffusionMode → Ordering # (<) ∷ DiffusionMode → DiffusionMode → Bool # (<=) ∷ DiffusionMode → DiffusionMode → Bool # (>) ∷ DiffusionMode → DiffusionMode → Bool # (>=) ∷ DiffusionMode → DiffusionMode → Bool # |
simpleSingletonVersions ∷ vNum → vData → r → Versions vNum vData r Source #
Singleton smart constructor for Versions
.
foldMapVersions ∷ (Ord vNum, Foldable f, HasCallStack) ⇒ (x → Versions vNum extra r) → f x → Versions vNum extra r Source #
combineVersions ∷ (Ord vNum, Foldable f, HasCallStack) ⇒ f (Versions vNum extra r) → Versions vNum extra r Source #
Codecs
nodeToNodeHandshakeCodec ∷ ∀ (m ∷ Type → Type). MonadST m ⇒ Codec (Handshake NodeToNodeVersion Term) DeserialiseFailure m ByteString Source #
Handshake
codec for the node-to-node
protocol suite.
Re-exports
data ExpandedInitiatorContext addr (m ∷ Type → Type) Source #
Context passed to initiator mini-protocol execution.
newtype MinimalInitiatorContext addr Source #
A context passed to initiator mini-protocol execution for non-p2p applications.
Instances
Functor MinimalInitiatorContext | |
Defined in Ouroboros.Network.Context fmap ∷ (a → b) → MinimalInitiatorContext a → MinimalInitiatorContext b # (<$) ∷ a → MinimalInitiatorContext b → MinimalInitiatorContext a # |
newtype ResponderContext addr Source #
Context passed to each responder mini-protocol execution.
Instances
Functor ResponderContext | |
Defined in Ouroboros.Network.Context fmap ∷ (a → b) → ResponderContext a → ResponderContext b # (<$) ∷ a → ResponderContext b → ResponderContext a # |
data ConnectionId addr Source #
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
.
ConnectionId | |
|
Instances
data ControlMessage Source #
Control signal sent to a mini-protocol. Expected to exit, on Continue
it
should continue its operation
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. |
Instances
Show ControlMessage | |
Defined in Ouroboros.Network.ControlMessage showsPrec ∷ Int → ControlMessage → ShowS # show ∷ ControlMessage → String # showList ∷ [ControlMessage] → ShowS # | |
Eq ControlMessage | |
Defined in Ouroboros.Network.ControlMessage (==) ∷ ControlMessage → ControlMessage → Bool # (/=) ∷ ControlMessage → ControlMessage → Bool # |
type ControlMessageSTM (m ∷ Type → Type) = STM m ControlMessage Source #
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.
type RemoteAddress = SockAddr Source #
data IsBigLedgerPeer Source #
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).
Instances
data ProtocolLimitFailure Source #
Instances
data Handshake (vNumber ∷ k) (vParams ∷ k1) Source #
The handshake mini-protocol is used initially to agree the version and associated parameters of the protocol to use for all subsequent communication.
Instances
data LocalAddresses addr Source #
Instances
Semigroup (LocalAddresses addr) | |
Defined in Ouroboros.Network.Subscription.Worker (<>) ∷ LocalAddresses addr → LocalAddresses addr → LocalAddresses addr # sconcat ∷ NonEmpty (LocalAddresses addr) → LocalAddresses addr # stimes ∷ Integral b ⇒ b → LocalAddresses addr → LocalAddresses addr # | |
Show addr ⇒ Show (LocalAddresses addr) | |
Defined in Ouroboros.Network.Subscription.Worker showsPrec ∷ Int → LocalAddresses addr → ShowS # show ∷ LocalAddresses addr → String # showList ∷ [LocalAddresses addr] → ShowS # | |
Eq addr ⇒ Eq (LocalAddresses addr) | |
Defined in Ouroboros.Network.Subscription.Worker (==) ∷ LocalAddresses addr → LocalAddresses addr → Bool # (/=) ∷ LocalAddresses addr → LocalAddresses addr → Bool # |
Basic type for a socket.
Exceptions
data ExceptionInHandler where Source #
Exception which where caught in the connection thread and were re-thrown in
the main thread by the rethrowPolicy
.
ExceptionInHandler ∷ ∀ peerAddr. (Typeable peerAddr, Show peerAddr) ⇒ !peerAddr → !SomeException → ExceptionInHandler |
Instances
Error Policies and Peer state
data ErrorPolicies Source #
List of error policies for exception handling and a policy for handing application return values.
ErrorPolicies | |
|
Instances
Semigroup ErrorPolicies | |
Defined in Ouroboros.Network.ErrorPolicy (<>) ∷ ErrorPolicies → ErrorPolicies → ErrorPolicies # sconcat ∷ NonEmpty ErrorPolicies → ErrorPolicies # stimes ∷ Integral b ⇒ b → ErrorPolicies → ErrorPolicies # |
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 Source #
ErrorPolicy | |
|
Instances
Show ErrorPolicy | |
Defined in Ouroboros.Network.ErrorPolicy showsPrec ∷ Int → ErrorPolicy → ShowS # show ∷ ErrorPolicy → String # showList ∷ [ErrorPolicy] → ShowS # |
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.
SuspendPeer !t !t | peer is suspend; The first |
SuspendConsumer !t | suspend local consumer / initiator side until |
Throw | throw an error from the main thread. |
Instances
Traces
data AcceptConnectionsPolicyTrace Source #
Trace for the AcceptConnectionsLimit
policy.
ServerTraceAcceptConnectionRateLimiting DiffTime Int | |
ServerTraceAcceptConnectionHardLimit Word32 | |
ServerTraceAcceptConnectionResume Int |
Instances
data TraceSendRecv ps where Source #
TraceSendMsg ∷ ∀ ps. AnyMessageAndAgency ps → TraceSendRecv ps | |
TraceRecvMsg ∷ ∀ ps. AnyMessageAndAgency ps → TraceSendRecv ps |
Instances
Show (AnyMessageAndAgency ps) ⇒ Show (TraceSendRecv ps) | |
Defined in Ouroboros.Network.Driver.Simple showsPrec ∷ Int → TraceSendRecv ps → ShowS # show ∷ TraceSendRecv ps → String # showList ∷ [TraceSendRecv ps] → ShowS # |
data SubscriptionTrace addr Source #
Instances
Show addr ⇒ Show (SubscriptionTrace addr) | |
Defined in Ouroboros.Network.Subscription.Worker showsPrec ∷ Int → SubscriptionTrace addr → ShowS # show ∷ SubscriptionTrace addr → String # showList ∷ [SubscriptionTrace addr] → ShowS # |
data ErrorPolicyTrace Source #
Trace data for error policies
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
|
ErrorPolicyUnhandledConnectionException SomeException |
|
ErrorPolicyAcceptException IOException |
|
Instances
Show ErrorPolicyTrace | |
Defined in Ouroboros.Network.ErrorPolicy showsPrec ∷ Int → ErrorPolicyTrace → ShowS # show ∷ ErrorPolicyTrace → String # showList ∷ [ErrorPolicyTrace] → ShowS # |
data WithIPList a Source #
Instances
Show a ⇒ Show (WithIPList a) | |
Defined in Ouroboros.Network.Subscription.Ip showsPrec ∷ Int → WithIPList a → ShowS # show ∷ WithIPList a → String # showList ∷ [WithIPList a] → ShowS # |
data WithDomainName a Source #
Instances
Show a ⇒ Show (WithDomainName a) | |
Defined in Ouroboros.Network.Subscription.Dns showsPrec ∷ Int → WithDomainName a → ShowS # show ∷ WithDomainName a → String # showList ∷ [WithDomainName a] → ShowS # |
type HandshakeTr ntnAddr ntnVersion = WithMuxBearer (ConnectionId ntnAddr) (TraceSendRecv (Handshake ntnVersion Term)) Source #