ecluse
Safe HaskellNone
LanguageGHC2021

Ecluse.Cve.Sync

Description

The advisory-sync plan: one CveSyncHandle per mount ecosystem (planCveSync), the projections the composition root reads off it, and one supervised sync task per handle.

Synopsis

Documentation

data CveSyncHandle Source #

One configured ecosystem's advisory-sync wiring.

Constructors

CveSyncHandle 

Fields

  • csReady :: TVar Bool

    The one-way first-sync readiness flag.

  • csEnv :: SyncEnv

    The sync task's environment. Its syncSlot is the slot this ecosystem's rules borrow through.

  • csMaxAge :: MaxAdvisoryAge

    This mount's effective maximum push age, derived once at boot from its own rules.

  • csClock :: IO UTCTime

    The wall clock the push age is read on, injected so a suite can fix it.

  • csAgeAlarmed :: TVar Bool

    Whether the half-maximum crossing has already been reported for the current push.

  • csOutage :: TVar OutageState

    The rules-side outage state every mount of this ecosystem reports through.

  • csDatabase :: DatabaseRequirement

    Whether this mount's own rules deny on the database, which is what its readiness turns on.

data AdvisoryNeed Source #

What one vetted mount's rules ask of the advisory stack, read off its own policy at boot.

Constructors

AdvisoryNeed 

Fields

planCveSync :: LogEnv -> Maybe AwsEndpoint -> AppConfig -> [AdvisoryNeed] -> IO (Map Ecosystem CveSyncHandle) Source #

Build one sync handle per vetted ecosystem. No store yields no handles, and unsupported mounts stay unready.

sweepStaleTemps :: LogEnv -> FilePath -> IO () Source #

Remove stale downloads retained across container restarts, with best-effort errors handled by sweepStep.

sweepStep :: LogEnv -> FilePath -> IO () -> IO () Source #

Log and swallow an IOError from one sweep step. Other exceptions propagate.

cveRuleDepsFor :: Map Ecosystem CveSyncHandle -> BreakerReporter -> (Ecosystem -> OutageReport -> IO ()) -> Ecosystem -> RuleDeps Source #

Bind each ecosystem's rules to its own advisory slot and observers. Missing handles configure no database.

advisoryFreshnessFor :: Map Ecosystem CveSyncHandle -> Ecosystem -> IO AdvisoryFreshness Source #

Assess the live slot's publication age. Ecosystems without an advisory stack have nothing to age.

reportPushAge :: LogEnv -> Ecosystem -> CveSyncHandle -> IO () Source #

Report crossing half the maximum age once. A fresh push re-arms the report.

katipOutageReporter :: LogEnv -> Ecosystem -> OutageReport -> IO () Source #

Log outage starts and reminders at ERROR, and recovery at INFO. Fault details reach no client.

outageReportPeriod :: NominalDiffTime Source #

The reminder interval for continuing outages, shared with unloaded-database reports.

cveSyncReadiness :: Map Ecosystem CveSyncHandle -> IO Readiness Source #

Wait for the first sync only on mounts with advisory denies. Other ecosystems remain routable.

cveSyncScheduleFor :: AppConfig -> SyncSchedule Source #

Use the boot retry burst and configured poll interval. Configuration bounds the microsecond conversion.

cveSyncTasks :: LogEnv -> Metrics -> Telemetry -> SyncSchedule -> Map Ecosystem CveSyncHandle -> [IO ()] Source #

Run one supervised sync task per ecosystem, marking first-sync readiness once for every evaluating role.

registerAdvisoryAges :: Metrics -> Map Ecosystem CveSyncHandle -> IO () Source #

Register once per role. Callbacks read the slots, so observations survive sync-task restarts.