Documentation
¶
Overview ¶
Package packagekit supplies portable manifests and dependency preflight. Hosts own discovery, trust storage and activation; adapters own native tools.
Index ¶
- Constants
- func FileDigest(path string) (string, error)
- func IdentityKey(id plugin.Identity) string
- func LoadDescriptor(path string) (plugin.Descriptor, error)
- func TreeDigest(root, dir string) (string, error)
- type Artifact
- type Asset
- type Dependency
- type Entrypoint
- type Environment
- type LaunchSelection
- type Manifest
- func (m Manifest) Artifact(name string) (Artifact, bool)
- func (m Manifest) MarshalJSON() ([]byte, error)
- func (m Manifest) Name() string
- func (m Manifest) SelectEntrypoint(name string, env Environment) (LaunchSelection, error)
- func (m Manifest) SourceOnly() bool
- func (m Manifest) Supports(name, version string) bool
- func (m *Manifest) UnmarshalJSON(data []byte) error
- func (m Manifest) Validate() error
- func (m Manifest) VerifyArtifacts(root string) error
- func (m Manifest) Version() string
- func (m Manifest) WithReverse(reverse []plugin.Contract) (Manifest, error)
- type PayloadSchema
- type Plan
- type Resolution
- type SharedDependency
Constants ¶
const ArtifactTree = "tree"
ArtifactTree marks an Artifact whose Path is a directory. Its SHA256 is plugin.DirectoryDigest of that directory, so one entry covers a large vendored tree whose files are not named individually (and may use any case). Trees hold only regular files; symbolic links and special files are rejected.
const ExecutableRuntime = "process"
ExecutableRuntime is the entrypoint runtime ExecutableManifest declares; the process backend's Profile uses the same name.
const MaxAuthoredArtifactBytes = 128 << 20
MaxAuthoredArtifactBytes bounds one file read while authoring a manifest.
const Version = "ext.io/v1"
Variables ¶
This section is empty.
Functions ¶
func FileDigest ¶
FileDigest returns the SHA-256 (hex) of a regular file of at most MaxAuthoredArtifactBytes.
func IdentityKey ¶
IdentityKey is the stable, opaque key of a plugin identity: the SHA-256 of its canonical JSON. Hosts use it to name a plugin in records of their own.
func LoadDescriptor ¶
func LoadDescriptor(path string) (plugin.Descriptor, error)
LoadDescriptor reads a descriptor from a package manifest (ext.io/v1) or from a file holding just a descriptor, bounded by plugin.MaxFrameBytes.
func TreeDigest ¶
TreeDigest returns plugin.DirectoryDigest of the directory dir (a slash-separated path) under root, for an artifact of kind ArtifactTree. The directory must hold at least one file and only regular files and directories.
Types ¶
type Dependency ¶
type Dependency struct {
// OS and Arch condition this requirement on an explicit host target. Empty matches any.
OS string `json:"os,omitempty"`
Arch string `json:"arch,omitempty"`
// Provider selects a package ID across revisions; it is exclusive with Identity.
Provider string `json:"provider,omitempty"`
Contract plugin.ContractRef `json:"contract"`
Operation string `json:"operation"`
Identity *plugin.Identity `json:"identity,omitempty"`
}
type Entrypoint ¶
type Environment ¶
type Environment struct {
OS string
Arch string
Runtimes map[string]plugin.BackendProfile
}
Environment is supplied by the host. Runtime profiles describe installed implementations; shared versions describe libraries the host actually serves.
type LaunchSelection ¶
type LaunchSelection struct {
Entrypoint Entrypoint `json:"entrypoint"`
Artifact Artifact `json:"artifact"`
Protocol string `json:"protocol"`
}
type Manifest ¶
type Manifest struct {
APIVersion string `json:"apiVersion"`
Descriptor plugin.Descriptor `json:"-"`
// License is an optional SPDX license expression. It is descriptive only.
License string `json:"license,omitempty"`
Artifacts []Artifact `json:"artifacts"`
Entrypoints []Entrypoint `json:"entrypoints,omitempty"`
Requires []Dependency `json:"requires,omitempty"`
Configuration *schema.Schema `json:"configuration,omitempty"`
Payloads []PayloadSchema `json:"payloads,omitempty"`
Assets []Asset `json:"assets,omitempty"`
// Metadata carries data defined by a consumer, keyed by a namespaced,
// versioned name such as "kvlite.module/v1"; each value is a JSON object.
// ext validates only the key shape and the bounds. It never interprets a
// value, and a value never grants authority, selects a backend or establishes
// trust. The manifest is part of the package directory, so the trust digest
// covers metadata. A consumer reads its own key and ignores the rest.
Metadata map[string]json.RawMessage `json:"metadata,omitempty"`
}
func ExecutableManifest ¶
func ExecutableManifest(id, version string, contracts []plugin.Contract, executable string) (Manifest, error)
ExecutableManifest describes a one-executable package. The executable sits beside plugin.json under its base name, and the artifact is bound to the running GOOS and GOARCH. The revision is "sha256:<digest of the executable>", so any rebuild is a new immutable revision. The entrypoint "main" runs under the process runtime and speaks plugin.APIVersion over JSON lines.
func SourceManifest ¶
func SourceManifest(id, version string, contracts []plugin.Contract, root string, files []string) (Manifest, error)
SourceManifest describes a package of source files and directories that the consumer runs under a runtime it owns; it declares no entrypoint. files are slash-separated paths relative to root, each listed once as an artifact whose name equals its path. A path that names a directory becomes one ArtifactTree artifact (see TreeDigest), which suits large vendored dependency trees; its files may use any case, while the tree's own path follows the lower-case artifact rules. The revision is "sha256:" over the sorted "path digest" pairs (a tree's path carries a trailing slash), so it follows content and names, not the order given.
func (Manifest) MarshalJSON ¶
func (Manifest) SelectEntrypoint ¶
func (m Manifest) SelectEntrypoint(name string, env Environment) (LaunchSelection, error)
func (Manifest) SourceOnly ¶
SourceOnly reports whether the package ships payload files with no declared entrypoint. The consumer chooses the runtime and the file that starts it.
func (*Manifest) UnmarshalJSON ¶
func (Manifest) VerifyArtifacts ¶
VerifyArtifacts checks listed contents only. Callers must protect the package against concurrent replacement and authenticate the reviewed manifest itself. A checksum never establishes publisher trust. No executable is launched.
func (Manifest) WithReverse ¶
WithReverse returns the manifest declaring the host operations its plugin may call (see plugin.Descriptor.Reverse). Declaring progress needs no helper: set Operation.Progress in the contracts given to ExecutableManifest or SourceManifest. A manifest generator writes both as the descriptor's "reverse" list and each operation's "progress" flag.
type PayloadSchema ¶
type Plan ¶
type Plan struct {
Order []plugin.Identity `json:"order"`
Bindings []Resolution `json:"bindings"`
}
type Resolution ¶
type Resolution struct {
Consumer plugin.Identity `json:"consumer"`
Requirement Dependency `json:"requirement"`
Provider plugin.Identity `json:"provider"`
}
type SharedDependency ¶
type SharedDependency struct {
}
SharedDependency declares exact host-provided frontend versions accepted by this package. Hosts resolve richer release ranges before constructing this.