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, one artifact per mounted ecosystem. Nothing is a store with no ecosystem, which the boot refuses.

exportCadenceMicros :: AdvisoriesSettings -> Int Source #

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

idleCadenceMicros :: Int Source #

The idle loop's sleep. An added store takes effect only on the next boot, so nothing observes the wakeup.

The upstreams a compile reads

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

The upstreams a compile reads, and how its artifact records them. A moved or mirrored feed never needs a new binary.

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

The quiet-time thresholds of one compile. An unconfigured ecosystem, or one this build does not serve, takes defaultQuietTime.

epssAttemptLine :: AdvisoriesSettings -> Text Source #

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

The publication guard

shrinkPolicyOf :: AdvisoriesSettings -> ShrinkPolicy Source #

The shrink limits every publication is held to, scheduled or one-shot.

pilotPostureLines :: AdvisoriesSettings -> [Text] Source #

What every Pilot boot reports: the egress it attempts, and, with a store to publish to, the guard each publication passes.

The one-shot run

data PilotCompileOptions Source #

Options for the one-shot ecluse pilot compile mode.

data UploadRequest Source #

Whether a one-shot run publishes its artifact. A rebaseline exists only beside an upload.

Constructors

NoUpload 
Upload

Publish under the configured guard.

UploadRebaselined Rebaseline

Publish once over the named revision, with this run's own shrink allowance, and restart the baseline.

Instances

Instances details
Show UploadRequest Source # 
Instance details

Defined in Ecluse.Pilot.Plan

Eq UploadRequest Source # 
Instance details

Defined in Ecluse.Pilot.Plan

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

The compiled mount's own requirement. A compile for no mount may serve a policy that needs EPSS.

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 (Maybe Rebaseline)

Upload the compiled artifact to this store, under an operator's rebaseline if one was given.

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. One asked for with no store is refused, so a scripted run cannot succeed having published nothing.

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

Where one compiled artifact lands: the store's bucket and its file's key under the prefix, which the proxy's sync reads.