| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
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
- data StoreMaintenance = StoreMaintenance {
- storeFacts :: StoreFacts
- listPackagesIn :: NamePrefix -> ConduitT () [PackageName] IO (Maybe StoreFault)
- enumerateVersions :: PackageName -> IO (Either StoreFault [StoredVersion])
- readStoreManifest :: StoreManifestRead
- deleteVersions :: DeleteGuard -> PackageName -> [Version] -> IO [(Version, VersionOutcome)]
- verifyConsent :: IO (Either StoreFault ConsentVerdict)
- classifyStore :: IO (Either StoreFault StoreClass)
- probeUpstream :: IO UpstreamSafety
- storeCursor :: Maybe StoreCursor
- data StoreObservation = StoreObservation {
- obFacts :: StoreFacts
- obListPackagesIn :: NamePrefix -> ConduitT () [PackageName] IO (Maybe StoreFault)
- obEnumerateVersions :: PackageName -> IO (Either StoreFault [StoredVersion])
- obReadManifest :: StoreManifestRead
- obVerifyConsent :: IO (Either StoreFault ConsentVerdict)
- obClassifyStore :: IO (Either StoreFault StoreClass)
- obProbeUpstream :: IO UpstreamSafety
- data StoreDeletion = StoreDeletion {
- dlDeleteVersions :: DeleteGuard -> PackageName -> [Version] -> IO [(Version, VersionOutcome)]
- dlCursor :: Maybe StoreCursor
- data DeleteGuard = DeleteGuard {
- dgCheck :: DeletePhase -> [Version] -> IO (Either StoreFault [Version])
- dgRetry :: StoreFault -> IO Bool
- data DeletePhase
- observationOf :: StoreMaintenance -> StoreObservation
- deletionOf :: StoreMaintenance -> StoreDeletion
- maintenanceOf :: StoreObservation -> StoreDeletion -> StoreMaintenance
- data StoreFacts = StoreFacts {}
- data DeleteCeiling
- data RefillPosture
- data CompletionNotion
- meteredObservation :: RequestGate -> StoreObservation -> StoreObservation
- meteredMaintenance :: RequestGate -> StoreMaintenance -> StoreMaintenance
- data StoredVersion = StoredVersion {}
- data VersionPresence
- data StoreCursor = StoreCursor {
- readCursor :: IO (Either StoreFault (Maybe NamePrefix))
- writeCursor :: NamePrefix -> IO (Either StoreFault ())
- clearCursor :: IO (Either StoreFault ())
- type StoreManifestRead = PackageName -> IO (Either StoreFault Manifest)
- storeFaultOfFetch :: FetchFault -> StoreFault
- storeFaultOfMetadata :: MetadataError -> StoreFault
- protocolFault :: Text -> StoreFault
- statusFault :: (Int -> Bool) -> Int -> Text -> StoreFault
- unformableFault :: UrlFormationError -> StoreFault
- data VersionOutcome
- data StoreRefusal
- storeRefusal :: Text -> Text -> StoreRefusal
- refusalCode :: StoreRefusal -> Text
- refusalDetail :: StoreRefusal -> Text
- unreachedBatch :: StoreFault -> [Version] -> [(Version, VersionOutcome)]
- pageSource :: Monad m => (Maybe Text -> m (Either StoreFault (Maybe Text, [a]))) -> ConduitT i [a] m (Maybe StoreFault)
- collectPages :: Monad m => ConduitT () [a] m (Maybe StoreFault) -> m (Either StoreFault [a])
- collectPagesBounded :: Monad m => Int -> ConduitT () [a] m (Maybe StoreFault) -> m (Either StoreFault [a])
- pageAll :: Monad m => (Maybe Text -> m (Either StoreFault (Maybe Text, [a]))) -> m (Either StoreFault [a])
- chunksOfCeiling :: DeleteCeiling -> [a] -> [[a]]
- deleteAll :: DeleteGuard -> ([Version] -> IO (Either StoreFault [(Version, VersionOutcome)])) -> [[Version]] -> IO [(Version, VersionOutcome)]
- data ConsentVerdict
- data StoreClass
- data StoreFault = StoreFault {}
- data RetryAdvice
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.
Constructors
| DeleteGuard | |
Fields
| |
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
| Show DeletePhase Source # | |
Defined in Ecluse.Core.Registry.Maintenance Methods showsPrec :: Int -> DeletePhase -> ShowS # show :: DeletePhase -> String # showList :: [DeletePhase] -> ShowS # | |
| Eq DeletePhase Source # | |
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
| Show StoreFacts Source # | |
Defined in Ecluse.Core.Registry.Maintenance Methods showsPrec :: Int -> StoreFacts -> ShowS # show :: StoreFacts -> String # showList :: [StoreFacts] -> ShowS # | |
| Eq StoreFacts Source # | |
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. |
Instances
| Show DeleteCeiling Source # | |
Defined in Ecluse.Core.Registry.Maintenance Methods showsPrec :: Int -> DeleteCeiling -> ShowS # show :: DeleteCeiling -> String # showList :: [DeleteCeiling] -> ShowS # | |
| Eq DeleteCeiling Source # | |
Defined in Ecluse.Core.Registry.Maintenance Methods (==) :: DeleteCeiling -> DeleteCeiling -> Bool # (/=) :: DeleteCeiling -> DeleteCeiling -> Bool # | |
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. |
Instances
| Show RefillPosture Source # | |
Defined in Ecluse.Core.Registry.Maintenance Methods showsPrec :: Int -> RefillPosture -> ShowS # show :: RefillPosture -> String # showList :: [RefillPosture] -> ShowS # | |
| Eq RefillPosture Source # | |
Defined in Ecluse.Core.Registry.Maintenance Methods (==) :: RefillPosture -> RefillPosture -> Bool # (/=) :: RefillPosture -> RefillPosture -> Bool # | |
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. |
Instances
| Show CompletionNotion Source # | |
Defined in Ecluse.Core.Registry.Maintenance Methods showsPrec :: Int -> CompletionNotion -> ShowS # show :: CompletionNotion -> String # showList :: [CompletionNotion] -> ShowS # | |
| Eq CompletionNotion Source # | |
Defined in Ecluse.Core.Registry.Maintenance Methods (==) :: CompletionNotion -> CompletionNotion -> Bool # (/=) :: CompletionNotion -> CompletionNotion -> Bool # | |
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
| |
Instances
| Show StoredVersion Source # | |
Defined in Ecluse.Core.Registry.Maintenance Methods showsPrec :: Int -> StoredVersion -> ShowS # show :: StoredVersion -> String # showList :: [StoredVersion] -> ShowS # | |
| Eq StoredVersion Source # | |
Defined in Ecluse.Core.Registry.Maintenance Methods (==) :: StoredVersion -> StoredVersion -> Bool # (/=) :: StoredVersion -> StoredVersion -> Bool # | |
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. |
Instances
| Show VersionPresence Source # | |
Defined in Ecluse.Core.Registry.Maintenance Methods showsPrec :: Int -> VersionPresence -> ShowS # show :: VersionPresence -> String # showList :: [VersionPresence] -> ShowS # | |
| Eq VersionPresence Source # | |
Defined in Ecluse.Core.Registry.Maintenance Methods (==) :: VersionPresence -> VersionPresence -> Bool # (/=) :: VersionPresence -> VersionPresence -> Bool # | |
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. |
Instances
| Show VersionOutcome Source # | |
Defined in Ecluse.Core.Registry.Maintenance Methods showsPrec :: Int -> VersionOutcome -> ShowS # show :: VersionOutcome -> String # showList :: [VersionOutcome] -> ShowS # | |
| Eq VersionOutcome Source # | |
Defined in Ecluse.Core.Registry.Maintenance Methods (==) :: VersionOutcome -> VersionOutcome -> Bool # (/=) :: VersionOutcome -> VersionOutcome -> Bool # | |
data StoreRefusal Source #
A backend's refusal of one version. Build it with storeRefusal so the detail stays bounded.
Instances
| Show StoreRefusal Source # | |
Defined in Ecluse.Core.Registry.Maintenance Methods showsPrec :: Int -> StoreRefusal -> ShowS # show :: StoreRefusal -> String # showList :: [StoreRefusal] -> ShowS # | |
| Eq StoreRefusal Source # | |
Defined in Ecluse.Core.Registry.Maintenance | |
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. |
Instances
| Show ConsentVerdict Source # | |
Defined in Ecluse.Core.Registry.Maintenance Methods showsPrec :: Int -> ConsentVerdict -> ShowS # show :: ConsentVerdict -> String # showList :: [ConsentVerdict] -> ShowS # | |
| Eq ConsentVerdict Source # | |
Defined in Ecluse.Core.Registry.Maintenance Methods (==) :: ConsentVerdict -> ConsentVerdict -> Bool # (/=) :: ConsentVerdict -> ConsentVerdict -> Bool # | |
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
| Show StoreClass Source # | |
Defined in Ecluse.Core.Registry.Maintenance Methods showsPrec :: Int -> StoreClass -> ShowS # show :: StoreClass -> String # showList :: [StoreClass] -> ShowS # | |
| Eq StoreClass Source # | |
Defined in Ecluse.Core.Registry.Maintenance | |
Faults
data StoreFault Source #
An adapter-classified failure with transport details and retry advice.
Constructors
| StoreFault | |
Fields | |
Instances
| Show StoreFault Source # | |
Defined in Ecluse.Core.Registry.Maintenance Methods showsPrec :: Int -> StoreFault -> ShowS # show :: StoreFault -> String # showList :: [StoreFault] -> ShowS # | |
| Eq StoreFault Source # | |
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
| Show RetryAdvice Source # | |
Defined in Ecluse.Core.Registry.Maintenance Methods showsPrec :: Int -> RetryAdvice -> ShowS # show :: RetryAdvice -> String # showList :: [RetryAdvice] -> ShowS # | |
| Eq RetryAdvice Source # | |
Defined in Ecluse.Core.Registry.Maintenance | |