1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-26 04:00:59 +01:00

Preload linked hashes to speed up lookups

By preloading all inodes in the /nix/store/.links directory, we can
quickly determine of a hardlinked file was already linked to the hashed
links.
This is tolerant of removing the .links directory, it will simply
recalculate all hashes in the store.
This commit is contained in:
Wout Mertens 2014-05-13 23:10:06 +02:00
parent a84f503d86
commit e974f20c98
2 changed files with 41 additions and 10 deletions

View file

@ -6,6 +6,11 @@
#include "util.hh"
#include "pathlocks.hh"
#if HAVE_TR1_UNORDERED_SET
#include <tr1/unordered_set>
#endif
class sqlite3;
class sqlite3_stmt;
@ -303,7 +308,14 @@ private:
void checkDerivationOutputs(const Path & drvPath, const Derivation & drv);
void optimisePath_(OptimiseStats & stats, const Path & path);
#if HAVE_TR1_UNORDERED_SET
typedef std::tr1::unordered_set<ino_t> Hashes;
#else
typedef std::set<ino_t> Hashes;
#endif
void loadHashes(Hashes & hashes);
void optimisePath_(OptimiseStats & stats, const Path & path, Hashes & hashes);
// Internal versions that are not wrapped in retry_sqlite.
bool isValidPath_(const Path & path);