Safe Haskell | Safe-Inferred |
---|---|
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 a =
LocalTxMonitorServer
{
- runLocalTxMonitorServer :: m ( ServerStIdle txid tx slot m a)
-
data
ServerStIdle
txid tx slot m a =
ServerStIdle
{
- recvMsgAcquire :: m ( ServerStAcquiring txid tx slot m a)
- recvMsgDone :: m a
-
data
ServerStAcquiring
txid tx slot m a
where
- SendMsgAcquired :: slot -> ServerStAcquired txid tx slot m a -> ServerStAcquiring txid tx slot m a
-
data
ServerStAcquired
txid tx slot m 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 a
where
- SendMsgReplyNextTx :: Maybe tx -> ServerStAcquired txid tx slot m a -> ServerStBusy NextTx txid tx slot m a
- SendMsgReplyHasTx :: Bool -> ServerStAcquired txid tx slot m a -> ServerStBusy HasTx txid tx slot m a
- SendMsgReplyGetSizes :: MempoolSizeAndCapacity -> ServerStAcquired txid tx slot m a -> ServerStBusy GetSizes txid tx slot m a
- localTxMonitorServerPeer :: forall txid tx slot m a. Monad m => LocalTxMonitorServer txid tx slot m a -> Peer ( LocalTxMonitor txid tx slot) AsServer StIdle m a
Protocol type for the server
The protocol states from the point of view of the server.
newtype LocalTxMonitorServer txid tx slot m a Source #
A local tx monitor protocol server, on top of some effect
m
.
LocalTxMonitorServer | |
|
data ServerStIdle txid tx slot m 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 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 :: slot -> ServerStAcquired txid tx slot m a -> ServerStAcquiring txid tx slot m a |
data ServerStAcquired txid tx slot m 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 a where Source #
SendMsgReplyNextTx :: Maybe tx -> ServerStAcquired txid tx slot m a -> ServerStBusy NextTx txid tx slot m a | |
SendMsgReplyHasTx :: Bool -> ServerStAcquired txid tx slot m a -> ServerStBusy HasTx txid tx slot m a | |
SendMsgReplyGetSizes :: 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 a. Monad m => LocalTxMonitorServer txid tx slot m a -> Peer ( LocalTxMonitor txid tx slot) AsServer StIdle m a Source #
Interpret a
LocalTxMonitorServer
action sequence as a
Peer
on the
client-side of the
LocalTxMonitor
protocol.