| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Cardano.Rpc.Server.Internal.UtxoRpc.Mempool
Description
Handler for the WatchMempool SubmitService RPC method: stream
mempool transactions matching a predicate as they enter the mempool.
Synopsis
- watchMempoolMethod :: MonadRpc e m => Proto WatchMempoolRequest -> (NextElem (Proto WatchMempoolResponse) -> IO ()) -> m ()
- watchMempoolStream :: MonadIO m => m MempoolWatchSnapshot -> (TicketNo -> m MempoolWatchSnapshot) -> Proto TxPredicate -> FieldMaskTree WatchMempoolResponse -> (NextElem (Proto WatchMempoolResponse) -> IO ()) -> m ()
Documentation
Arguments
| :: MonadRpc e m | |
| => Proto WatchMempoolRequest | Request containing a filter predicate and an optional field mask |
| -> (NextElem (Proto WatchMempoolResponse) -> IO ()) | Callback used to send each streamed response |
| -> m () |
Handle the WatchMempool SubmitService RPC method.
Streams new mempool entries matching the request's predicate, each with
stage always STAGE_MEMPOOL (the first locally observable stage;
see matchesTxPredicate).
The field mask is resolved once, before the stream starts; paths start at
the response message, for example tx.native_bytes.
Runs until the client disconnects or the stream is otherwise closed.
Arguments
| :: MonadIO m | |
| => m MempoolWatchSnapshot | Read the current mempool watch snapshot, without blocking - used once, for the initial baseline |
| -> (TicketNo -> m MempoolWatchSnapshot) | Block until an entry newer than the given ticket exists, then return the snapshot |
| -> Proto TxPredicate | Predicate filtering which new entries are sent |
| -> FieldMaskTree WatchMempoolResponse | Field mask resolved once for the whole stream |
| -> (NextElem (Proto WatchMempoolResponse) -> IO ()) | Callback used to send each streamed response |
| -> m () |
The WatchMempool streaming loop. Emits every mempool entry newer than
the last one seen, oldest first, filtered by the predicate and trimmed to
the field mask.
Removals produce no message: the proto has no representation for eviction.