| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Hydra.Node.Outbox
Description
An ordered hand-off for effects that must not block the thread producing them.
Synopsis
- data StallBounds = StallBounds {}
- data Outbox m = Outbox {
- submit :: m () -> m ()
- outboxStalled :: m (Maybe (StallReason, Natural))
- pendingActions :: STM m Natural
- outboxBacklog :: m (Natural, DiffTime)
- runOutbox :: m ()
- drainOutbox :: m ()
- stallBounds :: StallBounds
- newOutbox :: (MonadLabelledSTM m, MonadMonotonicTime m) => StallBounds -> String -> m (Outbox m)
- serviceWindow :: DiffTime
Documentation
data StallBounds Source #
Bounds beyond which an Outbox reports itself stalled.
Constructors
| StallBounds | |
Fields
| |
A single-consumer hand-off for actions that must not block the thread submitting them.
The hydra node processes all its inputs on one thread and used to run every
effect inline on it, so an effect that blocked stopped it dequeuing
anything at all - including the chain observation and the client command it
needs to close and contest a head. See GHSA-3mmr-q43p-g6p2 and
withNetworkOutbox.
$sel:submit:Outbox therefore only appends; $sel:runOutbox:Outbox is the one thing that performs
the actions, in submission order.
Constructors
| Outbox | |
Fields
| |
newOutbox :: (MonadLabelledSTM m, MonadMonotonicTime m) => StallBounds -> String -> m (Outbox m) Source #
serviceWindow :: DiffTime Source #
How much busy time the service time estimate averages over. Long enough
that a pause of a few hundred milliseconds barely moves it, short against
any $sel:noProgressFor:StallBounds worth configuring.