ouroboros-network-protocols
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Protocol.LocalTxMonitor.Server

Description

A view of the transaction monitor protocol from the point of view of the server.

This provides simple access to the local mempool snapshots, to allow building more monitoring logic from the client side after submitting transactions.

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

Synopsis

Protocol type for the server

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

newtype LocalTxMonitorServer txid tx slot (m :: Type -> Type) a Source #

A local tx monitor protocol server, on top of some effect m.

Constructors

LocalTxMonitorServer 

Fields

data ServerStIdle txid tx slot (m :: Type -> Type) a Source #

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

  • an acquire request,
  • a termination message.

Constructors

ServerStIdle 

Fields

data ServerStAcquiring txid tx slot (m :: Type -> Type) a where Source #

In the StAcquiring protocol state, the server has agency and must acquire, and hold on to, the current / latest snapshot of its mempool.

Constructors

SendMsgAcquired :: forall slot txid tx (m :: Type -> Type) a. slot -> ServerStAcquired txid tx slot m a -> ServerStAcquiring txid tx slot m a 

data ServerStAcquired txid tx slot (m :: Type -> Type) a Source #

In the StAcquired protocol state, the server does not have agency and is waiting for a client to either:

  • request the next transaction from the snapshot;
  • check the presence of a given transaction, by its id;
  • await a change in the snapshot and acquire it;
  • release and go back to the StIdle state;

Constructors

ServerStAcquired 

Fields

data ServerStBusy (kind :: StBusyKind) txid tx slot (m :: Type -> Type) a where Source #

Constructors

SendMsgReplyNextTx :: forall tx txid slot (m :: Type -> Type) a. Maybe tx -> ServerStAcquired txid tx slot m a -> ServerStBusy 'NextTx txid tx slot m a 
SendMsgReplyHasTx :: forall txid tx slot (m :: Type -> Type) a. Bool -> ServerStAcquired txid tx slot m a -> ServerStBusy 'HasTx txid tx slot m a 
SendMsgReplyGetSizes :: forall txid tx slot (m :: Type -> Type) a. MempoolSizeAndCapacity -> ServerStAcquired txid tx slot m a -> ServerStBusy 'GetSizes txid tx slot m a 

Execution as a typed protocol

localTxMonitorServerPeer :: forall txid tx slot (m :: Type -> Type) a. Monad m => LocalTxMonitorServer txid tx slot m a -> Server (LocalTxMonitor txid tx slot) 'NonPipelined ('StIdle :: LocalTxMonitor txid tx slot) m a Source #

Interpret a LocalTxMonitorServer action sequence as a Peer on the client-side of the LocalTxMonitor protocol.