1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-14 22:42:41 +01:00

Do big rename to clean up code

- `PathReferences` -> `References`

- `PathReferences<StorePath>` -> `StoreReference`

- `references` -> `others`

- `hasSelfReference` -> `self`

And get rid of silly subclassing
This commit is contained in:
John Ericson 2023-01-06 15:36:05 -05:00
parent 9cfa78e58a
commit 46e942ff9e
16 changed files with 146 additions and 112 deletions

View file

@ -1157,11 +1157,10 @@ void LocalStore::querySubstitutablePathInfos(const StorePathCAMap & paths, Subst
auto narInfo = std::dynamic_pointer_cast<const NarInfo>(
std::shared_ptr<const ValidPathInfo>(info));
infos.insert_or_assign(path.first, SubstitutablePathInfo{
info->references,
info->hasSelfReference,
info->deriver,
narInfo ? narInfo->fileSize : 0,
info->narSize,
.deriver = info->deriver,
.references = info->references,
.downloadSize = narInfo ? narInfo->fileSize : 0,
.narSize = info->narSize,
});
} catch (InvalidPath &) {
} catch (SubstituterDisabled &) {
@ -1228,7 +1227,7 @@ void LocalStore::registerValidPaths(const ValidPathInfos & infos)
topoSort(paths,
{[&](const StorePath & path) {
auto i = infos.find(path);
return i == infos.end() ? StorePathSet() : i->second.references;
return i == infos.end() ? StorePathSet() : i->second.references.others;
}},
{[&](const StorePath & path, const StorePath & parent) {
return BuildError(
@ -1427,8 +1426,8 @@ StorePath LocalStore::addToStoreFromDump(Source & source0, std::string_view name
.hash = hash,
},
.references = {
.references = references,
.hasSelfReference = false,
.others = references,
.self = false,
},
},
};
@ -1526,7 +1525,8 @@ StorePath LocalStore::addTextToStore(
ValidPathInfo info { dstPath, narHash };
info.narSize = sink.s.size();
info.references = references;
// No self reference allowed with text-hashing
info.references.others = references;
info.ca = TextHash { .hash = hash };
registerValidPath(info);
}