platform

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

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 exposes computed CUE views — #knownResources, #knownTraits, #composedTransformers, #matchers — that the kernel matcher consumes when walking a consumer Module's FQN demand. The matcher rewrite retires the previous Provider package; Platform is now the kernel's sole input for matching and execution.

All Platform views remain accessible only via Package.LookupPath using the version-binding paths (api.Binding.Paths().Registry, .ComposedTransformers, .Matchers, .KnownResources, .KnownTraits). They are intentionally not eagerly decoded into Go: the matcher iterates them lazily and the views are CUE-computed.

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

type CueContextOwner interface {
	CueContext() *cue.Context
}

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`.

Jump to

Keyboard shortcuts

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