hydra-node-0.20.0: The Hydra node
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.Network.Ouroboros

Description

Ouroboros-based implementation of Network interface. This implements a dumb FireForget protocol and maintains one connection to each peer. Contrary to other protocols implemented in Ouroboros, this is a push-based protocol.

Synopsis

Documentation

withIOManager :: WithIOManager #

data PortNumber #

Instances

Instances details
Arbitrary PortNumber 
Instance details

Defined in Hydra.Network

FromJSON PortNumber 
Instance details

Defined in Hydra.Network

Methods

parseJSON :: Value -> Parser PortNumber

parseJSONList :: Value -> Parser [PortNumber]

omittedField :: Maybe PortNumber

ToJSON PortNumber 
Instance details

Defined in Hydra.Network

Methods

toJSON :: PortNumber -> Value

toEncoding :: PortNumber -> Encoding

toJSONList :: [PortNumber] -> Value

toEncodingList :: [PortNumber] -> Encoding

omitField :: PortNumber -> Bool

Storable PortNumber 
Instance details

Defined in Network.Socket.Types

Bounded PortNumber 
Instance details

Defined in Network.Socket.Types

Enum PortNumber 
Instance details

Defined in Network.Socket.Types

Num PortNumber 
Instance details

Defined in Network.Socket.Types

Read PortNumber 
Instance details

Defined in Network.Socket.Types

Integral PortNumber 
Instance details

Defined in Network.Socket.Types

Real PortNumber 
Instance details

Defined in Network.Socket.Types

Show PortNumber 
Instance details

Defined in Network.Socket.Types

FromCBOR PortNumber 
Instance details

Defined in Hydra.Network

Methods

fromCBOR :: Decoder s PortNumber

label :: Proxy PortNumber -> Text

ToCBOR PortNumber 
Instance details

Defined in Hydra.Network

Methods

toCBOR :: PortNumber -> Encoding

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy PortNumber -> Size

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [PortNumber] -> Size

Eq PortNumber 
Instance details

Defined in Network.Socket.Types

Ord PortNumber 
Instance details

Defined in Network.Socket.Types

newtype Network m msg Source #

Interface from the application to the network layer.

Constructors

Network 

Fields

  • broadcast :: msg -> m ()

    Send a msg to the whole configured hydra network including ourselves.

Instances

Instances details
Contravariant (Network m) Source # 
Instance details

Defined in Hydra.Network

Methods

contramap :: (a' -> a) -> Network m a -> Network m a' Source #

(>$) :: b -> Network m b -> Network m a Source #

data Host Source #

Constructors

Host 

Fields

Instances

Instances details
Arbitrary Host Source # 
Instance details

Defined in Hydra.Network

Methods

arbitrary :: Gen Host

shrink :: Host -> [Host]

FromJSON Host Source # 
Instance details

Defined in Hydra.Network

Methods

parseJSON :: Value -> Parser Host

parseJSONList :: Value -> Parser [Host]

omittedField :: Maybe Host

ToJSON Host Source # 
Instance details

Defined in Hydra.Network

Methods

toJSON :: Host -> Value

toEncoding :: Host -> Encoding

toJSONList :: [Host] -> Value

toEncodingList :: [Host] -> Encoding

omitField :: Host -> Bool

Generic Host Source # 
Instance details

Defined in Hydra.Network

Associated Types

type Rep Host :: Type -> Type Source #

Methods

from :: Host -> Rep Host x Source #

to :: Rep Host x -> Host Source #

Read Host Source # 
Instance details

Defined in Hydra.Network

Show Host Source # 
Instance details

Defined in Hydra.Network

FromCBOR Host Source # 
Instance details

Defined in Hydra.Network

Methods

fromCBOR :: Decoder s Host

label :: Proxy Host -> Text

ToCBOR Host Source # 
Instance details

Defined in Hydra.Network

Methods

toCBOR :: Host -> Encoding

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy Host -> Size

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [Host] -> Size

Eq Host Source # 
Instance details

Defined in Hydra.Network

Methods

(==) :: Host -> Host -> Bool Source #

(/=) :: Host -> Host -> Bool Source #

Ord Host Source # 
Instance details

Defined in Hydra.Network

type Rep Host Source # 
Instance details

Defined in Hydra.Network

type Rep Host = D1 ('MetaData "Host" "Hydra.Network" "hydra-node-0.20.0-5pXAEiXeWsXH8K4KfwlMxW" 'False) (C1 ('MetaCons "Host" 'PrefixI 'True) (S1 ('MetaSel ('Just "hostname") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "port") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PortNumber)))

newtype NetworkCallback msg m Source #

Interface from network layer to the application. XXX: Reliably delivering a message in the crash-recovery fault model is tricky. According to "Introduction to Reliable and Secure Distributed Programming" section "2.2.4 Crashes with recoveries" explains that storing to stable storage and just pointing to stored events is a better way.

Constructors

NetworkCallback 

Fields

  • deliver :: msg -> m ()

    The given msg was received from the network.

type NetworkComponent m inbound outbound a = NetworkCallback inbound m -> (Network m outbound -> m a) -> m a Source #

A type tying both inbound and outbound messages sending in a single Component.

A NetworkComponent can have different inbound and outbound message types.

data TraceOuroborosNetwork msg Source #

Constructors

TraceSubscriptions (WithIPList (SubscriptionTrace SockAddr)) 
TraceErrorPolicy (WithAddr SockAddr ErrorPolicyTrace) 
TraceAcceptPolicy AcceptConnectionsPolicyTrace 
TraceHandshake (WithMuxBearer (ConnectionId SockAddr) (TraceSendRecv (Handshake HydraVersionedProtocolNumber Term))) 
TraceSendRecv (TraceSendRecv (FireForget msg)) 

Instances

Instances details
ToJSON msg => ToJSON (TraceOuroborosNetwork msg) Source # 
Instance details

Defined in Hydra.Network.Ouroboros

data WithHost trace Source #

Constructors

WithHost Host trace 

Instances

Instances details
FromJSON trace => FromJSON (WithHost trace) Source # 
Instance details

Defined in Hydra.Network.Ouroboros

Methods

parseJSON :: Value -> Parser (WithHost trace)

parseJSONList :: Value -> Parser [WithHost trace]

omittedField :: Maybe (WithHost trace)

ToJSON trace => ToJSON (WithHost trace) Source # 
Instance details

Defined in Hydra.Network.Ouroboros

Methods

toJSON :: WithHost trace -> Value

toEncoding :: WithHost trace -> Encoding

toJSONList :: [WithHost trace] -> Value

toEncodingList :: [WithHost trace] -> Encoding

omitField :: WithHost trace -> Bool

Show trace => Show (WithHost trace) Source # 
Instance details

Defined in Hydra.Network.Ouroboros

Methods

showsPrec :: Int -> WithHost trace -> ShowS Source #

show :: WithHost trace -> String Source #

showList :: [WithHost trace] -> ShowS Source #

tagged :: Text -> [Pair] -> Value Source #

withOuroborosNetwork :: forall inbound outbound. (ToCBOR outbound, FromCBOR outbound) => (ToCBOR inbound, FromCBOR inbound) => Tracer IO (WithHost (TraceOuroborosNetwork outbound)) -> HydraNetworkConfig -> (HydraHandshakeRefused -> IO ()) -> NetworkComponent IO inbound outbound () Source #

encodeWithIPList :: WithIPList (SubscriptionTrace SockAddr) -> Value Source #

encodeWithAddr :: WithAddr SockAddr ErrorPolicyTrace -> Value Source #

encodeTraceSendRecvHandshake :: WithMuxBearer (ConnectionId SockAddr) (TraceSendRecv (Handshake HydraVersionedProtocolNumber Term)) -> [Pair] Source #

encodeTraceSendRecvFireForget :: forall msg. ToJSON msg => TraceSendRecv (FireForget msg) -> [Pair] Source #

data HydraNetworkConfig Source #

Instances

Instances details
Generic HydraNetworkConfig Source # 
Instance details

Defined in Hydra.Network.Ouroboros.VersionedProtocol

Associated Types

type Rep HydraNetworkConfig :: Type -> Type Source #

Show HydraNetworkConfig Source # 
Instance details

Defined in Hydra.Network.Ouroboros.VersionedProtocol

Eq HydraNetworkConfig Source # 
Instance details

Defined in Hydra.Network.Ouroboros.VersionedProtocol

type Rep HydraNetworkConfig Source # 
Instance details

Defined in Hydra.Network.Ouroboros.VersionedProtocol

type Rep HydraNetworkConfig = D1 ('MetaData "HydraNetworkConfig" "Hydra.Network.Ouroboros.VersionedProtocol" "hydra-node-0.20.0-5pXAEiXeWsXH8K4KfwlMxW" 'False) (C1 ('MetaCons "HydraNetworkConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "protocolVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HydraVersionedProtocolNumber) :*: (S1 ('MetaSel ('Just "localHost") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Host) :*: S1 ('MetaSel ('Just "remoteHosts") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Host]))))

data HydraVersionedProtocolData Source #

Instances

Instances details
Generic HydraVersionedProtocolData Source # 
Instance details

Defined in Hydra.Network.Ouroboros.VersionedProtocol

Associated Types

type Rep HydraVersionedProtocolData :: Type -> Type Source #

Show HydraVersionedProtocolData Source # 
Instance details

Defined in Hydra.Network.Ouroboros.VersionedProtocol

Eq HydraVersionedProtocolData Source # 
Instance details

Defined in Hydra.Network.Ouroboros.VersionedProtocol

Ord HydraVersionedProtocolData Source # 
Instance details

Defined in Hydra.Network.Ouroboros.VersionedProtocol

Acceptable HydraVersionedProtocolData Source # 
Instance details

Defined in Hydra.Network.Ouroboros.VersionedProtocol

Queryable HydraVersionedProtocolData Source # 
Instance details

Defined in Hydra.Network.Ouroboros.VersionedProtocol

type Rep HydraVersionedProtocolData Source # 
Instance details

Defined in Hydra.Network.Ouroboros.VersionedProtocol

type Rep HydraVersionedProtocolData = D1 ('MetaData "HydraVersionedProtocolData" "Hydra.Network.Ouroboros.VersionedProtocol" "hydra-node-0.20.0-5pXAEiXeWsXH8K4KfwlMxW" 'False) (C1 ('MetaCons "MkHydraVersionedProtocolData" 'PrefixI 'False) (U1 :: Type -> Type))