ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Server.Pipeline.Packument

Description

Merge authorised private metadata with admitted public versions. First-party names use only private metadata, and a private read that fails refuses every name with the status its cause sets.

Synopsis

Documentation

data PackumentReplies response Source #

The route-owned ways the ecosystem-neutral packument pipeline may answer.

Constructors

PackumentReplies 

Fields

data DocumentRejectionObserver response Source #

Observe checked version and file rejections for native coordinate resolution.

Constructors

DocumentRejectionObserver 

Fields

packumentAction :: PackumentReplies response -> Method -> PackageName -> ResponseAction response Source #

GET and HEAD use the same gate and merge. HEAD withholds the body.

servePackument :: PackumentReplies response -> PackageName -> Request -> (response -> IO ResponseReceived) -> Handler ResponseReceived Source #

Serve merged metadata while retaining private access authority and package identity checks.

headPackument :: PackumentReplies response -> PackageName -> Request -> (response -> IO ResponseReceived) -> Handler ResponseReceived Source #

Serve the packument's GET status and headers without its body.

withObservedAdmittedDocument :: PackumentReplies response -> MemoryTicket -> (Int -> IO ()) -> (Int -> IO (Either response ())) -> Maybe (DocumentRejectionObserver response) -> PackageName -> Request -> Maybe response -> (CachedDoc -> Int -> Map Text Provenance -> Handler response) -> Handler response Source #

Observe source sizes and checked rejections, including admission with no surviving contribution. A caller that supplies an absent answer receives it for a name both origins answered 404 for.

answerMetadataBytes :: PackumentReplies response -> PackumentDeps -> MemoryTicket -> Request -> ByteString -> Handler response Source #

Finalise bounded native bytes only after current authorisation, admission and validation.

answerDigestedMetadataBytes :: PackumentReplies response -> PackumentDeps -> MemoryTicket -> Request -> Digest SHA256 -> ByteString -> Handler response Source #

answerMetadataBytes with the caller's SHA-256 of the same bytes, so a caller that also sends it hashes once.

mapPackumentReplies :: (a -> b) -> PackumentReplies a -> PackumentReplies b Source #

Change only response construction while retaining shared admission and refusal decisions.

The first-party private miss (exported for its unit spec)

firstPartyMissDecision :: PackageName -> OriginMiss -> ServeDecision Source #

Classify a first-party absence as a policy refusal, and an unread origin by its cause.

firstPartyMissReply :: PackumentReplies response -> Maybe HelpMessage -> PackageName -> OriginMiss -> response Source #

Render a settled absence as 404, an unavailable origin as 503 with its delay, and an invalid reply as 502.

The refusal when no version survives (exported for its unit spec)

noSurvivors :: PackumentReplies response -> Maybe HelpMessage -> PackumentStatus -> [ServeDecision] -> response Source #

Answer an empty listing, finishing the selected refusal text before writing the reply.

The 404 for a name no upstream lists a version of

notFoundReply :: MetricsPort -> PackumentReplies response -> Maybe HelpMessage -> Text -> IO response Source #

Answer 404 with this cause, recorded as the artifact path records a missing version.