ouroboros-network-protocols
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Protocol.LocalStateQuery.Client

Synopsis

Protocol type for the client

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

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

Constructors

LocalStateQueryClient 

Fields

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

In the StIdle protocol state, the client has agency and must send:

  • a request to acquire a state
  • a termination messge

Constructors

SendMsgAcquire :: forall point block (query :: Type -> Type) (m :: Type -> Type) a. Target point -> ClientStAcquiring block point query m a -> ClientStIdle block point query m a 
SendMsgDone :: forall a block point (query :: Type -> Type) (m :: Type -> Type). a -> ClientStIdle block point query m a 

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

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

  • acquired
  • failure to acquire

It must be prepared to handle either.

Constructors

ClientStAcquiring 

Fields

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

In the StAcquired protocol state, the client has agency and must send:

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

Constructors

SendMsgQuery :: forall (query :: Type -> Type) result block point (m :: Type -> Type) a. query result -> ClientStQuerying block point query m a result -> ClientStAcquired block point query m a 
SendMsgReAcquire :: forall point block (query :: Type -> Type) (m :: Type -> Type) a. Target point -> ClientStAcquiring block point query m a -> ClientStAcquired block point query m a 
SendMsgRelease :: forall (m :: Type -> Type) block point (query :: Type -> Type) a. m (ClientStIdle block point query m a) -> ClientStAcquired block point query m a 

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

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

  • a result

Constructors

ClientStQuerying 

Fields

Execution as a typed protocol

localStateQueryClientPeer :: forall block point (query :: Type -> Type) (m :: Type -> Type) a. Monad m => LocalStateQueryClient block point query m a -> Client (LocalStateQuery block point query) ('StIdle :: LocalStateQuery block point query) (State :: LocalStateQuery block point query -> Type) m a Source #

Interpret a LocalStateQueryClient action sequence as a Peer on the client side of the LocalStateQuery protocol.

Utilities

mapLocalStateQueryClient :: forall block block' point point' query query' (m :: Type -> Type) a. Functor m => (point -> point') -> (forall result. query result -> Some query') -> (forall result result'. query result -> query' result' -> result' -> result) -> LocalStateQueryClient block point query m a -> LocalStateQueryClient block' point' query' m a Source #

Transform a LocalStateQueryClient by mapping over the query and query result values.

Note the direction of the individual mapping functions corresponds to whether the types are used as protocol inputs or outputs.

data Some (f :: k -> Type) where Source #

Constructors

Some :: forall {k} (f :: k -> Type) (a :: k). f a -> Some f