| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Core.Server.Pipeline.Tarball.Relay
Description
Request shaping and response classification for artifact relays. Response judgements precede the client response commit.
Synopsis
- data ArtifactServe
- withMethod :: ArtifactServe -> Request -> Request
- withValidators :: RequestHeaders -> Request -> Request
- relayUpstreamResult :: ArtifactServe -> ExchangeClient -> ProgressFloor -> Request -> (Status -> Bool) -> (Status -> ResponseHeaders -> IO (Status, ResponseHeaders, verdict)) -> RelayResponder response -> IO (UpstreamResult (verdict, response))
- relayPublicResult :: PublicControl -> PublicReadKind -> ArtifactServe -> ExchangeClient -> ProgressFloor -> Request -> (Status -> Bool) -> (Status -> ResponseHeaders -> IO (Status, ResponseHeaders, verdict)) -> RelayResponder response -> IO (UpstreamResult (verdict, response))
- acceptArtifact :: Status -> Bool
- acceptPrivateArtifact :: Status -> Bool
- privateArtifactResponder :: (Status -> IO result) -> (response -> result) -> RelayResponder response -> RelayResponder result
- relayUnjudged :: Status -> ResponseHeaders -> IO (Status, ResponseHeaders, ())
- relayJudged :: Status -> ResponseHeaders -> IO (Status, ResponseHeaders, RelayVerdict)
- data RelayVerdict
- relayVerdict :: Status -> ResponseHeaders -> RelayVerdict
- observeRelayAnomaly :: KatipContext m => MetricsPort -> PackageName -> Version -> RelayVerdict -> m ()
Serve mode
data ArtifactServe Source #
The artifact method and whether a public admit enqueues a mirror job.
Shaping the upstream artifact request
withMethod :: ArtifactServe -> Request -> Request Source #
Tag an upstream artifact request with the serve mode's method. ServeFull keeps the GET.
withValidators :: RequestHeaders -> Request -> Request Source #
Forward conditional validators so upstream can answer 304.
Relaying the upstream response
relayUpstreamResult :: ArtifactServe -> ExchangeClient -> ProgressFloor -> Request -> (Status -> Bool) -> (Status -> ResponseHeaders -> IO (Status, ResponseHeaders, verdict)) -> RelayResponder response -> IO (UpstreamResult (verdict, response)) Source #
Relay in the serve mode, preserving an upstream rejection or transport failure.
relayPublicResult :: PublicControl -> PublicReadKind -> ArtifactServe -> ExchangeClient -> ProgressFloor -> Request -> (Status -> Bool) -> (Status -> ResponseHeaders -> IO (Status, ResponseHeaders, verdict)) -> RelayResponder response -> IO (UpstreamResult (verdict, response)) Source #
Relay a public artifact or companion after shared authority admission.
acceptArtifact :: Status -> Bool Source #
A successful artifact response, including a matching conditional validator.
acceptPrivateArtifact :: Status -> Bool Source #
Private authorisation failures commit a local refusal instead of allowing public fallback.
privateArtifactResponder :: (Status -> IO result) -> (response -> result) -> RelayResponder response -> RelayResponder result Source #
Replace private access refusals without invoking either upstream responder.
relayUnjudged :: Status -> ResponseHeaders -> IO (Status, ResponseHeaders, ()) Source #
Forward private headers without the public leg's anomaly scan.
relayJudged :: Status -> ResponseHeaders -> IO (Status, ResponseHeaders, RelayVerdict) Source #
Judge public headers before committing the response.
Judging the public relay
data RelayVerdict Source #
What the public leg relayed, judged at relay time from the status and headers alone.
Constructors
| RelayedArtifact | A success whose headers look like the admitted artifact. A relayed |
| RelayedOddShape Text | A success that does not look like an artifact. Carries a bounded reason. |
| RelayedNonSuccess Status | A non-success passed through verbatim. Carries the status. |
Instances
| Show RelayVerdict Source # | |
Defined in Ecluse.Core.Server.Pipeline.Tarball.Relay Methods showsPrec :: Int -> RelayVerdict -> ShowS # show :: RelayVerdict -> String # showList :: [RelayVerdict] -> ShowS # | |
| Eq RelayVerdict Source # | |
Defined in Ecluse.Core.Server.Pipeline.Tarball.Relay | |
relayVerdict :: Status -> ResponseHeaders -> RelayVerdict Source #
Judge one public relay from its status and headers alone.
observeRelayAnomaly :: KatipContext m => MetricsPort -> PackageName -> Version -> RelayVerdict -> m () Source #
Count bounded anomaly classes and log their unbounded detail.