ouroboros-network:framework
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Context

Contents

Description

Initiator and responder execution context.

Synopsis

Documentation

data ExpandedInitiatorContext addr extraFlags (m :: Type -> Type) Source #

Context passed to initiator mini-protocol execution.

Constructors

ExpandedInitiatorContext 

Fields

newtype MinimalInitiatorContext addr Source #

A context passed to initiator mini-protocol execution for non-p2p applications.

Constructors

MinimalInitiatorContext 

Fields

Instances

Instances details
Functor MinimalInitiatorContext Source # 
Instance details

Defined in Ouroboros.Network.Context

newtype ResponderContext addr Source #

Context passed to each responder mini-protocol execution.

Constructors

ResponderContext 

Fields

Instances

Instances details
Functor ResponderContext Source # 
Instance details

Defined in Ouroboros.Network.Context

Methods

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

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

Re-exports

data ConnectionId addr Source #

Connection is identified by local and remote address.

Exclusivity. Successive connections may have the same ConnectionId, but mini-protocols that run at the same time with the same ConnectionId always run on the same connection. So a connection's mini-protocols can use its ConnectionId as the key for the state they share. That covers only the mini-protocols' own threads: a thread one of them forks may outlive it, and so use that key after a later connection has started using it.

Exclusivity holds because a connection's socket stays open until all its mini-protocols have ended, and while it is open no other connection can have the same pair of addresses:

  • Each mini-protocol runs as a job of its connection's mux, and the mux's run (see Network.Mux) returns only once it has cancelled every job and waited for it to end, finalisers included.
  • The socket is closed only after run has returned. The connection manager (see Ouroboros.Network.ConnectionManager.Core) closes it once the connection handler, which runs the mux, has returned, and connectToNode (see Ouroboros.Network.Socket) once the mux's thread has ended.
  • While a socket is open, no other socket has the same pair of addresses. TCP ensures that, as does the simulated snocket (see Simulation.Network.Snocket). Over any other snocket, exclusivity holds only if it ensures that too.

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

Defined in Ouroboros.Network.ConnectionId

Methods

showProxy :: Proxy (ConnectionId addr) -> String

Generic (ConnectionId addr) Source # 
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-2.0.0.0-inplace-framework" '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) Source # 
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) Source # 
Instance details

Defined in Ouroboros.Network.ConnectionId

Methods

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

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

Ord addr => Ord (ConnectionId addr) Source #

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

Defined in Ouroboros.Network.ConnectionId

Typeable addr => NoThunks (ConnectionId addr) Source # 
Instance details

Defined in Ouroboros.Network.ConnectionId

PrettyShow addr => PrettyShow (ConnectionId addr) Source # 
Instance details

Defined in Ouroboros.Network.ConnectionId

Methods

prettyShow :: ConnectionId addr -> String

type Rep (ConnectionId addr) Source # 
Instance details

Defined in Ouroboros.Network.ConnectionId

type Rep (ConnectionId addr) = D1 ('MetaData "ConnectionId" "Ouroboros.Network.ConnectionId" "ouroboros-network-2.0.0.0-inplace-framework" 'False) (C1 ('MetaCons "ConnectionId" 'PrefixI 'True) (S1 ('MetaSel ('Just "localAddress") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 addr) :*: S1 ('MetaSel ('Just "remoteAddress") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 addr)))

type ControlMessageSTM (m :: Type -> Type) = STM m ControlMessage #