| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Runtime.Cve.Sync.Internal
Description
Advisory sync scheduling, observation, and paced operator reports.
Synopsis
- data CveFetch = CveFetch {}
- data FetchedObject = FetchedObject {
- foEtag :: DbEtag
- foPushedAt :: Maybe UTCTime
- newtype DbEtag = DbEtag Text
- data OsvDbFetchFault
- = OsvDbTooLarge Int
- | OsvDbNoEtag
- | OsvDbTransport TransportFault
- newtype OsvDbCapExceeded = OsvDbCapExceeded Int
- data S3CveSource
- newS3CveSource :: Maybe AwsEndpoint -> IO S3CveSource
- s3CveFetchFor :: S3CveSource -> Text -> Text -> Int -> CveFetch
- s3CveFetch :: Env -> Text -> Text -> Int -> CveFetch
- cappedAt :: forall (m :: Type -> Type). MonadIO m => Int -> ConduitT ByteString ByteString m ()
- data SyncEnv = SyncEnv {
- syncFetch :: CveFetch
- syncEcosystem :: Ecosystem
- syncEpssRequirement :: EpssRequirement
- syncDbPath :: FilePath
- syncSlot :: CveSlot
- syncStoreRef :: Text
- data SyncOutcome
- = SyncSwapped DbEtag [(Text, Text)]
- | SyncUnchanged
- | SyncAbsent
- | SyncRejected DbEtag CveDbRejected
- | SyncFetchFaulted OsvDbFetchFault
- syncStep :: SyncEnv -> Maybe DbEtag -> IO SyncOutcome
- data SyncSchedule = SyncSchedule {
- schedBootBackoff :: [Int]
- schedPollDelay :: Int
- schedAbsentReport :: Int
- data SyncHooks = SyncHooks {
- hookFirstSync :: IO ()
- hookPushAge :: IO ()
- runCveSync :: (MonadUnliftIO m, KatipContext m) => AdvisorySyncMetricsPort -> AdvisorySyncTracingPort -> SyncEnv -> SyncSchedule -> SyncHooks -> m ()
- bootBackoffDelays :: [Int]
- absentReportInterval :: Int
The injected transport
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 | |
Instances
| Show FetchedObject Source # | |
Defined in Ecluse.Runtime.Cve.Sync.Step Methods showsPrec :: Int -> FetchedObject -> ShowS # show :: FetchedObject -> String # showList :: [FetchedObject] -> ShowS # | |
| Eq FetchedObject Source # | |
Defined in Ecluse.Runtime.Cve.Sync.Step Methods (==) :: FetchedObject -> FetchedObject -> Bool # (/=) :: FetchedObject -> FetchedObject -> Bool # | |
data OsvDbFetchFault #
Constructors
| OsvDbTooLarge Int | |
| OsvDbNoEtag | |
| OsvDbTransport TransportFault |
Instances
| Show OsvDbFetchFault | |
Defined in Ecluse.Core.Cve.Types Methods showsPrec :: Int -> OsvDbFetchFault -> ShowS # show :: OsvDbFetchFault -> String # showList :: [OsvDbFetchFault] -> ShowS # | |
| Eq OsvDbFetchFault | |
Defined in Ecluse.Core.Cve.Types Methods (==) :: OsvDbFetchFault -> OsvDbFetchFault -> Bool # (/=) :: OsvDbFetchFault -> OsvDbFetchFault -> Bool # | |
newtype OsvDbCapExceeded Source #
The confined exception cappedAt throws from inside a conduit, which s3Download folds into OsvDbTooLarge.
Constructors
| OsvDbCapExceeded Int |
Instances
| Exception OsvDbCapExceeded Source # | |
Defined in Ecluse.Runtime.Cve.Sync.S3 Methods toException :: OsvDbCapExceeded -> SomeException # fromException :: SomeException -> Maybe OsvDbCapExceeded # | |
| Show OsvDbCapExceeded Source # | |
Defined in Ecluse.Runtime.Cve.Sync.S3 Methods showsPrec :: Int -> OsvDbCapExceeded -> ShowS # show :: OsvDbCapExceeded -> String # showList :: [OsvDbCapExceeded] -> ShowS # | |
| Eq OsvDbCapExceeded Source # | |
Defined in Ecluse.Runtime.Cve.Sync.S3 Methods (==) :: OsvDbCapExceeded -> OsvDbCapExceeded -> Bool # (/=) :: OsvDbCapExceeded -> OsvDbCapExceeded -> Bool # | |
data S3CveSource Source #
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
Everything one ecosystem's sync task operates on.
Constructors
| SyncEnv | |
Fields
| |
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
| Show SyncOutcome Source # | |
Defined in Ecluse.Runtime.Cve.Sync.Step Methods showsPrec :: Int -> SyncOutcome -> ShowS # show :: SyncOutcome -> String # showList :: [SyncOutcome] -> ShowS # | |
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
| |
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
| |
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.