cardano-client
Safe HaskellNone
LanguageHaskell2010

Cardano.Client.Subscription

Synopsis

Documentation

subscribe Source #

Arguments

:: LocalSnocket 
-> NetworkMagic 
-> Map NodeToClientVersion blockVersion

Use supportedNodeToClientVersions from `ouroboros-consensus`.

-> NetworkClientSubcriptionTracers 
-> ClientSubscriptionParams () 
-> (NodeToClientVersion -> blockVersion -> NodeToClientProtocols 'InitiatorMode LocalAddress ByteString IO x y) 
-> IO Void 

Subscribe using `node-to-client` mini-protocol.

blockVersion ought to be instantiated with `BlockNodeToClientVersion blk`. The callback receives blockVersion associated with each NodeToClientVersion and can be used to create codecs with clientCodecs.

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.

Instances

Instances details
Functor ConnectionId 
Instance details

Defined in Ouroboros.Network.ConnectionId

Methods

fmap :: (a -> b) -> ConnectionId a -> ConnectionId b #

(<$) :: a -> ConnectionId b -> ConnectionId a #

ShowProxy addr => ShowProxy (ConnectionId addr :: Type) 
Instance details

Defined in Ouroboros.Network.ConnectionId

Methods

showProxy :: Proxy (ConnectionId addr) -> String #

Generic (ConnectionId addr) 
Instance details

Defined in Ouroboros.Network.ConnectionId

Associated Types

type Rep (ConnectionId addr) 
Instance details

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)))

Methods

from :: ConnectionId addr -> Rep (ConnectionId addr) x #

to :: Rep (ConnectionId addr) x -> ConnectionId addr #

Show addr => Show (ConnectionId addr) 
Instance details

Defined in Ouroboros.Network.ConnectionId

Methods

showsPrec :: Int -> ConnectionId addr -> ShowS #

show :: ConnectionId addr -> String #

showList :: [ConnectionId addr] -> ShowS #

Eq addr => Eq (ConnectionId addr) 
Instance details

Defined in Ouroboros.Network.ConnectionId

Methods

(==) :: ConnectionId addr -> ConnectionId addr -> Bool #

(/=) :: ConnectionId addr -> ConnectionId addr -> Bool #

Ord addr => Ord (ConnectionId addr)

Order first by remoteAddress then by localAddress.

Note: we relay on the fact that remoteAddress is an order preserving map (which allows us to use mapKeysMonotonic in some cases).

Instance details

Defined in Ouroboros.Network.ConnectionId

Methods

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) 
Instance details

Defined in Ouroboros.Network.ConnectionId

Typeable addr => NoThunks (ConnectionId addr) 
Instance details

Defined in Ouroboros.Network.ConnectionId

type Rep (ConnectionId addr) 
Instance details

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)))

data LocalAddress #

Local address, on Unix is associated with AF_UNIX family, on

Windows with `named-pipes`.

Instances

Instances details
Generic LocalAddress 
Instance details

Defined in Ouroboros.Network.Snocket

Associated Types

type Rep LocalAddress 
Instance details

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)))
Show LocalAddress 
Instance details

Defined in Ouroboros.Network.Snocket

Eq LocalAddress 
Instance details

Defined in Ouroboros.Network.Snocket

Ord LocalAddress 
Instance details

Defined in Ouroboros.Network.Snocket

Hashable LocalAddress 
Instance details

Defined in Ouroboros.Network.Snocket

type Rep LocalAddress 
Instance details

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)))

data NodeToClientProtocols (appType :: MuxMode) ntcAddr bytes (m :: Type -> Type) a b #

Record of node-to-client mini protocols.

Constructors

NodeToClientProtocols 

Fields

data MiniProtocolCb ctx bytes (m :: Type -> Type) a where #

A callback executed by each muxed mini-protocol.

Constructors

MiniProtocolCb :: forall ctx (m :: Type -> Type) bytes a. (ctx -> Channel m bytes -> m (a, Maybe bytes)) -> MiniProtocolCb ctx bytes m a 
MuxPeer :: forall (pr :: PeerRole) ps (st :: ps) failure ctx bytes (m :: Type -> Type) a. (ShowProxy ps, forall (st' :: ps) tok. tok ~ StateToken st' => Show tok, Show failure) => (ctx -> (Tracer m (TraceSendRecv ps), Codec ps failure m bytes, Peer ps pr 'NonPipelined st m a)) -> MiniProtocolCb ctx bytes m a 
MuxPeerPipelined :: forall (pr :: PeerRole) ps (st :: ps) failure ctx bytes (m :: Type -> Type) a. (ShowProxy ps, forall (st' :: ps) tok. tok ~ StateToken st' => Show tok, Show failure) => (ctx -> (Tracer m (TraceSendRecv ps), Codec ps failure m bytes, PeerPipelined ps pr st m a)) -> MiniProtocolCb ctx bytes m a 

Bundled Patterns

pattern MuxPeerRaw :: forall ctx bytes m a. (ctx -> Channel m bytes -> m (a, Maybe bytes)) -> MiniProtocolCb ctx bytes m a 

data MuxTrace #

Enumeration of Mux events that can be traced.

Instances

Instances details
Show MuxTrace 
Instance details

Defined in Network.Mux.Trace

data RunMiniProtocol (mode :: MuxMode) initiatorCtx responderCtx bytes (m :: Type -> Type) a b where #

RunMiniProtocol. It also capture context (the IsBigLedgerPeer) which is passed to the mini-protocol when a mini-protocol is started.

Constructors

InitiatorProtocolOnly :: forall initiatorCtx bytes (m :: Type -> Type) a responderCtx. MiniProtocolCb initiatorCtx bytes m a -> RunMiniProtocol 'InitiatorMode initiatorCtx responderCtx bytes m a Void 
ResponderProtocolOnly :: forall responderCtx bytes (m :: Type -> Type) b initiatorCtx. MiniProtocolCb responderCtx bytes m b -> RunMiniProtocol 'ResponderMode initiatorCtx responderCtx bytes m Void b 
InitiatorAndResponderProtocol :: forall initiatorCtx bytes (m :: Type -> Type) a responderCtx b. MiniProtocolCb initiatorCtx bytes m a -> MiniProtocolCb responderCtx bytes m b -> RunMiniProtocol 'InitiatorResponderMode initiatorCtx responderCtx bytes m a b 

data WithMuxBearer peerid a #

Type used for tracing mux events.

Instances

Instances details
Generic (WithMuxBearer peerid a) 
Instance details

Defined in Network.Mux.Trace

Associated Types

type Rep (WithMuxBearer peerid a) 
Instance details

Defined in Network.Mux.Trace

type Rep (WithMuxBearer peerid a) = D1 ('MetaData "WithMuxBearer" "Network.Mux.Trace" "network-mux-0.4.5.3-inplace" 'False) (C1 ('MetaCons "WithMuxBearer" 'PrefixI 'True) (S1 ('MetaSel ('Just "wmbPeerId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 peerid) :*: S1 ('MetaSel ('Just "wmbEvent") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)))

Methods

from :: WithMuxBearer peerid a -> Rep (WithMuxBearer peerid a) x #

to :: Rep (WithMuxBearer peerid a) x -> WithMuxBearer peerid a #

(Show peerid, Show a) => Show (WithMuxBearer peerid a) 
Instance details

Defined in Network.Mux.Trace

Methods

showsPrec :: Int -> WithMuxBearer peerid a -> ShowS #

show :: WithMuxBearer peerid a -> String #

showList :: [WithMuxBearer peerid a] -> ShowS #

type Rep (WithMuxBearer peerid a) 
Instance details

Defined in Network.Mux.Trace

type Rep (WithMuxBearer peerid a) = D1 ('MetaData "WithMuxBearer" "Network.Mux.Trace" "network-mux-0.4.5.3-inplace" 'False) (C1 ('MetaCons "WithMuxBearer" 'PrefixI 'True) (S1 ('MetaSel ('Just "wmbPeerId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 peerid) :*: S1 ('MetaSel ('Just "wmbEvent") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)))

data ControlMessage #

Control signal sent to a mini-protocol. Expected to exit, on Continue it should continue its operation

Constructors

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.