Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
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
- withOuroborosNetwork :: forall msg. (ToCBOR msg, FromCBOR msg) => Tracer IO (WithHost (TraceOuroborosNetwork msg)) -> Host -> [Host] -> NetworkComponent IO msg msg ()
- withIOManager :: WithIOManager
- data TraceOuroborosNetwork msg
- data WithHost trace
- data PortNumber
- newtype Network m msg = Network {
- broadcast :: msg -> m ()
- type NetworkComponent m inbound outbound a = NetworkCallback inbound m -> (Network m outbound -> m a) -> m a
- type NetworkCallback msg m = msg -> m ()
- data Host = Host {
- hostname :: Text
- port :: PortNumber
- encodeTraceSendRecvFireForget :: forall msg. ToJSON msg => TraceSendRecv (FireForget msg) -> [Pair]
Documentation
withOuroborosNetwork :: forall msg. (ToCBOR msg, FromCBOR msg) => Tracer IO (WithHost (TraceOuroborosNetwork msg)) -> Host -> [Host] -> NetworkComponent IO msg msg () Source #
withIOManager :: WithIOManager #
data TraceOuroborosNetwork msg Source #
Instances
ToJSON msg => ToJSON (TraceOuroborosNetwork msg) Source # | |
Defined in Hydra.Network.Ouroboros toJSON :: TraceOuroborosNetwork msg -> Value toEncoding :: TraceOuroborosNetwork msg -> Encoding toJSONList :: [TraceOuroborosNetwork msg] -> Value toEncodingList :: [TraceOuroborosNetwork msg] -> Encoding |
Instances
FromJSON trace => FromJSON (WithHost trace) Source # | |
Defined in Hydra.Network.Ouroboros parseJSON :: Value -> Parser (WithHost trace) parseJSONList :: Value -> Parser [WithHost trace] | |
ToJSON trace => ToJSON (WithHost trace) Source # | |
Defined in Hydra.Network.Ouroboros toJSON :: WithHost trace -> Value toEncoding :: WithHost trace -> Encoding toJSONList :: [WithHost trace] -> Value toEncodingList :: [WithHost trace] -> Encoding | |
Show trace => Show (WithHost trace) Source # | |
data PortNumber #
Instances
newtype Network m msg Source #
Handle to interface with the hydra network and send messages "off chain".
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.
type NetworkCallback msg m = msg -> m () Source #
Handle to interface for inbound messages.
Host | |
|
Instances
Arbitrary Host Source # | |
FromJSON Host Source # | |
Defined in Hydra.Network parseJSON :: Value -> Parser Host parseJSONList :: Value -> Parser [Host] | |
ToJSON Host Source # | |
Defined in Hydra.Network | |
Generic Host Source # | |
Read Host Source # | |
Show Host Source # | |
FromCBOR Host Source # | |
ToCBOR Host Source # | |
Defined in Hydra.Network 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 # | |
Ord Host Source # | |
type Rep Host Source # | |
Defined in Hydra.Network type Rep Host = D1 ('MetaData "Host" "Hydra.Network" "hydra-node-0.15.0-K4KH8u1blrnL9UtrBUWVZh" 'False) (C1 ('MetaCons "Host" 'PrefixI 'True) (S1 ('MetaSel ('Just "hostname") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "port") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PortNumber))) |
encodeTraceSendRecvFireForget :: forall msg. ToJSON msg => TraceSendRecv (FireForget msg) -> [Pair] Source #