Unified fetcher caching system

This commit is contained in:
Eelco Dolstra
2020-03-17 22:35:29 +01:00
parent fbcb897e21
commit 2a4e4f6a6e
20 changed files with 425 additions and 197 deletions
+3 -3
View File
@@ -132,10 +132,10 @@ static FlakeInput parseFlakeInput(EvalState & state,
auto sFlake = state.symbols.create("flake");
auto sFollows = state.symbols.create("follows");
fetchers::Input::Attrs attrs;
fetchers::Attrs attrs;
std::optional<std::string> url;
for (Attr attr : *(value->attrs)) {
for (nix::Attr attr : *(value->attrs)) {
try {
if (attr.name == sUrl || attr.name == sUri) {
expectType(state, tString, *attr.value, *attr.pos);
@@ -188,7 +188,7 @@ static std::map<FlakeId, FlakeInput> parseFlakeInputs(
expectType(state, tAttrs, *value, pos);
for (Attr & inputAttr : *(*value).attrs) {
for (nix::Attr & inputAttr : *(*value).attrs) {
inputs.emplace(inputAttr.name,
parseFlakeInput(state,
inputAttr.name,
+2 -2
View File
@@ -19,7 +19,7 @@ std::string FlakeRef::to_string() const
return input->to_string();
}
fetchers::Input::Attrs FlakeRef::toAttrs() const
fetchers::Attrs FlakeRef::toAttrs() const
{
auto attrs = input->toAttrs();
if (subdir != "")
@@ -168,7 +168,7 @@ std::optional<std::pair<FlakeRef, std::string>> maybeParseFlakeRefWithFragment(
}
}
FlakeRef FlakeRef::fromAttrs(const fetchers::Input::Attrs & attrs)
FlakeRef FlakeRef::fromAttrs(const fetchers::Attrs & attrs)
{
auto attrs2(attrs);
attrs2.erase("dir");
+2 -2
View File
@@ -29,11 +29,11 @@ struct FlakeRef
// FIXME: change to operator <<.
std::string to_string() const;
fetchers::Input::Attrs toAttrs() const;
fetchers::Attrs toAttrs() const;
FlakeRef resolve(ref<Store> store) const;
static FlakeRef fromAttrs(const fetchers::Input::Attrs & attrs);
static FlakeRef fromAttrs(const fetchers::Attrs & attrs);
std::pair<fetchers::Tree, FlakeRef> fetchTree(ref<Store> store) const;
};