diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-11-16T17·11+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-11-16T17·11+0000 |
commit | a3883cbd28057a3dd2573f77dcda9a26faaac555 (patch) | |
tree | 3ad605543e6bba8869f9413fb4f77f73e936cd1a /src/libutil/hash.hh | |
parent | fb9368b5a0b2457b28f19d4902bc0790123338a2 (diff) |
* Store the size of a store path in the database (to be precise, the
size of the NAR serialisation of the path, i.e., `nix-store --dump PATH'). This is useful for Hydra.
Diffstat (limited to 'src/libutil/hash.hh')
-rw-r--r-- | src/libutil/hash.hh | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libutil/hash.hh b/src/libutil/hash.hh index 81425b23494c..13740954d625 100644 --- a/src/libutil/hash.hh +++ b/src/libutil/hash.hh @@ -40,7 +40,6 @@ struct Hash /* For sorting. */ bool operator < (const Hash & h) const; - }; @@ -72,7 +71,8 @@ Hash hashFile(HashType ht, const Path & path); (essentially) hashString(ht, dumpPath(path)). */ struct PathFilter; extern PathFilter defaultPathFilter; -Hash hashPath(HashType ht, const Path & path, +typedef std::pair<Hash, unsigned long long> HashResult; +HashResult hashPath(HashType ht, const Path & path, PathFilter & filter = defaultPathFilter); /* Compress a hash to the specified number of bytes by cyclically @@ -93,13 +93,14 @@ class HashSink : public Sink private: HashType ht; Ctx * ctx; + unsigned long long bytes; public: HashSink(HashType ht); HashSink(const HashSink & h); ~HashSink(); virtual void operator () (const unsigned char * data, unsigned int len); - Hash finish(); + HashResult finish(); }; |