platform

package
v1.0.0-alpha.28 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package platform defines the Platform and PlatformMetadata types, mirroring the #Platform definition of the OPM core schema. A Platform represents a deployment target's identity, type, and the catalogs it carries, in the unified (Metadata, Package, Source) artifact shape used elsewhere in the kernel.

A platform is a CUE module on disk that imports its catalogs: every #registry entry embeds a catalog by import and core derives the entry's version and the platform's #composedTransformers from it (enhancement 0019 D5/D17). The kernel acquires it with Kernel.AcquirePlatformFromDir, which stamps Source, and renders against it with Kernel.Render, which imports the platform package into the render build. No Go code navigates the platform value by path: the composed transformers are read by the render glue, in CUE, inside the build.

See:

  • enhancements/0019 (workspace root) — single-build render
  • adr/006-single-build-artifact-construction.md (one CUE build per artifact)
  • adr/005-shares-nothing-renders.md (the build's lifetime and concurrency)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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, the
	// evaluated form of the package Source points at.
	Package cue.Value `json:"-"`

	// Source is the staged source tree the platform package was loaded from,
	// so a follow-on build can import the platform as a package. It is
	// stamped by Kernel.AcquirePlatformFromDir (on-disk mode, the loaded
	// directory) and is nil for platforms constructed from a bare value
	// (NewPlatformFromValue). Source is the render input: Kernel.Render
	// imports the platform package from it, so a platform without Source
	// cannot be rendered against. No other kernel operation reads it.
	Source *Source `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 metadata decoding reads it. The CUE-computed view (#composedTransformers) is NOT decoded into Go fields and is not read from Go at all: the render build imports the platform package and the glue reads the view in CUE.

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(v cue.Value) (*Platform, error)

NewPlatformFromValue builds a *Platform from a raw CUE artifact value: it decodes PlatformMetadata from the value's metadata field (with the top-level type hoisted in) and stores the input cue.Value unmodified in Package. Errors return a nil *Platform — partial values are never returned. The returned Platform carries no Source.

type PlatformMetadata

type PlatformMetadata = schema.PlatformMetadata

PlatformMetadata is a re-export of schema.PlatformMetadata so callers can keep working with `platform.PlatformMetadata`.

type Source

type Source = module.Source

Source is a re-export of module.Source so callers can keep working with `platform.Source`, mirroring the PlatformMetadata re-export. One type describes the staged source tree of every artifact; see module.Source for the overlay and on-disk modes.

Jump to

Keyboard shortcuts

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