{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Ouroboros.Network.Protocol.LocalTxMonitor.Client
(
LocalTxMonitorClient (..)
, ClientStIdle (..)
, ClientStAcquired (..)
, localTxMonitorClientPeer
) where
import Network.TypedProtocol.Core
import Ouroboros.Network.Protocol.LocalTxMonitor.Type
newtype LocalTxMonitorClient txid tx slot m a = LocalTxMonitorClient {
forall txid tx slot (m :: * -> *) a.
LocalTxMonitorClient txid tx slot m a
-> m (ClientStIdle txid tx slot m a)
runLocalTxMonitorClient :: m (ClientStIdle txid tx slot m a)
}
data ClientStIdle txid tx slot m a where
SendMsgAcquire
:: (slot -> m (ClientStAcquired txid tx slot m a))
-> ClientStIdle txid tx slot m a
SendMsgDone
:: a
-> ClientStIdle txid tx slot m a
data ClientStAcquired txid tx slot m a where
SendMsgNextTx
:: (Maybe tx -> m (ClientStAcquired txid tx slot m a))
-> ClientStAcquired txid tx slot m a
SendMsgHasTx
:: txid
-> (Bool -> m (ClientStAcquired txid tx slot m a))
-> ClientStAcquired txid tx slot m a
SendMsgGetSizes
:: (MempoolSizeAndCapacity -> m (ClientStAcquired txid tx slot m a))
-> ClientStAcquired txid tx slot m a
SendMsgAwaitAcquire
:: (slot -> m (ClientStAcquired txid tx slot m a))
-> ClientStAcquired txid tx slot m a
SendMsgRelease
:: m (ClientStIdle txid tx slot m a)
-> ClientStAcquired txid tx slot m a
localTxMonitorClientPeer ::
forall txid tx slot m a.
( Monad m
)
=> LocalTxMonitorClient txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) AsClient StIdle m a
localTxMonitorClientPeer :: forall txid tx slot (m :: * -> *) a.
Monad m =>
LocalTxMonitorClient txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a
localTxMonitorClientPeer (LocalTxMonitorClient m (ClientStIdle txid tx slot m a)
mClient) =
m (Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a
forall (m :: * -> *) ps (pr :: PeerRole) (st :: ps) a.
m (Peer ps pr st m a) -> Peer ps pr st m a
Effect (m (Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a)
-> m (Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a
forall a b. (a -> b) -> a -> b
$ ClientStIdle txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a
handleStIdle (ClientStIdle txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a)
-> m (ClientStIdle txid tx slot m a)
-> m (Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (ClientStIdle txid tx slot m a)
mClient
where
handleStIdle ::
ClientStIdle txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) AsClient StIdle m a
handleStIdle :: ClientStIdle txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a
handleStIdle = \case
SendMsgAcquire slot -> m (ClientStAcquired txid tx slot m a)
stAcquired ->
WeHaveAgency 'AsClient 'StIdle
-> Message (LocalTxMonitor txid tx slot) 'StIdle 'StAcquiring
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquiring m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a
forall (pr :: PeerRole) ps (st :: ps) (st' :: ps) (m :: * -> *) a.
WeHaveAgency pr st
-> Message ps st st' -> Peer ps pr st' m a -> Peer ps pr st m a
Yield (ClientHasAgency 'StIdle -> WeHaveAgency 'AsClient 'StIdle
forall {ps} (st :: ps).
ClientHasAgency st -> PeerHasAgency 'AsClient st
ClientAgency ClientHasAgency 'StIdle
forall {k} {k1} {k2} {txid :: k} {tx :: k1} {slot :: k2}.
ClientHasAgency 'StIdle
TokIdle) Message (LocalTxMonitor txid tx slot) 'StIdle 'StAcquiring
forall {k} {k1} {k2} (txid :: k) (tx :: k1) (slot :: k2).
Message (LocalTxMonitor txid tx slot) 'StIdle 'StAcquiring
MsgAcquire (Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquiring m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquiring m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a
forall a b. (a -> b) -> a -> b
$
TheyHaveAgency 'AsClient 'StAcquiring
-> (forall (st' :: LocalTxMonitor txid tx slot).
Message (LocalTxMonitor txid tx slot) 'StAcquiring st'
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquiring m a
forall (pr :: PeerRole) ps (st :: ps) (m :: * -> *) a.
TheyHaveAgency pr st
-> (forall (st' :: ps). Message ps st st' -> Peer ps pr st' m a)
-> Peer ps pr st m a
Await (ServerHasAgency 'StAcquiring
-> PeerHasAgency 'AsServer 'StAcquiring
forall {ps} (st :: ps).
ServerHasAgency st -> PeerHasAgency 'AsServer st
ServerAgency ServerHasAgency 'StAcquiring
forall {k} {k1} {k2} {txid :: k} {tx :: k1} {slot :: k2}.
ServerHasAgency 'StAcquiring
TokAcquiring) ((forall (st' :: LocalTxMonitor txid tx slot).
Message (LocalTxMonitor txid tx slot) 'StAcquiring st'
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquiring m a)
-> (forall (st' :: LocalTxMonitor txid tx slot).
Message (LocalTxMonitor txid tx slot) 'StAcquiring st'
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquiring m a
forall a b. (a -> b) -> a -> b
$ \case
MsgAcquired slot1
slot -> m (Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a
forall (m :: * -> *) ps (pr :: PeerRole) (st :: ps) a.
m (Peer ps pr st m a) -> Peer ps pr st m a
Effect (m (Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> m (Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a
forall a b. (a -> b) -> a -> b
$ ClientStAcquired txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a
ClientStAcquired txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a
handleStAcquired (ClientStAcquired txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> m (ClientStAcquired txid tx slot m a)
-> m (Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> slot -> m (ClientStAcquired txid tx slot m a)
stAcquired slot
slot1
slot
SendMsgDone a
a ->
WeHaveAgency 'AsClient 'StIdle
-> Message (LocalTxMonitor txid tx slot) 'StIdle 'StDone
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StDone m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a
forall (pr :: PeerRole) ps (st :: ps) (st' :: ps) (m :: * -> *) a.
WeHaveAgency pr st
-> Message ps st st' -> Peer ps pr st' m a -> Peer ps pr st m a
Yield (ClientHasAgency 'StIdle -> WeHaveAgency 'AsClient 'StIdle
forall {ps} (st :: ps).
ClientHasAgency st -> PeerHasAgency 'AsClient st
ClientAgency ClientHasAgency 'StIdle
forall {k} {k1} {k2} {txid :: k} {tx :: k1} {slot :: k2}.
ClientHasAgency 'StIdle
TokIdle) Message (LocalTxMonitor txid tx slot) 'StIdle 'StDone
forall {k} {k1} {k2} (txid :: k) (tx :: k1) (slot :: k2).
Message (LocalTxMonitor txid tx slot) 'StIdle 'StDone
MsgDone (NobodyHasAgency 'StDone
-> a -> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StDone m a
forall ps (st :: ps) a (pr :: PeerRole) (m :: * -> *).
NobodyHasAgency st -> a -> Peer ps pr st m a
Done NobodyHasAgency 'StDone
forall {k} {k1} {k2} {txid :: k} {tx :: k1} {slot :: k2}.
NobodyHasAgency 'StDone
TokDone a
a)
handleStAcquired ::
ClientStAcquired txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) AsClient StAcquired m a
handleStAcquired :: ClientStAcquired txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a
handleStAcquired = \case
SendMsgNextTx Maybe tx -> m (ClientStAcquired txid tx slot m a)
stAcquired ->
WeHaveAgency 'AsClient 'StAcquired
-> Message
(LocalTxMonitor txid tx slot) 'StAcquired ('StBusy 'NextTx)
-> Peer
(LocalTxMonitor txid tx slot) 'AsClient ('StBusy 'NextTx) m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a
forall (pr :: PeerRole) ps (st :: ps) (st' :: ps) (m :: * -> *) a.
WeHaveAgency pr st
-> Message ps st st' -> Peer ps pr st' m a -> Peer ps pr st m a
Yield (ClientHasAgency 'StAcquired -> WeHaveAgency 'AsClient 'StAcquired
forall {ps} (st :: ps).
ClientHasAgency st -> PeerHasAgency 'AsClient st
ClientAgency ClientHasAgency 'StAcquired
forall {k} {k1} {k2} {txid :: k} {tx :: k1} {slot :: k2}.
ClientHasAgency 'StAcquired
TokAcquired) Message (LocalTxMonitor txid tx slot) 'StAcquired ('StBusy 'NextTx)
forall {k} {k1} {k2} (txid :: k) (tx :: k1) (slot :: k2).
Message (LocalTxMonitor txid tx slot) 'StAcquired ('StBusy 'NextTx)
MsgNextTx (Peer (LocalTxMonitor txid tx slot) 'AsClient ('StBusy 'NextTx) m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a)
-> Peer
(LocalTxMonitor txid tx slot) 'AsClient ('StBusy 'NextTx) m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a
forall a b. (a -> b) -> a -> b
$
TheyHaveAgency 'AsClient ('StBusy 'NextTx)
-> (forall (st' :: LocalTxMonitor txid tx slot).
Message (LocalTxMonitor txid tx slot) ('StBusy 'NextTx) st'
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer
(LocalTxMonitor txid tx slot) 'AsClient ('StBusy 'NextTx) m a
forall (pr :: PeerRole) ps (st :: ps) (m :: * -> *) a.
TheyHaveAgency pr st
-> (forall (st' :: ps). Message ps st st' -> Peer ps pr st' m a)
-> Peer ps pr st m a
Await (ServerHasAgency ('StBusy 'NextTx)
-> PeerHasAgency 'AsServer ('StBusy 'NextTx)
forall {ps} (st :: ps).
ServerHasAgency st -> PeerHasAgency 'AsServer st
ServerAgency (TokBusyKind 'NextTx -> ServerHasAgency ('StBusy 'NextTx)
forall {k} {k1} {k2} {txid :: k} {tx :: k1} {slot :: k2}
(k3 :: StBusyKind).
TokBusyKind k3 -> ServerHasAgency ('StBusy k3)
TokBusy TokBusyKind 'NextTx
TokNextTx)) ((forall (st' :: LocalTxMonitor txid tx slot).
Message (LocalTxMonitor txid tx slot) ('StBusy 'NextTx) st'
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer
(LocalTxMonitor txid tx slot) 'AsClient ('StBusy 'NextTx) m a)
-> (forall (st' :: LocalTxMonitor txid tx slot).
Message (LocalTxMonitor txid tx slot) ('StBusy 'NextTx) st'
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer
(LocalTxMonitor txid tx slot) 'AsClient ('StBusy 'NextTx) m a
forall a b. (a -> b) -> a -> b
$ \case
MsgReplyNextTx Maybe tx1
tx ->
m (Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a
forall (m :: * -> *) ps (pr :: PeerRole) (st :: ps) a.
m (Peer ps pr st m a) -> Peer ps pr st m a
Effect (m (Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> m (Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a
forall a b. (a -> b) -> a -> b
$ ClientStAcquired txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a
ClientStAcquired txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a
handleStAcquired (ClientStAcquired txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> m (ClientStAcquired txid tx slot m a)
-> m (Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe tx -> m (ClientStAcquired txid tx slot m a)
stAcquired Maybe tx
Maybe tx1
tx
SendMsgHasTx txid
txid Bool -> m (ClientStAcquired txid tx slot m a)
stAcquired ->
WeHaveAgency 'AsClient 'StAcquired
-> Message
(LocalTxMonitor txid tx slot) 'StAcquired ('StBusy 'HasTx)
-> Peer
(LocalTxMonitor txid tx slot) 'AsClient ('StBusy 'HasTx) m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a
forall (pr :: PeerRole) ps (st :: ps) (st' :: ps) (m :: * -> *) a.
WeHaveAgency pr st
-> Message ps st st' -> Peer ps pr st' m a -> Peer ps pr st m a
Yield (ClientHasAgency 'StAcquired -> WeHaveAgency 'AsClient 'StAcquired
forall {ps} (st :: ps).
ClientHasAgency st -> PeerHasAgency 'AsClient st
ClientAgency ClientHasAgency 'StAcquired
forall {k} {k1} {k2} {txid :: k} {tx :: k1} {slot :: k2}.
ClientHasAgency 'StAcquired
TokAcquired) (txid
-> Message
(LocalTxMonitor txid tx slot) 'StAcquired ('StBusy 'HasTx)
forall {k1} {k2} txid1 (tx :: k1) (slot :: k2).
txid1
-> Message
(LocalTxMonitor txid1 tx slot) 'StAcquired ('StBusy 'HasTx)
MsgHasTx txid
txid) (Peer (LocalTxMonitor txid tx slot) 'AsClient ('StBusy 'HasTx) m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a)
-> Peer
(LocalTxMonitor txid tx slot) 'AsClient ('StBusy 'HasTx) m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a
forall a b. (a -> b) -> a -> b
$
TheyHaveAgency 'AsClient ('StBusy 'HasTx)
-> (forall (st' :: LocalTxMonitor txid tx slot).
Message (LocalTxMonitor txid tx slot) ('StBusy 'HasTx) st'
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer
(LocalTxMonitor txid tx slot) 'AsClient ('StBusy 'HasTx) m a
forall (pr :: PeerRole) ps (st :: ps) (m :: * -> *) a.
TheyHaveAgency pr st
-> (forall (st' :: ps). Message ps st st' -> Peer ps pr st' m a)
-> Peer ps pr st m a
Await (ServerHasAgency ('StBusy 'HasTx)
-> PeerHasAgency 'AsServer ('StBusy 'HasTx)
forall {ps} (st :: ps).
ServerHasAgency st -> PeerHasAgency 'AsServer st
ServerAgency (TokBusyKind 'HasTx -> ServerHasAgency ('StBusy 'HasTx)
forall {k} {k1} {k2} {txid :: k} {tx :: k1} {slot :: k2}
(k3 :: StBusyKind).
TokBusyKind k3 -> ServerHasAgency ('StBusy k3)
TokBusy TokBusyKind 'HasTx
TokHasTx)) ((forall (st' :: LocalTxMonitor txid tx slot).
Message (LocalTxMonitor txid tx slot) ('StBusy 'HasTx) st'
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer
(LocalTxMonitor txid tx slot) 'AsClient ('StBusy 'HasTx) m a)
-> (forall (st' :: LocalTxMonitor txid tx slot).
Message (LocalTxMonitor txid tx slot) ('StBusy 'HasTx) st'
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer
(LocalTxMonitor txid tx slot) 'AsClient ('StBusy 'HasTx) m a
forall a b. (a -> b) -> a -> b
$ \case
MsgReplyHasTx Bool
res ->
m (Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a
forall (m :: * -> *) ps (pr :: PeerRole) (st :: ps) a.
m (Peer ps pr st m a) -> Peer ps pr st m a
Effect (m (Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> m (Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a
forall a b. (a -> b) -> a -> b
$ ClientStAcquired txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a
ClientStAcquired txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a
handleStAcquired (ClientStAcquired txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> m (ClientStAcquired txid tx slot m a)
-> m (Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Bool -> m (ClientStAcquired txid tx slot m a)
stAcquired Bool
res
SendMsgGetSizes MempoolSizeAndCapacity -> m (ClientStAcquired txid tx slot m a)
stAcquired ->
WeHaveAgency 'AsClient 'StAcquired
-> Message
(LocalTxMonitor txid tx slot) 'StAcquired ('StBusy 'GetSizes)
-> Peer
(LocalTxMonitor txid tx slot) 'AsClient ('StBusy 'GetSizes) m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a
forall (pr :: PeerRole) ps (st :: ps) (st' :: ps) (m :: * -> *) a.
WeHaveAgency pr st
-> Message ps st st' -> Peer ps pr st' m a -> Peer ps pr st m a
Yield (ClientHasAgency 'StAcquired -> WeHaveAgency 'AsClient 'StAcquired
forall {ps} (st :: ps).
ClientHasAgency st -> PeerHasAgency 'AsClient st
ClientAgency ClientHasAgency 'StAcquired
forall {k} {k1} {k2} {txid :: k} {tx :: k1} {slot :: k2}.
ClientHasAgency 'StAcquired
TokAcquired) Message
(LocalTxMonitor txid tx slot) 'StAcquired ('StBusy 'GetSizes)
forall {k} {k1} {k2} (txid :: k) (tx :: k1) (slot :: k2).
Message
(LocalTxMonitor txid tx slot) 'StAcquired ('StBusy 'GetSizes)
MsgGetSizes (Peer
(LocalTxMonitor txid tx slot) 'AsClient ('StBusy 'GetSizes) m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a)
-> Peer
(LocalTxMonitor txid tx slot) 'AsClient ('StBusy 'GetSizes) m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a
forall a b. (a -> b) -> a -> b
$
TheyHaveAgency 'AsClient ('StBusy 'GetSizes)
-> (forall (st' :: LocalTxMonitor txid tx slot).
Message (LocalTxMonitor txid tx slot) ('StBusy 'GetSizes) st'
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer
(LocalTxMonitor txid tx slot) 'AsClient ('StBusy 'GetSizes) m a
forall (pr :: PeerRole) ps (st :: ps) (m :: * -> *) a.
TheyHaveAgency pr st
-> (forall (st' :: ps). Message ps st st' -> Peer ps pr st' m a)
-> Peer ps pr st m a
Await (ServerHasAgency ('StBusy 'GetSizes)
-> PeerHasAgency 'AsServer ('StBusy 'GetSizes)
forall {ps} (st :: ps).
ServerHasAgency st -> PeerHasAgency 'AsServer st
ServerAgency (TokBusyKind 'GetSizes -> ServerHasAgency ('StBusy 'GetSizes)
forall {k} {k1} {k2} {txid :: k} {tx :: k1} {slot :: k2}
(k3 :: StBusyKind).
TokBusyKind k3 -> ServerHasAgency ('StBusy k3)
TokBusy TokBusyKind 'GetSizes
TokGetSizes)) ((forall (st' :: LocalTxMonitor txid tx slot).
Message (LocalTxMonitor txid tx slot) ('StBusy 'GetSizes) st'
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer
(LocalTxMonitor txid tx slot) 'AsClient ('StBusy 'GetSizes) m a)
-> (forall (st' :: LocalTxMonitor txid tx slot).
Message (LocalTxMonitor txid tx slot) ('StBusy 'GetSizes) st'
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer
(LocalTxMonitor txid tx slot) 'AsClient ('StBusy 'GetSizes) m a
forall a b. (a -> b) -> a -> b
$ \case
MsgReplyGetSizes MempoolSizeAndCapacity
sizes ->
m (Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a
forall (m :: * -> *) ps (pr :: PeerRole) (st :: ps) a.
m (Peer ps pr st m a) -> Peer ps pr st m a
Effect (m (Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> m (Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a
forall a b. (a -> b) -> a -> b
$ ClientStAcquired txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a
ClientStAcquired txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a
handleStAcquired (ClientStAcquired txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> m (ClientStAcquired txid tx slot m a)
-> m (Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> MempoolSizeAndCapacity -> m (ClientStAcquired txid tx slot m a)
stAcquired MempoolSizeAndCapacity
sizes
SendMsgAwaitAcquire slot -> m (ClientStAcquired txid tx slot m a)
stAcquired ->
WeHaveAgency 'AsClient 'StAcquired
-> Message (LocalTxMonitor txid tx slot) 'StAcquired 'StAcquiring
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquiring m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a
forall (pr :: PeerRole) ps (st :: ps) (st' :: ps) (m :: * -> *) a.
WeHaveAgency pr st
-> Message ps st st' -> Peer ps pr st' m a -> Peer ps pr st m a
Yield (ClientHasAgency 'StAcquired -> WeHaveAgency 'AsClient 'StAcquired
forall {ps} (st :: ps).
ClientHasAgency st -> PeerHasAgency 'AsClient st
ClientAgency ClientHasAgency 'StAcquired
forall {k} {k1} {k2} {txid :: k} {tx :: k1} {slot :: k2}.
ClientHasAgency 'StAcquired
TokAcquired) Message (LocalTxMonitor txid tx slot) 'StAcquired 'StAcquiring
forall {k} {k1} {k2} (txid :: k) (tx :: k1) (slot :: k2).
Message (LocalTxMonitor txid tx slot) 'StAcquired 'StAcquiring
MsgAwaitAcquire (Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquiring m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquiring m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a
forall a b. (a -> b) -> a -> b
$
TheyHaveAgency 'AsClient 'StAcquiring
-> (forall (st' :: LocalTxMonitor txid tx slot).
Message (LocalTxMonitor txid tx slot) 'StAcquiring st'
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquiring m a
forall (pr :: PeerRole) ps (st :: ps) (m :: * -> *) a.
TheyHaveAgency pr st
-> (forall (st' :: ps). Message ps st st' -> Peer ps pr st' m a)
-> Peer ps pr st m a
Await (ServerHasAgency 'StAcquiring
-> PeerHasAgency 'AsServer 'StAcquiring
forall {ps} (st :: ps).
ServerHasAgency st -> PeerHasAgency 'AsServer st
ServerAgency ServerHasAgency 'StAcquiring
forall {k} {k1} {k2} {txid :: k} {tx :: k1} {slot :: k2}.
ServerHasAgency 'StAcquiring
TokAcquiring) ((forall (st' :: LocalTxMonitor txid tx slot).
Message (LocalTxMonitor txid tx slot) 'StAcquiring st'
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquiring m a)
-> (forall (st' :: LocalTxMonitor txid tx slot).
Message (LocalTxMonitor txid tx slot) 'StAcquiring st'
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquiring m a
forall a b. (a -> b) -> a -> b
$ \case
MsgAcquired slot1
slot ->
m (Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a
forall (m :: * -> *) ps (pr :: PeerRole) (st :: ps) a.
m (Peer ps pr st m a) -> Peer ps pr st m a
Effect (m (Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> m (Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a
forall a b. (a -> b) -> a -> b
$ ClientStAcquired txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a
ClientStAcquired txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a
handleStAcquired (ClientStAcquired txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
-> m (ClientStAcquired txid tx slot m a)
-> m (Peer (LocalTxMonitor txid tx slot) 'AsClient st' m a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> slot -> m (ClientStAcquired txid tx slot m a)
stAcquired slot
slot1
slot
SendMsgRelease m (ClientStIdle txid tx slot m a)
stIdle ->
WeHaveAgency 'AsClient 'StAcquired
-> Message (LocalTxMonitor txid tx slot) 'StAcquired 'StIdle
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a
forall (pr :: PeerRole) ps (st :: ps) (st' :: ps) (m :: * -> *) a.
WeHaveAgency pr st
-> Message ps st st' -> Peer ps pr st' m a -> Peer ps pr st m a
Yield (ClientHasAgency 'StAcquired -> WeHaveAgency 'AsClient 'StAcquired
forall {ps} (st :: ps).
ClientHasAgency st -> PeerHasAgency 'AsClient st
ClientAgency ClientHasAgency 'StAcquired
forall {k} {k1} {k2} {txid :: k} {tx :: k1} {slot :: k2}.
ClientHasAgency 'StAcquired
TokAcquired) Message (LocalTxMonitor txid tx slot) 'StAcquired 'StIdle
forall {k} {k1} {k2} (txid :: k) (tx :: k1) (slot :: k2).
Message (LocalTxMonitor txid tx slot) 'StAcquired 'StIdle
MsgRelease (Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StAcquired m a
forall a b. (a -> b) -> a -> b
$
m (Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a
forall (m :: * -> *) ps (pr :: PeerRole) (st :: ps) a.
m (Peer ps pr st m a) -> Peer ps pr st m a
Effect (m (Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a)
-> m (Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a)
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a
forall a b. (a -> b) -> a -> b
$ ClientStIdle txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a
handleStIdle (ClientStIdle txid tx slot m a
-> Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a)
-> m (ClientStIdle txid tx slot m a)
-> m (Peer (LocalTxMonitor txid tx slot) 'AsClient 'StIdle m a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (ClientStIdle txid tx slot m a)
stIdle