Documentation
¶
Overview ¶
Package platform defines the Platform and PlatformMetadata types, mirroring the #Platform definition introduced in catalog enhancement 014-platform-construct. A Platform represents a deployment target's identity, type, and registered Module extensions in the unified (APIVersion, Metadata, Package) artifact shape used elsewhere in the kernel.
Catalog enhancement 014 introduces #Platform as the replacement for #Provider. #Platform carries a #registry of #ModuleRegistration entries and declares computed CUE views — #knownResources, #knownTraits, #composedTransformers, #matchers — over which the kernel matcher and executor operate. The matcher rewrite retires the previous Provider package; Platform is now the kernel's sole input for matching and execution.
The #knownResources / #knownTraits views are computed on the platform value and read via Package.LookupPath. The #composedTransformers / #matchers data, however, is NO LONGER materialized onto the closed platform value: as of federate-materialize-transformers (ADR-003), Materialize builds those natively in the owner *cue.Context and exposes them as materialize.MaterializedPlatform.Transformers / .Matchers, and never fills them onto Package (doing so corrupts output-local hidden fields in #transforms). The schema still declares the fields, but on a materialized platform they are unfilled here — read the composed map / reverse index off MaterializedPlatform, not off platform.Package. The views that do live on Package are CUE-computed and not eagerly decoded into Go; the matcher iterates them lazily.
See:
- catalog/enhancements/014-platform-construct/ — the source enhancement
- library/enhancements/001-kernel-redesign-around-platform/ — umbrella
- openspec/changes/add-platform-construct/ — this slice's proposal
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CueContextOwner ¶
CueContextOwner is the minimal context-owner interface accepted by the constructor helpers. *kernel.Kernel satisfies it; tests may pass any value exposing a *cue.Context. The interface lives in opm/platform to keep the constructor's import surface free of opm/kernel.
type Platform ¶
type Platform struct {
// Metadata is the decoded platform-level metadata cache. Authoritative
// data lives in Package; Metadata exists for hot-path access (logging,
// name lookups). May be nil when the metadata could not be decoded.
Metadata *PlatformMetadata `json:"metadata"`
// Package is the loaded CUE value for the platform artifact. Source of
// truth for every field reachable via opm/schema, including #registry
// and the computed views.
Package cue.Value `json:"-"`
}
Platform represents an OPM #Platform artifact in the unified artifact shape: { Metadata, Package }.
Package is the source of truth: it is the loaded CUE value for the platform and every kernel-internal read (Registry, computed views) goes through Package.LookupPath with paths from opm/schema. The CUE-computed views (#composedTransformers, #matchers) are NOT decoded into Go fields; consumers iterate them lazily off Package.
Metadata is an ergonomic decoded projection of the platform-level metadata stamped at construction. It is a cache, not a parallel source of truth — when Metadata and the corresponding subtree of Package disagree, Package wins.
func NewPlatformFromValue ¶
func NewPlatformFromValue(_ CueContextOwner, v cue.Value) (*Platform, error)
NewPlatformFromValue builds a *Platform from a raw CUE artifact value. The supplied k is currently unused but preserved in the signature so future kernel-scoped state (logger, tracer, clock) can be threaded without an API break.
The function decodes PlatformMetadata via schema.DecodePlatformMetadata and stores the input cue.Value unmodified in Package. Errors return a nil *Platform — partial values are never returned.
type PlatformMetadata ¶
type PlatformMetadata = schema.PlatformMetadata
PlatformMetadata is a re-export of schema.PlatformMetadata so callers can keep working with `platform.PlatformMetadata`.