Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
- newtype LocalTxMonitorServer txid tx slot (m :: Type -> Type) a = LocalTxMonitorServer {
- runLocalTxMonitorServer :: m (ServerStIdle txid tx slot m a)
- data ServerStIdle txid tx slot (m :: Type -> Type) a = ServerStIdle {
- recvMsgAcquire :: m (ServerStAcquiring txid tx slot m a)
- recvMsgDone :: m a
- data ServerStAcquiring txid tx slot (m :: Type -> Type) a where
- 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 = ServerStAcquired {
- recvMsgNextTx :: m (ServerStBusy 'NextTx txid tx slot m a)
- recvMsgHasTx :: txid -> m (ServerStBusy 'HasTx txid tx slot m a)
- recvMsgGetSizes :: m (ServerStBusy 'GetSizes txid tx slot m a)
- recvMsgAwaitAcquire :: m (ServerStAcquiring txid tx slot m a)
- recvMsgRelease :: m (ServerStIdle txid tx slot m a)
- data ServerStBusy (kind :: StBusyKind) txid tx slot (m :: Type -> Type) a where
- 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
- 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
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
.
LocalTxMonitorServer | |
|
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.
ServerStIdle | |
|
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.
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;
ServerStAcquired | |
|
data ServerStBusy (kind :: StBusyKind) txid tx slot (m :: Type -> Type) a where Source #
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.