sources

package
v1.12.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 48 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PhaseResolved means a value is in hand, whether freshly fetched or served
	// from the store.
	PhaseResolved = "Resolved"
	// PhaseFailed means the binding has no value and the message says why.
	PhaseFailed = "Failed"
	// PhaseStale is reported by the Application controller for a value served
	// past its TTL, which this package reports as resolved with a reason.
	PhaseStale = "Stale"
	// PhaseUnused means the binding was declared and nothing read it.
	PhaseUnused = "Unused"
)

The phases a binding is reported in. Declared here because this package writes them; a consumer comparing against its own copy of the string would stop matching the moment one side was edited.

View Source
const (
	// SurfaceComponent is an expression in a component's properties.
	SurfaceComponent = "component"
	// SurfaceTrait is an expression in a trait's properties.
	SurfaceTrait = "trait"
	// SurfacePolicy is an expression in a built-in policy's properties - topology,
	// override and the rest. It may read `context` but not `source`: those
	// properties are consumed straight off af.Policies by a provider, so nothing
	// renders them and there is no resolver to reach a source through.
	SurfacePolicy = "policy-default"
	// SurfacePolicyRendered is an expression in a PolicyDefinition that has a CUE
	// template. It renders through the same engine a component does, so a source
	// resolves there exactly as it would in a component.
	SurfacePolicyRendered = "policy-rendered"
	// SurfacePolicyApp is an expression in an Application-scoped PolicyDefinition.
	// It renders before the appfile is built, so there is no spec.sources[] to
	// resolve against - context only, substituted by the appfile-time pass.
	SurfacePolicyApp = "policy-app"
	// SurfaceWorkflowStep is an expression in a workflow step's (or sub-step's) properties.
	SurfaceWorkflowStep = "workflowstep"
	// SurfaceSource is an expression in a later spec.sources[] entry's properties,
	// i.e. source chaining. It resolves because the chain is walked during a
	// component render.
	SurfaceSource = "source"
)

Surfaces an Application can carry a property expression on.

These live here, next to the resolver, because which of them can read a `source` or a `component` value is a property of this package: both are answered by its resolvers and nowhere else, ResolveSourceExpressions for a render and StepExpressions for a workflow step. The admission webhook and the appfile parser both enforce that rule, so it is stated once rather than restated per enforcement point - which is exactly the divergence that let admission accept `$(context...)` in every policy while only one kind of policy substituted it.

View Source
const PinnedSourcesKey = "kubevela-pinned-sources"

PinnedSourcesKey is the workflow context entry holding the sources a run has read, so every step of the run reads the value the first one did.

View Source
const (
	// SourceResolutionStatusKey stores per-source runtime resolution statuses in
	// the render context, for a caller that has one.
	SourceResolutionStatusKey = "sourceResolutionStatuses"
)

SourceResolutionStatus captures source runtime resolution result.

Variables

View Source
var ConsumableSurfaces = consumableSurfaces()

ConsumableSurfaces are the surfaces a SourceDefinition may name in consumableFrom: the places an Application actually consumes a resolved value.

Derived from sourceReadingSurfaces, less source chaining - that is plumbing between sources, not a place an Application consumes a value, so a definition has no reason to name it.

Functions

func ApplySourceCacheMetadata

func ApplySourceCacheMetadata(obj metav1.Object, sourceType string, meta velaprocess.SourceCacheWriteMeta)

ApplySourceCacheMetadata stamps identity and lifetime metadata onto a source cache object so a context-free GC sweep can reason about it. It is strictly additive: it never overwrites the config.oam.dev/type label, which callers (e.g. the config-API store via ParseConfig) set to the ConfigTemplate name and which the config factory relies on for its change-template guard. The ttl/template/sourcedefinition markers are new.

func CacheNamespace

func CacheNamespace() string

CacheNamespace is where cache entries live: with the definitions they are bookkeeping about, which is the namespace the controller was told to use rather than a fixed "vela-system". An install with a non-default systemDefinitionNamespace would otherwise write to a namespace its own chart granted it no access to, and every cache write, touch and sweep would be Forbidden.

Read through a function rather than copied into a constant: the flag that sets it is parsed after package initialisation.

func CarryComponentScope

func CarryComponentScope(from, to context.Context) context.Context

CarryComponentScope returns to with from's delivered component reads, if it has any, so a render's reads stay known after its context is replaced.

func ComponentPlaceholders

func ComponentPlaceholders(ctx context.Context) bool

ComponentPlaceholders reports whether component reads render as placeholders.

func ConcreteForOpenRender

func ConcreteForOpenRender(ctx context.Context, v cue.Value) (cue.Value, bool)

ConcreteForOpenRender is ConcreteForValidation for whichever open render ctx is. A placeholder dry-run first takes each leaf's default, which is where a component read's placeholder sits wherever its parameter takes text; a validation does not, since a default there says nothing about the value.

func ConcreteForValidation

func ConcreteForValidation(v cue.Value) (cue.Value, bool)

ConcreteForValidation makes a typed render marshalable: a component's output becomes the base its traits render against, and the engine passes that as JSON, which an unknowable leaf cannot survive.

Those leaves are left out rather than zeroed. A trait patches the base by unification, and a zero value conflicts with every literal it might patch in, which would refuse an Application that renders fine. An absent field unifies with anything.

The output and not the parameters. The parameter block is checked against the definition's constraints, where a missing field would fail the required-field check; the output is checked against nothing.

func ContextFields

func ContextFields(surface string) ([]string, error)

ContextFields are the context fields a source consumed from surface can read: the cache-key rules' fields that surface offers, and name, which is the binding's.

func Dependencies

func Dependencies(comps []common.ApplicationComponent, annotations map[string]string) []common.ComponentDependency

Dependencies is what each component depends on, sorted and each once: the components named in its dependsOn, those whose outputs its inputs read, and, in an Application that has opted in, those its property expressions read, with the cluster and namespace an expression names.

func DependencyPlacement

func DependencyPlacement(d common.ComponentDependency) string

DependencyPlacement is where an expression reads a component, as it named it: a cluster, a cluster and namespace, or a namespace of the reader's own cluster, said as such so that it is not taken for a cluster. It is empty for a dependency beside its component.

func EffectiveDependsOn

func EffectiveDependsOn(comp common.ApplicationComponent, annotations map[string]string) []string

EffectiveDependsOn is a component's dependsOn as written, then each component it reads beside itself that is not already there.

func ExpressionsEnabledFor

func ExpressionsEnabledFor(annotations map[string]string) bool

ExpressionsEnabledFor reports whether $( ) property expressions are read for an Application carrying these annotations.

One function because admission and render must agree exactly. They reach it by different routes - the webhook holds the Application, a render reads context.appAnnotations - and if they ever disagreed the result would be an Application admitted and then failing to render, or worse, one admitted with an expression that is then written into a workload verbatim.

Three states, from two gates:

EnableCelExpressions=false                      off, for everyone
EnableCelExpressions=true, RequireOptIn=true     annotated Applications only
EnableCelExpressions=true, RequireOptIn=false    every Application

func ExtractSensitiveOutputPaths

func ExtractSensitiveOutputPaths(template string) []string

ExtractSensitiveOutputPaths reports the schema paths a source template marks +sensitive, so a caller need not compute them and cannot get them wrong.

Derived rather than supplied, for the same reason schemas are: both are projections of the template, and accepting either separately lets the two disagree. A caller that supplied templates but forgot the paths would get silent under-redaction.

func ForgetRefreshHolds

func ForgetRefreshHolds()

ForgetRefreshHolds drops every refresh hold in the process.

A hold is controller-lifetime state, keyed by cache entry and shared by every Application that resolves to it, which is what rests a failing upstream between reconciles. A harness that evaluates independent cases in one process has to drop them between cases, or one case's failure refuses the next case's fetch of the same entry.

func HasComponentScope

func HasComponentScope(ctx context.Context) bool

HasComponentScope reports whether the controller delivered component reads to the render ctx belongs to. An empty scope delivered none.

func IsComponentReadNotReady

func IsComponentReadNotReady(err error) bool

IsComponentReadNotReady reports whether err, or anything it wraps, means a read is waiting: a ComponentReadNotReady, or any resolver's celengine.ErrNotReady.

func IsSourceCacheEntry

func IsSourceCacheEntry(obj metav1.Object) bool

IsSourceCacheEntry reports whether a Secret carries the mark every source cache write stamps (ApplySourceCacheMetadata always records the SourceDefinition), so a store reads only its own entries and not any Secret that happens to have the cache key as its name. It tells the cache's Secrets from others, not a forged one from a real one: whoever can write Secrets in the cache namespace can rewrite a real entry's data anyway, so that write access is the trust boundary of every store.

func MaskedPath

func MaskedPath(path string, masks map[string]struct{}) bool

MaskedPath reports whether a consumed field is covered by a mask, either exactly or by sitting underneath one.

The descent matters. A marker can only be written where the schema declares a field, so a source exposing an open struct - `properties: _`, whose shape is whatever template produced it - has nowhere to put a marker except on the struct itself. Matching exactly would mask a read of `properties` and publish `properties.token` beside it, which is the one case the marker exists for.

Indices are dropped before matching. A read through a list arrives as "members.0.token" because a reference carries its indices as decimal segments, while the mark can only ever be "members.token" - the schema walk records no indices, since a mark on one element applies to them all.

func NewLRUSourceCacheStore

func NewLRUSourceCacheStore(delegate velaprocess.SourceCacheStore) velaprocess.SourceCacheStore

NewLRUSourceCacheStore wraps delegate with the shared process-level LRU. If delegate is nil the wrapper is nil (source caching is disabled).

func NewReadOnlySourceCacheStore

func NewReadOnlySourceCacheStore(delegate velaprocess.SourceCacheStore) velaprocess.SourceCacheStore

NewReadOnlySourceCacheStore wraps delegate so reads are served and writes are dropped. Returns nil if delegate is nil, matching the other constructors.

func NewSecretSourceCacheStore

func NewSecretSourceCacheStore(cli client.Client) velaprocess.SourceCacheStore

NewSecretSourceCacheStore creates a Secret-backed source cache store.

func NotSourceCacheEntry

func NotSourceCacheEntry(obj metav1.Object) error

NotSourceCacheEntry is the stores' one answer to a Secret of the cache key's name that does not carry the mark: they neither read it nor write over it.

func OpenParams

func OpenParams(ctx context.Context) bool

OpenParams reports whether a render's parameters may carry types instead of values: a validation, or a dry-run standing in for component reads. Such a render writes parameters as CUE and prunes what stays open from its output.

func OptionalSourceField

func OptionalSourceField(ctx process.Context, params map[string]interface{}, missing string) (binding, field string, ok bool)

OptionalSourceField reports the binding and field behind a required parameter the properties do set, through a source read of a field the source's schema declares optional. It reports false for any other reason a parameter is absent.

A source read contributes only the fields its schema guarantees, so an optional one is not among them and the required-field check sees a parameter the Application did not provide. It did provide it: the expression is right there in the properties. What is missing is the guarantee.

func Orders

Orders reports whether a dependency orders its component after the one it depends on, as dependsOn does: one named in dependsOn, and one an expression reads beside its component. An inputs dependency is ordered by inputs, and one an expression reads at a named placement by the workflow.

func ParamsAsCUE

func ParamsAsCUE(params map[string]any) (string, error)

ParamsAsCUE renders typed properties as CUE. Values without a type in them render as the JSON they would have anyway; a type cannot survive JSON.

func ReadDependencies

func ReadDependencies(comp common.ApplicationComponent, annotations map[string]string) []string

ReadDependencies is the components a component reads beside itself, naming no cluster or namespace: each is an implied dependsOn, with dependsOn's meaning of the producer in the reader's own placement. A read that names a placement implies none; the workflow orders it. It is taken from Dependencies, so what orders a component is what status.dependencies says does.

func RedactValue

func RedactValue(path string, v interface{}, masks map[string]struct{}) interface{}

RedactValue blanks anything marked sensitive inside a read value.

MaskedPath alone is not enough. It answers "is this path at or below a mark", which covers reading db.password directly, but an expression may substitute a whole collection - "$(source.creds.db)" - and then the read path is db while the mark is db.password, one level below. Nothing matched and the secret went into status verbatim.

Marks are schema paths and carry no list indices, since collectSensitivePaths descends only into struct literals. So elements of a list share their parent's path: a mark of "members.token" applies to the token of every member.

func ResolveSourceExpressions

func ResolveSourceExpressions(ctx process.Context, params interface{}, surface string) (interface{}, error)

ResolveSourceExpressions substitutes $(...) expressions in a properties blob.

surface names the call site, which decides both what a source may read from context and - once the compatibility check lands - whether it may be consumed here at all.

func RootsFor

func RootsFor(surface string) []string

RootsFor is every root an expression on this surface may read. Every surface offers `context`, a workflow step alone offers `steps` and `each`, and the rest follow from the surface lists above.

func SchemasForContext

func SchemasForContext(ctx process.Context) map[string]string

SchemasForContext returns each declared binding's output schema, as the CUE text of its schema: block.

A binding whose definition declares no schema is absent rather than empty, so a caller can tell "nothing to judge by" from "a schema declaring nothing".

func ShouldTouchSourceCache

func ShouldTouchSourceCache(annotations map[string]string, now time.Time) bool

ShouldTouchSourceCache throttles last-accessed updates: it returns true only when no marker exists yet or the existing one is older than half the entry's TTL, so a hot stale entry is not rewritten on every reconcile. The TTL is read from the entry's own annotation, defaulting to sourceCacheTTL.

func StepExpressions

func StepExpressions(stepContext func(step, stepType string) process.Context,
	record func(step, stepType string, statuses map[string]SourceResolutionStatus), vault SensitivePins) wftypes.ExpressionOptions

StepExpressions are the roots KubeVela answers for a workflow step's expressions, which the workflow resolves when the step runs: context and source, read as the step's own render would. stepContext is the render context of the step named, to which its name and type are added, and record is given what each step's sources resolved to.

A source holds for the whole run: each is resolved the first time a step reads it, and every later step reads that value, typed again against its schema. Its sensitive fields are pinned in vault; with no vault a source that has any is not pinned, and each step resolves it.

func SurfaceReadsComponents

func SurfaceReadsComponents(surface string) bool

SurfaceReadsComponents reports whether an expression on this surface may read `component`.

func SurfaceReadsSource

func SurfaceReadsSource(surface string) bool

SurfaceReadsSource reports whether an expression on this surface may read a `source`.

Anywhere else the read cannot be honoured: the value would survive into the consumer as the literal text of the expression, which either fails CUE type-checking with a confusing message or, where the target parameter is open, is silently accepted as a value. Both enforcement points reject it instead.

func TypeOnly

func TypeOnly(ctx context.Context) bool

TypeOnly reports whether this render is a validation.

func TypedParams

func TypedParams(ctx process.Context, params map[string]any, surface string) (map[string]any, error)

TypedParams replaces every $( ) expression in a component's properties with the type its source schema declares, leaving every other value alone.

A struct read keeps its shape: the required-field check flattens what was provided and looks for "meta.region".

func WithComponentPlaceholders

func WithComponentPlaceholders(ctx context.Context) context.Context

WithComponentPlaceholders marks a render as one with no live producers, a dry-run: each component read renders as its own text, `<component.db...>`, while source and context reads still evaluate.

func WithComponentScope

func WithComponentScope(ctx context.Context, scope map[string]interface{}) context.Context

WithComponentScope attaches the `component` scope the controller delivered for a render: producer name -> its output view.

func WithTypeOnly

func WithTypeOnly(ctx context.Context) context.Context

WithTypeOnly marks a context as validating, so an expression is typed from its source schema rather than resolved.

Types

type CUEType

type CUEType string

CUEType is a CUE type expression standing in for a value that is not knowable until render: "int", "string", "[...string]".

A type and not a placeholder value: `replicas: int` unifies with a `>0 & int` constraint, while a sentinel 0 is refused as out of bound.

type CachePolicy

type CachePolicy struct {
	// Key is the entry's key: the definition's readable prefix, then a hash of
	// its template, the binding's properties and the context values KeyInputs
	// names.
	Key       string
	KeyInputs []string
	TTL       time.Duration
	// OnStaleFailure is what a failed refresh does with a stale value:
	// use-stale serves it, fail does not.
	OnStaleFailure string
}

CachePolicy is how a binding's resolved value is cached.

type CheckError

type CheckError struct {
	// Property is the path within the properties blob, e.g. "env[0].value".
	Property string
	// Expr is the expression source, without the surrounding $( ).
	Expr string
	Err  error
}

CheckError is one expression that will not compile, and where it was found.

func (CheckError) Error

func (c CheckError) Error() string

func (CheckError) Unwrap

func (c CheckError) Unwrap() error

Unwrap exposes the underlying compile error, so a caller can match on it.

type ComponentRead

type ComponentRead struct {
	// Trait is the index of the trait whose properties hold the read, or -1 for
	// the component's own properties.
	Trait int
	// Producer is the component being read.
	Producer string
	// Placement is the placement calls the read makes, in order, as
	// template.Call spells them; empty for the producer beside the reader.
	Placement []string
	// Path is the read below the producer and its placement: ["output", ...] or
	// ["outputs", <resource>, ...].
	Path []string
	// Guarded records that the read sits under has() or a ternary arm testing it.
	Guarded bool
}

ComponentRead is one `component.<name>...` read in a component's properties or in one of its traits' properties.

func ComponentReads

func ComponentReads(comp common.ApplicationComponent) ([]ComponentRead, error)

ComponentReads returns every read of another component's output that a component makes, in its own properties and then in each trait's, sorted within each.

func (ComponentRead) Misplaced

func (r ComponentRead) Misplaced() bool

Misplaced reports a placement call anywhere but straight after the component.

func (ComponentRead) String

func (r ComponentRead) String() string

String renders the read the way the author wrote it.

func (ComponentRead) Target

func (r ComponentRead) Target() (ReadTarget, error)

Target reads the placement calls: none, cluster(), namespace() or cluster().namespace(), and nothing else.

type ComponentReadNotReady

type ComponentReadNotReady struct{ Reason string }

ComponentReadNotReady is a component read that cannot be answered yet: its producer is not healthy, not placed where the read names, or its output lacks the field. A reader that hits one is not healthy, and waits, as it would for any dependency; nothing about it is an error in the Application.

func (ComponentReadNotReady) Error

func (e ComponentReadNotReady) Error() string

func (ComponentReadNotReady) Is

func (e ComponentReadNotReady) Is(target error) bool

Is makes a ComponentReadNotReady match celengine.ErrNotReady.

type DefinitionError

type DefinitionError struct {
	// User are the definition's `errs` entries.
	User []string
	// Schema are the ways its output does not fit its schema, one per field.
	Schema []string
	// contains filtered or unexported fields
}

DefinitionError is a source definition refusing on its own terms, as opposed to failing to compile or fetch: the errors it raised through `errs`, or an output its `schema` does not admit.

func (*DefinitionError) Error

func (e *DefinitionError) Error() string

Error is the resolver's message, or the entries joined when there is none.

func (*DefinitionError) Unwrap

func (e *DefinitionError) Unwrap() error

type ReadTarget

type ReadTarget struct {
	// Cluster and Namespace name one placement; either may be empty, meaning the
	// reader's own cluster, or the one namespace the producer has in Cluster.
	Cluster, Namespace string
}

ReadTarget is where a read's placement calls point.

type SensitivePins

type SensitivePins interface {
	// Ref is what the workflow context holds in place of the field stored under key.
	Ref(key string) string
	Load(ctx context.Context, run string) (map[string]interface{}, error)
	Save(ctx context.Context, run string, fields map[string]interface{}) error
}

SensitivePins keeps the sensitive fields of a run's pinned sources, which the workflow context, a ConfigMap, must not hold. A field is stored under its key: the source's name and the field's path, dot-joined. Load returns nothing for another run.

type SourceCompiler

type SourceCompiler interface {
	CompileString(ctx context.Context, src string) (cue.Value, error)
	CompileStringWithOptions(ctx context.Context, src string, opts ...upstreamcuex.CompileOption) (cue.Value, error)
}

SourceCompiler evaluates a source's CUE template. Satisfied by *cuex.Compiler.

An interface rather than the package singleton so a caller can supply its own provider set, and so a test can compile without reaching for global state. The resolver needs both methods: the template is evaluated with providers, and the storage block deliberately without them.

type SourceEngine

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

SourceEngine resolves source expressions in a properties blob.

One engine is one caller's view for one render: it caches what it resolves so a binding read by several properties is fetched once, and it accumulates what resolved so the caller can report it. Build a new one per render rather than sharing.

func NewSourceEngine

func NewSourceEngine(opts SourceEngineOptions) (*SourceEngine, error)

NewSourceEngine validates the options and returns an engine.

The surface must be one the registry declares. That is checked here because the alternative is silent: an unrecognised surface fails open to "offers everything", so a typo would widen what sources may read instead of erroring.

The context deliberately is not checked for completeness. A render populates only the fields that have values, so requiring all of them would reject the Application's own calls.

func (*SourceEngine) CachePolicy

func (e *SourceEngine) CachePolicy(ctx context.Context, binding string) (CachePolicy, error)

CachePolicy is the cache policy binding resolves with, computed as a resolve computes it but without running this binding's provider functions, which storage never needs. Its properties' expressions are substituted first, as for a resolve, so a property reading another source resolves that source, providers included, reading the cache as a resolve does but never writing to it.

func (*SourceEngine) Check

func (e *SourceEngine) Check(properties interface{}) []CheckError

Check reports every expression in properties that will not compile against the bindings and surface this engine was built for.

No I/O and no resolution: this is a parse and a type-check, so it is safe on a value that has not been admitted and cheap enough to run before deciding whether to resolve at all.

It answers "is this expression valid here" - an undeclared binding, a path the schema does not declare, a type error within the expression. It does not answer "does the result fit where it is going", because the engine does not know the destination; use TypeOf and compare against your own target.

Every problem is reported rather than the first, since a caller validating a blob wants all of them in one pass.

func (*SourceEngine) Resolve

func (e *SourceEngine) Resolve(ctx context.Context, properties interface{}) (SourceResult, error)

Resolve substitutes every $( ) expression in properties.

properties is any JSON-shaped value - a map, a list, a scalar - and is walked to any depth, so an expression inside a list entry or a nested object resolves like any other.

type SourceEngineOptions

type SourceEngineOptions struct {
	// Surface names the call site, and decides which context fields a source may
	// read. One of propexpr.SurfaceNames().
	Surface string
	// Context is the value for each field the surface offers, as far as the caller
	// has them. Fields may legitimately be absent rather than empty - appRevision
	// before the first revision exists, publishVersion unless set - so this is not
	// required to be complete, and an expression reading an absent field is
	// refused at admission by the surface's own schema rather than here.
	Context map[string]interface{}

	// Bindings is binding name -> that binding's own properties, which may
	// themselves contain expressions reading an earlier binding.
	Bindings map[string]map[string]interface{}
	// Types is binding name -> SourceDefinition type, carrying a pinned revision
	// where one was requested.
	Types map[string]string
	// Templates is definition type -> its CUE template.
	Templates map[string]string
	// Sensitive is definition type -> paths its schema marks +sensitive.
	//
	// Optional: any type not listed has its paths derived from its template. Supply
	// this only to add paths a template does not declare. Leaving it nil is the
	// safe default, since a caller that supplied templates and forgot the paths
	// would otherwise get silent under-redaction.
	Sensitive map[string][]string

	// Store persists resolved values between reconciles. Nil resolves correctly
	// and simply re-fetches every time.
	Store velaprocess.SourceCacheStore
	// Compiler evaluates templates. Nil uses the workload compiler.
	Compiler SourceCompiler
	// ComponentReads is the `component` scope the controller delivered: producer
	// name -> its output view. Nil when the render reads no component.
	ComponentReads map[string]interface{}

	// Validate runs Check before resolving, and refuses rather than resolving an
	// expression that will not type.
	//
	// Off by default, and deliberately not the only way to get typing. The
	// Application checks at admission, where a failure has a field path and a user
	// to show it to; the same failure at render is a component that will not
	// reconcile. A caller with no admission step of its own sets this and gets the
	// check without having to know to call Check separately.
	Validate bool
}

SourceEngineOptions describes one caller's world: which bindings exist, what backs them, and what context they resolve against.

Stated explicitly rather than read off a process.Context. That is what keeps resolution testable without a cluster and keeps the render context's protocol in one place - ResolveSourceExpressions - rather than spread through here.

type SourceRead

type SourceRead struct {
	// SourceAttr is the attribute of the source that was read, e.g. "data.image".
	SourceAttr string
	// Property is the consumer's property it landed in, e.g. "image" or
	// "env[0].value". Empty when the read happened somewhere without a property
	// path, which today means a source resolving its own properties.
	Property string
	// ReaderKind and ReaderName name the reader when it is not the surface being
	// rendered - a source whose own properties read an earlier source. Empty
	// means the enclosing component, trait or step.
	ReaderKind string
	ReaderName string
	Value      interface{}
}

SourceRead is one value taken from a source: what was read, where it went, and who read it.

type SourceResolutionStatus

type SourceResolutionStatus struct {
	Name  string
	Type  string
	Phase string
	// Stale says the value was served past its TTL. The resolver reports
	// PhaseResolved alongside it, because a value is in hand; the Application
	// controller is what turns the pair into the Stale phase it reports.
	//
	// A flag and not the expiry timestamp: a value served from the in-process
	// layer carries the persistent store's expiry while being fresh by that
	// layer's own rules, so the timestamp does not say what happened.
	Stale     bool
	Message   string
	Config    string
	ExpiresAt string
	// ConsumedFields is field -> value, and is what the auto-update hash is
	// computed over. Deliberately left as a map: json.Marshal sorts map keys, so
	// the hash is stable, and moving it to an ordered list would risk every
	// existing workload's stamped hash changing on upgrade and re-dispatching.
	ConsumedFields map[string]interface{}
	// Reads is the same information with the destination attached: which property
	// of the consumer each value landed in, and which reader took it. Reporting
	// only, never hashed.
	Reads          []SourceRead
	SensitivePaths []string
}

SourceResolutionStatus is what one binding's resolution produced, for the caller to report.

type SourceResult

type SourceResult struct {
	// Properties is the input with every $( ) expression replaced.
	Properties interface{}
	// Statuses is what each binding resolved to, keyed by binding name - the
	// phase, the storage key, the expiry, and the values consumed. Enough to
	// build status from without the caller knowing how resolution works.
	Statuses map[string]SourceResolutionStatus
}

SourceResult is a resolution: the substituted properties, and what it took to produce them.

Jump to

Keyboard shortcuts

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