| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Core.Package.Merge
Description
Merge admitted source snapshots with trusted-source precedence. The plan carries exact artifact coordinates for raw assembly and reports integrity divergence.
Synopsis
- data Provenance
- type SourceId = Int
- data MergePlan = MergePlan {
- mpName :: PackageName
- mpSurvivors :: Map Text SourceId
- mpDistTags :: ~(Map Text Version)
- mpArtifacts :: ~(Map Text (NonEmpty AdmittedEntry))
- mpTime :: ~(Map Text UTCTime)
- mpDivergences :: Set Divergence
- data Divergence = Divergence {}
- data IntegrityFingerprint
- integrityHashes :: IntegrityFingerprint -> [(Text, Maybe HashAlg, Text)]
- integrityDivergences :: Map Text PackageDetails -> Map Text PackageDetails -> Set Divergence
- mergePackuments :: [(Provenance, Snapshot PackageInfo)] -> Maybe MergePlan
- withoutTrustedReleases :: Map Text PackageDetails -> PackageInfo -> PackageInfo
- data Merge
- contribute :: Provenance -> Snapshot PackageInfo -> Merge
- planFrom :: Merge -> Maybe MergePlan
Provenance
data Provenance Source #
Which upstream a document came from. The caller decides this and applies it before merging.
Ord is the trust order: TrustedSource sorts before GatedSource, so the smallest wins.
Constructors
| TrustedSource | A private-upstream document. Its versions are already vetted, so they enter the union unfiltered and win any collision. |
| GatedSource | A public-upstream document. Its versions are the set that already survived the rules engine. The merge unions them but never re-filters. |
Instances
| Show Provenance Source # | |
Defined in Ecluse.Core.Package.Merge Methods showsPrec :: Int -> Provenance -> ShowS # show :: Provenance -> String # showList :: [Provenance] -> ShowS # | |
| Eq Provenance Source # | |
Defined in Ecluse.Core.Package.Merge | |
| Ord Provenance Source # | |
Defined in Ecluse.Core.Package.Merge Methods compare :: Provenance -> Provenance -> Ordering # (<) :: Provenance -> Provenance -> Bool # (<=) :: Provenance -> Provenance -> Bool # (>) :: Provenance -> Provenance -> Bool # (>=) :: Provenance -> Provenance -> Bool # max :: Provenance -> Provenance -> Provenance # min :: Provenance -> Provenance -> Provenance # | |
Merging
The 0-based index of an input to one mergePackuments call. The caller pairs each SourceId
back to the raw Value it passed at that position, which Provenance alone cannot name.
The decisions a merge reached over several upstream packuments. The serve layer replays the
plan onto the raw upstream Values. It is never a finished, re-serialisable document.
Constructors
| MergePlan | |
Fields
| |
data Divergence Source #
Conflicting digests for one version. The private copy wins and both fingerprints remain for alarms.
Constructors
| Divergence | |
Fields
| |
Instances
| Show Divergence Source # | |
Defined in Ecluse.Core.Package.Merge Methods showsPrec :: Int -> Divergence -> ShowS # show :: Divergence -> String # showList :: [Divergence] -> ShowS # | |
| Eq Divergence Source # | |
Defined in Ecluse.Core.Package.Merge | |
| Ord Divergence Source # | |
Defined in Ecluse.Core.Package.Merge Methods compare :: Divergence -> Divergence -> Ordering # (<) :: Divergence -> Divergence -> Bool # (<=) :: Divergence -> Divergence -> Bool # (>) :: Divergence -> Divergence -> Bool # (>=) :: Divergence -> Divergence -> Bool # max :: Divergence -> Divergence -> Divergence # min :: Divergence -> Divergence -> Divergence # | |
data IntegrityFingerprint Source #
Sorted file, asserted algorithm, and diagnostic digest triples. Only shared file/algorithm keys can contradict.
Instances
| Show IntegrityFingerprint Source # | |
Defined in Ecluse.Core.Package.Merge Methods showsPrec :: Int -> IntegrityFingerprint -> ShowS # show :: IntegrityFingerprint -> String # showList :: [IntegrityFingerprint] -> ShowS # | |
| Eq IntegrityFingerprint Source # | |
Defined in Ecluse.Core.Package.Merge Methods (==) :: IntegrityFingerprint -> IntegrityFingerprint -> Bool # (/=) :: IntegrityFingerprint -> IntegrityFingerprint -> Bool # | |
| Ord IntegrityFingerprint Source # | |
Defined in Ecluse.Core.Package.Merge Methods compare :: IntegrityFingerprint -> IntegrityFingerprint -> Ordering # (<) :: IntegrityFingerprint -> IntegrityFingerprint -> Bool # (<=) :: IntegrityFingerprint -> IntegrityFingerprint -> Bool # (>) :: IntegrityFingerprint -> IntegrityFingerprint -> Bool # (>=) :: IntegrityFingerprint -> IntegrityFingerprint -> Bool # max :: IntegrityFingerprint -> IntegrityFingerprint -> IntegrityFingerprint # min :: IntegrityFingerprint -> IntegrityFingerprint -> IntegrityFingerprint # | |
integrityHashes :: IntegrityFingerprint -> [(Text, Maybe HashAlg, Text)] Source #
Sorted filename, algorithm, and original digest-body triples, including duplicates.
integrityDivergences :: Map Text PackageDetails -> Map Text PackageDetails -> Set Divergence Source #
Compare integrity-admitted versions independently of rule eligibility, with the trusted map winning. Inputs must share a validated package identity. Only shared version keys are compared.
mergePackuments :: [(Provenance, Snapshot PackageInfo)] -> Maybe MergePlan Source #
Merge admitted snapshots with trusted-source precedence and divergence reporting.
Empty input yields Nothing.
withoutTrustedReleases :: Map Text PackageDetails -> PackageInfo -> PackageInfo Source #
Drop gated versions that a trusted version claims under another spelling of the same release. An exact key collision stays, so precedence and divergence reporting still see it.
The merge accumulator
mergePackuments equals planFrom over a fold of each input's contribute into the lawful Merge
Monoid. Merge is opaque, so a SourceId always names a real input position.
The monoidal accumulator the merge folds into. It leaves every version key's candidates unresolved, because a pairwise winner decision during the fold is not associative for 3+ copies.
contribute :: Provenance -> Snapshot PackageInfo -> Merge Source #