| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Arbiter.Worker.Heartbeat.Guard
Description
Internal to the arbiter packages. Not covered by the PVP.
One guard per pool. It fences every batch in flight and extends their leases.
A batch registers through guardBatch. recheck asks for its extend now.
runHeartbeatGuard is the loop that fences and extends.
Synopsis
- data HeartbeatGuard (n :: Type -> Type) job
- data GuardConfig (n :: Type -> Type) job = GuardConfig {
- configInterval :: DiffTime
- configTimeout :: DiffTime
- configMaxDuration :: Maybe DiffTime
- configKey :: job -> JobId
- configLease :: job -> Maybe UTCTime
- configExtend :: [job] -> n [SetVisibilityResult]
- configExtended :: n ()
- configLog :: LogLevel -> [job] -> Text -> n ()
- configHeartbeat :: job -> UTCTime -> UTCTime -> n ()
- newHeartbeatGuard :: MonadSTM n => GuardConfig n job -> n (HeartbeatGuard n job)
- runHeartbeatGuard :: (MonadFork n, MonadMask n, MonadTime n, MonadTimer n) => HeartbeatGuard n job -> n Void
- guardKey :: forall (n :: Type -> Type) job. HeartbeatGuard n job -> job -> JobId
- data Batch (n :: Type -> Type) job = Batch {
- batchJobs :: NonEmpty job
- batchPending :: n [job]
- batchStart :: UTCTime
- batchInherit :: n () -> n ()
- guardBatch :: (MonadFork n, MonadMask n, MonadMonotonicTime n, MonadSTM n, MonadTime n) => HeartbeatGuard n job -> Batch n job -> n a -> n a
- recheck :: (MonadMonotonicTime n, MonadSTM n) => HeartbeatGuard n job -> JobId -> n ()
- trySync :: MonadCatch n => n a -> n (Either SomeException a)
- toDiffTime :: NominalDiffTime -> DiffTime
- minRetryPause :: DiffTime
- settleGrace :: DiffTime
- leaseExpiredReason :: Text
- reclaimedReason :: Text
- deletedReason :: Text
Documentation
data HeartbeatGuard (n :: Type -> Type) jobSource #
The pool's heartbeat guard.
data GuardConfig (n :: Type -> Type) jobSource #
What the guard needs from the pool.
Constructors
| GuardConfig | |
Fields
| |
newHeartbeatGuard :: MonadSTM n => GuardConfig n job -> n (HeartbeatGuard n job)Source #
A guard with no batches registered.
runHeartbeatGuard :: (MonadFork n, MonadMask n, MonadTime n, MonadTimer n) => HeartbeatGuard n job -> n VoidSource #
The guard loop. Fences what is due, then extends what is due.
guardKey :: forall (n :: Type -> Type) job. HeartbeatGuard n job -> job -> JobIdSource #
The key the guard tracks jobs by.
data Batch (n :: Type -> Type) jobSource #
A batch under guard.
Constructors
| Batch | |
Fields
| |
guardBatch :: (MonadFork n, MonadMask n, MonadMonotonicTime n, MonadSTM n, MonadTime n) => HeartbeatGuard n job -> Batch n job -> n a -> n aSource #
Run action on the calling thread with the batch registered with the guard.
recheck :: (MonadMonotonicTime n, MonadSTM n) => HeartbeatGuard n job -> JobId -> n ()Source #
Extend the batch that holds the job now. The extend's verdict signals its handler.
trySync :: MonadCatch n => n a -> n (Either SomeException a)Source #
try for synchronous exceptions only.
toDiffTime :: NominalDiffTime -> DiffTimeSource #
A wall-clock span as a monotonic one.
minRetryPause :: DiffTimeSource #
Shortest gap between failed extends.
settleGrace :: DiffTimeSource #
Settle time a landed extend gets past its give-up.
leaseExpiredReason :: TextSource #
The reason a batch is stopped at its lease.
reclaimedReason :: TextSource #
The reason a batch another worker reclaimed is stopped.
The reason a batch whose row was deleted under it is stopped.