ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Cve.Slot

Description

Advisory generations stay pinned for each lookup. Retirement belongs to the last reader, or to the swapper when no readers remain, even if the swapper is cancelled.

Synopsis

Documentation

data CveSlot Source #

The slot: the currently-active generation, or nothing before the first sync.

newCveSlot :: IO CveSlot Source #

A fresh, empty slot: readers see Nothing until the first swapIn.

withSlotGeneration :: CveSlot -> (Maybe (DbEtag, CveLookup) -> IO a) -> IO a Source #

Borrow a lookup and its own ETag together until the action returns or is cancelled.

currentAdvisoryEtag :: CveSlot -> IO (Maybe DbEtag) Source #

The active generation's artifact DbEtag, or Nothing before the first sync. The read does not pin the generation, so it never delays a swapIn.

data AdvisorySource Source #

Where the serving artifact came from. The publication time is the store's, not the artifact's, so republishing the same bytes can advance it.

Constructors

AdvisorySource 

Fields

Instances

Instances details
Show AdvisorySource Source # 
Instance details

Defined in Ecluse.Core.Cve.Slot

Eq AdvisorySource Source # 
Instance details

Defined in Ecluse.Core.Cve.Slot

currentAdvisorySource :: CveSlot -> IO (Maybe AdvisorySource) Source #

What the serving artifact came from, or Nothing before the first sync. A failed poll never reaches swapIn, so a warm process keeps the last value it read.

observeAdvisoryPublication :: CveSlot -> DbEtag -> Maybe UTCTime -> IO () Source #

Advance publication time only for the installed ETag, without replacing or retiring its database.

generationInstalledAt :: CveSlot -> IO (Maybe Double) Source #

When the serving generation went live, or Nothing while no swap has landed. Only swapIn moves it, so it measures what the slot serves, not the liveness of what fills it.

swapIn :: CveSlot -> DbEtag -> Maybe UTCTime -> CveDb -> IO () Source #

Install a newly verified generation, drain the displaced one's readers, then close it. The slot owns newDb from entry, so no caller cleanup may close it.