| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
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
- data ExportLoopPlan
- data ExportTarget = ExportTarget {
- etEcosystem :: Ecosystem
- etEpss :: EpssRequirement
- exportLoopPlan :: AdvisoriesSettings -> [ExportTarget] -> Maybe ExportLoopPlan
- exportCadenceMicros :: AdvisoriesSettings -> Int
- idleCadenceMicros :: Int
- configuredSources :: AdvisoriesSettings -> OsvEcosystem -> CompileSources
- quietTimeFor :: AdvisoriesSettings -> Maybe Ecosystem -> QuietTime
- epssAttemptLine :: AdvisoriesSettings -> Text
- data PilotCompileOptions = PilotCompileOptions {}
- compileEpssRequirement :: MountMap -> PilotCompileOptions -> EpssRequirement
- unmountedCompileWarning :: MountMap -> PilotCompileOptions -> Maybe Text
- data UploadPlan
- uploadPlan :: PilotCompileOptions -> Maybe AdvisoryStoreUrl -> Either PilotUploadUnconfigured UploadPlan
- data PilotUploadUnconfigured = PilotUploadUnconfigured
- uploadTarget :: AdvisoryStoreUrl -> FilePath -> (Text, Text)
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
| Show ExportLoopPlan Source # | |
Defined in Ecluse.Pilot.Plan Methods showsPrec :: Int -> ExportLoopPlan -> ShowS # show :: ExportLoopPlan -> String # showList :: [ExportLoopPlan] -> ShowS # | |
| Eq ExportLoopPlan Source # | |
Defined in Ecluse.Pilot.Plan Methods (==) :: ExportLoopPlan -> ExportLoopPlan -> Bool # (/=) :: ExportLoopPlan -> ExportLoopPlan -> Bool # | |
data ExportTarget Source #
One mounted ecosystem the scheduled loop compiles, with what a failed EPSS feed means for it.
Constructors
| ExportTarget | |
Fields
| |
Instances
| Show ExportTarget Source # | |
Defined in Ecluse.Pilot.Plan Methods showsPrec :: Int -> ExportTarget -> ShowS # show :: ExportTarget -> String # showList :: [ExportTarget] -> ShowS # | |
| Eq ExportTarget Source # | |
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 | |
Instances
| Show PilotCompileOptions Source # | |
Defined in Ecluse.Pilot.Plan Methods showsPrec :: Int -> PilotCompileOptions -> ShowS # show :: PilotCompileOptions -> String # showList :: [PilotCompileOptions] -> ShowS # | |
| Eq PilotCompileOptions Source # | |
Defined in Ecluse.Pilot.Plan Methods (==) :: PilotCompileOptions -> PilotCompileOptions -> Bool # (/=) :: PilotCompileOptions -> PilotCompileOptions -> Bool # | |
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
| Show UploadPlan Source # | |
Defined in Ecluse.Pilot.Plan Methods showsPrec :: Int -> UploadPlan -> ShowS # show :: UploadPlan -> String # showList :: [UploadPlan] -> ShowS # | |
| Eq UploadPlan Source # | |
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.
Constructors
| PilotUploadUnconfigured |
Instances
| Exception PilotUploadUnconfigured Source # | |
Defined in Ecluse.Pilot.Plan | |
| Show PilotUploadUnconfigured Source # | |
Defined in Ecluse.Pilot.Plan Methods showsPrec :: Int -> PilotUploadUnconfigured -> ShowS # show :: PilotUploadUnconfigured -> String # showList :: [PilotUploadUnconfigured] -> ShowS # | |
| Eq PilotUploadUnconfigured Source # | |
Defined in Ecluse.Pilot.Plan Methods (==) :: PilotUploadUnconfigured -> PilotUploadUnconfigured -> Bool # (/=) :: PilotUploadUnconfigured -> PilotUploadUnconfigured -> Bool # | |
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.