| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Core.Registry.Publish
Description
The mirror-write capability: a shared publish transport, an adapter-provided
protocol codec, and the married MirrorPublish handle the worker's per-ecosystem
bundle carries.
The mirror write splits along what genuinely varies per ecosystem. The
PublishCodec is protocol: how a publish document is assembled and shaped into a
request, how a mirror listing is read for the presence probe, and what the
registry's status answer means. The MirrorTransport is everything else: the
trusted-path connection manager, the credential-minting action (with whatever
refresh and breaker apparatus sits behind it), the response bound, and the fault
classification into the typed channels. newMirrorPublish marries the two against
one mirror-target endpoint; the composition root performs that marriage once per
mounted ecosystem, so a new ecosystem contributes a codec and never a transport.
Both effectful operations report failure as a value (FetchFault on the
probe, PublishFault on the write), never a throw, so the worker's
fall-through and retry-vs-drop decisions stay total at the call site. The codec
carries no authentication: the bearer is minted by the transport per call and
handed to the codec's request formers, which attach it at the shared single
attach point (withToken for npm), preserving
the credential-redirect invariant per married client.
Synopsis
- data PublishCodec = PublishCodec {
- pcProbeRequest :: Text -> Maybe Secret -> PackageName -> Either UrlFormationError Request
- pcParseVersionList :: RegistryResponse -> Either ParseError [Version]
- pcPublishRequest :: Text -> Maybe Secret -> PackageName -> Version -> MirrorArtifact -> ByteString -> Either UrlFormationError Request
- pcPublishOutcome :: Int -> Either PublishFault ()
- data MirrorTransport = MirrorTransport {}
- data MirrorPublish = MirrorPublish {
- mpProbeMetadata :: PackageName -> IO (Either FetchFault RegistryResponse)
- mpParseVersionList :: RegistryResponse -> Either ParseError [Version]
- mpPublishArtifact :: PackageName -> Version -> MirrorArtifact -> ByteString -> IO (Either PublishFault ())
- newMirrorPublish :: MirrorTransport -> Text -> PublishCodec -> MirrorPublish
The adapter's protocol codec
data PublishCodec Source #
One ecosystem's mirror-write protocol: the pure request formations and
projections that differ per registry protocol, and nothing effectful. An adapter
registers exactly one of these (AdapterPublish);
the target endpoint and bearer arrive as arguments from the transport, so the
codec holds no URL, no credential, and no connection state, and the mirror
target's protocol (a packument-fragment PUT, a multipart upload, a binary push)
is entirely the codec's to shape through the Request it forms.
Constructors
| PublishCodec | |
Fields
| |
The shared transport
data MirrorTransport Source #
The shared half of the mirror write: the trusted-path connection manager, the credential mint, and the response bound the probe reads under. Supplied by the environment at construction (the composition root builds one per marriage from process-wide parts), exactly like the queue handle: nothing here is ecosystem-shaped.
Constructors
| MirrorTransport | |
Fields
| |
The married capability
data MirrorPublish Source #
The married mirror-write capability one worker bundle carries: the presence probe's read pair and the verified-bytes publish, all bound to one mirror-target endpoint under one credential mint. A record of functions (the Handle pattern), so the worker consumes a plain handle and never sees the codec, the transport, or the adapter that contributed them.
Constructors
| MirrorPublish | |
Fields
| |
newMirrorPublish :: MirrorTransport -> Text -> PublishCodec -> MirrorPublish Source #
Marry a protocol codec to the shared transport against one mirror-target
endpoint. The transport executes what the codec forms: it mints the bearer per
call, runs the request over the trusted manager, folds a thrown transport failure
into the typed channel (classifyTransport on both the probe's read and the
write), reads the probe's body bounded, and hands the write's status answer to the
codec's own outcome classification.