ecluse:ecluse-runtime
Safe HaskellNone
LanguageGHC2021

Ecluse.Runtime.Cve.Sync.Internal

Description

Advisory sync scheduling, observation, and paced operator reports.

Synopsis

The injected transport

data CveFetch Source #

The advisory transport supplied to one sync cycle.

Constructors

CveFetch 

Fields

data FetchedObject Source #

Metadata from one HEAD or GET response. A download carries its own, so a publication racing HEAD cannot mislabel the bytes.

Constructors

FetchedObject 

Fields

newtype DbEtag #

Constructors

DbEtag Text 

Instances

Instances details
Show DbEtag 
Instance details

Defined in Ecluse.Core.Cve.Types

Eq DbEtag 
Instance details

Defined in Ecluse.Core.Cve.Types

Methods

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

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

data OsvDbFetchFault #

Constructors

OsvDbTooLarge Int 
OsvDbNoEtag 
OsvDbTransport TransportFault 

Instances

Instances details
Show OsvDbFetchFault 
Instance details

Defined in Ecluse.Core.Cve.Types

Eq OsvDbFetchFault 
Instance details

Defined in Ecluse.Core.Cve.Types

data S3CveSource Source #

An S3-backed advisory-fetch source over one amazonka Env, so every mount's CveFetch shares one credential discovery.

newS3CveSource :: Maybe AwsEndpoint -> IO S3CveSource Source #

Build an S3CveSource over one S3 amazonka env, honouring the resolved endpoint override.

s3CveFetchFor :: S3CveSource -> Text -> Text -> Int -> CveFetch Source #

A CveFetch against one bucket, object key, and byte cap, over the captured env.

s3CveFetch :: Env -> Text -> Text -> Int -> CveFetch Source #

A CveFetch for one bucket, object key and byte cap over an amazonka env.

cappedAt :: forall (m :: Type -> Type). MonadIO m => Int -> ConduitT ByteString ByteString m () Source #

A breach throws OsvDbCapExceeded before yielding the excess chunk. The S3 adapter folds it into OsvDbTooLarge.

One sync cycle

data SyncEnv Source #

Everything one ecosystem's sync task operates on.

Constructors

SyncEnv 

Fields

  • syncFetch :: CveFetch

    The transport for this ecosystem's object key.

  • syncEcosystem :: Ecosystem

    The ecosystem the artifact must verify as.

  • syncEpssRequirement :: EpssRequirement

    Whether this ecosystem requires successful EPSS enrichment.

  • syncDbPath :: FilePath

    The canonical on-disk artifact path (the stable per-ecosystem name).

  • syncSlot :: CveSlot

    The slot this task's swaps publish to.

  • syncStoreRef :: Text

    How the configured store reads back, for the reports that name where an artifact belongs.

data SyncOutcome Source #

The result of one sync cycle, for scheduling and observation.

Constructors

SyncSwapped DbEtag [(Text, Text)]

Verification accepted a new artifact and it is now live (its ETag and provenance carried).

SyncUnchanged

No database replacement, though an accepted republication can advance publication time.

SyncAbsent

The object does not exist in the bucket (not yet published).

SyncRejected DbEtag CveDbRejected

The artifact downloaded, and verification refused it. The last-good generation serves on, and the sync remembers the ETag.

SyncFetchFaulted OsvDbFetchFault

The fetch itself failed (carried). The step learned nothing, so the last seen ETag stands and the schedule retries.

Instances

Instances details
Show SyncOutcome Source # 
Instance details

Defined in Ecluse.Runtime.Cve.Sync.Step

syncStep :: SyncEnv -> Maybe DbEtag -> IO SyncOutcome Source #

One detect-download-verify-swap cycle against the last seen ETag. A failed fetch and a refused artifact are outcomes, not exceptions.

The scheduled task

data SyncSchedule Source #

The task's timing in microseconds. The composition root ships bootBackoffDelays and the configured poll interval.

Constructors

SyncSchedule 

Fields

data SyncHooks Source #

What the shell hangs off one sync task. Both run inside the task, so neither may block it, and both must tolerate a repeat.

Constructors

SyncHooks 

Fields

  • hookFirstSync :: IO ()

    Runs after every swap, so it must be idempotent.

  • hookPushAge :: IO ()

    Runs after every step, settled or not, so the push age is read on a poll that changed nothing.

runCveSync :: (MonadUnliftIO m, KatipContext m) => AdvisorySyncMetricsPort -> AdvisorySyncTracingPort -> SyncEnv -> SyncSchedule -> SyncHooks -> m () Source #

Retry at boot, then poll forever. A refused artifact ends the boot burst.

bootBackoffDelays :: [Int] Source #

The boot-burst backoff: an immediate attempt, a retry after each delay, then the steady poll, which is the operator's knob.

absentReportInterval :: Int Source #

The gap in microseconds between repeats of the unloaded-database and fetch-failure reports, and of the rules' outage reminder.