Implement more queries

This commit is contained in:
John Ericson 2023-05-09 17:20:58 -04:00
parent 8339c170d7
commit 4173743a3c
3 changed files with 35 additions and 0 deletions

View file

@ -103,6 +103,22 @@ bool LocalOverlayStore::isValidPathUncached(const StorePath & path)
}
void LocalOverlayStore::queryReferrers(const StorePath & path, StorePathSet & referrers)
{
LocalStore::queryReferrers(path, referrers);
lowerStore->queryReferrers(path, referrers);
}
StorePathSet LocalOverlayStore::queryValidDerivers(const StorePath & path)
{
auto res = LocalStore::queryValidDerivers(path);
for (auto p : lowerStore->queryValidDerivers(path))
res.insert(p);
return res;
}
std::optional<StorePath> LocalOverlayStore::queryPathFromHashPart(const std::string & hashPart)
{
auto res = LocalStore::queryPathFromHashPart(hashPart);

View file

@ -89,6 +89,10 @@ private:
bool isValidPathUncached(const StorePath & path) override;
void queryReferrers(const StorePath & path, StorePathSet & referrers) override;
StorePathSet queryValidDerivers(const StorePath & path) override;
std::optional<StorePath> queryPathFromHashPart(const std::string & hashPart) override;
void registerValidPaths(const ValidPathInfos & infos) override;

View file

@ -55,6 +55,21 @@ expect 1 stat $(toRealPath "$storeBTop" "$path")
# Checking for path in overlay store matching lower layer
diff $(toRealPath "$storeA/nix/store" "$path") $(toRealPath "$TEST_ROOT/merged-store/nix/store" "$path")
# Checking requisites query agreement
[[ \
$(nix-store --store $storeA --query --requisites $drvPath) \
== \
$(nix-store --store $storeB --query --requisites $drvPath) \
]]
# Checking referrers query agreement
busyboxStore=$(nix store --store $storeA add-path $busybox)
[[ \
$(nix-store --store $storeA --query --referrers $busyboxStore) \
== \
$(nix-store --store $storeB --query --referrers $busyboxStore) \
]]
# Checking derivers query agreement
[[ \
$(nix-store --store $storeA --query --deriver $path) \