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 ¶
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.
const MaxManifestBytes = 256 << 10
MaxManifestBytes bounds a manifest, as workertype does for a contract.
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 ¶
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 ¶
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 (*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) Remove ¶
Remove deletes the installed release id@version. Removing one that is not installed is not an error.