store

package
v0.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package store is the central, in-memory state container for the controller pipeline. It tracks three orthogonal kinds of information for each Kubernetes-style resource (keyed by manifest.NamedResource):

  • The parsed manifest object itself.
  • The processing status (Pending / Ready / Failed) with an optional error message.
  • The artifact produced by a controller (e.g. a checked-out git working tree, a rendered manifest, a downloaded chart).

Three event types are dispatched as state evolves: ObjectAdded, StatusUpdated, ArtifactUpdated. Callers subscribe via AddListener (sync, returns an unsubscribe function).

Store is safe for concurrent use. Listeners run inline on the goroutine that triggered the event; they MUST NOT call back into the same Store with a blocking call.

Index

Constants

View Source
const (
	ReasonSucceeded   = "Succeeded"
	ReasonFailed      = "Failed"
	ReasonReconciling = "Reconciling"
)

Condition reasons attached to the Ready condition.

View Source
const ConditionReady = "Ready"

ConditionReady remains independent of auxiliary health conditions.

Variables

This section is empty.

Functions

func CheckoutClaimSource added in v0.8.1

func CheckoutClaimSource() manifest.NamedResource

CheckoutClaimSource supplies the claim domain for a direct checkout observation.

func PreferProducer added in v0.8.1

func PreferProducer(candidate, selected manifest.NamedResource) bool

PreferProducer keeps scoped representatives in the same order as store representatives.

func RawDeclarationAuthority added in v0.8.1

func RawDeclarationAuthority(index *manifest.DiscoveryIndex, id manifest.NamedResource, classified bool) bool

RawDeclarationAuthority reports whether the indexed file can supply the declaration. Raw self evidence MUST NOT override another builder's transformed declaration.

func SameDeclarationContent added in v0.8.1

func SameDeclarationContent(a, b *Child) bool

SameDeclarationContent compares immutable object, document, and ordered warning payloads.

Types

type AcquisitionState

type AcquisitionState uint8

AcquisitionState grants no content authority without valid captured evidence.

const (
	AcquisitionPending AcquisitionState = iota
	AcquisitionPrepared
	AcquisitionSkipped
)

Acquisition results describe credential settlement separately from source readiness.

type AdvisoryEvidence

type AdvisoryEvidence struct {
	Overrides []SuppliedOverride
}

AdvisoryEvidence retains accepted facts for cluster advisory publication.

type Artifact

type Artifact interface {
	// contains filtered or unexported methods
}

Artifact is a marker interface implemented by every artifact type. Controllers type-assert to the concrete type they expect.

type ArtifactHistory

type ArtifactHistory struct {
	ArtifactInput

	URL string `json:"URL"`
}

ArtifactHistory MUST exclude execution registrations and mutable acquisition state.

type ArtifactInput

type ArtifactInput struct {
	Present       bool           `json:"Present"`
	Readable      bool           `json:"Readable"`
	Kind          string         `json:"Kind"`
	Key           string         `json:"Key"`
	Content       string         `json:"Content"`
	Digest        string         `json:"Digest"`
	LocalRoot     string         `json:"LocalRoot"`
	LocalPath     string         `json:"LocalPath"`
	Provider      SourceProvider `json:"Provider"`
	Extent        SourceExtent   `json:"Extent"`
	Revision      string         `json:"Revision"`
	Origin        string         `json:"Origin"`
	OriginPresent bool           `json:"OriginPresent"`
}

ArtifactInput is the comparable projection of selected source facts.

type ArtifactRead

type ArtifactRead uint8

ArtifactRead selects the source facts consumed by an execution.

const (
	// ArtifactContent selects content availability, generation and source binding.
	ArtifactContent ArtifactRead = 1 << iota
	// ArtifactRevision selects the human-readable source revision.
	ArtifactRevision
	// ArtifactOrigin selects origin revision and its presence.
	ArtifactOrigin
)

type AssessmentKind

type AssessmentKind uint8

AssessmentKind keeps entry bindings separate from reconciliation acceptance.

const (
	AssessmentReconciled AssessmentKind = iota
	AssessmentReused
	AssessmentQualificationSettled
	AssessmentEntryBinding
)

Assessment dispositions select one of the two independent acceptance slots.

type Child

type Child struct {
	Entry             *manifest.EntryApplication
	SourceSupport     manifest.NamedResource
	Obj               manifest.BaseManifest
	Doc               map[string]any
	Generated         bool
	VisibleGeneration bool

	Productions []manifest.Production
	Warnings    []manifest.Warning `json:"-"`
	Ordinal     int                `json:"-"`
	// contains filtered or unexported fields
}

Child retains an admitted object and its authoritative sanitized document.

func (Child) Origin

func (c Child) Origin() manifest.DeclarationOrigin

Origin projects construction and repository children into the same discovery origin.

func (Child) Policy

Policy retains construction authority and derives visibility under the incoming identity.

type ChildDocuments

type ChildDocuments struct {
	Children []Child
	Visible  []manifest.DocOccurrence
	Failures []manifest.DocOccurrence
}

ChildDocuments retains admission failures beside successfully parsed documents.

type Condition

type Condition = metav1.Condition

Condition is an alias for k8s metav1.Condition. flate stores per-resource conditions so SOPS-encrypted-secret detection, health-check rollups, and Flux's dependsOn ReadyExpr CEL evaluation can interoperate with the rest of the K8s ecosystem.

type Declaration

type Declaration struct {
	Obj  manifest.BaseManifest
	Doc  map[string]any
	Role DeclarationRole

	InputPath string
	Ordinal   int
	Warnings  []manifest.Warning `json:"-"`
	// contains filtered or unexported fields
}

Declaration associates an immutable input object with its origin and provenance.

type DeclarationContent

type DeclarationContent struct {
	Exact            string
	WithoutNamespace string
	Namespace        string
}

DeclarationContent MUST come from loader comparison of an immutable document.

type DeclarationPolicy added in v0.8.1

type DeclarationPolicy struct {
	Root, Reconcile, Report bool
	// contains filtered or unexported fields
}

DeclarationPolicy includes the authority of provisional inputs.

func (DeclarationPolicy) Child added in v0.8.1

Child retains declaration authority when a captured object enters a generation.

func (DeclarationPolicy) RootCandidate added in v0.8.1

func (p DeclarationPolicy) RootCandidate() bool

RootCandidate includes supplied references that can support root selection.

func (DeclarationPolicy) Supplied added in v0.8.1

func (p DeclarationPolicy) Supplied() bool

Supplied reports whether the invocation supplied the declaration.

type DeclarationRole added in v0.8.1

type DeclarationRole uint8

DeclarationRole identifies the authority under which the store admits a declaration.

const (
	RepositoryDeclaration DeclarationRole = iota
	SuppliedDeclaration
)

The loader admits repository and supplied declarations. The store owns construction authority.

func (DeclarationRole) Origin added in v0.8.1

Origin projects store input authority into a discovery record.

func (DeclarationRole) Policy added in v0.8.1

Policy derives eligibility for the given object and identity.

type Emission

type Emission struct {
	// Reads records the accepted assessment's consumed inputs.
	Reads *ReadSet
	// OutputReads retains provenance for attempted output or the last complete inventory.
	OutputReads *ReadSet

	Children  []Child
	Manifests []manifest.DocOccurrence
	// Originals holds pre-substitution maps keyed by position in Manifests.
	Originals    map[int]map[string]any
	Failures     []manifest.DocOccurrence
	Fingerprint  string
	Unreadable   []manifest.NamedResource
	Complete     bool
	Construction bool

	// Render retains immutable pre-admission renderer metadata and output.
	Render *manifest.RenderReceipt
	// contains filtered or unexported fields
}

Emission is an immutable assessed inventory. Maps and objects are borrowed read-only.

func (*Emission) DocumentChild added in v0.8.1

func (e *Emission) DocumentChild(i int) manifest.NamedResource

DocumentChild reads the accepted binding at the same position as Manifests.

func (*Emission) Finish

func (e *Emission) Finish()

Finish retains completed renderer bytes across rejected admission without retaining its captures.

func (*Emission) Footprint

Footprint projects the exact complete inventory accepted by this invocation. A nil iterator denotes an unaccepted or incomplete attempt.

func (*Emission) Replay

func (e *Emission) Replay(fingerprint string) (RenderedOutput, bool)

Replay returns completed content matching the caller's canonical input key. Stale accepted inventory remains unavailable through GetEmission.

func (*Emission) Retains

func (e *Emission) Retains(reads *ReadSet) bool

Retains reports whether an accepted assessment or borrowed descriptor still owns reads.

func (*Emission) SourcePaths

func (e *Emission) SourcePaths() []manifest.SourceEvidence

SourcePaths projects the source paths of a complete accepted inventory.

type EventKind

type EventKind int

EventKind enumerates the three observable changes the Store dispatches.

const (
	// EventObjectAdded fires on publication, the first explicit inclusion of a
	// present manifest, or registration with flush=true to replay existing state.
	EventObjectAdded EventKind = iota + 1
	// EventStatusUpdated reports condition transitions and transient reconciliation progress.
	EventStatusUpdated
	// EventArtifactUpdated fires when an artifact is stored.
	EventArtifactUpdated
)

type Gate

type Gate struct {
	manifest.DependencyRef

	Materializer bool
}

Gate retains a readiness expression and its dependency purpose.

type Input

type Input struct {
	Ref manifest.DependencyRef
	// contains filtered or unexported fields
}

Input co-owns a captured dependency and its authority registrations. Its observations MUST remain immutable while retained for content comparison.

type Listener

type Listener func(id manifest.NamedResource, payload any)

Listener receives store events. The payload type depends on EventKind:

  • EventObjectAdded → manifest.BaseManifest
  • EventStatusUpdated → StatusInfo
  • EventArtifactUpdated → Artifact

Listeners run synchronously on the goroutine that triggered the event, so they MUST NOT call back into the same Store with a blocking call.

type Observation

type Observation struct {
	StatusInfo

	Conditions []Condition
	Statusful  bool
}

Observation holds the requested readiness facts from a coherent Snapshot.

type OrderingEdge added in v0.8.1

type OrderingEdge struct {
	Target    manifest.NamedResource
	ReadyExpr string
}

OrderingEdge retains an effective prerequisite and its edge-specific expression.

func OrderingEdgeFor added in v0.8.1

func OrderingEdgeFor(dep *manifest.DependencyRef) OrderingEdge

OrderingEdgeFor retains the target and optional readiness expression of a captured dependency.

func (OrderingEdge) Compare added in v0.8.1

func (e OrderingEdge) Compare(other OrderingEdge) int

Compare orders edges by target and readiness expression.

type Outcome

type Outcome string

Outcome classifies a resource's readiness and failure provenance.

const (
	OutcomePending   Outcome = "Pending"
	OutcomePassed    Outcome = "Passed"
	OutcomeFailed    Outcome = "Failed"
	OutcomeBlocked   Outcome = "Blocked"
	OutcomeSkipped   Outcome = "Skipped"
	OutcomeUnchanged Outcome = "Unchanged"
	OutcomeSuspended Outcome = "Suspended"
)

Resource outcomes.

type PreflightFailure added in v0.8.1

type PreflightFailure struct {
	Message         string
	DependencyCycle bool
}

PreflightFailure keeps cycle origin separate from the failure's display text.

type ProducerAssessment added in v0.8.1

type ProducerAssessment struct {
	Warnings []manifest.Warning
	// GeneratedOverlaps indexes direct document contributions by emitter and child.
	GeneratedOverlaps map[manifest.NamedResource]map[manifest.NamedResource]struct{}
}

ProducerAssessment captures completed diagnostics and shared generated sync identities.

type ProducerBindings added in v0.8.1

type ProducerBindings struct {
	// contains filtered or unexported fields
}

ProducerBindings borrows immutable comparison coordinates from an accepted discovery index.

func Bindings added in v0.8.1

func Bindings(index *manifest.DiscoveryIndex) ProducerBindings

Bindings borrows immutable coordinates from the accepted index.

func (ProducerBindings) All added in v0.8.1

All iterates the immutable coordinates in unspecified order.

func (ProducerBindings) Empty added in v0.8.1

func (b ProducerBindings) Empty() bool

Empty lets callers skip translating inputs when discovery has no binding.

func (ProducerBindings) Peer added in v0.8.1

Peer keeps unmapped identities and requires an accepted peer for mapped identities.

func (ProducerBindings) Producer added in v0.8.1

Producer returns the producer for the comparison identity, or the identity itself.

func (ProducerBindings) Slot added in v0.8.1

Slot returns the comparison identity and whether discovery mapped the producer.

type ReadSet

type ReadSet struct {
	// contains filtered or unexported fields
}

ReadSet retains the immutable inputs consumed by one execution. Its storage MUST remain owned until subscriptions and retained comparisons finish.

func (*ReadSet) Accept

func (r *ReadSet) Accept(kind AssessmentKind)

Accept publishes only against the predecessor captured by this execution.

func (*ReadSet) AddWarning

func (r *ReadSet) AddWarning(warning manifest.Warning)

AddWarning retains a render advisory in this execution's accepted bundle.

func (*ReadSet) Admit

func (r *ReadSet) Admit(child Child, source, owner manifest.NamedResource)

Admit binds raw-file admission to the captured source that supplied its bytes.

func (*ReadSet) AdmitConstructed added in v0.8.1

func (r *ReadSet) AdmitConstructed(child *Child)

AdmitConstructed retains the source coordinate captured by construction.

func (*ReadSet) AdmitOperand added in v0.8.1

func (r *ReadSet) AdmitOperand(obj manifest.BaseManifest, source manifest.NamedResource)

AdmitOperand retains physical support under the captured source while an emission supplies the value.

func (*ReadSet) AdmitSelection added in v0.8.1

func (r *ReadSet) AdmitSelection(
	ctx context.Context,
	children []Child,
	sources []manifest.NamedResource,
	current func() bool,
) bool

AdmitSelection MUST recheck production reads after publishing the proposal's absent declarations.

func (*ReadSet) Admitted

func (r *ReadSet) Admitted() bool

Admitted reports the captured changed-only disposition.

func (*ReadSet) AssessOrdering added in v0.8.1

func (r *ReadSet) AssessOrdering()

AssessOrdering records that an empty ordering footprint is authoritative.

func (*ReadSet) BeginExecution

func (r *ReadSet) BeginExecution(obj manifest.BaseManifest)

BeginExecution borrows optional run-owned counters for an execution.

func (*ReadSet) Bind

func (r *ReadSet) Bind(emission *Emission)

Bind attaches consumed provenance and retains prospective children before publication.

func (*ReadSet) Capture

func (r *ReadSet) Capture(input *Input) manifest.BaseManifest

Capture records a caller-owned named input without reconstructing its identity index.

func (*ReadSet) CarryAdvisories

func (r *ReadSet) CarryAdvisories(previous *ReadSet)

CarryAdvisories copies precedence facts after the caller proves equal consumed inputs.

func (*ReadSet) CarryWarnings

func (r *ReadSet) CarryWarnings(previous RenderedOutput)

CarryWarnings MUST replace prior diagnostics, including an empty projection.

func (*ReadSet) ClearToleratedCRDs added in v0.8.1

func (r *ReadSet) ClearToleratedCRDs()

ClearToleratedCRDs starts a new pass over the retained gates.

func (*ReadSet) Close

func (r *ReadSet) Close()

Close retires captured assessment cells and the origin's borrowed output. Callers MUST stop work for the origin before closing.

func (*ReadSet) ControllerDemand added in v0.8.1

func (r *ReadSet) ControllerDemand(id manifest.NamedResource) bool

ControllerDemand permits the controller body to establish a required outcome.

func (*ReadSet) DeclarationProducers added in v0.8.1

func (r *ReadSet) DeclarationProducers(id manifest.NamedResource) []manifest.NamedResource

DeclarationProducers retains observed omission without authorizing indexed bytes.

func (*ReadSet) Gates

func (r *ReadSet) Gates() iter.Seq[Gate]

Gates enumerates the retained readiness assessments.

func (*ReadSet) GeneratedDocument added in v0.8.1

func (r *ReadSet) GeneratedDocument(id manifest.NamedResource) bool

GeneratedDocument reports whether the captured declaration came from visible generation.

func (*ReadSet) Get

Get returns the captured object asserted to T.

func (*ReadSet) GetAcquisition

func (r *ReadSet) GetAcquisition(id manifest.NamedResource) AcquisitionState

GetAcquisition freezes the accepted result for this capture.

func (*ReadSet) GetArtifact

func (r *ReadSet) GetArtifact(id manifest.NamedResource, read ArtifactRead) Artifact

GetArtifact captures fetched content or accepted output for a dependency.

func (*ReadSet) GetDeclaration

func (r *ReadSet) GetDeclaration(id manifest.NamedResource) manifest.BaseManifest

GetDeclaration captures the effective input authorized by static or accepted support.

func (*ReadSet) GetEmission

GetEmission binds candidate output to this execution's captured declaration and source.

func (*ReadSet) GetObject

GetObject captures a named object, including its absence and supplying producer.

func (*ReadSet) GetStatus

func (r *ReadSet) GetStatus(id manifest.NamedResource) (StatusInfo, bool)

GetStatus captures the readiness condition used by an assessment.

func (*ReadSet) ID

func (r *ReadSet) ID() manifest.NamedResource

ID identifies the execution that owns these inputs.

func (*ReadSet) IncomingProductions

func (r *ReadSet) IncomingProductions(child Child, index *manifest.DiscoveryIndex) []manifest.Production

IncomingProductions captures prospective source and contributor evidence without reading the target.

func (*ReadSet) Init

func (r *ReadSet) Init(s *Store, id manifest.NamedResource, inputs []Input)

Init starts an execution using caller-owned dependency storage. Reused storage MUST have no live or detached registration or output borrower.

func (*ReadSet) Inputs

func (r *ReadSet) Inputs() iter.Seq[manifest.NamedResource]

Inputs yields the concrete identities captured by the completed execution. The owning output MUST keep the read set immutable throughout iteration.

func (*ReadSet) ListObjects

func (r *ReadSet) ListObjects(group, kind string) []manifest.BaseManifest

ListObjects captures the kind bucket and every candidate consulted by selection.

func (*ReadSet) ListProductionCandidates

func (r *ReadSet) ListProductionCandidates(
	group, kind string,
	index *manifest.DiscoveryIndex,
	prospective map[manifest.NamedResource]bool,
) []manifest.BaseManifest

ListProductionCandidates captures visible objects with indexed, prospective, or published ownership. A prospective key without a namespace includes every namespace.

func (*ReadSet) Lookup

Lookup MUST return the object and policy from one captured authority.

func (*ReadSet) Matches

func (r *ReadSet) Matches(previous *ReadSet) bool

Matches recaptures a predecessor's consumed projections in a fresh execution.

func (*ReadSet) MatchesContent

func (r *ReadSet) MatchesContent(previous *ReadSet, id manifest.NamedResource) bool

MatchesContent compares captured content without granting current authority. Both captures MUST have finished recording and retain their observation payloads.

func (*ReadSet) MaterialCurrent added in v0.8.1

func (r *ReadSet) MaterialCurrent() bool

MaterialCurrent checks the retained proof's facets after a source changes execution role. The invalid flag also records role changes, so it cannot decide material validity.

func (*ReadSet) Materializer

func (r *ReadSet) Materializer(id manifest.NamedResource, production manifest.Production) manifest.NamedResource

Materializer selects and captures the runnable declaration supplying a production.

func (*ReadSet) Ordering added in v0.8.1

func (r *ReadSet) Ordering() iter.Seq[OrderingEdge]

Ordering yields the effective declaration dependencies.

func (*ReadSet) OrderingAssessed added in v0.8.1

func (r *ReadSet) OrderingAssessed() bool

OrderingAssessed distinguishes an empty assessment from one still in preparation.

func (*ReadSet) Policy

Policy MUST retain the origin captured with the object.

func (*ReadSet) Preflight

Preflight returns the captured structural admission failure.

func (*ReadSet) ProducerPublished added in v0.8.1

func (r *ReadSet) ProducerPublished(id manifest.NamedResource) bool

ProducerPublished reports whether the captured declaration producer supplied an inventory.

func (*ReadSet) Productions

Productions captures all contributors and discovery evidence for a named input.

func (*ReadSet) Promotions

Promotions captures source-family evidence before conditional raw-file admission. The target itself is a mutation precondition until admission has completed.

func (*ReadSet) QualificationSettled

func (r *ReadSet) QualificationSettled(id manifest.NamedResource) bool

QualificationSettled MUST retain the original assessment's validity around capture matching.

func (*ReadSet) ReadableSourceArtifact added in v0.8.1

func (r *ReadSet) ReadableSourceArtifact(id manifest.NamedResource, read ArtifactRead) (*SourceArtifact, bool)

ReadableSourceArtifact can return a descriptor without a file system.

func (*ReadSet) ReadinessDemand added in v0.8.1

func (r *ReadSet) ReadinessDemand(id manifest.NamedResource) bool

ReadinessDemand distinguishes an assessed prerequisite from ordinary rendering.

func (*ReadSet) RecordSuppliedOverride

func (r *ReadSet) RecordSuppliedOverride(override SuppliedOverride)

RecordSuppliedOverride retains a copied precedence fact in this execution.

func (*ReadSet) RecordToleratedCRD added in v0.8.1

func (r *ReadSet) RecordToleratedCRD(id manifest.NamedResource)

RecordToleratedCRD requires a gate already retained for id.

func (*ReadSet) ReferenceFacts

func (r *ReadSet) ReferenceFacts(
	id manifest.NamedResource,
	index *manifest.DiscoveryIndex,

	consumer manifest.NamedResource,
) ReferenceFacts

ReferenceFacts captures visible data and its accepted source-qualified authority.

func (*ReadSet) ReleaseCapture

func (r *ReadSet) ReleaseCapture()

ReleaseCapture MUST follow evaluation, replay and every output borrow.

func (*ReadSet) ReplacesInvalid

func (r *ReadSet) ReplacesInvalid() bool

ReplacesInvalid reports whether this attempt supersedes a stale accepted assessment.

func (*ReadSet) Require

func (r *ReadSet) Require(ref manifest.DependencyRef)

Require retains each distinct readiness gate in the execution footprint.

func (*ReadSet) RequireData

func (r *ReadSet) RequireData(id manifest.NamedResource)

RequireData records a required semantic input without imposing readiness.

func (*ReadSet) RequireMaterializer

func (r *ReadSet) RequireMaterializer(id manifest.NamedResource)

RequireMaterializer retains a supplier's status-aware readiness assessment.

func (*ReadSet) RequireOrdering added in v0.8.1

func (r *ReadSet) RequireOrdering(edge *OrderingEdge)

RequireOrdering retains readiness demand from the effective declaration.

func (*ReadSet) RequireQualification

func (r *ReadSet) RequireQualification(id manifest.NamedResource)

RequireQualification retains demand without authorizing an ordinary producer body.

func (*ReadSet) Required

func (r *ReadSet) Required() iter.Seq2[manifest.NamedResource, bool]

Required enumerates the required inputs of the accepted execution.

func (*ReadSet) RequiresOrdering added in v0.8.1

func (r *ReadSet) RequiresOrdering(id manifest.NamedResource) bool

RequiresOrdering identifies ordering among retained required inputs.

func (*ReadSet) Retire

func (r *ReadSet) Retire()

Retire releases only this execution's subscriptions at the next boundary.

func (*ReadSet) SetAcquisition

func (r *ReadSet) SetAcquisition(state AcquisitionState)

SetAcquisition stages settlement without changing the accepted result.

func (*ReadSet) SetWork

func (r *ReadSet) SetWork(work *manifest.WorkRecorder)

SetWork borrows invocation-owned recording storage for a temporary proof.

func (*ReadSet) Snapshot

func (r *ReadSet) Snapshot(id manifest.NamedResource, conditions bool) (manifest.BaseManifest, Observation)

Snapshot captures the declaration and requested readiness facts.

func (*ReadSet) SourceAdmission

func (r *ReadSet) SourceAdmission(id, source manifest.NamedResource) bool

SourceAdmission captures whether accepted output still permits initial source support.

func (*ReadSet) ToleratedCRDs added in v0.8.1

func (r *ReadSet) ToleratedCRDs() iter.Seq[manifest.NamedResource]

ToleratedCRDs yields the missing declarations admitted in the latest gate pass.

func (*ReadSet) UnsettledProducers

func (r *ReadSet) UnsettledProducers(id manifest.NamedResource) []manifest.NamedResource

UnsettledProducers captures contributors needed to supply an unpublished declaration. Availability MUST NOT become a content projection for artifact reuse.

func (*ReadSet) Valid

func (r *ReadSet) Valid() bool

Valid reports whether every consumed authority still has its original stamp.

func (*ReadSet) Work

func (r *ReadSet) Work() *manifest.WorkRecorder

Work returns this operation's accounting, including a borrowed proof's parent.

func (*ReadSet) WorkScope

func (r *ReadSet) WorkScope() manifest.WorkScope

WorkScope returns the operation's attribution or its store's discovery scope.

type ReferenceFacts

type ReferenceFacts struct {
	Data, Original              manifest.Data
	Declared                    bool
	Keys                        manifest.KeySet
	Warnings                    []manifest.Warning
	Materializers               []manifest.NamedResource
	Generated, Offline, Private bool
	Accepted                    bool
	// Private preparation MUST remain distinct from authored-consumer input authority.
	Prepared      bool
	Productions   []manifest.Production
	ReferenceData []manifest.ReferenceData
}

ReferenceFacts MUST retain selected warnings and the original data before supply.

type RenderedOutput

type RenderedOutput struct {
	// Render retains immutable pre-admission renderer metadata and output.
	Render      *manifest.RenderReceipt
	Children    []Child
	Manifests   []manifest.DocOccurrence
	Originals   map[int]map[string]any
	Fingerprint string
	Unreadable  []manifest.NamedResource
	// contains filtered or unexported fields
}

RenderedOutput retains keyed render content without assessment registrations. Its objects, documents and warning details MUST remain immutable.

type SourceArtifact

type SourceArtifact struct {

	// Reads retains the declaration and material that produced this acquisition.
	Reads     *ReadSet
	Kind      string
	URL       string
	LocalPath string
	Revision  string
	// Content identifies the exact acquired filesystem generation and shaping.
	Content  string
	Digest   string
	Size     int64
	Metadata map[string]string

	// LocalRoot is the selected input's ownership origin, which may be synthetic.
	// Only an admitted bootstrap uses its original checkout root for Git metadata.
	LocalRoot string
	// SourceDirectory is nonempty only for a committed subtree. A full commit can also have a LocalRoot.
	SourceDirectory string `json:"-"`

	// Key identifies the source family across acquired content generations.
	// Empty Content with FS denotes mutable content requiring cache validation.
	// Nonempty Key without FS requires acquisition before reading.
	Key          string
	Provider     SourceProvider
	Extent       SourceExtent
	ComposedFrom *SourceArtifact `json:"-"`
	// FS supplies acquired content; LocalPath and LocalRoot are coordinates only.
	// Nil FS is unavailable or existence-only, regardless of Key or LocalPath.
	FS fs.FS
	// Warnings is immutable acquisition evidence, excluded from content identity.
	Warnings []manifest.Warning
	// ContentFingerprint lazily identifies selected bytes at their source owner.
	// Nil or an empty result supplies no equality evidence; acquisition identity stays separate.
	ContentFingerprint func(context.Context, fs.FS) (string, error) `json:"-"`
	// contains filtered or unexported fields
}

SourceArtifact retains content and metadata acquired by a source owner.

func (*SourceArtifact) ApplicationOrigin added in v0.8.1

func (a *SourceArtifact) ApplicationOrigin(path string) string

ApplicationOrigin resolves a checkout application through its accepted source origin.

func (*SourceArtifact) Available added in v0.8.1

func (a *SourceArtifact) Available() bool

Available requires material from the current acquisition.

func (*SourceArtifact) CheckoutView added in v0.8.1

func (a *SourceArtifact) CheckoutView() bool

CheckoutView requires checkout origin without a remount for composition.

func (*SourceArtifact) ClaimSource added in v0.8.1

ClaimSource projects an accepted material origin onto the claim query's domain.

func (*SourceArtifact) CompleteCheckout added in v0.8.1

func (a *SourceArtifact) CompleteCheckout() bool

CompleteCheckout excludes filtered and composed views from checkout reuse.

func (*SourceArtifact) DiagnosticRoot added in v0.8.1

func (a *SourceArtifact) DiagnosticRoot(root, logical string) string

DiagnosticRoot uses a logical root when published content has no single checkout location.

func (*SourceArtifact) HistoryIdentity

func (a *SourceArtifact) HistoryIdentity() manifest.SourceIdentity

HistoryIdentity identifies a qualified source family across changed filesystem generations.

func (*SourceArtifact) HistoryInput

func (a *SourceArtifact) HistoryInput() ArtifactHistory

HistoryInput MUST keep URL outside material identity and raw render keys.

func (*SourceArtifact) IndexPath

func (a *SourceArtifact) IndexPath(root, sourcePath string) (string, bool)

IndexPath maps source coordinates without granting filesystem access.

func (*SourceArtifact) Input

func (a *SourceArtifact) Input(read ArtifactRead) ArtifactInput

Input returns the selected facts without retaining filesystem handles or metadata maps.

func (*SourceArtifact) MatchesOrigin added in v0.8.1

func (a *SourceArtifact) MatchesOrigin(path, origin string) bool

MatchesOrigin requires an artifact-local path and a projected origin.

func (*SourceArtifact) OriginPath

func (a *SourceArtifact) OriginPath(file string) string

OriginPath projects checkout material onto its physical input origin. file MUST be within the admitted artifact's LocalPath.

func (*SourceArtifact) SameMaterial

func (a *SourceArtifact) SameMaterial(other *SourceArtifact, read ArtifactRead) bool

SameMaterial MUST ignore execution registrations. The identical-pointer path MUST inline during capture validation.

func (*SourceArtifact) SourcePath

func (a *SourceArtifact) SourcePath(root, indexPath string) (string, bool)

SourcePath maps discovery coordinates without granting source membership.

func (*SourceArtifact) WithReads

func (a *SourceArtifact) WithReads(reads *ReadSet) *SourceArtifact

WithReads retains the acquired material while replacing its execution registrations.

func (*SourceArtifact) WithSourceView added in v0.8.1

func (a *SourceArtifact) WithSourceView(input fs.FS) *SourceArtifact

WithSourceView retains acquisition metadata with a new filesystem generation.

func (*SourceArtifact) WorkingTree added in v0.8.1

func (a *SourceArtifact) WorkingTree() bool

WorkingTree reports whether discovery selected checkout bytes for this artifact.

type SourceExtent added in v0.8.1

type SourceExtent uint8

SourceExtent distinguishes an admitted input, a filtered view, and composed material.

const (
	ExtentInput SourceExtent = iota
	ExtentFiltered
	ExtentComposed
)

ExtentInput permits reuse with other complete views of the same checkout.

type SourceProvider added in v0.8.1

type SourceProvider uint8

SourceProvider identifies the accepted origin of source content.

const (
	ProviderFetch SourceProvider = iota
	ProviderInput
	ProviderAlias
	ProviderCommit
	ProviderGenerator
	ProviderAbsent
)

Acquired artifacts default to ProviderFetch until discovery records another provider.

func (SourceProvider) Generated added in v0.8.1

func (p SourceProvider) Generated() bool

Generated includes ArtifactGenerator content whose production is still pending.

func (SourceProvider) WorkingTree added in v0.8.1

func (p SourceProvider) WorkingTree() bool

WorkingTree reports whether the provider selects checkout bytes.

type Status

type Status string

Status is the processing state of a resource as projected from its Ready condition. Kept as a high-level rollup for callers (depwait, `test` reporting) that don't need the full condition slice.

const (
	StatusPending Status = "Pending"
	StatusReady   Status = "Ready"
	StatusFailed  Status = "Failed"
)

Possible Status values.

type StatusInfo

type StatusInfo struct {
	Status  Status
	Reason  StatusReason
	Message string
	// contains filtered or unexported fields
}

StatusInfo projects readiness, reason, message and failure provenance from a Ready condition.

func ApplyingStatus

func ApplyingStatus(objects int) StatusInfo

ApplyingStatus records pending progress without formatting its object count.

func FailureStatus

func FailureStatus(err error) StatusInfo

FailureStatus retains detached dependency provenance without publishing a condition.

func (StatusInfo) BlockedBy

func (i StatusInfo) BlockedBy() []manifest.NamedResource

BlockedBy returns a copy of the immediate failed dependencies in this snapshot.

func (StatusInfo) DependencyReason

func (i StatusInfo) DependencyReason(subject manifest.DiagnosticIdentity) manifest.DiagnosticReason

DependencyReason returns detached failure context for nested dependency propagation.

func (StatusInfo) IsDependencyFailure

func (i StatusInfo) IsDependencyFailure() bool

IsDependencyFailure reports whether the Failed status came from failed dependencies.

func (StatusInfo) IsUnavailable

func (i StatusInfo) IsUnavailable() bool

IsUnavailable reports whether a producer's output cannot be compared.

func (StatusInfo) MarshalJSON

func (i StatusInfo) MarshalJSON() ([]byte, error)

MarshalJSON encodes the visible status message with its readiness and reason.

func (StatusInfo) Outcome

func (i StatusInfo) Outcome() Outcome

Outcome returns the semantic outcome independently of diagnostic text.

func (StatusInfo) String

func (i StatusInfo) String() string

String returns the visible status message.

type StatusReason

type StatusReason string

StatusReason identifies a Ready condition's machine-readable reason.

const (
	ReasonSkipped   StatusReason = "Skipped"
	ReasonUnchanged StatusReason = "Unchanged"
	ReasonSuspended StatusReason = "Suspended"
)

Special Ready condition reasons.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is the central in-memory state container.

Sharded layout

The Store's hot state is sharded across shardCount shards keyed by the FNV-1a hash of id.Kind.

Cross-shard operations (the ListObjects("", ""), FailedResources, AddListener(replay=true) iterate-everything paths) acquire every shard in ascending index order via lockAll/unlockAll. Holding all shards in canonical order is mandatory: any code path that locks two or more shards MUST do so via lockAll / rLockAll — taking them out-of-order or interleaving with shardFor's lock will deadlock.

Immutability contract

Objects passed to AddObject (and returned by GetObject / ListObjects) are treated as IMMUTABLE after insertion. The store returns shared pointers rather than defensive copies for performance: rendering pipelines read millions of fields per reconcile, and cloning the full manifest tree on every read would dominate CPU.

Callers that need to "modify" a stored object must:

  1. Shallow-copy the struct (most manifest types are flat enough that *clone := *orig works).
  2. Mutate the copy's fields.
  3. Re-AddObject the modified copy. AddObject's content dedup avoids spurious events, and the second-pass dispatch reaches downstream controllers.

Mutating an object after AddObject is a bug — concurrent readers will see torn state and AddObject's dedup will compare against a moving target. The loader (internal/engine/loader/inherit.go) and orchestrator (pkg/orchestrator/orchestrator.go) follow the clone-then-AddObject pattern; any new mutation site should too.

func New

func New() *Store

New constructs an empty Store.

func (*Store) AddConstructionDeclaration added in v0.8.1

func (s *Store) AddConstructionDeclaration(obj manifest.BaseManifest, doc map[string]any)

AddConstructionDeclaration supplies an include before discovery grants repository authority.

func (*Store) AddDeclaration

func (s *Store) AddDeclaration(child Declaration)

AddDeclaration admits an immutable declaration under its origin's authority.

func (*Store) AddListener

func (s *Store) AddListener(event EventKind, fn Listener, flush bool) Unsubscribe

AddListener registers a callback for the given event kind. When flush==true, the listener is immediately invoked with every matching object already in the store before the call returns. Replay order is unspecified (Go-map iteration); listeners that need a deterministic order must sort what they receive. Listener panics during replay are recovered, same as live dispatch. The returned Unsubscribe removes the listener.

Lock strategy (sharded):

  • flush=false: holds every shard's RLock during set.add so a concurrent writer can't snapshot listeners (fireUnderLock) and dispatch before fn is registered. We need RLocks on ALL shards because a writer on any shard runs fireUnderLock under its own shard's write lock — without holding every shard's RLock here, a concurrent writer on shard X could snapshot listeners (not yet including fn), release shard X's lock, and dispatch while fn is being added. The cost (one rLockAll per AddListener) is paid once at controller wiring time, not on the dispatch hot path.
  • flush=true: holds every shard's write lock across (register + snapshot) so the pair is atomic with respect to writers. Without the write locks, a concurrent AddObject on some shard could update its map, snapshot listeners (already including fn via set.add), and dispatch — while this goroutine replays the same object from the post-update map snapshot, double-firing fn. Exactly-one delivery is the invariant; the canonical-order lockAll prevents deadlock between two simultaneous flush=true calls.

func (*Store) AddObject

func (s *Store) AddObject(obj manifest.BaseManifest, docs ...map[string]any)

AddObject inserts a manifest. Equal content with unchanged authority is a no-op.

func (*Store) AddWarning

func (s *Store) AddWarning(w manifest.Warning)

AddWarning retains each complete direct warning payload once, ignoring incoming Count.

func (*Store) AdvisoryEvidence

func (s *Store) AdvisoryEvidence() AdvisoryEvidence

AdvisoryEvidence returns defensive copies of current valid accepted facts.

func (*Store) AssessProducers added in v0.8.1

func (s *Store) AssessProducers() ProducerAssessment

AssessProducers collects warnings and overlap from visible accepted inventories.

func (*Store) AssessmentsWithToleratedCRDs added in v0.8.1

func (s *Store) AssessmentsWithToleratedCRDs() []*ReadSet

AssessmentsWithToleratedCRDs MUST run after the scheduler drains.

func (*Store) BootstrapInput added in v0.8.1

func (s *Store) BootstrapInput(configured *SourceArtifact) *SourceArtifact

BootstrapInput prefers the configured input over the effective bootstrap artifact.

func (*Store) ChildFootprint

func (s *Store) ChildFootprint(
	parent manifest.NamedResource,
	children []Child,
	index *manifest.DiscoveryIndex,
) iter.Seq2[manifest.NamedResource, manifest.DiscoveryRecord]

ChildFootprint projects a complete parsed batch using the supplied discovery evidence. Objects, documents and index records are borrowed and MUST remain immutable.

func (*Store) ChildSourcePaths

func (s *Store) ChildSourcePaths(
	parent manifest.NamedResource,
	children []Child,
	index *manifest.DiscoveryIndex,
) []manifest.SourceEvidence

ChildSourcePaths projects the source paths of a complete discovery batch.

func (*Store) DeleteObject

func (s *Store) DeleteObject(id manifest.NamedResource) bool

DeleteObject removes static authority and its condition/artifact payloads.

func (*Store) EmissionOwner

func (s *Store) EmissionOwner(id manifest.NamedResource) manifest.NamedResource

EmissionOwner returns the generated producer supplying the representative for id. Static, hidden or absent representatives have an empty owner. This individual read does not form an atomic pair with a separate GetEmission call.

func (*Store) FailedResources

func (s *Store) FailedResources() map[manifest.NamedResource]StatusInfo

FailedResources returns every (id, info) currently in Failed state for an object that is also present in the store. The "also present" gate filters phantom entries: DeleteObject wipes the conditions map, but a condition write that lands AFTER the delete (e.g. a slow reconcile goroutine writing back its terminal status) would otherwise resurrect a failure entry for an id that no longer exists. Conditioning on s.objects ensures FailedResources never reports a failure for a resource the orchestrator has explicitly removed.

Iterating conditions rather than objects is faster when most objects don't have conditions yet (common during bootstrap) — avoids the secondary map lookup for every un-reconciled object.

Cross-shard read: walks every shard's conditions/objects. Each shard is RLocked independently in canonical (ascending) order via rLockAll because conditions and objects for a single id always share the same shard, so per-shard reads suffice to detect the phantom — no global lock needed beyond the canonical-order ordering itself, which prevents lockAll-vs-rLockAll deadlocks.

func (*Store) Get

Get fetches the object at id and asserts it to T. Returns (zero, false) when absent, stored under another type, or s is nil.

func (*Store) GetArtifact

func (s *Store) GetArtifact(id manifest.NamedResource, _ ArtifactRead) Artifact

GetArtifact returns the artifact for id, or nil if none was set.

func (*Store) GetDeclaration

func (s *Store) GetDeclaration(id manifest.NamedResource) manifest.BaseManifest

GetDeclaration returns the effective input authorized by static or accepted support.

func (*Store) GetEmission

func (s *Store) GetEmission(id manifest.NamedResource) (manifest.BaseManifest, map[string]any, Emission)

GetEmission borrows valid accepted inventory and binds an attempt to its current input. The captured document remains available while declaration authority is parked. Render identity is available through Emission.Replay. OutputReads preserves validity evidence for withdrawal without exposing invalid inventory. Returned slices and their contents MUST be copied before mutation.

func (*Store) GetObject

GetObject returns the manifest for id, or nil if not present.

func (*Store) GetStatus

func (s *Store) GetStatus(id manifest.NamedResource) (StatusInfo, bool)

GetStatus returns the Ready-derived StatusInfo for id and whether a Ready condition was present.

func (*Store) HasGeneratedObjects

func (s *Store) HasGeneratedObjects(id manifest.NamedResource) bool

HasGeneratedObjects reports whether retained inventory contains auxiliary declarations.

func (*Store) HasInventory

func (s *Store) HasInventory(id manifest.NamedResource) bool

HasInventory reports whether a producer has published an inventory, including hidden output.

func (*Store) IncomingProductions

func (s *Store) IncomingProductions(child Child, index *manifest.DiscoveryIndex) []manifest.Production

IncomingProductions projects prospective evidence without the stored target's state.

func (*Store) ListAs

func (s *Store) ListAs[T manifest.BaseManifest](group, kind string) []T

ListAs returns objects in the exact group/kind bucket that assert to T. Empty group and kind selects the complete inventory, as in ListObjects.

func (*Store) ListObjects

func (s *Store) ListObjects(group, kind string) []manifest.BaseManifest

ListObjects returns objects in the exact group/kind bucket, sorted by NamedResource.Compare. Empty group and kind returns the complete inventory. Single-bucket reads use one kind shard; inventory reads MUST use rLockAll to capture a consistent snapshot across shards.

func (*Store) ListProductionCandidates

func (s *Store) ListProductionCandidates(
	group, kind string,
	index *manifest.DiscoveryIndex,
	prospective map[manifest.NamedResource]bool,
) []manifest.BaseManifest

ListProductionCandidates returns visible objects with indexed, prospective, or published ownership. A prospective key without a namespace includes every namespace.

func (*Store) Lookup

Lookup returns the coherent representative and its declaration roles.

func (*Store) Objects

func (s *Store) Objects() []manifest.BaseManifest

Objects snapshots visible objects in unspecified order without holding locks during use.

func (*Store) Parent added in v0.8.1

Parent MUST prefer indexed structure over accepted rendered relations.

func (*Store) Policy

Policy projects the coherent representative's declaration roles.

func (*Store) Productions

func (s *Store) Productions(id manifest.NamedResource, index *manifest.DiscoveryIndex) []manifest.Production

Productions merges discovery evidence with accepted reverse memberships into a read-only snapshot.

func (*Store) RecordEmitted

func (s *Store) RecordEmitted(
	id manifest.NamedResource,
	next *Emission,
	payloads map[manifest.NamedResource]*SourceArtifact,
)

RecordEmitted atomically accepts completed work, replacing complete inventories and merging incomplete progress. The greatest producer identity supplies shared content.

func (*Store) ReferenceFacts

func (s *Store) ReferenceFacts(
	id manifest.NamedResource,
	index *manifest.DiscoveryIndex,

	consumer manifest.NamedResource,
) ReferenceFacts

ReferenceFacts selects visible data and source-qualified production evidence.

func (*Store) RenderedParents added in v0.8.1

func (s *Store) RenderedParents(
	id manifest.NamedResource,
	index *manifest.DiscoveryIndex,
) iter.Seq[manifest.NamedResource]

RenderedParents MUST exclude self relations and retain every accepted producer.

func (*Store) ReportHidden

func (s *Store) ReportHidden(id manifest.NamedResource) bool

ReportHidden classifies the coherent representative's auxiliary provenance.

func (*Store) ReportProgress

func (s *Store) ReportProgress(id manifest.NamedResource, message string)

ReportProgress dispatches transient phase text without changing Ready conditions.

func (*Store) ReportStatus

func (s *Store) ReportStatus(id manifest.NamedResource) (StatusInfo, bool)

ReportStatus returns status and whether the representative is hidden from reports. A missing Ready condition has an empty status.

func (*Store) RequiredInputs

func (s *Store) RequiredInputs(id manifest.NamedResource) iter.Seq2[manifest.NamedResource, bool]

RequiredInputs enumerates a completed origin's accepted required footprint.

func (*Store) RetainOperand added in v0.8.1

func (s *Store) RetainOperand(id manifest.NamedResource)

RetainOperand preserves reachability from the physical checkout across an emitted source replacement.

func (*Store) Retire

func (s *Store) Retire(reads *ReadSet)

Retire releases registrations only when neither retained output borrows them.

func (*Store) SetArtifact

func (s *Store) SetArtifact(id manifest.NamedResource, artifact *SourceArtifact)

SetArtifact stores acquired content and notifies readers of selected source facts.

func (*Store) SetDiscoveryIndex

func (s *Store) SetDiscoveryIndex(index *manifest.DiscoveryIndex)

SetDiscoveryIndex installs frozen source-qualified evidence before reconciliation. Discovery is never rebuilt on the render path.

func (*Store) SetIncluded

func (s *Store) SetIncluded(
	id manifest.NamedResource, included, ordinary, readiness bool, incoming ...manifest.BaseManifest,
)

SetIncluded MUST never exclude an object after this Store invocation admits it.

func (*Store) SetPreflight

func (s *Store) SetPreflight(id manifest.NamedResource, failure PreflightFailure)

SetPreflight publishes a changed structural admission decision.

func (*Store) SetWorkTree

func (s *Store) SetWorkTree(tree manifest.TreeID, scope manifest.WorkScope)

SetWorkTree qualifies subsequent execution accounting before admission begins.

func (*Store) Snapshot

func (s *Store) Snapshot(id manifest.NamedResource, conditions bool) (manifest.BaseManifest, Observation)

Snapshot reads an effective object and its requested readiness observation.

func (*Store) SourceAdmission

func (s *Store) SourceAdmission(id, source manifest.NamedResource) bool

SourceAdmission rejects initial source support after accepted ownership retires it.

func (*Store) SourceArtifactIDs added in v0.8.1

func (s *Store) SourceArtifactIDs() []manifest.NamedResource

SourceArtifactIDs includes material published before its declaration becomes visible.

func (*Store) Sweep

func (s *Store) Sweep() iter.Seq[manifest.NamedResource]

Sweep delivers changed inputs and reclaims retired registrations. Only the invocation's structural boundary may call Sweep.

func (*Store) UpdateFailure

func (s *Store) UpdateFailure(id manifest.NamedResource, err error)

UpdateFailure atomically records a terminal error and its immediate failed dependencies.

func (*Store) UpdateStatus

func (s *Store) UpdateStatus(id manifest.NamedResource, info StatusInfo)

UpdateStatus records a Ready-condition transition and dispatches a StatusUpdated event when the StatusInfo rollup changes. Snapshot exposes the full condition state. An empty reason derives the normal reason from status.

func (*Store) Warnings

func (s *Store) Warnings() []manifest.Warning

Warnings returns a copy of the collected advisories ordered by manifest.CompareWarning, or nil when none were recorded.

func (*Store) WorkScope

func (s *Store) WorkScope() manifest.WorkScope

WorkScope returns the invocation's tree preparation attribution.

func (*Store) WorkSnapshot

func (s *Store) WorkSnapshot() manifest.WorkSummary

WorkSnapshot detaches this run's sorted admission and operation counters. All writers MUST join before the snapshot is constructed.

type SuppliedOverride

type SuppliedOverride struct {
	Resource   manifest.NamedResource
	SupplyPath string
	Keys       []string
}

SuppliedOverride records repository keys that take precedence over supplied data.

type Unsubscribe

type Unsubscribe func()

Unsubscribe removes a listener. It is safe to call from inside the listener.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL