export

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package export builds the immutable per-cell component archives and the component-set document that an aggregate release producer consumes.

Everything emitted here is derived from the embedded target descriptors the installer itself trusts: the archive members, their permission modes, and the declared bundle identity all come from one artifact.Bundle per cell. Nothing downstream re-derives them.

The archive format is specified in docs/component-archive-format.md and is implemented by WriteArchive/ReadArchive in this package.

Index

Constants

View Source
const ArchiveFormat = "pasture.component-archive/v1"

ArchiveFormat is the canonical identifier of the component archive format specified in docs/component-archive-format.md.

View Source
const ComponentSetFilename = "components.json"

ComponentSetFilename is the basename of the emitted component-set document.

View Source
const ComponentSetSchema = "aura.aggregate-components/v1"

ComponentSetSchema is the schema string of the component-set document the aggregate release producer consumes.

Variables

This section is empty.

Functions

func AssetBasename

func AssetBasename(version artifact.Version, id artifact.ComponentID) (string, error)

AssetBasename returns the canonical immutable component asset basename for one release version and one component coordinate. Aggregate release validation accepts exactly this spelling and nothing else.

func MarshalComponentSet

func MarshalComponentSet(cells []CellResult) ([]byte, error)

MarshalComponentSet encodes the component-set document for the given cell results, in canonical component order, with a trailing newline.

func VerifyArchive

func VerifyArchive(id artifact.ComponentID, location string, content []byte, bundle artifact.Bundle) error

VerifyArchive re-reads archive bytes and proves they carry exactly the members, permission modes, sizes, and content digests the bundle manifest declares — in the canonical order. It is the round-trip check every written archive passes before an export is reported as complete.

func WriteArchive

func WriteArchive(destination io.Writer, bundle artifact.Bundle) error

WriteArchive writes one bundle as a component archive: a gzip-compressed tar whose members are exactly the bundle manifest entries, in lexicographic path order, carrying the manifest's permission modes and zeroed ownership and timestamps. The same bundle always produces byte-identical output.

Types

type BundleSource

type BundleSource func() ([]CellBundle, error)

BundleSource yields the nine canonical cell bundles. Production wiring reads the embedded target descriptors; tests inject small synthetic bundles.

type CellBundle

type CellBundle struct {
	ID     artifact.ComponentID
	Bundle artifact.Bundle
}

CellBundle pairs one canonical component coordinate with the exact target bundle the installer would activate for it.

func EmbeddedBundles

func EmbeddedBundles() ([]CellBundle, error)

EmbeddedBundles is the production bundle source: the exact per-cell bundles the three embedded target descriptors declare — the same bundles the installer activates. Nothing here re-derives paths, modes, or identities.

type CellResult

type CellResult struct {
	ID          artifact.ComponentID
	Asset       string
	ArchivePath string
	BundleID    artifact.BundleID
	Digest      artifact.Digest
	Size        int64
	Members     int
}

CellResult reports what was written for one component coordinate.

type Member

type Member struct {
	Path   string
	Kind   MemberKind
	Mode   uint32
	Digest artifact.Digest
	Size   int64
}

Member is one archive member: the bundle-relative path, its permission mode, its variant, and — for regular files — the exact content digest and size.

func BundleMembers

func BundleMembers(bundle artifact.Bundle) ([]Member, error)

BundleMembers returns the exact member list a bundle must produce, in the canonical order WriteArchive writes it. It is the expectation side of the round-trip check performed against every written archive.

func ReadArchive

func ReadArchive(source io.Reader) ([]Member, error)

ReadArchive reads a component archive back into its member list, recomputing each regular file's digest from the archived bytes. It is the verification half of the format: the installer, the release pipeline, and the tests all use it to prove an archive matches the bundle it claims to carry.

type MemberKind

type MemberKind uint8

MemberKind is the closed set of archive member variants.

const (
	// MemberDirectory is a directory member declared by the bundle manifest.
	MemberDirectory MemberKind = iota + 1
	// MemberRegularFile is a regular-file member declared by the bundle manifest.
	MemberRegularFile
)

func (MemberKind) String

func (k MemberKind) String() string

type Request

type Request struct {
	Version artifact.Version
	OutDir  string
}

Request is one complete export: the immutable release version the assets are named for, and the output directory to claim.

type Result

type Result struct {
	Version          artifact.Version
	OutDir           string
	ComponentSetPath string
	Cells            []CellResult
}

Result reports a complete export.

func Export

func Export(ctx context.Context, request Request, source BundleSource) (result Result, err error)

Export writes one component archive per canonical cell into a freshly claimed output directory, verifies each written archive against the bundle manifest it was built from, and writes the component-set document the aggregate release producer consumes. A failed export leaves no directory behind, so a partial set can never be published.

Jump to

Keyboard shortcuts

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