Documentation
¶
Overview ¶
Package change computes file-level differences between two filesystem trees and maps them onto the Flux resources they affect.
It is the core of flate's "changed-only" mode (--path-orig on any command): walk both trees in parallel, SHA-256 every regular file, emit the relative paths that differ. Callers then ask Filter whether a given resource — identified by the file it was loaded from — has changed.
The filter cascades through references: when a HelmRelease's file changed, its chart source (OCIRepository / HelmRepository / GitRepository) is also marked needed so the actual chart still gets downloaded. Likewise, a Kustomization's sourceRef is kept ready so downstream waits succeed. dependsOn is intentionally excluded: it's a reconcile-ordering signal, not a content dependency.
The cascade also runs in reverse: when the changed file IS a source resource, every HelmRelease/Kustomization that references it is kept so its render re-runs against the new source spec. This catches the centralized-source layout where an OCIRepository lives in its own Kustomization tree, separate from the HelmReleases that chartRef it — bumping the OCIRepository's tag must still re-render those consumers.
Index ¶
- type Comparison
- type DeclarationInputs
- type DetectConfig
- type InputChange
- type Set
- func (s *Set) ComparePaths(match func(string) bool) Comparison
- func (s *Set) CompareSource(source manifest.NamedResource, side manifest.TreeSide, ...) (Comparison, bool)
- func (s *Set) Contains(rel string) bool
- func (s *Set) DeclarationChanged(side manifest.TreeSide, source, id manifest.NamedResource, ...) Comparison
- func (s *Set) EffectiveDeclarationChanged(side manifest.TreeSide, id manifest.NamedResource, ...) bool
- func (s *Set) ForSource(source manifest.NamedResource) (*Set, [2]*store.SourceArtifact, [2]manifest.BaseManifest)
- func (s *Set) Inputs(input manifest.NamedResource) iter.Seq2[manifest.NamedResource, InputChange]
- func (s *Set) Len() int
- func (s *Set) OppositeDeclaration(side manifest.TreeSide, source, id manifest.NamedResource, ...) manifest.BaseManifest
- func (s *Set) OutputChanged(side manifest.TreeSide, source manifest.NamedResource, ref manifest.Reference, ...) Comparison
- func (s *Set) Paired() bool
- func (s *Set) Paths() []string
- func (s *Set) PendingSourceOwner(source manifest.NamedResource, side manifest.TreeSide) manifest.NamedResource
- func (s *Set) Present(side manifest.TreeSide, file string) (present, known bool)
- func (s *Set) RemovedDeclarations(side manifest.TreeSide, source manifest.NamedResource, ...) iter.Seq[manifest.NamedResource]
- func (s *Set) Sources() iter.Seq[manifest.NamedResource]
- func (s *Set) WithDeclarations(ctx context.Context, input DeclarationInputs) (*Set, error)
- func (s *Set) WithEffectiveRemovals(stores [2]*store.Store, owners [][2]manifest.NamedResource, ...) *Set
- func (s *Set) WithReaders(ctx context.Context, indexes [2]*manifest.DiscoveryIndex, ...) (*Set, error)
- type SourcePair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comparison ¶
type Comparison struct{ Changed, Known bool }
Comparison grants a change verdict only when Known is true.
type DeclarationInputs ¶
type DeclarationInputs struct {
Stores [2]*store.Store
Prepared [2]map[manifest.NamedResource]store.Child
Work manifest.WorkScope
}
DeclarationInputs carries the completed source pair and its preparation authority.
type DetectConfig ¶
type DetectConfig struct {
Work manifest.WorkScope
// Nil discovers all paths; an empty map compares no candidate content.
// True preserves read failures from uncertain checkout observations.
Candidates map[string]bool
}
DetectConfig borrows candidate evidence, which MUST remain immutable until Detect returns.
type InputChange ¶
type InputChange struct {
File string
Declarations []string
Productions []manifest.Production
Unbound bool // Neither side supplies an admitted read of File.
}
InputChange records a changed input and its static discovery authority.
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set carries immutable bootstrap-path changes and qualified source evidence. Completed sets MUST remain immutable while readers share them.
func Detect ¶
func Detect(ctx context.Context, before, after *store.SourceArtifact, config DetectConfig) (*Set, error)
Detect compares the contents exposed by each input filesystem.
func Qualify ¶
func Qualify(ctx context.Context, changes *Set, pair SourcePair, work manifest.WorkScope) (*Set, error)
Qualify compares available admitted source pairs before reconciliation. Supplied changes retain their bootstrap coordinates and are never mutated.
func (*Set) ComparePaths ¶ added in v0.8.1
func (s *Set) ComparePaths(match func(string) bool) Comparison
ComparePaths applies a read footprint to the paired file delta.
func (*Set) CompareSource ¶ added in v0.8.1
func (s *Set) CompareSource( source manifest.NamedResource, side manifest.TreeSide, current *store.SourceArtifact, compare func(*Set) Comparison, ) (Comparison, bool)
CompareSource evaluates a generated read against its current paired source generation.
func (*Set) Contains ¶
Contains reports whether rel is in the change set. rel is expected to be filepath.ToSlash-normalized.
func (*Set) DeclarationChanged ¶
func (s *Set) DeclarationChanged( side manifest.TreeSide, source, id manifest.NamedResource, content *store.DeclarationContent, ) Comparison
DeclarationChanged MUST retain comparison-only behavior for a nil content value.
func (*Set) EffectiveDeclarationChanged ¶ added in v0.8.1
func (s *Set) EffectiveDeclarationChanged( side manifest.TreeSide, id manifest.NamedResource, inputFor func(manifest.NamedResource) *store.SourceArtifact, ) bool
EffectiveDeclarationChanged requires current source authority for an accepted paired removal.
func (*Set) ForSource ¶
func (s *Set) ForSource(source manifest.NamedResource) (*Set, [2]*store.SourceArtifact, [2]manifest.BaseManifest)
ForSource returns source-relative changes, exact admitted artifacts and their source declarations.
func (*Set) Inputs ¶
func (s *Set) Inputs(input manifest.NamedResource) iter.Seq2[manifest.NamedResource, InputChange]
Inputs yields qualified one-sided inputs matching a name, or all inputs for an empty name.
func (*Set) OppositeDeclaration ¶
func (s *Set) OppositeDeclaration( side manifest.TreeSide, source, id manifest.NamedResource, current manifest.BaseManifest, ) manifest.BaseManifest
OppositeDeclaration returns the opposite declaration while the local identity and declaration apply. Source artifact applicability MUST be checked by the caller against ForSource first.
func (*Set) OutputChanged ¶
func (s *Set) OutputChanged( side manifest.TreeSide, source manifest.NamedResource, ref manifest.Reference, current manifest.BaseManifest, ) Comparison
OutputChanged reads a frozen verdict only while the same local declaration and reference apply. Source artifact applicability MUST be checked by the caller against ForSource first.
func (*Set) Paired ¶ added in v0.8.1
Paired reports whether both sides participate in source qualification.
func (*Set) PendingSourceOwner ¶ added in v0.8.1
func (s *Set) PendingSourceOwner(source manifest.NamedResource, side manifest.TreeSide) manifest.NamedResource
PendingSourceOwner returns the prior producer that still owes absence evidence on this side.
func (*Set) RemovedDeclarations ¶ added in v0.8.1
func (s *Set) RemovedDeclarations( side manifest.TreeSide, source manifest.NamedResource, input *store.SourceArtifact, paired bool, ) iter.Seq[manifest.NamedResource]
RemovedDeclarations yields paired observations that can belong to a removal or rename.
func (*Set) Sources ¶
func (s *Set) Sources() iter.Seq[manifest.NamedResource]
Sources yields the source identities carrying immutable comparison evidence.
func (*Set) WithDeclarations ¶
WithDeclarations freezes observed authoritative declaration and reference comparisons before dispatch. Only completed producer output is prepared comparison authority; raw producer-owned input is excluded. Missing preparation is unknown; the returned set retains no Store or captured read set.
func (*Set) WithEffectiveRemovals ¶ added in v0.8.1
func (s *Set) WithEffectiveRemovals( stores [2]*store.Store, owners [][2]manifest.NamedResource, indexedFile func(int, manifest.NamedResource) string, ) *Set
WithEffectiveRemovals compares complete, current producer inventories at a paired drain.
func (*Set) WithReaders ¶
func (s *Set) WithReaders( ctx context.Context, indexes [2]*manifest.DiscoveryIndex, inputs [2]map[manifest.NamedResource]inputprojection.Projection, scope manifest.WorkScope, ) (*Set, error)
WithReaders derives affected inputs from raw facts and current discovery observations. The receiver and both discovery indexes remain immutable.
type SourcePair ¶ added in v0.8.1
type SourcePair struct {
Stores [2]*store.Store
Indexes [2]*manifest.DiscoveryIndex
}
SourcePair carries the current discovery indexes before the stores freeze them.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package inputprojection binds transient content evidence to immutable data inputs.
|
Package inputprojection binds transient content evidence to immutable data inputs. |