ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Registry.Maintenance

Description

Backend maintenance capabilities for a mirror store: the observing and deleting halves of one handle, and the drives every backend shares. Enumeration and deletion may need a control plane beyond the store's own package protocol. The buckets a walk addresses are in Ecluse.Core.Registry.Maintenance.NameSpace.

Synopsis

The handle

data StoreMaintenance Source #

Backend operations for one store, independent of the application's runtime.

Constructors

StoreMaintenance 

Fields

Its two halves, held apart

data StoreObservation Source #

The calls that only observe a store, which change nothing whatever the caller does.

Constructors

StoreObservation 

Fields

data StoreDeletion Source #

The calls that change a store, which only a role authorised to delete from it holds.

Constructors

StoreDeletion 

Fields

data DeleteGuard Source #

The sweep rechecks authority inside backend-owned batches and bounds each uncertain retry.

data DeletePhase Source #

Observation after uncertainty must not reserve or announce another destructive attempt.

Constructors

BeforeDelete

Recheck and reserve immediately before a destructive attempt.

AfterUncertain

Inspect an uncertain result without reserving or announcing another attempt.

Instances

Instances details
Show DeletePhase Source # 
Instance details

Defined in Ecluse.Core.Registry.Maintenance

Eq DeletePhase Source # 
Instance details

Defined in Ecluse.Core.Registry.Maintenance

observationOf :: StoreMaintenance -> StoreObservation Source #

The observing half of a whole handle.

deletionOf :: StoreMaintenance -> StoreDeletion Source #

The changing half of a whole handle.

maintenanceOf :: StoreObservation -> StoreDeletion -> StoreMaintenance Source #

The two halves joined into a whole handle, which every backend builds its own through.

What the backend does

data StoreFacts Source #

Backend capabilities and limits fixed for this handle's lifetime.

Constructors

StoreFacts 

Fields

Instances

Instances details
Show StoreFacts Source # 
Instance details

Defined in Ecluse.Core.Registry.Maintenance

Eq StoreFacts Source # 
Instance details

Defined in Ecluse.Core.Registry.Maintenance

data DeleteCeiling Source #

The maximum batch size supported by one backend deletion call.

Constructors

NoCeiling

The backend takes a batch of any size, so a caller never splits one.

AtMost Int

The backend refuses a call carrying more than this many versions.

data RefillPosture Source #

The backend's documented re-publication policy after deletion, without an enforcement guarantee.

Constructors

RefillPermitted

The backend accepts a re-publication of a version it deleted (CodeArtifact).

RefillRefused

Deletion permanently prevents re-publication under the same version name.

data CompletionNotion Source #

When a delete is finished, relative to the call that asked for it.

Constructors

CompletesOnCall

The delete is done by the time the call answers.

CompletesLater

The call starts a long-running operation, and the outcome names it.

Counting and pacing what a handle asks of the backend

meteredObservation :: RequestGate -> StoreObservation -> StoreObservation Source #

Count and pace every request the observing calls make. A version enumeration counts as one request however many pages it takes, so a large package costs more than was counted.

meteredMaintenance :: RequestGate -> StoreMaintenance -> StoreMaintenance Source #

The same metering over a whole handle. A delete counts one request per batch the backend's ceiling divides the versions into.

Enumeration

data StoredVersion Source #

One version an enumeration found, with what the store does with it now.

Constructors

StoredVersion 

Fields

data VersionPresence Source #

Distinguish served versions from retained deletion records to avoid repeated deletion.

Constructors

VersionServed

The store serves the version, so deleting it removes something.

VersionWithdrawn

The store lists the version but no longer serves it.

Walk resumption

data StoreCursor Source #

Persist the last completed bucket so a restart repeats only unfinished work.

Constructors

StoreCursor 

Fields

Reading a package's metadata from the store

type StoreManifestRead = PackageName -> IO (Either StoreFault Manifest) Source #

Read a package manifest using the store's credential and ecosystem codec.

storeFaultOfFetch :: FetchFault -> StoreFault Source #

Only retryable transport faults warrant another attempt within the same cycle.

storeFaultOfMetadata :: MetadataError -> StoreFault Source #

Preserve HTTP and transport retry advice. Absence and other terminal refusals advise no retry.

protocolFault :: Text -> StoreFault Source #

A fault in the store's own answer, which the next attempt reproduces.

statusFault :: (Int -> Bool) -> Int -> Text -> StoreFault Source #

A fault the store's answer status classifies. The predicate is the caller's own: the statuses worth another attempt differ between the reads.

unformableFault :: UrlFormationError -> StoreFault Source #

A URL the store's own coordinates could not form, reduced to its authority.

Deletion

data VersionOutcome Source #

What became of one version a caller asked to delete.

Constructors

VersionRemoved

The backend removed it before answering.

VersionRemoving Text

The backend accepted the removal and carries on, named by the reference an operator follows the work with.

VersionRefused StoreRefusal

The backend refused this one version and said why.

VersionUnreached StoreFault

The call carrying this version did not reach the backend.

VersionUncertain StoreFault

A destructive call faulted after issue, so its effects need a fresh observation.

data StoreRefusal Source #

A backend's refusal of one version. Build it with storeRefusal so the detail stays bounded.

storeRefusal :: Text -> Text -> StoreRefusal Source #

Build a StoreRefusal, truncating the detail to the log-line budget.

refusalCode :: StoreRefusal -> Text Source #

The backend's own code, which an operator looks up in its documentation.

refusalDetail :: StoreRefusal -> Text Source #

The backend's message, bounded to the shared log-line budget and never parsed.

unreachedBatch :: StoreFault -> [Version] -> [(Version, VersionOutcome)] Source #

Give every version an unreached outcome when its batch call faults.

Backend-neutral drives

pageSource :: Monad m => (Maybe Text -> m (Either StoreFault (Maybe Text, [a]))) -> ConduitT i [a] m (Maybe StoreFault) Source #

Stream pages until completion, a fault, or a repeated continuation token.

collectPages :: Monad m => ConduitT () [a] m (Maybe StoreFault) -> m (Either StoreFault [a]) Source #

Buffer a bounded listing, discarding collected pages if the stream faults.

collectPagesBounded :: Monad m => Int -> ConduitT () [a] m (Maybe StoreFault) -> m (Either StoreFault [a]) Source #

Stop consuming pages at the item bound and return no partial inventory.

pageAll :: Monad m => (Maybe Text -> m (Either StoreFault (Maybe Text, [a]))) -> m (Either StoreFault [a]) Source #

Collect one package's versions. Return a fault without partial results.

chunksOfCeiling :: DeleteCeiling -> [a] -> [[a]] Source #

Apply the backend batch limit, treating a non-positive limit as one.

deleteAll :: DeleteGuard -> ([Version] -> IO (Either StoreFault [(Version, VersionOutcome)])) -> [[Version]] -> IO [(Version, VersionOutcome)] Source #

The backend owns chunks. A request fault stops later chunks, including after a guarded retry.

Verdicts

data ConsentVerdict Source #

Whether the operator has consented to deletion from this store.

Constructors

ConsentGranted

The store carries the consent marker.

ConsentWithheld Text

The required consent marker is absent. Carries the backend's instructions for adding it.

data StoreClass Source #

Whether deleting from this store destroys anything.

Constructors

StoreDestroyable

A private store that holds only what was published to it, so a delete is final.

StorePreserved Text

The store can refill deleted versions. Carries the reason deletion must be withheld.

Instances

Instances details
Show StoreClass Source # 
Instance details

Defined in Ecluse.Core.Registry.Maintenance

Eq StoreClass Source # 
Instance details

Defined in Ecluse.Core.Registry.Maintenance

Faults

data StoreFault Source #

An adapter-classified failure with transport details and retry advice.

Instances

Instances details
Show StoreFault Source # 
Instance details

Defined in Ecluse.Core.Registry.Maintenance

Eq StoreFault Source # 
Instance details

Defined in Ecluse.Core.Registry.Maintenance

data RetryAdvice Source #

What a caller does after a fault.

Constructors

RetryFutile

Another attempt fails the same way, so the caller stops.

RetryWorthwhile

Worth another attempt, with no delay the backend asked for.

RetryDelayed RetryAfter

Worth another attempt, no sooner than the delay the backend itself asked for.

Instances

Instances details
Show RetryAdvice Source # 
Instance details

Defined in Ecluse.Core.Registry.Maintenance

Eq RetryAdvice Source # 
Instance details

Defined in Ecluse.Core.Registry.Maintenance