A SQLite3 database used to cache derivation/package information about a single locked flake.
More...
#include <read.hh>
|
void | init () |
| Open SQLite3 db connection at dbPath.
|
|
A SQLite3 database used to cache derivation/package information about a single locked flake.
◆ PkgDbReadOnly() [1/4]
flox::pkgdb::PkgDbReadOnly::PkgDbReadOnly |
( |
| ) |
|
|
inlineprotected |
Dummy constructor required for child classes so that they can open databases in read-only mode.
Does NOT attempt to create a database if one does not exist.
◆ PkgDbReadOnly() [2/4]
flox::pkgdb::PkgDbReadOnly::PkgDbReadOnly |
( |
std::string_view |
dbPath | ) |
|
|
inlineexplicit |
Opens an existing database.
Does NOT attempt to create a database if one does not exist.
- Parameters
-
dbPath | Absolute path to database file. |
◆ PkgDbReadOnly() [3/4]
flox::pkgdb::PkgDbReadOnly::PkgDbReadOnly |
( |
const Fingerprint & |
fingerprint, |
|
|
std::string_view |
dbPath |
|
) |
| |
|
inline |
Opens a DB directly by its fingerprint hash.
Does NOT attempt to create a database if one does not exist.
- Parameters
-
fingerprint | Unique hash associated with locked flake. |
dbPath | Absolute path to database file. |
◆ PkgDbReadOnly() [4/4]
flox::pkgdb::PkgDbReadOnly::PkgDbReadOnly |
( |
const Fingerprint & |
fingerprint | ) |
|
|
inlineexplicit |
Opens a DB directly by its fingerprint hash.
Does NOT attempt to create a database if one does not exist.
- Parameters
-
fingerprint | Unique hash associated with locked flake. |
◆ completedAttrSet() [1/2]
bool flox::pkgdb::PkgDbReadOnly::completedAttrSet |
( |
const flox::AttrPath & |
path | ) |
|
Check to see if database has a complete list of packages under the prefix path.
- Parameters
-
path | An attribute path prefix such as packages.x86_64-linux or legacyPackages.aarch64-darwin.python3Packages . |
- Returns
true
iff the database has completely scraped the AttrSet
at path.
◆ completedAttrSet() [2/2]
bool flox::pkgdb::PkgDbReadOnly::completedAttrSet |
( |
row_id |
row | ) |
|
Check to see if database has a complete list of packages under the prefix path.
- Parameters
-
row | The AttrSets.id to lookup. |
- Returns
true
iff the database has completely scraped the AttrSet
at path.
◆ getAttrSetId()
Get the AttrSet.id
for a given path.
- Parameters
-
path | An attribute path prefix such as packages.x86_64-linux or legacyPackages.aarch64-darwin.python3Packages . |
- Returns
- A unique
row_id
( unsigned 64bit int ) associated with path.
◆ getAttrSetPath()
Get the attribute path for a given AttrSet.id
.
- Parameters
-
row | A unique row_id ( unsigned 64bit int ). |
- Returns
- An attribute path prefix such as
packages.x86_64-linux
or legacyPackages.aarch64-darwin.python3Packages
.
◆ getDbVersion()
SqlVersions flox::pkgdb::PkgDbReadOnly::getDbVersion |
( |
| ) |
|
- Returns
- The Package Database schema version.
◆ getDescription()
std::string flox::pkgdb::PkgDbReadOnly::getDescription |
( |
row_id |
descriptionId | ) |
|
Get the Description.description
for a given Description.id
.
- Parameters
-
descriptionId | The row id to lookup. |
- Returns
- A string describing a package.
◆ getPackage() [1/2]
nlohmann::json flox::pkgdb::PkgDbReadOnly::getPackage |
( |
const flox::AttrPath & |
path | ) |
|
Get metadata about a single package.
Returns pname
, version
, description
, broken
, unfree
, and license
columns.
- Parameters
-
row | An attribute path to a package. |
- Returns
- A JSON object containing information about a package.
◆ getPackage() [2/2]
nlohmann::json flox::pkgdb::PkgDbReadOnly::getPackage |
( |
row_id |
row | ) |
|
Get metadata about a single package.
Returns pname
, version
, description
, broken
, unfree
, and license
columns.
- Parameters
-
row | A Packages.id to lookup. |
- Returns
- A JSON object containing information about a package.
◆ getPackageId()
Get the Packages.id
for a given path.
- Parameters
-
path | An attribute path prefix such as packages.x86_64-linux.hello or legacyPackages.aarch64-darwin.python3Packages.pip . |
- Returns
- A unique
row_id
( unsigned 64bit int ) associated with path.
◆ getPackagePath()
Get the attribute path for a given Packages.id
.
- Parameters
-
row | A unique row_id ( unsigned 64bit int ). |
- Returns
- An attribute path such as
packages.x86_64-linux.hello
or legacyPackages.aarch64-darwin.python3Packages.pip
.
◆ getPackages()
std::vector< row_id > flox::pkgdb::PkgDbReadOnly::getPackages |
( |
const PkgQueryArgs & |
params | ) |
|
Return a list of Packages.id
s for packages which satisfy a given set of requirements.
These results may be ordered flexibly based on various query parameters. TODO: document parameters effected by ordering.
◆ hasAttrSet()
bool flox::pkgdb::PkgDbReadOnly::hasAttrSet |
( |
const flox::AttrPath & |
path | ) |
|
Check to see if database has and attribute set at path.
- Parameters
-
path | An attribute path prefix such as packages.x86_64-linux or legacyPackages.aarch64-darwin.python3Packages . |
- Returns
true
iff the database has an AttrSet
at path.
◆ hasPackage()
bool flox::pkgdb::PkgDbReadOnly::hasPackage |
( |
const flox::AttrPath & |
path | ) |
|
Check to see if database has a package at the attribute path path.
- Parameters
-
path | An attribute path such as packages.x86_64-linux.hello or legacyPackages.aarch64-darwin.python3Packages.pip . |
- Returns
true
iff the database has a rows in the Packages
table with path
as the absolute path.
◆ init()
void flox::pkgdb::PkgDbReadOnly::init |
( |
| ) |
|
|
private |
Open SQLite3 db connection at dbPath.
Throw an error if no database exists.
◆ loadLockedFlake()
void flox::pkgdb::PkgDbReadOnly::loadLockedFlake |
( |
| ) |
|
|
protected |
Set this PkgDb
lockedRef
fields from database metadata.
◆ db
SQLiteDb flox::pkgdb::PkgDbReadOnly::db |
◆ dbPath
std::filesystem::path flox::pkgdb::PkgDbReadOnly::dbPath |
Absolute path to database.
◆ fingerprint
Unique hash of associated flake.
◆ lockedRef
The documentation for this class was generated from the following files: