Flox Package Database 1
CRUD Operations on Nix Package Metadata
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
flox::RegistryRaw Struct Reference

A set of user inputs used to set input preferences during search and resolution. More...

#include <registry.hh>

Public Member Functions

 RegistryRaw (const RegistryRaw &)=default
 
 RegistryRaw (RegistryRaw &&)=default
 
RegistryRawoperator= (const RegistryRaw &)=default
 
RegistryRawoperator= (RegistryRaw &&)=default
 
 RegistryRaw (std::map< std::string, RegistryInput > inputs, InputPreferences defaults={}, std::vector< std::string > priority={})
 
 RegistryRaw (std::map< std::string, RegistryInput > inputs, std::vector< std::string > priority={})
 
virtual std::vector< std::reference_wrapper< const std::string > > getOrder () const
 Return an ordered list of input names.
 
virtual void clear ()
 Reset to default state.
 
pkgdb::PkgQueryArgs & fillPkgQueryArgs (const std::string &input, pkgdb::PkgQueryArgs &pqa) const
 Fill a flox::pkgdb::PkgQueryArgs struct with preferences to lookup packages in a particular input.
 
void merge (const RegistryRaw &overrides)
 Merge this flox::RegistryRaw struct with another flox::RegistryRaw, overriding any existing values with those from the other RegistryRaw.
 
bool operator== (const RegistryRaw &other) const
 
bool operator!= (const RegistryRaw &other) const
 

Public Attributes

std::map< std::string, RegistryInputinputs
 
InputPreferences defaults
 
std::vector< std::string > priority
 

Detailed Description

A set of user inputs used to set input preferences during search and resolution.

Example Registry:

{
"inputs": {
"nixpkgs": {
"from": {
"type": "github"
, "owner": "NixOS"
, "repo": "nixpkgs"
}
, "subtrees": ["legacyPackages"]
}
, "floco": {
"from": {
"type": "github"
, "owner": "aakropotkin"
, "repo": "floco"
}
, "subtrees": ["packages"]
}
}
, "defaults": {
"subtrees": null
}
, "priority": ["nixpkgs", "floco"]
}

Member Function Documentation

◆ fillPkgQueryArgs()

pkgdb::PkgQueryArgs & flox::RegistryRaw::fillPkgQueryArgs ( const std::string &  input,
pkgdb::PkgQueryArgs &  pqa 
) const

Fill a flox::pkgdb::PkgQueryArgs struct with preferences to lookup packages in a particular input.

Parameters
inputThe input name to be searched.
pqaA set of query args to fill with preferences.
Returns
A reference to the modified query args.

◆ getOrder()

std::vector< std::reference_wrapper< const std::string > > flox::RegistryRaw::getOrder ( ) const
virtual

Return an ordered list of input names.

This appends priority with any missing inputs in lexicographical order.

The resulting list contains wrapped references and need to be accessed using std::reference_wrapper<T>::get().

Example:

Registry reg = R"( {
"inputs": {
"floco": {
"from": { "type": "github", "owner": "aakropotkin", "repo": "floco" }
}
, "nixpkgs": {
"from": { "type": "github", "owner": "NixOS", "repo": "nixpkgs" }
}
}
, "priority": ["nixpkgs"]
} )"_json;
for ( const auto & name : reg.getOrder() )
{
std::cout << name.get() << " ";
}
std::cout << std::endl;
// => nixpkgs floco
Returns
A list of input names in order of priority.

◆ merge()

void flox::RegistryRaw::merge ( const RegistryRaw overrides)

Merge this flox::RegistryRaw struct with another flox::RegistryRaw, overriding any existing values with those from the other RegistryRaw.

Member Data Documentation

◆ defaults

InputPreferences flox::RegistryRaw::defaults

Default/fallback settings for inputs.

◆ inputs

std::map<std::string, RegistryInput> flox::RegistryRaw::inputs

Settings and fetcher information associated with named inputs.

◆ priority

std::vector<std::string> flox::RegistryRaw::priority

Priority order used to process inputs. Inputs which do not appear in this list are handled in lexicographical order after any explicitly named inputs.


The documentation for this struct was generated from the following files: