| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Core.Mirror.State.Internal
Description
Monotonic expected files retain their first admitted source fragment and companion identity.
Synopsis
- newtype StateTarget = StateTarget Text
- stateTarget :: Text -> StateTarget
- data StateRevision = StateRevision StateTarget PackageName ByteString
- data ProjectMirrorRecord = ProjectMirrorRecord {}
- data StoredMirrorFragment = StoredMirrorFragment PackageDetails MirrorReadData (NonEmpty ExpectedMirrorFile)
- data MirrorVersion = MirrorVersion {}
- data CompanionState
- data CompanionRef = CompanionRef Hash Int
- data VerifiedCompanionBytes = VerifiedCompanionBytes Artifact CompanionRef 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
- retainVerifiedIdentity :: Version -> VerifiedArtifactBytes -> ProjectMirrorRecord -> Either MirrorStateFault ProjectMirrorRecord
- verifyCompanionBytes :: Limits -> ExpectedMirrorFile -> ByteString -> Either MirrorStateFault VerifiedCompanionBytes
- verifyRetainedCompanion :: CompanionRef -> ByteString -> Either MirrorStateFault ByteString
- versionFiles :: MirrorVersion -> Map Text ExpectedMirrorFile
- recordVersion :: Version -> ProjectMirrorRecord -> Maybe MirrorVersion
- recordTarget :: ProjectMirrorRecord -> StateTarget
- recordPackage :: ProjectMirrorRecord -> PackageName
- recordVersions :: ProjectMirrorRecord -> Map Text MirrorVersion
- recordEnvelope :: ProjectMirrorRecord -> Object
- versionFragments :: MirrorVersion -> NonEmpty StoredMirrorFragment
- versionCompanions :: MirrorVersion -> Map Text CompanionState
- versionVerifiedIdentities :: MirrorVersion -> Map Text Hash
- companionDigest :: CompanionRef -> Text
- companionSize :: CompanionRef -> Int
- companionBody :: VerifiedCompanionBytes -> ByteString
- targetKey :: StateTarget -> Text
- projectKey :: StateTarget -> PackageName -> Text
- checkMirrorCompletion :: MirrorVersion -> [Artifact] -> MirrorCompletion
- data MirrorCompletion
- data MirrorCompletionFault
- declaredCompanion :: Artifact -> Bool
- declaredSourceCompanion :: CompanionRequirement -> Artifact -> Bool
- verifySourceCompanionBytes :: Limits -> CompanionRequirement -> ExpectedMirrorFile -> ByteString -> Either MirrorStateFault VerifiedCompanionBytes
- checkStateFiles :: Limits -> Int -> Either LimitError ()
Documentation
newtype StateTarget Source #
A digest of the configured target, never a credential or caller authorisation.
Constructors
| StateTarget Text |
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.
Constructors
| StateRevision StateTarget PackageName ByteString |
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.
Constructors
| ProjectMirrorRecord | |
Fields | |
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 # | |
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 # | |
data MirrorVersion Source #
Files grow monotonically. Each companion starts pending before any distribution upload.
Constructors
| MirrorVersion | |
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 # | |
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.
Constructors
| CompanionRef Hash Int |
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 | |
data VerifiedCompanionBytes Source #
Checked source companion bytes are bounded and tied to a declared parent.
Constructors
| VerifiedCompanionBytes Artifact CompanionRef ByteString |
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 # | |
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.
retainVerifiedIdentity :: Version -> VerifiedArtifactBytes -> ProjectMirrorRecord -> Either MirrorStateFault ProjectMirrorRecord Source #
Retain a digest computed only from bytes that passed the admitted source integrity check.
verifyCompanionBytes :: Limits -> ExpectedMirrorFile -> ByteString -> Either MirrorStateFault VerifiedCompanionBytes Source #
A pending expectation cannot become retained until its actual bytes satisfy the declaration.
verifyRetainedCompanion :: CompanionRef -> ByteString -> Either MirrorStateFault ByteString Source #
Actual reads verify immutable content identity, including the recorded size.
versionFiles :: MirrorVersion -> Map Text ExpectedMirrorFile Source #
Original source coordinates remain scoped to their fragment until the renderer assigns new ones.
recordVersion :: Version -> ProjectMirrorRecord -> Maybe MirrorVersion Source #
A valid record without the requested version is unmanaged private content.
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.
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.
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.
targetKey :: StateTarget -> Text Source #
The target component has a fixed-length hexadecimal encoding.
projectKey :: StateTarget -> PackageName -> Text Source #
Length-independent components bind the schema, target, ecosystem, and canonical package.
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 # | |
declaredCompanion :: Artifact -> Bool Source #
A missing or false declaration creates no retention authority.
declaredSourceCompanion :: CompanionRequirement -> Artifact -> Bool Source #
Native source payloads can require metadata beyond artifact-advertised sidecars.
verifySourceCompanionBytes :: Limits -> CompanionRequirement -> ExpectedMirrorFile -> ByteString -> Either MirrorStateFault VerifiedCompanionBytes Source #
The native codec checks meaning before this step binds its bytes to the declared parent.
checkStateFiles :: Limits -> Int -> Either LimitError () Source #
Refuse a record count over the fixed mirror-state file ceiling, so every write stays readable.