ecluse
Safe HaskellNone
LanguageGHC2021

Ecluse.Composition.Worker

Description

The composition root's worker bundle construction: the one function that turns the served mounts, the resolved publish targets, and the adapter registry into the per-ecosystem WorkerPolicies the mirror worker dispatches every job through.

runProxy consumes this, and a worker-only binary is a thin entry over the same function: everything the worker's dispatch needs (the re-evaluation inputs, the artifact request formation, and the married mirror-write capability) is assembled here rather than threaded through the proxy's own wiring. The adapter registry is consumed only here, at the composition root, per the standing rule: the worker itself receives plain handles and never resolves an adapter.

Each bundle reuses its mount's own PackumentDeps (the same prepared rules, floors, host gate, and request formation the serve path gates with, so the ingest decision cannot diverge from the serve decision) and marries its ecosystem's publish codec to the shared publish transport at the mount's declared mirror target. A mount that serves no packument, or an ecosystem without a resolved publish target or adapter, contributes no bundle: a job for it is fail-closed at the worker rather than half-wired here.

Synopsis

Documentation

workerPoliciesFor :: Env -> [MountBinding] -> [PublishTarget] -> Int -> WorkerPolicies Source #

Build the worker's per-ecosystem bundles from the served mounts and the resolved publish targets: for each mount that serves a packument (carries PackumentDeps) and whose ecosystem resolves a publish target and an adapter, a bundle keyed by the ecosystem its path prefix names. A mount left at the recognised-but-unserved stub contributes none, and a job for an ecosystem absent here is fail-closed at the worker. The bundles reuse each mount's own prepared rules, so the serve gate and the ingest re-evaluation share one prepared rule set (and any per-source breaker state) rather than preparing a second; the publish leg is that ecosystem's codec married to the shared transport at its declared mirror target.

mirrorTransportFor :: Env -> PackumentDeps -> PublishTarget -> MirrorTransport Source #

The shared mirror-write transport for one mount: the trusted private-origin manager, the target's credential mint, and the mount's own pdLimits as the probe's response bound, so the presence probe reads under the same boot-computed, operator-overridable bound every other metadata read on the mount honours (rather than the shipped metadata-path default, which a larger mirror packument would silently overrun, defeating duplicate suppression).