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:
parent
a84f503d86
commit
e974f20c98
2 changed files with 41 additions and 10 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue