ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

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

Durations

newtype Seconds Source #

A duration in whole seconds, for extendVisibility. A 'newtype', so a raw Int of seconds cannot pass for some other count.

Constructors

Seconds Int 

Instances

Instances details
Show Seconds Source # 
Instance details

Defined in Ecluse.Core.Queue.Lease

Eq Seconds Source # 
Instance details

Defined in Ecluse.Core.Queue.Lease

Methods

(==) :: Seconds -> Seconds -> Bool #

(/=) :: Seconds -> Seconds -> Bool #

Ord Seconds Source # 
Instance details

Defined in Ecluse.Core.Queue.Lease

The clock a lease is measured on

newtype MonoTime Source #

A reading of the monotonic clock, in seconds from an arbitrary origin.

Constructors

MonoTime Double 

Instances

Instances details
Show MonoTime Source # 
Instance details

Defined in Ecluse.Core.Clock

Eq MonoTime Source # 
Instance details

Defined in Ecluse.Core.Clock

Ord MonoTime Source # 
Instance details

Defined in Ecluse.Core.Clock

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

  • rlWindow :: Seconds

    The window the backend granted, which each renewal asks for again.

  • rlExpiresAt :: MonoTime

    When the current window lapses and another consumer may take the delivery.

  • rlCeilingAt :: MonoTime

    The last instant the backend holds this receipt at all, however often it is renewed (SQS allows twelve hours from the first receipt).

Instances

Instances details
Show ReceiptLease Source # 
Instance details

Defined in Ecluse.Core.Queue.Lease

Eq ReceiptLease Source # 
Instance details

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.