| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Core.Queue.Lease
Description
The receipt-lease vocabulary a queue backend writes and the worker's renewal controller reads (Ecluse.Core.Worker.Lease).
The monotonic instants come from Ecluse.Core.Clock and are re-exported here, because a lease is where most callers meet them. A backend that never expires a delivery supplies no lease.
Synopsis
- newtype Seconds = Seconds Int
- newtype MonoTime = MonoTime Double
- monotonicNow :: IO MonoTime
- monoAfter :: MonoTime -> Double -> MonoTime
- monoSecondsBetween :: MonoTime -> MonoTime -> Double
- data ReceiptLease = ReceiptLease {}
- receiptLease :: MonoTime -> Seconds -> Seconds -> ReceiptLease
Durations
A duration in whole seconds, for extendVisibility. A 'newtype', so a
raw Int of seconds cannot pass for some other count.
The clock a lease is measured on
A reading of the monotonic clock, in seconds from an arbitrary origin.
monotonicNow :: IO MonoTime Source #
Read the monotonic clock.
monoAfter :: MonoTime -> Double -> MonoTime Source #
The instant this many seconds after the given one. A negative offset reads backwards.
monoSecondsBetween :: MonoTime -> MonoTime -> Double Source #
The seconds from the first instant to the second, negative once the second has passed.
One delivery's lease
data ReceiptLease Source #
What one delivery's lease grants: the window it stays hidden for, when that window lapses, and the ceiling the backend holds the whole receipt under.
Constructors
| ReceiptLease | |
Fields
| |
Instances
| Show ReceiptLease Source # | |
Defined in Ecluse.Core.Queue.Lease Methods showsPrec :: Int -> ReceiptLease -> ShowS # show :: ReceiptLease -> String # showList :: [ReceiptLease] -> ShowS # | |
| Eq ReceiptLease Source # | |
Defined in Ecluse.Core.Queue.Lease | |
receiptLease :: MonoTime -> Seconds -> Seconds -> ReceiptLease Source #
A lease stamped from the instant the delivery was asked for, so it never claims more time than the backend granted.