ouroboros-network-protocols
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Protocol.LocalStateQuery.Server

Synopsis

Protocol type for the server

The protocol states from the point of view of the server.

newtype LocalStateQueryServer block point (query :: Type -> Type) (m :: Type -> Type) a Source #

Constructors

LocalStateQueryServer 

Fields

data ServerStIdle block point (query :: Type -> Type) (m :: Type -> Type) a Source #

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

  • a request to acquire a state
  • a termination messge

It must be prepared to handle either.

Constructors

ServerStIdle 

Fields

data ServerStAcquiring block point (query :: Type -> Type) (m :: Type -> Type) a where Source #

In the StAcquiring protocol state, the server has agency and must send either:

  • acquired
  • failure to acquire

Constructors

SendMsgAcquired :: forall block point (query :: Type -> Type) (m :: Type -> Type) a. ServerStAcquired block point query m a -> ServerStAcquiring block point query m a 
SendMsgFailure :: forall block point (query :: Type -> Type) (m :: Type -> Type) a. AcquireFailure -> ServerStIdle block point query m a -> ServerStAcquiring block point query m a 

data ServerStAcquired block point (query :: Type -> Type) (m :: Type -> Type) a Source #

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

  • a query
  • a request to (re)acquire another state
  • a release of the current state

It must be prepared to handle either.

Constructors

ServerStAcquired 

Fields

data ServerStQuerying block point (query :: Type -> Type) (m :: Type -> Type) a result where Source #

In the StQuerying protocol state, the server has agency and must send:

  • a result

Constructors

SendMsgResult :: forall result block point (query :: Type -> Type) (m :: Type -> Type) a. result -> ServerStAcquired block point query m a -> ServerStQuerying block point query m a result 

Execution as a typed protocol

localStateQueryServerPeer :: forall block point (query :: Type -> Type) (m :: Type -> Type) a. Monad m => LocalStateQueryServer block point query m a -> Server (LocalStateQuery block point query) ('StIdle :: LocalStateQuery block point query) (State :: LocalStateQuery block point query -> Type) m a Source #

Interpret a LocalStateQueryServer action sequence as a Peer on the server side of the LocalStateQuery protocol.