| 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
- relayUpstreamWhen :: ArtifactServe -> Manager -> ProgressFloor -> Request -> (Status -> Bool) -> (Status -> ResponseHeaders -> IO (Status, ResponseHeaders, verdict)) -> RelayResponder response -> IO (Maybe (verdict, response))
- acceptArtifact :: Status -> Bool
- 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 serve mode, threaded through the artifact path so GET and HEAD share one
gate and one upstream-request construction.
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 #
Relay the client's conditional validators onto an upstream artifact request, so upstream can
answer a 304 Not Modified instead of resending an unchanged body.
Relaying the upstream response
relayUpstreamWhen :: ArtifactServe -> Manager -> ProgressFloor -> Request -> (Status -> Bool) -> (Status -> ResponseHeaders -> IO (Status, ResponseHeaders, verdict)) -> RelayResponder response -> IO (Maybe (verdict, response)) Source #
Relay an upstream artifact response in the serve mode. Both modes keep the same
recoverable-miss and committed split, so a HEAD falls through a private miss as a GET does.
acceptArtifact :: Status -> Bool Source #
A successful artifact response, including a matching conditional validator.
relayUnjudged :: Status -> ResponseHeaders -> IO (Status, ResponseHeaders, ()) Source #
The trusted leg's pre-commit relay. It judges nothing, so the private path pays no header scan for an anomaly only the public leg can have.
relayJudged :: Status -> ResponseHeaders -> IO (Status, ResponseHeaders, RelayVerdict) Source #
The public leg's pre-commit relay. The verdict is decided before any body moves, so a committed relay always carries exactly one.
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 #
Observe one public-relay verdict. An anomaly counts on the bounded
ecluse.serve.relay.anomalies metric, and the unbounded detail stays on the log line.