ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Server.Metadata

Description

Metadata observations and caching with credential posture enforced by the origin type. Private reads bypass shared retention and coalescing. Preparation runs only within raw reads.

Synopsis

Constructing a per-request read handle

data MetadataReads posture Source #

Bind raw origin reads to observers before choosing caching. The phantom retains the origin's credential posture.

newMetadataReads :: MetricsPort -> (PackageName -> MetadataError -> IO ()) -> (PackageName -> PackageInfo -> 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.

ecosystemMetadataReads :: PrepareRead -> TracingPort -> MetricsPort -> (PackageName -> MetadataError -> IO ()) -> (PackageName -> PackageInfo -> IO ()) -> (PackageName -> IO ()) -> OriginFor posture -> MetadataReads posture Source #

Bind origin preparation to raw reads, inside cache leaders and request deadlines.

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

Cap each raw read so its single-flight leader fails before the request timeout.

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

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

uncachedPublicMetadataClient :: MetadataReads Public -> MetadataClient Source #

Keep worker upload reads out of the narrower serving-version cache.

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.

Recording one upstream read

recordedFetch :: MetricsPort -> Upstream -> IO (Either MetadataError a) -> IO (Either MetadataError a) Source #

Record one upstream metadata read's latency or error cause. Only leaders call it, so followers and hits do not inflate it.

Projecting one version

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

Prefer an exact version key, then associate PyPI spellings through the canonical key.