ecluse
Safe HaskellNone
LanguageGHC2021

Ecluse.Pilot.Plan

Description

The decisions Pilot makes before it does anything: whether the scheduled loop exports at all and how often, which upstreams one compile reads, whether a failed EPSS feed stops its publication, and whether a one-shot run uploads.

Each is a pure function over the resolved configuration, so Ecluse.Pilot dispatches on their results instead of branching inside IO (Ecluse.Composition.MirrorRole is the same shape).

Synopsis

The scheduled export loop

data ExportLoopPlan Source #

What the scheduled export loop does with the advisory settings and the mounted ecosystems.

Constructors

ExportIdle

No advisory store is configured, so the loop idles and exports nothing.

ExportTo AdvisoryStoreUrl (NonEmpty ExportTarget)

Compile and upload one artifact per target to this store, each on its own cadence.

Instances

Instances details
Show ExportLoopPlan Source # 
Instance details

Defined in Ecluse.Pilot.Plan

Eq ExportLoopPlan Source # 
Instance details

Defined in Ecluse.Pilot.Plan

data ExportTarget Source #

One mounted ecosystem the scheduled loop compiles, with what a failed EPSS feed means for it.

Constructors

ExportTarget 

Fields

  • etEcosystem :: Ecosystem
     
  • etEpss :: EpssRequirement

    The mount's resolved requirement, the one its advisory consumers enforce.

Instances

Instances details
Show ExportTarget Source # 
Instance details

Defined in Ecluse.Pilot.Plan

Eq ExportTarget Source # 
Instance details

Defined in Ecluse.Pilot.Plan

exportLoopPlan :: AdvisoriesSettings -> [ExportTarget] -> Maybe ExportLoopPlan Source #

A configured store turns exporting on, as it does for the proxy's sync, and each mounted ecosystem earns an artifact. Nothing is a store with no ecosystem to compile, which the boot refuses.

exportCadenceMicros :: AdvisoriesSettings -> Int Source #

The delay between export cycles. The config decoder bounds compileInterval to maxBound `div` 1000000 seconds, so this conversion cannot wrap to a negative delay.

idleCadenceMicros :: Int Source #

How long the idle loop sleeps between wakeups. Nothing observes the wakeup, because an added store only takes effect on the next boot, so the sleep is deliberately long.

The upstreams a compile reads

configuredSources :: AdvisoriesSettings -> OsvEcosystem -> CompileSources Source #

The upstreams a compile reads, scheduled or one-shot. Both are configured keys, so a moved or mirrored feed never needs a new binary.

quietTimeFor :: AdvisoriesSettings -> Maybe Ecosystem -> QuietTime Source #

The quiet-time thresholds one compile is judged against. An ecosystem with no configured threshold, and a one-shot compile of a name this build does not serve, take defaultQuietTime.

epssAttemptLine :: AdvisoriesSettings -> Text Source #

The egress every compile attempts whatever the rules, named by the host and port it dials.

The one-shot run

data PilotCompileOptions Source #

Options for the one-shot ecluse pilot compile mode.

Constructors

PilotCompileOptions 

Fields

compileEpssRequirement :: MountMap -> PilotCompileOptions -> EpssRequirement Source #

The EPSS requirement a one-shot compile runs under. A mounted ecosystem takes its resolved policy's. An unmounted one prepares a dataset ahead of its mount, so it requires the feed.

unmountedCompileWarning :: MountMap -> PilotCompileOptions -> Maybe Text Source #

The warning a one-shot compile logs for an ecosystem the loaded configuration does not mount.

data UploadPlan Source #

Whether a one-shot run uploads its artifact, and where.

Constructors

UploadSkipped

The run did not ask to upload, so the artifact stays local.

UploadTo AdvisoryStoreUrl

Upload the compiled artifact to this store.

Instances

Instances details
Show UploadPlan Source # 
Instance details

Defined in Ecluse.Pilot.Plan

Eq UploadPlan Source # 
Instance details

Defined in Ecluse.Pilot.Plan

uploadPlan :: PilotCompileOptions -> Maybe AdvisoryStoreUrl -> Either PilotUploadUnconfigured UploadPlan Source #

Plan a one-shot run's upload. Asking for one with no store configured is refused, never skipped, so a scripted run cannot exit successfully having published nothing.

data PilotUploadUnconfigured Source #

Requesting an upload without a configured advisory store. It is a wiring fault at the composition root, so it throws rather than returning a value the caller could only re-raise.

uploadTarget :: AdvisoryStoreUrl -> FilePath -> (Text, Text) Source #

Where one compiled artifact lands: the store's bucket, and the object key its own file name takes under the store's prefix. The proxy's sync reads that same key.