diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2016-10-07T17·20+0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2016-10-07T17·20+0200 |
commit | c663b84573edee2c5ece78f4ee269be73ac3ca35 (patch) | |
tree | 652d8fd54ab1dac920da95390a0727f147c53c7c | |
parent | 35db4f65a0f2ccbcaaef719e52b895fa78cad361 (diff) |
Implement generic Store::queryValidPaths()
Diffstat (limited to '')
-rw-r--r-- | src/libstore/binary-cache-store.hh | 3 | ||||
-rw-r--r-- | src/libstore/store-api.cc | 11 | ||||
-rw-r--r-- | src/libstore/store-api.hh | 2 |
3 files changed, 12 insertions, 4 deletions
diff --git a/src/libstore/binary-cache-store.hh b/src/libstore/binary-cache-store.hh index e369abe46d6f..574696cf3a1f 100644 --- a/src/libstore/binary-cache-store.hh +++ b/src/libstore/binary-cache-store.hh @@ -54,9 +54,6 @@ public: bool isValidPathUncached(const Path & path) override; - PathSet queryValidPaths(const PathSet & paths) override - { notImpl(); } - PathSet queryAllValidPaths() override { notImpl(); } diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 74014b47e513..a830ae5bbd0c 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -361,6 +361,17 @@ void Store::queryPathInfo(const Path & storePath, } +PathSet Store::queryValidPaths(const PathSet & paths) +{ + PathSet valid; + + for (auto & path : paths) + if (isValidPath(path)) valid.insert(path); + + return valid; +} + + /* Return a string accepted by decodeValidPathInfo() that registers the specified paths as valid. Note: it's the responsibility of the caller to provide a closure. */ diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index b876ffbba765..ce1583b0c6fa 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -306,7 +306,7 @@ protected: public: /* Query which of the given paths is valid. */ - virtual PathSet queryValidPaths(const PathSet & paths) = 0; + virtual PathSet queryValidPaths(const PathSet & paths); /* Query the set of all valid paths. Note that for some store backends, the name part of store paths may be omitted |