Documentation
¶
Overview ¶
Package yapdb provides a state tracker for packages installed by YAP.
It maintains a SQLite database of installed packages, their files, and capabilities (provides, requires, conflicts, obsoletes). This allows YAP to track installations across builds without modifying the system rpmdb, apk database, or dpkg status file.
The database is stored at <rootDir>/var/lib/yap/installed.db by default. It is used by pkg/dnfinstall, pkg/aptinstall, and pkg/apkindex to record what was installed and enable conflict detection and uninstall tracking.
Schema version 1 is the current stable version.
Index ¶
- Variables
- func DefaultPath(rootDir string) string
- func RecordInstalled(ctx context.Context, rootDir string, pkg *Package) error
- type Capability
- type DB
- func (d *DB) Close() error
- func (d *DB) Insert(ctx context.Context, p *Package) error
- func (d *DB) IsInstalled(ctx context.Context, name string) (bool, error)
- func (d *DB) List(ctx context.Context) ([]Package, error)
- func (d *DB) LookupByName(ctx context.Context, name, arch string) (*Package, error)
- func (d *DB) ProvidersOf(ctx context.Context, capName string) ([]string, error)
- func (d *DB) Remove(ctx context.Context, name, arch string) error
- type File
- type Package
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = stderrors.New("yapdb: package not found")
ErrNotFound is returned by lookup methods when the requested record does not exist in the database.
Functions ¶
func DefaultPath ¶
DefaultPath returns the canonical state DB path for a given rootDir. If rootDir is empty or "/", uses /var/lib/yap/installed.db. Otherwise uses <rootDir>/var/lib/yap/installed.db.
func RecordInstalled ¶ added in v2.3.3
RecordInstalled opens the state DB under rootDir, inserts pkg, and closes the handle. This is the shared tail of every per-format installer (deb, rpm); metadata assembly stays format-specific, the open/insert/close transaction does not.
Types ¶
type Capability ¶
type Capability struct {
Kind string // "provide" | "require" | "obsolete" | "conflict"
Name string
Flags int
Version string
}
Capability represents a provides/requires/conflicts/obsoletes entry.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB wraps the sqlc-generated queries and provides a high-level API for managing the YAP installed package registry.
func Open ¶
Open opens or creates the state DB at the given path. If path is empty, uses DefaultPath(""). Auto-creates parent directories and initializes schema if needed.
func (*DB) Insert ¶
Insert adds or replaces an installed package record. If a package with the same name+arch already exists, it is replaced atomically (old files and caps are deleted via CASCADE).
func (*DB) IsInstalled ¶
IsInstalled reports whether a package is recorded by name.
func (*DB) LookupByName ¶
LookupByName returns the package record with files and caps. Returns (nil, ErrNotFound) if no package matches name+arch.
func (*DB) ProvidersOf ¶
ProvidersOf returns package names that provide the given capability.