ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Mirror.State

Description

Durable expected inventories distinguish complete mirrors from interrupted physical copies.

Synopsis

Documentation

data StateTarget Source #

A digest of the configured target, never a credential or caller authorisation.

stateTarget :: Text -> StateTarget Source #

Bind records and object keys to the exact configured target identity.

data StateRevision Source #

Opaque storage revision bound to the project it came from.

data ProjectMirrorRecord Source #

The target and package fields are checked on every decode, before state becomes usable.

recordTarget :: ProjectMirrorRecord -> StateTarget Source #

The configured target identity carried by this validated record.

recordPackage :: ProjectMirrorRecord -> PackageName Source #

The canonical package identity carried by this validated record.

recordVersions :: ProjectMirrorRecord -> Map Text MirrorVersion Source #

Versions contain accumulated admission fragments without a mutable completion flag.

recordEnvelope :: ProjectMirrorRecord -> Object Source #

Project fields follow the latest committed source admission, independently of file-byte updates.

recordVersion :: Version -> ProjectMirrorRecord -> Maybe MirrorVersion Source #

A valid record without the requested version is unmanaged private content.

data StoredMirrorFragment Source #

Fragments retain only newly owned filenames, with original admission facts and coordinates.

fragmentDetails :: StoredMirrorFragment -> PackageDetails Source #

Original admission facts remain attached to their retained source entries.

fragmentReadData :: StoredMirrorFragment -> MirrorReadData Source #

Coordinates in this source value are local to this fragment.

data MirrorVersion Source #

Files grow monotonically. Each companion starts pending before any distribution upload.

versionFiles :: MirrorVersion -> Map Text ExpectedMirrorFile Source #

Original source coordinates remain scoped to their fragment until the renderer assigns new ones.

versionFragments :: MirrorVersion -> NonEmpty StoredMirrorFragment Source #

Each fragment retains only its original owned source entries.

versionCompanions :: MirrorVersion -> Map Text CompanionState Source #

Pending declarations cannot be mistaken for durably retained metadata.

versionVerifiedIdentities :: MirrorVersion -> Map Text Hash Source #

These digests came from verified bytes, independently of preserved source digest fields.

data CompanionState Source #

A retained reference exists only after its immutable content object was written.

data CompanionRef Source #

Content-addressed metadata, with no arbitrary URL or object path.

companionDigest :: CompanionRef -> Text Source #

The content identity used in storage keys and byte verification.

companionSize :: CompanionRef -> Int Source #

The retained response size in bytes.

companionBody :: VerifiedCompanionBytes -> ByteString Source #

Only checked declared companion bytes reach the object writer.

data StateRead Source #

A 304 is useful only with the exact supplied, already charged project payload.

Instances

Instances details
Show StateRead Source # 
Instance details

Defined in Ecluse.Core.Mirror.State.Internal

Eq StateRead Source # 
Instance details

Defined in Ecluse.Core.Mirror.State.Internal

data StateWrite Source #

The caller rereads and unions after a collision instead of repeating an old replacement.

Instances

Instances details
Show StateWrite Source # 
Instance details

Defined in Ecluse.Core.Mirror.State.Internal

Eq StateWrite Source # 
Instance details

Defined in Ecluse.Core.Mirror.State.Internal

type StateCharge = Int -> IO () Source #

An absolute high-water requirement for sequential state work under one caller-owned lifetime.

extendProjectRecord :: MirrorStateFormat -> Limits -> StateTarget -> MirrorInventory -> Maybe ProjectMirrorRecord -> Either MirrorStateFault ProjectMirrorRecord Source #

Add only new filenames, retaining the old read fields for every unchanged physical identity.

retainCompanionReference :: Version -> VerifiedCompanionBytes -> CompanionRef -> ProjectMirrorRecord -> Either MirrorStateFault ProjectMirrorRecord Source #

Bind durable bytes only to the same admitted declaration and parent identity.

verifyCompanionBytes :: Limits -> ExpectedMirrorFile -> ByteString -> Either MirrorStateFault VerifiedCompanionBytes Source #

A pending expectation cannot become retained until its actual bytes satisfy the declaration.

verifySourceCompanionBytes :: Limits -> CompanionRequirement -> ExpectedMirrorFile -> ByteString -> Either MirrorStateFault VerifiedCompanionBytes Source #

The native codec checks meaning before this step binds its bytes to the declared parent.

verifyRetainedCompanion :: CompanionRef -> ByteString -> Either MirrorStateFault ByteString Source #

Actual reads verify immutable content identity, including the recorded size.

checkMirrorCompletion :: MirrorVersion -> [Artifact] -> MirrorCompletion Source #

Completion uses current authorised target identities and retained companions, never a stored Boolean.

data MirrorCompletion Source #

A failed proof reports each missing file, conflicting identity, or pending companion.

encodeProjectRecord :: MirrorStateFormat -> Limits -> ProjectMirrorRecord -> Either MirrorStateFault ByteString Source #

Account for declared companion bytes as well as encoded source records before writing. Another format's source refuses the write.

projectRecordWeight :: MirrorStateFormat -> Limits -> ProjectMirrorRecord -> Either MirrorStateFault Int Source #

Charge the durable graph separately from active-work reservations.

recordExpectedInventory :: MirrorStateFormat -> Limits -> StateCharge -> StateTarget -> MirrorState -> MirrorInventory -> IO (Either MirrorStateFault (StateRevision, ProjectMirrorRecord)) Source #

Record additions before any new distribution upload. Collisions reread and union within a fixed budget.

retainProjectCompanion :: Limits -> StateCharge -> MirrorState -> PackageName -> Version -> VerifiedCompanionBytes -> IO (Either MirrorStateFault (StateRevision, ProjectMirrorRecord)) Source #

Durable bytes precede their reference. A collision cannot drop another version or companion update.

recordVerifiedArtifact :: Limits -> StateCharge -> MirrorState -> PackageName -> Version -> VerifiedArtifactBytes -> IO (Either MirrorStateFault (StateRevision, ProjectMirrorRecord)) Source #

Store the target's usable digest before upload without changing the original served hash fields.