cardano-client
Safe HaskellNone
LanguageHaskell2010

Cardano.Client.Subscription

Synopsis

Subscription API

subscribe Source #

Arguments

:: LocalSnocket 
-> NetworkMagic 
-> Map NodeToClientVersion blockVersion

Use supportedNodeToClientVersions from `ouroboros-consensus`.

-> SubscriptionTracers a 
-> SubscriptionParams a 
-> (NodeToClientVersion -> blockVersion -> NodeToClientProtocols 'InitiatorMode LocalAddress ByteString IO a Void) 
-> IO () 

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 SubscriptionParams a Source #

Constructors

SubscriptionParams 

Fields

data SubscriptionTracers a Source #

Constructors

SubscriptionTracers 

Fields

Re-exports

Mux

data WithBearer peerid a #

Type used for tracing mux events.

Instances

Instances details
Generic (WithBearer peerid a) 
Instance details

Defined in Network.Mux.Trace

Associated Types

type Rep (WithBearer peerid a) 
Instance details

Defined in Network.Mux.Trace

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

Methods

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

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

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

Defined in Network.Mux.Trace

Methods

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

show :: WithBearer peerid a -> String #

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

type Rep (WithBearer peerid a) 
Instance details

Defined in Network.Mux.Trace

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

Connections

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.

Constructors

ConnectionId 

Fields

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.14.0.0-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. We also relay on this particular order in liveConnections

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.14.0.0-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 LocalAddress #

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

Windows with `named-pipes`.

Constructors

LocalAddress 

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.14.0.0-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.14.0.0-inplace" 'True) (C1 ('MetaCons "LocalAddress" 'PrefixI 'True) (S1 ('MetaSel ('Just "getFilePath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath)))

Protocol API

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

Record of node-to-client mini protocols.

Constructors

NodeToClientProtocols 

Fields

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

A callback executed by each muxed mini-protocol.

Constructors

MiniProtocolCb 

Fields

data RunMiniProtocol (mode :: Mode) 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 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.