manifest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package manifest reads and validates pulp.cell.toml files.

A manifest declares everything the host needs to know about a cell before instantiating it: identity, what functions the cell provides to siblings, what it consumes from siblings, which host primitives ("capabilities") it touches, and its free-form [config] table.

The parser does NOT resolve cross-cell dependencies or touch WASM. It produces a CellSpec that downstream code (loader, dependency resolver, capability binder) consumes.

Index

Constants

View Source
const (
	RestartNever   = "never"
	RestartOnCrash = "on_crash"
	RestartAlways  = "always"
)

RestartNever / RestartOnCrash / RestartAlways are the accepted values of the manifest's restart field. The supervisor is not yet implemented; the field is parsed and validated now so manifests written today survive the v2 supervisor drop without rewrites.

View Source
const CurrentSchemaVersion = 1

CurrentSchemaVersion is the manifest schema the host knows how to parse. Manifests that declare a higher schema_version are rejected.

Variables

This section is empty.

Functions

func EncodeConfig

func EncodeConfig(config map[string]any) ([]byte, error)

EncodeConfig serializes the manifest's [config] table to MessagePack bytes. The result is what the host passes to pulp_init as (config_ptr, config_len).

Nil or empty configs encode to an empty byte slice. Callers must not assume a non-nil slice — pulp_init receives zero-length bytes when there is no config to deliver.

Types

type CellSpec added in v0.2.0

type CellSpec struct {
	// SchemaVersion is the manifest schema this cell was written against.
	// Defaults to CurrentSchemaVersion when absent. Manifests declaring a
	// higher version than the host supports are rejected.
	SchemaVersion int

	// Identity.
	Name    string
	Version string

	// Dependency graph inputs. Resolved by the dependency resolver (not here).
	Provides []string
	Consumes []string

	// DependsOn lists cell names (not capabilities) that must finish Init
	// before this cell starts. The host refuses to boot on cycles or
	// references to cell names absent from the manifest set.
	DependsOn []string

	// Capability declarations. Normalized to lowercase. The host binds only
	// imports that match declared capabilities; everything else fails loudly.
	Capabilities []string

	// SharedMemoryGroups — opt-in zero-copy regions between cooperating
	// cells. Absent from v0.2 linking but parsed so manifests are
	// forward-compatible.
	SharedMemoryGroups []string

	// Operational knobs.
	DedicatedThread bool
	Snapshotable    bool

	// Restart is the post-exit policy: "never" (default), "on_crash", or
	// "always". Parsed + validated now; the supervisor that honors it ships
	// in a later Pulp version.
	Restart string

	// Free-form cell config. The TOML [config] table as a generic map —
	// the host encodes it to MessagePack before handing it to pulp_init.
	// Absent or empty table => nil map.
	Config map[string]any

	// ManifestPath is the absolute path the manifest was loaded from.
	// Used to resolve relative WASM paths.
	ManifestPath string

	// WASMPath is the absolute path to the cell's .wasm file. Resolved
	// from the manifest's `wasm =` field (relative paths are relative to
	// the manifest). If the field is absent, defaults to cell.wasm next
	// to the manifest.
	WASMPath string
}

CellSpec is the parsed, validated, normalized form of a pulp.cell.toml.

It contains everything the host needs to decide how to instantiate the cell. Config is returned as the raw TOML table so it can be encoded to whatever wire format the host chooses — MessagePack in v0.2.

func Load

func Load(path string) (*CellSpec, error)

Load reads, parses, and validates a pulp.cell.toml at path. Returns a CellSpec ready for the host to instantiate.

Unknown top-level keys are treated as errors — catches typos at boot rather than silently ignoring mis-spelled capabilities or provides.

type Set added in v0.2.0

type Set struct {
	// Cells in declaration order (the order manifests were supplied on
	// the command line). Use Order for dep-respecting boot order.
	Cells []*CellSpec

	// Order is a topological ordering: if A depends on B, B appears before
	// A. Used by the host to drive Setup + Init in an order that satisfies
	// every cell's depends_on.
	Order []*CellSpec
}

Set is a validated collection of cell specs ready for the host to boot. Built by LoadAll; guarantees unique cell names, no missing deps, and no dependency cycles.

func LoadAll added in v0.2.0

func LoadAll(paths []string) (*Set, error)

LoadAll parses every manifest path, validates as a group, and returns the resulting Set. Any manifest-level parse error, duplicate cell name, missing dependency, or dependency cycle aborts the load.

The host should reject a partial fleet — if any manifest is broken, nothing boots.

func (*Set) Lookup added in v0.2.0

func (s *Set) Lookup(name string) *CellSpec

Lookup finds a cell by name. Returns nil if not present.

Jump to

Keyboard shortcuts

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