|
Flox Package Database 1
CRUD Operations on Nix Package Metadata
|
Interfaces for caching package metadata in SQLite3 databases. More...
Classes | |
| class | DbPackage |
| Package metadata loaded from a ‘PkgDb’ cache. More... | |
| struct | DbPathMixin |
| Adds a single package database path to a state blob. More... | |
| class | GetCommand |
| Minimal set of DB queries, largely focused on looking up info that is non-trivial to query with a "plain" SQLite statement. More... | |
| class | ListCommand |
| class | PkgDb |
| A SQLite3 database used to cache derivation/package information about a single locked flake. More... | |
| class | PkgDbInput |
| A RegistryInput that opens a PkgDb associated with a flake. More... | |
| class | PkgDbInputFactory |
| Factory for PkgDbInput. More... | |
| struct | PkgDbMixin |
| Adds a single package database and optionally an associated flake to a state blob. More... | |
| class | PkgDbReadOnly |
| A SQLite3 database used to cache derivation/package information about a single locked flake. More... | |
| class | PkgDbRegistryMixin |
| Provides a registry of PkgDb managers. More... | |
| class | PkgQuery |
| A query used to lookup packages in a database. More... | |
| class | ScrapeCommand |
| Scrape a flake prefix producing a SQLite3 database with package metadata. More... | |
| struct | SqlVersions |
| SQLite3 schema versions. More... | |
Concepts | |
| concept | pkgdb_typename |
| Restricts template parameters to classes that extend flox::pkgdb::PkgDbReadOnly. | |
Typedefs | |
| using | row_id = uint64_t |
| using | Fingerprint = nix::flake::Fingerprint |
| using | SQLiteDb = sqlite3pp::database |
| using | sql_rc = int |
| using | Target = std::tuple< flox::AttrPath, flox::Cursor, row_id > |
| A set of arguments used by flox::pkgdb::PkgDb::scrape. | |
| using | Todos = std::queue< Target, std::list< Target > > |
| A queue of flox::pkgdb::Target to be completed. | |
Functions | |
| void | to_json (nlohmann::json &jto, const PkgQueryArgs &descriptor) |
| Convert an flox::pkgdb::PkgQueryArgs to a JSON object. | |
| static void | addIn (std::stringstream &oss, const std::vector< std::string > &elems) |
| void | prim_getFingerprint (nix::EvalState &state, const nix::PosIdx pos, nix::Value **args, nix::Value &value) |
| Lookup a flake's fingerprint hash. | |
| static nix::RegisterPrimOp | primop_getFingerprint ({ .name="__getFingerprint",.args={ "flakeRef" },.arity=0,.doc=R"( This hash uniquely identifies a revision of a locked flake. Takes a single argument: - `flakeRef`: Either an attribute set or string flake-ref. )",.fun=prim_getFingerprint,.experimentalFeature=nix::Xp::Flakes }) |
| bool | isSQLError (int rcode) |
| Predicate to detect failing SQLite3 return codes. | |
| std::ostream & | operator<< (std::ostream &oss, const SqlVersions &versions) |
| Emit version information to an output stream. | |
| std::filesystem::path | getPkgDbCachedir () |
| Get the default pkgdb cache directory to save databases. | |
| std::filesystem::path | genPkgDbName (const Fingerprint &fingerprint, const std::filesystem::path &cacheDir=getPkgDbCachedir()) |
| Get an absolute path to the ‘PkgDb’ for a given fingerprint hash. | |
Variables | |
| constexpr SqlVersions | sqlVersions = { .tables = 2, .views = 3 } |
Interfaces for caching package metadata in SQLite3 databases.
| using flox::pkgdb::Fingerprint = typedef nix::flake::Fingerprint |
A unique hash associated with a locked flake.
| using flox::pkgdb::row_id = typedef uint64_t |
A row index in a SQLite3 table.
| using flox::pkgdb::sql_rc = typedef int |
SQLITE_* result code.
| std::filesystem::path flox::pkgdb::getPkgDbCachedir | ( | ) |
Get the default pkgdb cache directory to save databases.
The environment variable PKGDB_CACHEDIR is respected if it is set, otherwise we use ${XDG_CACHE_HOME:-$HOME/.cache}/flox/pkgdb-v<SCHEMA-MAJOR>.
| bool flox::pkgdb::isSQLError | ( | int | rcode | ) |
Predicate to detect failing SQLite3 return codes.
| rcode | A SQLite3 return code. |
true iff rc is a SQLite3 error. | void flox::pkgdb::prim_getFingerprint | ( | nix::EvalState & | state, |
| const nix::PosIdx | pos, | ||
| nix::Value ** | args, | ||
| nix::Value & | value | ||
| ) |
Lookup a flake's fingerprint hash.
This hash uniquely identifies a revision of a locked flake.
Takes a single argument flakeRef: Either an attribute set or string.
| state | The nix evaluator's state. |
| pos | The position ( file name and line/column numbers ) of the call. This is generally used for error reporting. |
| args | The arguments to the primitive. |
| value | An allocated nix::Value to store the result in. |
|
constexpr |
The current SQLite3 schema versions.