ouroboros-network:protocols
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Protocol.ObjectDiffusion.Outbound

Description

A view of the object diffusion protocol from the point of view of the outbound/server peer.

This provides a view that uses less complex types and should be easier to use than the underlying typed protocol itself.

For execution, objectDiffusionOutboundPeer is provided for conversion into the typed protocol.

Synopsis

Protocol type for the outbound

newtype ObjectDiffusionOutbound objectId object (m :: Type -> Type) a Source #

The outbound side of the object diffusion protocol.

The peer in the outbound/server role submits objects to the peer in the inbound/client role.

Constructors

ObjectDiffusionOutbound 

Fields

data OutboundStIdle objectId object (m :: Type -> Type) a Source #

In the StIdle protocol state, the outbound does not have agency. Instead it is waiting for:

  • a request for object ids (blocking or non-blocking)
  • a request for a given list of objects
  • a termination message

It must be prepared to handle any of these.

Constructors

OutboundStIdle 

Fields

data OutboundStObjectIds (kind :: StObjectIdsKind) objectId object (m :: Type -> Type) a where Source #

The outbound node has agency; it must reply with a list of object identifiers that it wishes to submit.

A non-blocking request has one prompt reply state. A blocking request has two phases, distinguishing the prompt reply state from the state entered after the server has reported that it must await new objects.

Parameterizing this data type with `kind :: StObjectIdsKind` instead of creating 3 separate data types enables parametric polymorphism. The advantage of parametric polymorphism is that code that is oblivious to the distinction expressed by the parameter does not have to be duplicated. SendMsgReplyObjectIds is an example of this. Without parametric polymorphism, we would need 3 versions of it.

Constructors

SendMsgReplyObjectIds :: forall (kind :: StObjectIdsKind) objectId object (m :: Type -> Type) a. ObjectIdsReplyList kind objectId -> OutboundStIdle objectId object m a -> OutboundStObjectIds kind objectId object m a 
SendMsgAwaitReply :: forall (m :: Type -> Type) objectId object a. m (OutboundStObjectIds ('StObjectIdsBlocking 'StMustReply) objectId object m a) -> OutboundStObjectIds ('StObjectIdsBlocking 'StCanAwait) objectId object m a 
SendMsgServerIdle :: forall objectId object (m :: Type -> Type) a. OutboundStIdle objectId object m a -> OutboundStObjectIds ('StObjectIdsBlocking 'StMustReply) objectId object m a 

data OutboundStObjects objectId object (m :: Type -> Type) a where Source #

Constructors

SendMsgReplyObjects :: forall object objectId (m :: Type -> Type) a. [object] -> OutboundStIdle objectId object m a -> OutboundStObjects objectId object m a 

Execution as a typed protocol

objectDiffusionOutboundPeer :: forall objectId object (m :: Type -> Type) a. Monad m => ObjectDiffusionOutbound objectId object m a -> Peer (ObjectDiffusion objectId object) 'AsServer 'NonPipelined ('StInit :: ObjectDiffusion objectId object) m a Source #

A non-pipelined Peer representing the ObjectDiffusionOutbound.