Flox Package Database 1
CRUD Operations on Nix Package Metadata
|
A collection of data associated with an environment and its state. More...
#include <environment.hh>
Public Member Functions | |
Environment (std::optional< GlobalManifest > globalManifest, EnvironmentManifest manifest, std::optional< Lockfile > oldLockfile, Upgrades upgrades=false) | |
Environment (EnvironmentManifest manifest, std::optional< Lockfile > oldLockfile=std::nullopt) | |
const std::optional< GlobalManifest > & | getGlobalManifest () const |
std::optional< GlobalManifestRaw > | getGlobalManifestRaw () const |
const EnvironmentManifest & | getManifest () const |
const ManifestRaw & | getManifestRaw () const |
std::optional< ManifestRaw > | getOldManifestRaw () const |
Get the old manifest from oldLockfile if it exists. | |
std::optional< Lockfile > | getOldLockfile () const |
RegistryRaw & | getCombinedRegistryRaw () |
Get a merged form of oldLockfile ( if available ), globalManifest ( if available ) and manifest registries. | |
const pkgdb::PkgQueryArgs & | getCombinedBaseQueryArgs () |
Get a base set of flox::pkgdb::PkgQueryArgs from combined options. | |
std::vector< System > | getSystems () const |
Get the set of supported systems. | |
nix::ref< Registry< pkgdb::PkgDbInputFactory > > | getPkgDbRegistry () |
Lazily initialize and get the combined registry's DBs. | |
Lockfile | createLockfile () |
Create a new lockfile from manifest. | |
Protected Member Functions | |
std::optional< LockedInputRaw > | getGroupInput (const InstallDescriptors &group, const Lockfile &oldLockfile, const System &system) const |
Get locked input from a lockfile to try to use to resolve a group of packages. | |
bool | groupIsLocked (const InstallDescriptors &group, const Lockfile &oldLockfile, const System &system) const |
Check if lock from @ oldLockfile can be reused for a group. | |
Private Types | |
using | Upgrades = std::variant< bool, std::vector< InstallID > > |
Indicator for lockfile upgrade operations. | |
Private Member Functions | |
std::vector< InstallDescriptors > | getUnlockedGroups (const System &system) |
Get groups that need to be locked as opposed to reusing locks from oldLockfile. | |
std::vector< InstallDescriptors > | getLockedGroups (const System &system) |
Get groups with locks that can be reused from oldLockfile. | |
const Options & | getCombinedOptions () |
Get a merged form of oldLockfile or globalManifest ( if available ) and manifest options. | |
std::optional< pkgdb::row_id > | tryResolveDescriptorIn (const ManifestDescriptor &descriptor, const pkgdb::PkgDbInput &input, const System &system) |
Try to resolve a descriptor in a given package database. | |
ResolutionResult | tryResolveGroup (const InstallDescriptors &group, const System &system) |
Try to resolve a group of descriptors. | |
std::variant< InstallID, SystemPackages > | tryResolveGroupIn (const InstallDescriptors &group, const pkgdb::PkgDbInput &input, const System &system) |
Try to resolve a group of descriptors in a given package database. | |
void | lockSystem (const System &system) |
Lock all descriptors for a given system. This is a helper function of flox::resolver::Environment::createLockfile(). | |
![]() | |
NixStoreMixin (const NixStoreMixin &)=default | |
NixStoreMixin (NixStoreMixin &&)=default | |
NixStoreMixin & | operator= (const NixStoreMixin &)=default |
NixStoreMixin & | operator= (NixStoreMixin &&)=default |
NixStoreMixin (const nix::ref< nix::Store > &store) | |
Construct NixStoreMixin from an existing store connection. | |
NixStoreMixin () | |
Construct NixStoreMixin using the systems default nix store. | |
nix::ref< nix::Store > | getStore () |
Lazily open a nix store connection. | |
Static Private Member Functions | |
static LockedPackageRaw | lockPackage (const LockedInputRaw &input, pkgdb::PkgDbReadOnly &dbRO, pkgdb::row_id row, unsigned priority) |
static LockedPackageRaw | lockPackage (const pkgdb::PkgDbInput &input, pkgdb::row_id row, unsigned priority) |
Private Attributes | |
std::optional< GlobalManifest > | globalManifest |
EnvironmentManifest | manifest |
std::optional< Lockfile > | oldLockfile |
Upgrades | upgrades |
std::optional< LockfileRaw > | lockfileRaw |
std::optional< RegistryRaw > | combinedRegistryRaw |
std::optional< Options > | combinedOptions |
std::optional< pkgdb::PkgQueryArgs > | combinedBaseQueryArgs |
std::optional< RegistryRaw > | lockedRegistry |
std::shared_ptr< Registry< pkgdb::PkgDbInputFactory > > | dbs |
A collection of data associated with an environment and its state.
This structure provides a number of helper routines which require knowledge of manifests and lockfiles together - most importantly, locking descriptors.
|
private |
Indicator for lockfile upgrade operations.
true
means upgrade everything. false
or an empty vector mean upgrade nothing. A list of InstallID
s indicates a subset of packages to be upgraded.
|
private |
Get a merged form of oldLockfile or globalManifest ( if available ) and manifest options.
Global options have the lowest priority, and will be clobbered by locked options. Options defined in the current manifest have the highest priority and will clobber all other settings.
RegistryRaw & flox::resolver::Environment::getCombinedRegistryRaw | ( | ) |
Get a merged form of oldLockfile ( if available ), globalManifest ( if available ) and manifest registries.
The Global registry has the lowest priority, and will be clobbered by locked registry inputs/settings. The registry defined in the current manifest has the highest priority and will clobber all other inputs/settings.
|
protected |
Get locked input from a lockfile to try to use to resolve a group of packages.
Helper function for flox::resolver::Environment::lockSystem. Choosing the locked input for a group is full of edge cases, because the new group may be different than whatever was in the group in the old lockfile. We still want to reuse old locked inputs when we can. For example:
If, on the other hand, a package has changed, we don't want to use its locked input.
std::nullopt
.
|
protected |
Check if lock from @ oldLockfile can be reused for a group.
Checks if:
|
private |
Lock all descriptors for a given system. This is a helper function of flox::resolver::Environment::createLockfile().
This must be called after lockfileRaw is initialized. This is only intended to be called from flox::resolver::Environment::createLockfile().
|
private |
Try to resolve a group of descriptors.
Attempts to resolve using a locked input from the old lockfile if it exists for the group. If not, inputs from the combined environment registry are used.
std::nullopt
if resolution fails, otherwise a set of resolved packages.
|
private |
Try to resolve a group of descriptors in a given package database.
|
private |
Contents of user level manifest with global registry and settings.
|
private |
A registry of locked inputs.
|
private |
New/modified lockfile being edited.
|
private |
The environment manifest.
|
private |
Previous generation of the lockfile ( if any ).
|
private |
Packages to force an upgrade for, even if they are already locked.