ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Server.Metadata

Description

Caching, metrics, and failure logs around registry metadata reads. The caching policy is not exported, and an origin carries its credential posture in its type. publicMetadataClient takes reads over a Public origin, which only anonymousOrigin builds and which presents no credential, so reads that carry a caller's credential cannot reach the shared cache. privateMetadataClient takes no cache at all. Anonymous public reads use the selected provider's typed retention capabilities.

Synopsis

Constructing a per-request read handle

data MetadataReads posture Source #

One origin's raw reads bound to their observers, before a caching policy settles them into a MetadataClient. The phantom is the posture of the origin the reads were bound to.

newMetadataReads :: MetricsPort -> (PackageName -> MetadataError -> IO ()) -> (PackageName -> [InvalidEntry] -> IO ()) -> (PackageName -> IO ()) -> (OriginClient -> PackageName -> IO (Either MetadataError Manifest)) -> (OriginClient -> PackageName -> Version -> IO (Either MetadataError VersionRead)) -> OriginFor posture -> MetadataReads posture Source #

Bind one origin's raw reads to the metrics port and the failure, invalid-entry, and fetch logs.

withinRequestCap :: ProgressFloor -> MetadataReads posture -> MetadataReads posture Source #

Hold each raw read to the floor's serve-path cap, so a single-flight leader fails before the request timeout ends its request.

publicMetadataClient :: MetadataCache -> Source -> MetadataReads Public -> MetadataClient Source #

The anonymous origin's handle, resolving through the shared cache under its Source key.

preparePublicVersion :: MetadataCache -> Source -> MetadataReads Public -> PackageName -> Version -> IO (PreparedStore MetadataError VersionRead) Source #

Prepare anonymous selected metadata while keeping its logs and upstream metrics on the leader.

privateMetadataClient :: MetadataReads Private -> MetadataClient Source #

The per-caller origin's handle. It takes no cache, so the upstream re-authorises every caller.

Projecting one version

selectVersion :: Version -> PackageInfo -> Maybe PackageDetails Source #

Find a version by its ecosystem-rendered key in a package snapshot.