Safe Haskell | None |
---|---|
Language | Haskell2010 |
This is the starting point for a module that will bring together the overall node to client protocol, as a collection of mini-protocols.
Synopsis
- nodeToClientProtocols :: forall (appType :: MuxMode) addr bytes (m :: Type -> Type) a b. NodeToClientProtocols appType addr bytes m a b -> NodeToClientVersion -> OuroborosApplicationWithMinimalCtx appType addr bytes m a b
- data NodeToClientProtocols (appType :: MuxMode) ntcAddr bytes (m :: Type -> Type) a b = NodeToClientProtocols {
- localChainSyncProtocol :: RunMiniProtocolWithMinimalCtx appType ntcAddr bytes m a b
- localTxSubmissionProtocol :: RunMiniProtocolWithMinimalCtx appType ntcAddr bytes m a b
- localStateQueryProtocol :: RunMiniProtocolWithMinimalCtx appType ntcAddr bytes m a b
- localTxMonitorProtocol :: RunMiniProtocolWithMinimalCtx appType ntcAddr bytes m a b
- data NodeToClientVersion
- data NodeToClientVersionData = NodeToClientVersionData {
- networkMagic :: !NetworkMagic
- query :: !Bool
- 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 :: LocalSnocket -> NetworkConnectTracers LocalAddress NodeToClientVersion -> Versions NodeToClientVersion NodeToClientVersionData (OuroborosApplicationWithMinimalCtx 'InitiatorMode LocalAddress ByteString IO a b) -> FilePath -> 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)
- newNetworkMutableState :: IO (NetworkMutableState addr)
- newNetworkMutableStateSTM :: STM (NetworkMutableState addr)
- cleanNetworkMutableState :: NetworkMutableState addr -> IO ()
- withServer :: LocalSnocket -> NetworkServerTracers LocalAddress NodeToClientVersion -> NetworkMutableState LocalAddress -> LocalSocket -> Versions NodeToClientVersion NodeToClientVersionData (OuroborosApplicationWithMinimalCtx 'ResponderMode LocalAddress ByteString IO a b) -> ErrorPolicies -> IO Void
- type NetworkClientSubcriptionTracers = NetworkSubscriptionTracers Identity LocalAddress NodeToClientVersion
- data NetworkSubscriptionTracers (withIPList :: Type -> Type) 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))
- data ClientSubscriptionParams a = ClientSubscriptionParams {}
- ncSubscriptionWorker :: forall (mode :: MuxMode) x y. HasInitiator mode ~ 'True => LocalSnocket -> NetworkClientSubcriptionTracers -> NetworkMutableState LocalAddress -> ClientSubscriptionParams () -> Versions NodeToClientVersion NodeToClientVersionData (OuroborosApplicationWithMinimalCtx mode LocalAddress ByteString IO x y) -> IO Void
- chainSyncPeerNull :: forall header point tip (m :: Type -> Type) a. MonadDelay m => Client (ChainSync header point tip) 'NonPipelined ('StIdle :: ChainSync header point tip) m a
- localStateQueryPeerNull :: forall block point (query :: Type -> Type) (m :: Type -> Type) a. MonadDelay m => Client (LocalStateQuery block point query) ('StIdle :: LocalStateQuery block point query) (State :: LocalStateQuery block point query -> Type) m a
- localTxSubmissionPeerNull :: forall tx reject (m :: Type -> Type) a. MonadDelay m => Client (LocalTxSubmission tx reject) 'NonPipelined ('StIdle :: LocalTxSubmission tx reject) m a
- localTxMonitorPeerNull :: forall txid tx slot (m :: Type -> Type) a. MonadDelay m => Client (LocalTxMonitor txid tx slot) 'NonPipelined ('StIdle :: LocalTxMonitor txid tx slot) m a
- newtype IOManager = IOManager {
- associateWithIOManager :: forall hole. hole -> IO ()
- type AssociateWithIOCP = IOManager
- withIOManager :: WithIOManager
- type LocalSnocket = Snocket IO LocalSocket LocalAddress
- localSnocket :: IOManager -> LocalSnocket
- newtype LocalSocket = LocalSocket {
- getLocalHandle :: LocalHandle
- newtype LocalAddress = LocalAddress {}
- newtype Versions vNum vData r = Versions {
- getVersions :: Map vNum (Version vData r)
- versionedNodeToClientProtocols :: forall (appType :: MuxMode) bytes (m :: Type -> Type) a b. NodeToClientVersion -> NodeToClientVersionData -> NodeToClientProtocols appType LocalAddress bytes m a b -> Versions NodeToClientVersion NodeToClientVersionData (OuroborosApplicationWithMinimalCtx appType LocalAddress bytes m a b)
- 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
- nodeToClientHandshakeCodec :: forall (m :: Type -> Type). MonadST m => Codec (Handshake NodeToClientVersion Term) DeserialiseFailure m ByteString
- nodeToClientVersionCodec :: CodecCBORTerm (Text, Maybe Int) NodeToClientVersion
- nodeToClientCodecCBORTerm :: NodeToClientVersion -> CodecCBORTerm Text NodeToClientVersionData
- data ConnectionId addr = ConnectionId {
- localAddress :: !addr
- remoteAddress :: !addr
- newtype MinimalInitiatorContext addr = MinimalInitiatorContext {
- micConnectionId :: ConnectionId addr
- newtype ResponderContext addr = ResponderContext {
- rcConnectionId :: ConnectionId addr
- type LocalConnectionId = ConnectionId LocalAddress
- data ErrorPolicies = ErrorPolicies {}
- networkErrorPolicies :: ErrorPolicies
- nullErrorPolicies :: ErrorPolicies
- data ErrorPolicy where
- ErrorPolicy :: forall e. Exception e => (e -> Maybe (SuspendDecision DiffTime)) -> ErrorPolicy
- 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 WithAddr addr a = WithAddr {}
- data SuspendDecision t
- = SuspendPeer !t !t
- | SuspendConsumer !t
- | Throw
- data TraceSendRecv ps where
- TraceSendMsg :: forall ps. AnyMessage ps -> TraceSendRecv ps
- TraceRecvMsg :: forall ps. AnyMessage ps -> TraceSendRecv ps
- data ProtocolLimitFailure
- data Handshake (vNumber :: k) (vParams :: k1)
- data LocalAddresses addr = LocalAddresses {}
- 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
- type HandshakeTr ntcAddr (ntcVersion :: k) = WithMuxBearer (ConnectionId ntcAddr) (TraceSendRecv (Handshake ntcVersion Term))
Documentation
nodeToClientProtocols :: forall (appType :: MuxMode) addr bytes (m :: Type -> Type) a b. NodeToClientProtocols appType addr bytes m a b -> NodeToClientVersion -> OuroborosApplicationWithMinimalCtx appType addr bytes m a b Source #
Make an OuroborosApplication
for the bundle of mini-protocols that
make up the overall node-to-client protocol.
This function specifies the wire format protocol numbers as well as the
protocols that run for each NodeToClientVersion
.
They are chosen to not overlap with the node to node protocol numbers. 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 NodeToClientProtocols (appType :: MuxMode) ntcAddr bytes (m :: Type -> Type) a b Source #
Record of node-to-client mini protocols.
NodeToClientProtocols | |
|
data NodeToClientVersion #
Enumeration of node to client protocol versions.
NodeToClientV_9 | enabled |
NodeToClientV_10 | added |
NodeToClientV_11 | added |
NodeToClientV_12 | added |
NodeToClientV_13 | enabled |
NodeToClientV_14 | added |
NodeToClientV_15 | added |
NodeToClientV_16 | added |
NodeToClientV_17 | added |
NodeToClientV_18 | added |
Instances
data NodeToClientVersionData #
Version data for NodeToClient protocol v1
Instances
Show NodeToClientVersionData | |
Defined in Ouroboros.Network.NodeToClient.Version showsPrec :: Int -> NodeToClientVersionData -> ShowS # show :: NodeToClientVersionData -> String # showList :: [NodeToClientVersionData] -> ShowS # | |
Eq NodeToClientVersionData | |
Defined in Ouroboros.Network.NodeToClient.Version | |
Acceptable NodeToClientVersionData | |
Queryable NodeToClientVersionData | |
Defined in Ouroboros.Network.NodeToClient.Version |
data NetworkConnectTracers addr vNumber #
Tracer used by connectToNode
(and derivatives, like
connectTo
or
'Ouroboros.Network.NodeToClient.connectTo).
NetworkConnectTracers | |
|
nullNetworkConnectTracers :: NetworkConnectTracers addr vNumber #
:: LocalSnocket | callback constructed by |
-> NetworkConnectTracers LocalAddress NodeToClientVersion | |
-> Versions NodeToClientVersion NodeToClientVersionData (OuroborosApplicationWithMinimalCtx 'InitiatorMode LocalAddress ByteString IO a b) | A dictionary of protocol versions & applications to run on an established connection. The application to run will be chosen by initial handshake protocol (the highest shared version will be chosen). |
-> FilePath | path of the unix socket or named pipe |
-> IO () |
A specialised version of connectToNode
. It is
a general purpose function which can connect using any version of the
protocol. This is mostly useful for future enhancements.
data NetworkServerTracers addr vNumber #
Tracers required by a server which handles inbound connections.
NetworkServerTracers | |
|
nullNetworkServerTracers :: NetworkServerTracers addr vNumber #
data NetworkMutableState addr #
Mutable state maintained by the network component.
NetworkMutableState | |
|
newNetworkMutableState :: IO (NetworkMutableState addr) #
newNetworkMutableStateSTM :: STM (NetworkMutableState addr) #
cleanNetworkMutableState :: NetworkMutableState addr -> IO () #
Clean PeerStates
within NetworkMutableState
every 200s
withServer :: LocalSnocket -> NetworkServerTracers LocalAddress NodeToClientVersion -> NetworkMutableState LocalAddress -> LocalSocket -> Versions NodeToClientVersion NodeToClientVersionData (OuroborosApplicationWithMinimalCtx 'ResponderMode LocalAddress ByteString IO a b) -> ErrorPolicies -> IO Void Source #
A specialised version of withServerNode
.
Comments to withServer
apply here as well.
type NetworkClientSubcriptionTracers = NetworkSubscriptionTracers Identity LocalAddress NodeToClientVersion Source #
data NetworkSubscriptionTracers (withIPList :: Type -> Type) addr vNumber Source #
IP subscription tracers.
NetworkSubscriptionTracers | |
|
data ClientSubscriptionParams a #
ClientSubscriptionParams | |
|
ncSubscriptionWorker :: forall (mode :: MuxMode) x y. HasInitiator mode ~ 'True => LocalSnocket -> NetworkClientSubcriptionTracers -> NetworkMutableState LocalAddress -> ClientSubscriptionParams () -> Versions NodeToClientVersion NodeToClientVersionData (OuroborosApplicationWithMinimalCtx mode LocalAddress ByteString IO x y) -> IO Void Source #
ncSubscriptionWorker
which starts given application versions on each
established connection.
Null Protocol Peers
chainSyncPeerNull :: forall header point tip (m :: Type -> Type) a. MonadDelay m => Client (ChainSync header point tip) 'NonPipelined ('StIdle :: ChainSync header point tip) m a Source #
localStateQueryPeerNull :: forall block point (query :: Type -> Type) (m :: Type -> Type) a. MonadDelay m => Client (LocalStateQuery block point query) ('StIdle :: LocalStateQuery block point query) (State :: LocalStateQuery block point query -> Type) m a Source #
localTxSubmissionPeerNull :: forall tx reject (m :: Type -> Type) a. MonadDelay m => Client (LocalTxSubmission tx reject) 'NonPipelined ('StIdle :: LocalTxSubmission tx reject) m a Source #
localTxMonitorPeerNull :: forall txid tx slot (m :: Type -> Type) a. MonadDelay m => Client (LocalTxMonitor txid tx slot) 'NonPipelined ('StIdle :: LocalTxMonitor txid tx slot) m a Source #
Re-exported network interface
This is public api to interact with the io manager; On Windows IOManager
holds associateWithIOCompletionPort
;
on other platforms IOManager
can run over any type, and thus is
guaranteed to be no-op.
IOManager | |
|
type AssociateWithIOCP = IOManager #
withIOManager :: WithIOManager #
withIOManager
allows to do asynchronous io on Windows hiding the
differences between posix and Win32.
It starts an io manger thread, which should be only one running at a time, so
the best place to call it is very close to the main
function and last for
duration of the application.
Async IO
operations which are using the iocp
port should not leak
out-side of withIOManager
. They will be silently cancelled when
withIOManager
exists. In particular one should not return IOManager
from withIOManager
.
type LocalSnocket = Snocket IO LocalSocket LocalAddress #
System dependent LocalSnocket
localSnocket :: IOManager -> LocalSnocket #
Create a LocalSnocket
.
On Windows, there is no way to get path associated to a named pipe. To go
around this, the address passed to open
via LocalFamily
will be
referenced by LocalSocket
.
newtype LocalSocket #
System dependent LocalSnocket type
LocalSocket | |
|
Instances
Generic LocalSocket | |||||
Defined in Ouroboros.Network.Snocket
from :: LocalSocket -> Rep LocalSocket x # to :: Rep LocalSocket x -> LocalSocket # | |||||
Show LocalSocket | |||||
Defined in Ouroboros.Network.Snocket showsPrec :: Int -> LocalSocket -> ShowS # show :: LocalSocket -> String # showList :: [LocalSocket] -> ShowS # | |||||
Eq LocalSocket | |||||
Defined in Ouroboros.Network.Snocket (==) :: LocalSocket -> LocalSocket -> Bool # (/=) :: LocalSocket -> LocalSocket -> Bool # | |||||
type Rep LocalSocket | |||||
Defined in Ouroboros.Network.Snocket type Rep LocalSocket = D1 ('MetaData "LocalSocket" "Ouroboros.Network.Snocket" "ouroboros-network-framework-0.13.2.4-inplace" 'True) (C1 ('MetaCons "LocalSocket" 'PrefixI 'True) (S1 ('MetaSel ('Just "getLocalHandle") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalHandle))) |
newtype LocalAddress #
Local address, on Unix is associated with AF_UNIX
family, on
Windows with `named-pipes`.
Instances
Generic LocalAddress | |||||
Defined in Ouroboros.Network.Snocket
from :: LocalAddress -> Rep LocalAddress x # to :: Rep LocalAddress x -> LocalAddress # | |||||
Show LocalAddress | |||||
Defined in Ouroboros.Network.Snocket showsPrec :: Int -> LocalAddress -> ShowS # show :: LocalAddress -> String # showList :: [LocalAddress] -> ShowS # | |||||
Eq LocalAddress | |||||
Defined in Ouroboros.Network.Snocket (==) :: LocalAddress -> LocalAddress -> Bool # (/=) :: LocalAddress -> LocalAddress -> Bool # | |||||
Ord LocalAddress | |||||
Defined in Ouroboros.Network.Snocket compare :: LocalAddress -> LocalAddress -> Ordering # (<) :: LocalAddress -> LocalAddress -> Bool # (<=) :: LocalAddress -> LocalAddress -> Bool # (>) :: LocalAddress -> LocalAddress -> Bool # (>=) :: LocalAddress -> LocalAddress -> Bool # max :: LocalAddress -> LocalAddress -> LocalAddress # min :: LocalAddress -> LocalAddress -> LocalAddress # | |||||
Hashable LocalAddress | |||||
Defined in Ouroboros.Network.Snocket hashWithSalt :: Int -> LocalAddress -> Int # hash :: LocalAddress -> Int # | |||||
type Rep LocalAddress | |||||
Defined in Ouroboros.Network.Snocket type Rep LocalAddress = D1 ('MetaData "LocalAddress" "Ouroboros.Network.Snocket" "ouroboros-network-framework-0.13.2.4-inplace" 'True) (C1 ('MetaCons "LocalAddress" 'PrefixI 'True) (S1 ('MetaSel ('Just "getFilePath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath))) |
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 ...) , ... ]
Versions | |
|
versionedNodeToClientProtocols :: forall (appType :: MuxMode) bytes (m :: Type -> Type) a b. NodeToClientVersion -> NodeToClientVersionData -> NodeToClientProtocols appType LocalAddress bytes m a b -> Versions NodeToClientVersion NodeToClientVersionData (OuroborosApplicationWithMinimalCtx appType LocalAddress bytes m a b) Source #
Versions
containing a single version of nodeToClientProtocols
.
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 #
combineVersions :: (Ord vNum, Foldable f, HasCallStack) => f (Versions vNum extra r) -> Versions vNum extra r #
Codecs
nodeToClientHandshakeCodec :: forall (m :: Type -> Type). MonadST m => Codec (Handshake NodeToClientVersion Term) DeserialiseFailure m ByteString #
Handshake
codec for the node-to-client
protocol suite.
nodeToClientVersionCodec :: CodecCBORTerm (Text, Maybe Int) NodeToClientVersion #
We set 16ths bit to distinguish NodeToNodeVersion
and
NodeToClientVersion
. This way connecting wrong protocol suite will fail
during Handshake
negotiation
This is done in backward compatible way, so NodeToClientV_1
encoding is not
changed.
Re-exports
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
.
ConnectionId | |
|
Instances
Functor ConnectionId | |||||
Defined in Ouroboros.Network.ConnectionId fmap :: (a -> b) -> ConnectionId a -> ConnectionId b # (<$) :: a -> ConnectionId b -> ConnectionId a # | |||||
ShowProxy addr => ShowProxy (ConnectionId addr :: Type) | |||||
Defined in Ouroboros.Network.ConnectionId showProxy :: Proxy (ConnectionId addr) -> String # | |||||
Generic (ConnectionId addr) | |||||
Defined in Ouroboros.Network.ConnectionId
from :: ConnectionId addr -> Rep (ConnectionId addr) x # to :: Rep (ConnectionId addr) x -> ConnectionId addr # | |||||
Show addr => Show (ConnectionId addr) | |||||
Defined in Ouroboros.Network.ConnectionId showsPrec :: Int -> ConnectionId addr -> ShowS # show :: ConnectionId addr -> String # showList :: [ConnectionId addr] -> ShowS # | |||||
Eq addr => Eq (ConnectionId addr) | |||||
Defined in Ouroboros.Network.ConnectionId (==) :: ConnectionId addr -> ConnectionId addr -> Bool # (/=) :: ConnectionId addr -> ConnectionId addr -> Bool # | |||||
Ord addr => Ord (ConnectionId addr) | Order first by Note: we relay on the fact that | ||||
Defined in Ouroboros.Network.ConnectionId 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) | |||||
Defined in Ouroboros.Network.ConnectionId hashWithSalt :: Int -> ConnectionId a -> Int # hash :: ConnectionId a -> Int # | |||||
Typeable addr => NoThunks (ConnectionId addr) | |||||
Defined in Ouroboros.Network.ConnectionId noThunks :: Context -> ConnectionId addr -> IO (Maybe ThunkInfo) # wNoThunks :: Context -> ConnectionId addr -> IO (Maybe ThunkInfo) # showTypeOf :: Proxy (ConnectionId addr) -> String # | |||||
type Rep (ConnectionId addr) | |||||
Defined in Ouroboros.Network.ConnectionId type Rep (ConnectionId addr) = D1 ('MetaData "ConnectionId" "Ouroboros.Network.ConnectionId" "ouroboros-network-framework-0.13.2.4-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))) |
newtype MinimalInitiatorContext addr #
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 #
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 ErrorPolicies #
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 # |
networkErrorPolicies :: ErrorPolicies Source #
ErrorPolicies
for client application. Additional rules can be added by
means of a Semigroup
instance of ErrorPolicies
.
This error policies will try to preserve subscriptionWorker
, e.g. if the
connect function throws an IOException
we will suspend it for
a shortDelay
, and try to re-connect.
This allows to recover from a situation where a node temporarily shutsdown, or running a client application which is subscribed two more than one node (possibly over network).
data ErrorPolicy where #
ErrorPolicy | |
|
Instances
Show ErrorPolicy | |
Defined in Ouroboros.Network.ErrorPolicy showsPrec :: Int -> ErrorPolicy -> ShowS # show :: ErrorPolicy -> String # showList :: [ErrorPolicy] -> ShowS # |
data ErrorPolicyTrace #
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 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.
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
Functor SuspendDecision | |
Defined in Ouroboros.Network.Subscription.PeerState fmap :: (a -> b) -> SuspendDecision a -> SuspendDecision b # (<$) :: a -> SuspendDecision b -> SuspendDecision a # | |
Ord t => Semigroup (SuspendDecision t) | The semigroup instance. Note that composing |
Defined in Ouroboros.Network.Subscription.PeerState (<>) :: SuspendDecision t -> SuspendDecision t -> SuspendDecision t # sconcat :: NonEmpty (SuspendDecision t) -> SuspendDecision t # stimes :: Integral b => b -> SuspendDecision t -> SuspendDecision t # | |
Show t => Show (SuspendDecision t) | |
Defined in Ouroboros.Network.Subscription.PeerState showsPrec :: Int -> SuspendDecision t -> ShowS # show :: SuspendDecision t -> String # showList :: [SuspendDecision t] -> ShowS # | |
Eq t => Eq (SuspendDecision t) | |
Defined in Ouroboros.Network.Subscription.PeerState (==) :: SuspendDecision t -> SuspendDecision t -> Bool # (/=) :: SuspendDecision t -> SuspendDecision t -> Bool # | |
Ord t => Ord (SuspendDecision t) | |
Defined in Ouroboros.Network.Subscription.PeerState compare :: SuspendDecision t -> SuspendDecision t -> Ordering # (<) :: SuspendDecision t -> SuspendDecision t -> Bool # (<=) :: SuspendDecision t -> SuspendDecision t -> Bool # (>) :: SuspendDecision t -> SuspendDecision t -> Bool # (>=) :: SuspendDecision t -> SuspendDecision t -> Bool # max :: SuspendDecision t -> SuspendDecision t -> SuspendDecision t # min :: SuspendDecision t -> SuspendDecision t -> SuspendDecision t # | |
SAct (SuspendDecision Time) (Maybe (PeerState m)) | Action of Note: |
Defined in Ouroboros.Network.Subscription.PeerState |
data TraceSendRecv ps where #
TraceSendMsg :: forall ps. AnyMessage ps -> TraceSendRecv ps | |
TraceRecvMsg :: forall ps. AnyMessage ps -> TraceSendRecv ps |
Instances
Show (AnyMessage ps) => Show (TraceSendRecv ps) | |
Defined in Ouroboros.Network.Driver.Simple showsPrec :: Int -> TraceSendRecv ps -> ShowS # show :: TraceSendRecv ps -> String # showList :: [TraceSendRecv ps] -> ShowS # |
data ProtocolLimitFailure #
Instances
Exception ProtocolLimitFailure | |
Show ProtocolLimitFailure | |
Defined in Ouroboros.Network.Protocol.Limits showsPrec :: Int -> ProtocolLimitFailure -> ShowS # show :: ProtocolLimitFailure -> String # showList :: [ProtocolLimitFailure] -> ShowS # |
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
ShowProxy (Handshake vNumber vParams :: Type) | |||||
(NFData vNumber, NFData vParams) => NFData (Message (Handshake vNumber vParams) from to) | |||||
Defined in Ouroboros.Network.Protocol.Handshake.Type | |||||
(Show vNumber, Show vParams) => Show (Message (Handshake vNumber vParams) from to) | |||||
Protocol (Handshake vNumber vParams) | |||||
Defined in Ouroboros.Network.Protocol.Handshake.Type
| |||||
StateTokenI ('StConfirm :: Handshake vNumber vParams) | |||||
Defined in Ouroboros.Network.Protocol.Handshake.Type stateToken :: StateToken ('StConfirm :: Handshake vNumber vParams) # | |||||
StateTokenI ('StDone :: Handshake vNumber vParams) | |||||
Defined in Ouroboros.Network.Protocol.Handshake.Type stateToken :: StateToken ('StDone :: Handshake vNumber vParams) # | |||||
StateTokenI ('StPropose :: Handshake vNumber vParams) | |||||
Defined in Ouroboros.Network.Protocol.Handshake.Type stateToken :: StateToken ('StPropose :: Handshake vNumber vParams) # | |||||
data Message (Handshake vNumber vParams) (from :: Handshake vNumber vParams) (to :: Handshake vNumber vParams) | |||||
Defined in Ouroboros.Network.Protocol.Handshake.Type data Message (Handshake vNumber vParams) (from :: Handshake vNumber vParams) (to :: Handshake vNumber vParams) where
| |||||
type StateToken | |||||
Defined in Ouroboros.Network.Protocol.Handshake.Type | |||||
type StateAgency ('StConfirm :: Handshake vNumber vParams) | |||||
Defined in Ouroboros.Network.Protocol.Handshake.Type | |||||
type StateAgency ('StDone :: Handshake vNumber vParams) | |||||
Defined in Ouroboros.Network.Protocol.Handshake.Type | |||||
type StateAgency ('StPropose :: Handshake vNumber vParams) | |||||
Defined in Ouroboros.Network.Protocol.Handshake.Type |
data LocalAddresses addr #
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 # |
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 |
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 # |
type HandshakeTr ntcAddr (ntcVersion :: k) = WithMuxBearer (ConnectionId ntcAddr) (TraceSendRecv (Handshake ntcVersion Term)) Source #