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

Hydra.Network

Description

Asynchronous messaging interface to the Hydra Network, e.g to other Hydra nodes.

Concrete implementations are provided by submodules. Import those instead of this one if interested in actually configuring and running a real network layer.

Incoming and outgoing messages are modelled as Message data type.

Synopsis

Documentation

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.

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.21.0-K9GEdlBE90HJcNWdc0ihAv" '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 ProtocolVersion Source #

Constructors

ProtocolVersion Natural 

Instances

Instances details
Arbitrary ProtocolVersion Source # 
Instance details

Defined in Hydra.Network

FromJSON ProtocolVersion Source # 
Instance details

Defined in Hydra.Network

ToJSON ProtocolVersion Source # 
Instance details

Defined in Hydra.Network

Generic ProtocolVersion Source # 
Instance details

Defined in Hydra.Network

Associated Types

type Rep ProtocolVersion :: Type -> Type Source #

Show ProtocolVersion Source # 
Instance details

Defined in Hydra.Network

FromCBOR ProtocolVersion Source # 
Instance details

Defined in Hydra.Network

ToCBOR ProtocolVersion Source # 
Instance details

Defined in Hydra.Network

Methods

toCBOR :: ProtocolVersion -> Encoding

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

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

Eq ProtocolVersion Source # 
Instance details

Defined in Hydra.Network

Ord ProtocolVersion Source # 
Instance details

Defined in Hydra.Network

type Rep ProtocolVersion Source # 
Instance details

Defined in Hydra.Network

type Rep ProtocolVersion = D1 ('MetaData "ProtocolVersion" "Hydra.Network" "hydra-node-0.21.0-K9GEdlBE90HJcNWdc0ihAv" 'True) (C1 ('MetaCons "ProtocolVersion" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Natural)))

data 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

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 Connectivity Source #

Constructors

PeerConnected

Individual peer appeared alive on network.

Fields

PeerDisconnected

Individual peer disappeared from network (has not been seen active in a while).

Fields

NetworkConnected

Connected to Hydra network.

NetworkDisconnected

Disconnected from Hydra network.

VersionMismatch 

Instances

Instances details
Arbitrary Connectivity Source # 
Instance details

Defined in Hydra.Network

ToJSON Connectivity Source # 
Instance details

Defined in Hydra.Network

Methods

toJSON :: Connectivity -> Value

toEncoding :: Connectivity -> Encoding

toJSONList :: [Connectivity] -> Value

toEncodingList :: [Connectivity] -> Encoding

omitField :: Connectivity -> Bool

Generic Connectivity Source # 
Instance details

Defined in Hydra.Network

Associated Types

type Rep Connectivity :: Type -> Type Source #

Show Connectivity Source # 
Instance details

Defined in Hydra.Network

Eq Connectivity Source # 
Instance details

Defined in Hydra.Network

type Rep Connectivity Source # 
Instance details

Defined in Hydra.Network

type Rep Connectivity = D1 ('MetaData "Connectivity" "Hydra.Network" "hydra-node-0.21.0-K9GEdlBE90HJcNWdc0ihAv" 'False) ((C1 ('MetaCons "PeerConnected" 'PrefixI 'True) (S1 ('MetaSel ('Just "peer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Host)) :+: C1 ('MetaCons "PeerDisconnected" 'PrefixI 'True) (S1 ('MetaSel ('Just "peer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Host))) :+: (C1 ('MetaCons "NetworkConnected" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "NetworkDisconnected" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "VersionMismatch" 'PrefixI 'True) (S1 ('MetaSel ('Just "ourVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ProtocolVersion) :*: S1 ('MetaSel ('Just "theirVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe ProtocolVersion))))))

data NetworkConfiguration Source #

Configuration for a Node network layer.

Constructors

NetworkConfiguration 

Fields

newtype NodeId Source #

Constructors

NodeId 

Fields

Instances

Instances details
Arbitrary NodeId Source # 
Instance details

Defined in Hydra.Network

Methods

arbitrary :: Gen NodeId

shrink :: NodeId -> [NodeId]

FromJSON NodeId Source # 
Instance details

Defined in Hydra.Network

Methods

parseJSON :: Value -> Parser NodeId

parseJSONList :: Value -> Parser [NodeId]

omittedField :: Maybe NodeId

ToJSON NodeId Source # 
Instance details

Defined in Hydra.Network

Methods

toJSON :: NodeId -> Value

toEncoding :: NodeId -> Encoding

toJSONList :: [NodeId] -> Value

toEncodingList :: [NodeId] -> Encoding

omitField :: NodeId -> Bool

IsString NodeId Source # 
Instance details

Defined in Hydra.Network

Read NodeId Source # 
Instance details

Defined in Hydra.Network

Show NodeId Source # 
Instance details

Defined in Hydra.Network

Eq NodeId Source # 
Instance details

Defined in Hydra.Network

Ord NodeId Source # 
Instance details

Defined in Hydra.Network

data IP #

Instances

Instances details
Arbitrary IP 
Instance details

Defined in Hydra.Options

Methods

arbitrary :: Gen IP

shrink :: IP -> [IP]

FromJSON IP 
Instance details

Defined in Hydra.Network

Methods

parseJSON :: Value -> Parser IP

parseJSONList :: Value -> Parser [IP]

omittedField :: Maybe IP

ToJSON IP 
Instance details

Defined in Hydra.Network

Methods

toJSON :: IP -> Value

toEncoding :: IP -> Encoding

toJSONList :: [IP] -> Value

toEncodingList :: [IP] -> Encoding

omitField :: IP -> Bool

Data IP 
Instance details

Defined in Data.IP.Addr

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> IP -> c IP Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c IP Source #

toConstr :: IP -> Constr Source #

dataTypeOf :: IP -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c IP) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IP) Source #

gmapT :: (forall b. Data b => b -> b) -> IP -> IP Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IP -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IP -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> IP -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> IP -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> IP -> m IP Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> IP -> m IP Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> IP -> m IP Source #

IsString IP 
Instance details

Defined in Data.IP.Addr

Methods

fromString :: String -> IP Source #

Enum IP 
Instance details

Defined in Data.IP.Addr

Methods

succ :: IP -> IP Source #

pred :: IP -> IP Source #

toEnum :: Int -> IP Source #

fromEnum :: IP -> Int Source #

enumFrom :: IP -> [IP] Source #

enumFromThen :: IP -> IP -> [IP] Source #

enumFromTo :: IP -> IP -> [IP] Source #

enumFromThenTo :: IP -> IP -> IP -> [IP] Source #

Generic IP 
Instance details

Defined in Data.IP.Addr

Associated Types

type Rep IP :: Type -> Type Source #

Methods

from :: IP -> Rep IP x Source #

to :: Rep IP x -> IP Source #

Read IP 
Instance details

Defined in Data.IP.Addr

Show IP 
Instance details

Defined in Data.IP.Addr

Eq IP 
Instance details

Defined in Data.IP.Addr

Methods

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

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

Ord IP 
Instance details

Defined in Data.IP.Addr

Methods

compare :: IP -> IP -> Ordering Source #

(<) :: IP -> IP -> Bool Source #

(<=) :: IP -> IP -> Bool Source #

(>) :: IP -> IP -> Bool Source #

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

max :: IP -> IP -> IP Source #

min :: IP -> IP -> IP Source #

type Rep IP 
Instance details

Defined in Data.IP.Addr

type Rep IP = D1 ('MetaData "IP" "Data.IP.Addr" "iproute-1.7.15-6AApfiBXsvvLCjHCLgabKJ" 'False) (C1 ('MetaCons "IPv4" 'PrefixI 'True) (S1 ('MetaSel ('Just "ipv4") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedUnpack) (Rec0 IPv4)) :+: C1 ('MetaCons "IPv6" 'PrefixI 'True) (S1 ('MetaSel ('Just "ipv6") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 IPv6)))

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

Eq PortNumber 
Instance details

Defined in Network.Socket.Types

Ord PortNumber 
Instance details

Defined in Network.Socket.Types

Orphan instances

Arbitrary PortNumber Source # 
Instance details

FromJSON IP Source # 
Instance details

Methods

parseJSON :: Value -> Parser IP

parseJSONList :: Value -> Parser [IP]

omittedField :: Maybe IP

FromJSON PortNumber Source # 
Instance details

Methods

parseJSON :: Value -> Parser PortNumber

parseJSONList :: Value -> Parser [PortNumber]

omittedField :: Maybe PortNumber

ToJSON IP Source # 
Instance details

Methods

toJSON :: IP -> Value

toEncoding :: IP -> Encoding

toJSONList :: [IP] -> Value

toEncodingList :: [IP] -> Encoding

omitField :: IP -> Bool

ToJSON PortNumber Source # 
Instance details

Methods

toJSON :: PortNumber -> Value

toEncoding :: PortNumber -> Encoding

toJSONList :: [PortNumber] -> Value

toEncodingList :: [PortNumber] -> Encoding

omitField :: PortNumber -> Bool