Documentation
¶
Overview ¶
Package inventory keeps track of the artifacts drop installs in the local system. The data lives in a single versioned JSON document in the user's configuration directory and records, for every installed app, what was installed and enough metadata to later verify, update or uninstall it.
Index ¶
Constants ¶
const FileName = "installed.json"
FileName is the name of the inventory database file.
const Version = 1
Version is the current schema version of the inventory file.
Variables ¶
This section is empty.
Functions ¶
func DefaultPath ¶
DefaultPath returns the location of the inventory database in the user's configuration directory.
Types ¶
type Inventory ¶
type Inventory struct {
Version int `json:"version"`
Installs map[string]*Record `json:"installs"`
// contains filtered or unexported fields
}
Inventory is the database of artifacts installed by drop.
func Open ¶
Open loads the inventory from its default location, returning an empty inventory if no database exists yet.
func OpenFile ¶
OpenFile loads the inventory from a file, returning an empty inventory bound to the path if the file does not exist yet.
func (*Inventory) Add ¶
Add upserts a record into the inventory. When the app is already recorded, the original installation timestamp is preserved.
type Record ¶
type Record struct {
// Repository coordinates and installable name identifying the app.
Host string `json:"host"`
Org string `json:"org"`
Repo string `json:"repo"`
Name string `json:"name"`
// Version is the release tag the installed artifact came from.
Version string `json:"version"`
// Kind is the artifact type that was installed (binary, package or
// archive).
Kind string `json:"kind"`
// Asset is the exact release asset that was downloaded.
Asset string `json:"asset"`
// Digest captures the hashes of the verified artifact, keyed by
// algorithm. For binaries it can be checked against the installed
// file, for packages integrity checks are delegated to the package
// manager and the digest ties the record to the verified file.
Digest map[string]string `json:"digest,omitempty"`
// BinPath is the path where the binary was installed (binaries and
// archives only).
BinPath string `json:"binPath,omitempty"`
// ArchiveEntry is the path inside the release archive of the file that
// was installed (archives only). Updates reuse it to pick the same
// file without asking again.
ArchiveEntry string `json:"archiveEntry,omitempty"`
// PackageFormat is the package type handed to the package manager
// (packages only).
PackageFormat string `json:"packageFormat,omitempty"`
// Verified records if the artifact passed policy verification or was
// installed with verification disabled.
Verified bool `json:"verified"`
InstalledAt time.Time `json:"installedAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
Record stores the data of one installed app.