mirror of
https://github.com/NixOS/nix.git
synced 2025-11-15 23:12:44 +01:00
Move fetchers from libstore to libfetchers
This commit is contained in:
parent
4ba4c7ff66
commit
e0a0ae0467
35 changed files with 80 additions and 90 deletions
62
src/libfetchers/registry.hh
Normal file
62
src/libfetchers/registry.hh
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
#pragma once
|
||||
|
||||
#include "types.hh"
|
||||
#include "fetchers.hh"
|
||||
|
||||
namespace nix { class Store; }
|
||||
|
||||
namespace nix::fetchers {
|
||||
|
||||
struct Registry
|
||||
{
|
||||
enum RegistryType {
|
||||
Flag = 0,
|
||||
User = 1,
|
||||
Global = 2,
|
||||
};
|
||||
|
||||
RegistryType type;
|
||||
|
||||
std::vector<
|
||||
std::tuple<
|
||||
std::shared_ptr<const Input>, // from
|
||||
std::shared_ptr<const Input>, // to
|
||||
Attrs // extra attributes
|
||||
>
|
||||
> entries;
|
||||
|
||||
Registry(RegistryType type)
|
||||
: type(type)
|
||||
{ }
|
||||
|
||||
static std::shared_ptr<Registry> read(
|
||||
const Path & path, RegistryType type);
|
||||
|
||||
void write(const Path & path);
|
||||
|
||||
void add(
|
||||
const std::shared_ptr<const Input> & from,
|
||||
const std::shared_ptr<const Input> & to,
|
||||
const Attrs & extraAttrs);
|
||||
|
||||
void remove(const std::shared_ptr<const Input> & input);
|
||||
};
|
||||
|
||||
typedef std::vector<std::shared_ptr<Registry>> Registries;
|
||||
|
||||
std::shared_ptr<Registry> getUserRegistry();
|
||||
|
||||
Path getUserRegistryPath();
|
||||
|
||||
Registries getRegistries(ref<Store> store);
|
||||
|
||||
void overrideRegistry(
|
||||
const std::shared_ptr<const Input> & from,
|
||||
const std::shared_ptr<const Input> & to,
|
||||
const Attrs & extraAttrs);
|
||||
|
||||
std::pair<std::shared_ptr<const Input>, Attrs> lookupInRegistries(
|
||||
ref<Store> store,
|
||||
std::shared_ptr<const Input> input);
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue