install

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package install keeps the Worker Type artifacts installed on this server: a content-addressed store under the data directory, from which the supervisor launches a Worker Type's executable after verifying it again (ADR-0535 §2, migration step 3).

An installed release lives at <dir>/<id>/<version>/<hex digest>/, holding the executable and installed.json (the manifest as given, and what this server recorded about it). A release is immutable: installing the same id and version again with the same digest changes nothing, with another digest is refused. The digest is checked when the artifact is installed and again before every launch, so a file altered on disk is refused rather than run.

Nothing here runs on the engine's run loop or touches durable engine state: an installed Worker Type is design-time state on disk, like the other sidecar stores.

Index

Constants

View Source
const MaxArtifactBytes = 512 << 20

MaxArtifactBytes bounds one installed executable. A Worker Type is one process's code; a file larger than this is not one, and the bound keeps an install from filling the data directory.

View Source
const MaxManifestBytes = 256 << 10

MaxManifestBytes bounds a manifest, as workertype does for a contract.

View Source
const OriginFile = "file"

Origin says where an installed release came from. Only a local file exists before the registry of step 5; a signed release from atlas hub will add its own.

Variables

View Source
var ErrConflict = errors.New("this Worker Type version is already installed with another artifact; a release is immutable, so publish a new version")

ErrConflict is an install of a version already installed with other content.

Functions

func Platform

func Platform() string

Platform is this process's platform as a manifest names it, os/arch.

Types

type Installed

type Installed struct {
	ID       string `json:"id"`
	Version  string `json:"version"`
	Name     string `json:"name"`
	Platform string `json:"platform"`
	// Digest is the artifact's sha256 as the manifest declared it and as it was
	// verified at install.
	Digest   string   `json:"digest"`
	JobTypes []string `json:"jobTypes"`
	Origin   string   `json:"origin"`
	// Signed is false until signature verification exists (ADR-0535 §6, step 5):
	// every installed release is then an unsigned, locally installed one, and is
	// shown as such.
	Signed      bool  `json:"signed"`
	InstalledAt int64 `json:"installedAt"`
	// Path is the executable's location, filled in when read; it is not stored.
	Path string `json:"-"`
	// Manifest is the manifest exactly as it was installed.
	Manifest json.RawMessage `json:"manifest"`
}

Installed is one installed Worker Type release.

type Store

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

Store is the installed Worker Types under one directory. Its methods are safe for concurrent use; installs and removals are serialized.

func Open

func Open(dir string) (*Store, error)

Open opens (creating if needed) the store under dir.

func (*Store) Install

func (s *Store) Install(manifest []byte, r io.Reader, platform string, now time.Time) (Installed, error)

Install verifies manifest and the artifact read from r against each other and records the release. The manifest must declare an artifact for platform, of the executable media type, whose sha256 the bytes read from r match.

func (*Store) List

func (s *Store) List() ([]Installed, error)

List returns every installed release, ordered by id and version.

func (*Store) Remove

func (s *Store) Remove(id, version string) error

Remove deletes the installed release id@version. Removing one that is not installed is not an error.

func (*Store) Verified

func (s *Store) Verified(id, version string) (Installed, error)

Verified returns the installed release id@version after hashing its executable again: an artifact whose bytes no longer match the digest it was installed with is refused, so the supervisor never launches a file altered on disk.

Jump to

Keyboard shortcuts

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