ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Registry

Description

Registry payloads and typed failures shared by the protocol capabilities. Read responses retain the HTTP status so metadata projection cannot erase access refusals.

Synopsis

Fetch payload

data RegistryResponse Source #

Upstream status and bytes retained before protocol decoding.

Constructors

RegistryResponse 

Fields

data BodyOutcome a Source #

The answer to a read that consumes only a 2xx body.

Constructors

SuccessBody Int a

The 2xx status and the consumer's result.

UnreadStatus Int (Maybe RetryAfter)

A status outside 2xx, with any delay its Retry-After asked for. The consumer never ran.

Instances

Instances details
Functor BodyOutcome Source # 
Instance details

Defined in Ecluse.Core.Registry

Methods

fmap :: (a -> b) -> BodyOutcome a -> BodyOutcome b #

(<$) :: a -> BodyOutcome b -> BodyOutcome a #

Show a => Show (BodyOutcome a) Source # 
Instance details

Defined in Ecluse.Core.Registry

Eq a => Eq (BodyOutcome a) Source # 
Instance details

Defined in Ecluse.Core.Registry

isAuthorisationFailure :: Int -> Bool Source #

Whether an upstream status explicitly refuses authentication or authorisation.

isSuccessStatus :: Int -> Bool Source #

Whether an upstream status reports success. Every leg reads this one test, so none can drift.

Publish descriptor

data MirrorArtifact Source #

The artifact descriptor the mirror publish uses.

Constructors

MirrorArtifact 

Fields

  • maFilename :: Filename

    The artifact's on-the-wire filename, the _attachments key in the publish document.

  • maHashes :: NonEmpty Hash

    The integrity digests, at least one. The tamper gate verified the fetched bytes against this floor-checked set.

  • maSize :: Maybe Int

    Registry-declared size, which may describe the unpacked tree rather than transferred bytes.

Instances

Instances details
Show MirrorArtifact Source # 
Instance details

Defined in Ecluse.Core.Registry

Eq MirrorArtifact Source # 
Instance details

Defined in Ecluse.Core.Registry

firstHashValue :: HashAlg -> MirrorArtifact -> Maybe Text Source #

The digest value of the first Hash with the given HashAlg, or Nothing when the artifact carries none.

Mirror companions

data CompanionRequirement Source #

Which mirrored files a version needs retained metadata companions for before it is complete.

Constructors

DeclaredCompanions

Only files whose source metadata declares a companion.

NativeCompanions

Every file, through the format's native companion.

Errors

newtype ParseError Source #

A protocol decode failure for the caller to classify.

Constructors

ParseError 

Fields

Instances

Instances details
Show ParseError Source # 
Instance details

Defined in Ecluse.Core.Registry

Eq ParseError Source # 
Instance details

Defined in Ecluse.Core.Registry

parseRefusal :: Text -> Either ParseError a Source #

Refuse a decode with a human-readable reason.

data FetchFault Source #

A request-formation, response-bound, or transport failure before a usable response.

Constructors

FetchUrlUnformable UrlFormationError

The request URL could not be formed from the base URL and the package identity.

FetchBoundExceeded LimitError

The peer's body crossed the response-size bound, and the read refused it fail-closed.

FetchTransport TransportFault

The adapter classified a failed or interrupted exchange.

FetchCooldown RetryAfter

A public authority is cooling down. No usable metadata or artifact body was read.

Instances

Instances details
Show FetchFault Source # 
Instance details

Defined in Ecluse.Core.Registry

Eq FetchFault Source # 
Instance details

Defined in Ecluse.Core.Registry

newtype PublishError Source #

Why the mirror target refused a publication.

Constructors

PublishError 

Fields

Instances

Instances details
Show PublishError Source # 
Instance details

Defined in Ecluse.Core.Registry

Eq PublishError Source # 
Instance details

Defined in Ecluse.Core.Registry

data PublishFault Source #

Separate exchange faults from registry rejections so workers can choose retry or drop.

Constructors

PublishFetch FetchFault

An exchange failure whose retry disposition follows the shared fetch-fault model.

PublishRejected PublishError

The registry answered and rejected the write (a non-2xx, non-409 status). Retryable.

PublishSourceUnavailable Text

Mirror upload preparation refused missing or inconsistent mirror upload data. Not retryable.

PublishIntegrityMismatch Text

Artifact bytes differ from the admitted strongest digest. Not retryable.

Instances

Instances details
Show PublishFault Source # 
Instance details

Defined in Ecluse.Core.Registry

Eq PublishFault Source # 
Instance details

Defined in Ecluse.Core.Registry

data UrlFormationError Source #

Why an upstream request URL could not be formed from configuration and a parsed PackageName.

Constructors

EmptyBaseUrl

The configured base URL is empty, so no request URL can be formed.

UnparseableUrl Text

The formed URL string could not be parsed into a request. Carries the offending URL.

renderUrlFormationError :: UrlFormationError -> Text Source #

Render a URL formation failure with its URL reduced to an authority, excluding userinfo and queries.

data PublishBodyFault Source #

Why a publish body is not relayed. Only the shape of a new-release upload is, since other writes edit stored releases.

Constructors

PublishMalformed ParseError

The body cannot be read as the ecosystem's upload: 400.

PublishUnsupported Text

A readable write that is not a new-release upload, with the publisher's way forward: 501.

data PublishRelayResponse Source #

The response from the publication target after relaying a publish document.

Constructors

PublishRelayResponse 

Fields