cellpack

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package cellpack is the Piglet-Binary-side counterpart to the host's prebuilt-cell seam (runtimecell.PrebuiltResolver). A Piglet Binary embeds its packed cells plus a manifest describing each cell's composition; at startup it extracts the binaries and registers a Resolver so the host serves them without any Go/Rust toolchain.

Matching is by composition (language + cell key + target + extension set), which is stable across machines, rather than the host's from-source build hash, which embeds the toolchain version and is not reproducible on a toolchain-less consumer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register() error

Register wires this binary's embedded cells into the host prebuilt-cell seam and records source-free cell entries that startup can load directly. It is a no-op when the embedded manifest is empty (stock pig), so it never changes stock behavior.

Types

type CellEntry

type CellEntry struct {
	Language   string     `json:"language"` // go | rust | python
	Key        string     `json:"key"`
	Strategy   string     `json:"strategy,omitempty"` // isolated | packed-go | packed-rust | packed-python
	OS         string     `json:"os"`
	Arch       string     `json:"arch"`
	Binary     string     `json:"binary"` // path relative to the extraction dir
	Extensions []ExtEntry `json:"extensions"`
}

CellEntry is one prebuilt cell: its composition and where its binary lives relative to the extraction directory.

type ExtEntry

type ExtEntry struct {
	Name string `json:"name"`
	Hash string `json:"hash,omitempty"`
}

ExtEntry pins one extension's identity in a cell.

type LoadedCell

type LoadedCell struct {
	Language   string
	Key        string
	Strategy   string
	BinaryPath string
	Extensions []ExtEntry
}

LoadedCell is an embedded cell extracted from the Piglet Binary binary and ready to start without source or a language toolchain.

func LoadedCells

func LoadedCells() []LoadedCell

LoadedCells returns the embedded cells extracted by Register. The returned slice is a copy, so callers may sort or filter it.

type Manifest

type Manifest struct {
	PigCoreVersion string      `json:"pigCoreVersion"`
	Cells          []CellEntry `json:"cells"`
}

Manifest describes the cells embedded in a Piglet Binary.

type Resolver

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

Resolver serves embedded cells by composition. It implements runtimecell.PrebuiltResolver.

func NewResolver

func NewResolver(m Manifest, baseDir string) *Resolver

NewResolver indexes a manifest against the directory its binaries were extracted into.

func (*Resolver) ResolvePrebuilt

func (r *Resolver) ResolvePrebuilt(req runtimecell.PrebuiltRequest) (string, bool)

ResolvePrebuilt returns the embedded binary for a request's composition, or ok=false to let the host build from source. It fails closed: a pinned hash that disagrees with the request, or a missing extracted binary, is a miss.

Jump to

Keyboard shortcuts

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