| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Core.Mirror.State
Description
Durable expected inventories distinguish complete mirrors from interrupted physical copies.
Synopsis
- data StateTarget
- stateTarget :: Text -> StateTarget
- data StateRevision
- data ProjectMirrorRecord
- recordTarget :: ProjectMirrorRecord -> StateTarget
- recordPackage :: ProjectMirrorRecord -> PackageName
- recordVersions :: ProjectMirrorRecord -> Map Text MirrorVersion
- recordEnvelope :: ProjectMirrorRecord -> Object
- recordVersion :: Version -> ProjectMirrorRecord -> Maybe MirrorVersion
- data StoredMirrorFragment
- fragmentDetails :: StoredMirrorFragment -> PackageDetails
- fragmentReadData :: StoredMirrorFragment -> MirrorReadData
- data MirrorVersion
- versionFiles :: MirrorVersion -> Map Text ExpectedMirrorFile
- versionFragments :: MirrorVersion -> NonEmpty StoredMirrorFragment
- versionCompanions :: MirrorVersion -> Map Text CompanionState
- versionVerifiedIdentities :: MirrorVersion -> Map Text Hash
- data CompanionState
- data CompanionRef
- companionDigest :: CompanionRef -> Text
- companionSize :: CompanionRef -> Int
- data VerifiedCompanionBytes
- companionBody :: VerifiedCompanionBytes -> ByteString
- data MirrorStateFault
- data StateRead
- data StateWrite
- data MirrorState = MirrorState {
- msReadProject :: StateCharge -> PackageName -> Maybe StateRevision -> IO (Either MirrorStateFault StateRead)
- msWriteProject :: StateCharge -> PackageName -> Maybe StateRevision -> ProjectMirrorRecord -> IO (Either MirrorStateFault StateWrite)
- msRetainCompanion :: StateCharge -> VerifiedCompanionBytes -> IO (Either MirrorStateFault CompanionRef)
- msReadCompanion :: StateCharge -> CompanionRef -> IO (Either MirrorStateFault ByteString)
- type StateCharge = Int -> IO ()
- extendProjectRecord :: MirrorStateFormat -> Limits -> StateTarget -> MirrorInventory -> Maybe ProjectMirrorRecord -> Either MirrorStateFault ProjectMirrorRecord
- retainCompanionReference :: Version -> VerifiedCompanionBytes -> CompanionRef -> ProjectMirrorRecord -> Either MirrorStateFault ProjectMirrorRecord
- verifyCompanionBytes :: Limits -> ExpectedMirrorFile -> ByteString -> Either MirrorStateFault VerifiedCompanionBytes
- verifySourceCompanionBytes :: Limits -> CompanionRequirement -> ExpectedMirrorFile -> ByteString -> Either MirrorStateFault VerifiedCompanionBytes
- verifyRetainedCompanion :: CompanionRef -> ByteString -> Either MirrorStateFault ByteString
- checkMirrorCompletion :: MirrorVersion -> [Artifact] -> MirrorCompletion
- data MirrorCompletion
- data MirrorCompletionFault
- encodeProjectRecord :: MirrorStateFormat -> Limits -> ProjectMirrorRecord -> Either MirrorStateFault ByteString
- projectRecordWeight :: MirrorStateFormat -> Limits -> ProjectMirrorRecord -> Either MirrorStateFault Int
- recordExpectedInventory :: MirrorStateFormat -> Limits -> StateCharge -> StateTarget -> MirrorState -> MirrorInventory -> IO (Either MirrorStateFault (StateRevision, ProjectMirrorRecord))
- retainProjectCompanion :: Limits -> StateCharge -> MirrorState -> PackageName -> Version -> VerifiedCompanionBytes -> IO (Either MirrorStateFault (StateRevision, ProjectMirrorRecord))
- recordVerifiedArtifact :: Limits -> StateCharge -> MirrorState -> PackageName -> Version -> VerifiedArtifactBytes -> IO (Either MirrorStateFault (StateRevision, ProjectMirrorRecord))
Documentation
data StateTarget Source #
A digest of the configured target, never a credential or caller authorisation.
Instances
| Show StateTarget Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods showsPrec :: Int -> StateTarget -> ShowS # show :: StateTarget -> String # showList :: [StateTarget] -> ShowS # | |
| Eq StateTarget Source # | |
Defined in Ecluse.Core.Mirror.State.Internal | |
| Ord StateTarget Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods compare :: StateTarget -> StateTarget -> Ordering # (<) :: StateTarget -> StateTarget -> Bool # (<=) :: StateTarget -> StateTarget -> Bool # (>) :: StateTarget -> StateTarget -> Bool # (>=) :: StateTarget -> StateTarget -> Bool # max :: StateTarget -> StateTarget -> StateTarget # min :: StateTarget -> StateTarget -> StateTarget # | |
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.
Instances
| Show StateRevision Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods showsPrec :: Int -> StateRevision -> ShowS # show :: StateRevision -> String # showList :: [StateRevision] -> ShowS # | |
| Eq StateRevision Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods (==) :: StateRevision -> StateRevision -> Bool # (/=) :: StateRevision -> StateRevision -> Bool # | |
data ProjectMirrorRecord Source #
The target and package fields are checked on every decode, before state becomes usable.
Instances
| Show ProjectMirrorRecord Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods showsPrec :: Int -> ProjectMirrorRecord -> ShowS # show :: ProjectMirrorRecord -> String # showList :: [ProjectMirrorRecord] -> ShowS # | |
| Eq ProjectMirrorRecord Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods (==) :: ProjectMirrorRecord -> ProjectMirrorRecord -> Bool # (/=) :: ProjectMirrorRecord -> ProjectMirrorRecord -> Bool # | |
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.
Instances
| Show StoredMirrorFragment Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods showsPrec :: Int -> StoredMirrorFragment -> ShowS # show :: StoredMirrorFragment -> String # showList :: [StoredMirrorFragment] -> ShowS # | |
| Eq StoredMirrorFragment Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods (==) :: StoredMirrorFragment -> StoredMirrorFragment -> Bool # (/=) :: StoredMirrorFragment -> StoredMirrorFragment -> Bool # | |
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.
Instances
| Show MirrorVersion Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods showsPrec :: Int -> MirrorVersion -> ShowS # show :: MirrorVersion -> String # showList :: [MirrorVersion] -> ShowS # | |
| Eq MirrorVersion Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods (==) :: MirrorVersion -> MirrorVersion -> Bool # (/=) :: MirrorVersion -> MirrorVersion -> Bool # | |
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.
Constructors
| CompanionPending | |
| CompanionRetained CompanionRef |
Instances
| Show CompanionState Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods showsPrec :: Int -> CompanionState -> ShowS # show :: CompanionState -> String # showList :: [CompanionState] -> ShowS # | |
| Eq CompanionState Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods (==) :: CompanionState -> CompanionState -> Bool # (/=) :: CompanionState -> CompanionState -> Bool # | |
data CompanionRef Source #
Content-addressed metadata, with no arbitrary URL or object path.
Instances
| Show CompanionRef Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods showsPrec :: Int -> CompanionRef -> ShowS # show :: CompanionRef -> String # showList :: [CompanionRef] -> ShowS # | |
| Eq CompanionRef Source # | |
Defined in Ecluse.Core.Mirror.State.Internal | |
companionDigest :: CompanionRef -> Text Source #
The content identity used in storage keys and byte verification.
companionSize :: CompanionRef -> Int Source #
The retained response size in bytes.
data VerifiedCompanionBytes Source #
Checked source companion bytes are bounded and tied to a declared parent.
Instances
| Show VerifiedCompanionBytes Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods showsPrec :: Int -> VerifiedCompanionBytes -> ShowS # show :: VerifiedCompanionBytes -> String # showList :: [VerifiedCompanionBytes] -> ShowS # | |
| Eq VerifiedCompanionBytes Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods (==) :: VerifiedCompanionBytes -> VerifiedCompanionBytes -> Bool # (/=) :: VerifiedCompanionBytes -> VerifiedCompanionBytes -> Bool # | |
companionBody :: VerifiedCompanionBytes -> ByteString Source #
Only checked declared companion bytes reach the object writer.
data MirrorStateFault Source #
State uncertainty never means absence or permission to present a smaller expected set.
Constructors
Instances
| Show MirrorStateFault Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods showsPrec :: Int -> MirrorStateFault -> ShowS # show :: MirrorStateFault -> String # showList :: [MirrorStateFault] -> ShowS # | |
| Eq MirrorStateFault Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods (==) :: MirrorStateFault -> MirrorStateFault -> Bool # (/=) :: MirrorStateFault -> MirrorStateFault -> Bool # | |
A 304 is useful only with the exact supplied, already charged project payload.
data StateWrite Source #
The caller rereads and unions after a collision instead of repeating an old replacement.
Constructors
| StateStored StateRevision | |
| StateConflict |
Instances
| Show StateWrite Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods showsPrec :: Int -> StateWrite -> ShowS # show :: StateWrite -> String # showList :: [StateWrite] -> ShowS # | |
| Eq StateWrite Source # | |
Defined in Ecluse.Core.Mirror.State.Internal | |
data MirrorState Source #
Composition binds a target and storage prefix. No operation accepts an arbitrary object key.
Constructors
| MirrorState | |
Fields
| |
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.
Constructors
| MirrorComplete | |
| MirrorIncomplete (NonEmpty MirrorCompletionFault) |
Instances
| Show MirrorCompletion Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods showsPrec :: Int -> MirrorCompletion -> ShowS # show :: MirrorCompletion -> String # showList :: [MirrorCompletion] -> ShowS # | |
| Eq MirrorCompletion Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods (==) :: MirrorCompletion -> MirrorCompletion -> Bool # (/=) :: MirrorCompletion -> MirrorCompletion -> Bool # | |
data MirrorCompletionFault Source #
The worker can retry absent files without republishing a conflicting existing filename.
Constructors
| MissingMirrorFile Text | |
| ConflictingMirrorFile Text | |
| MissingMirrorProof Text | |
| PendingMirrorCompanion Text |
Instances
| Show MirrorCompletionFault Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods showsPrec :: Int -> MirrorCompletionFault -> ShowS # show :: MirrorCompletionFault -> String # showList :: [MirrorCompletionFault] -> ShowS # | |
| Eq MirrorCompletionFault Source # | |
Defined in Ecluse.Core.Mirror.State.Internal Methods (==) :: MirrorCompletionFault -> MirrorCompletionFault -> Bool # (/=) :: MirrorCompletionFault -> MirrorCompletionFault -> Bool # | |
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.