Documentation
¶
Overview ¶
Package plugin is the local plugin store: verified plugin binaries and manifests under <Dir>/plugins/<qualified name>/<version>/ (0500), and <Dir>/plugins.lock recording what was verified at install time. Every Open re-hashes the binary and the manifest against the lock.
Index ¶
- Constants
- Variables
- func Qualify(marketplace, name string, official bool) string
- type Installed
- type LockEntry
- type Store
- func (s Store) Install(e LockEntry, binary, manifest []byte) error
- func (s Store) Installed() ([]Installed, error)
- func (s Store) MarkYanked(marketplace string, status func(bare, version string) (yanked, known bool)) ([]LockEntry, error)
- func (s Store) Open(name string) (*os.File, Installed, error)
- func (s Store) Remove(name string) error
- func (s Store) RemoveAll() error
Constants ¶
const OfficialMarketplace = "official"
OfficialMarketplace is the marketplace name whose plugins have bare names.
Variables ¶
Functions ¶
Types ¶
type Installed ¶
type Installed struct {
LockEntry
Manifest pluginspec.Manifest
Binary string
Tampered bool
}
Installed is a lock entry with its manifest as read from disk. Tampered is set, and Manifest left empty, when the manifest on disk no longer matches the lock.
type LockEntry ¶
type LockEntry struct {
Name string `toml:"name"`
Version string `toml:"version"`
Marketplace string `toml:"marketplace"`
BinarySHA256 string `toml:"binary_sha256"`
ManifestSHA256 string `toml:"manifest_sha256"`
Official bool `toml:"official"`
// Yanked is set from a refreshed, signature-verified marketplace index
// that withdrew this version: Open refuses it.
Yanked bool `toml:"yanked,omitempty"`
}
LockEntry is one installed plugin in plugins.lock. Name is qualified: bare for the official marketplace, "<marketplace>/<name>" otherwise.
type Store ¶
type Store struct{ Dir string }
func (Store) Install ¶
Install stores a plugin whose binary and manifest have already been verified against the marketplace, after checking them against e. A previously installed version of the same plugin is replaced.
func (Store) MarkYanked ¶ added in v0.3.0
func (s Store) MarkYanked(marketplace string, status func(bare, version string) (yanked, known bool)) ([]LockEntry, error)
MarkYanked records, for every installed plugin of marketplace, the yanked status a freshly verified index gives its version. status returns known=false for a version the index does not list: its status is kept. It returns the entries whose status changed.
func (Store) Open ¶
Open opens an installed plugin's binary and checks, from the opened file itself, that it still hashes to the lock entry; the returned file is positioned at its start and is the one to execute.