diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-11-16 17:11:46 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-11-16 17:11:46 +0000 |
commit | a3883cbd28057a3dd2573f77dcda9a26faaac555 (patch) | |
tree | 3ad605543e6bba8869f9413fb4f77f73e936cd1a /src/libstore/store-api.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/libstore/store-api.hh')
-rw-r--r-- | src/libstore/store-api.hh | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index 082a9edc4..b0071da83 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -90,6 +90,21 @@ struct SubstitutablePathInfo }; +struct ValidPathInfo +{ + Path path; + Path deriver; + Hash hash; + PathSet references; + time_t registrationTime; + unsigned long long narSize; // 0 = unknown + unsigned long long id; // internal use only + ValidPathInfo() : registrationTime(0), narSize(0) { } +}; + +typedef list<ValidPathInfo> ValidPathInfos; + + class StoreAPI { public: @@ -102,6 +117,9 @@ public: /* Query the set of valid paths. */ virtual PathSet queryValidPaths() = 0; + /* Query information about a valid path. */ + virtual ValidPathInfo queryPathInfo(const Path & path) = 0; + /* Queries the hash of a valid path. */ virtual Hash queryPathHash(const Path & path) = 0; @@ -214,6 +232,12 @@ public: /* Clear the "failed" status of the given paths. The special value `*' causes all failed paths to be cleared. */ virtual void clearFailedPaths(const PathSet & paths) = 0; + + /* Return a string representing information about the path that + can be loaded into the database using `nix-store --load-db' or + `nix-store --register-validity'. */ + string makeValidityRegistration(const PathSet & paths, + bool showDerivers, bool showHash); }; @@ -307,22 +331,6 @@ boost::shared_ptr<StoreAPI> openStore(); string showPaths(const PathSet & paths); -string makeValidityRegistration(const PathSet & paths, - bool showDerivers, bool showHash); - -struct ValidPathInfo -{ - Path path; - Path deriver; - Hash hash; - PathSet references; - time_t registrationTime; - unsigned long long id; // internal use only - ValidPathInfo() : registrationTime(0) { } -}; - -typedef list<ValidPathInfo> ValidPathInfos; - ValidPathInfo decodeValidPathInfo(std::istream & str, bool hashGiven = false); |