diff options
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/store.cc | 8 | ||||
-rw-r--r-- | src/libstore/store.hh | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/libstore/store.cc b/src/libstore/store.cc index 946be5e02..9f50e597e 100644 --- a/src/libstore/store.cc +++ b/src/libstore/store.cc @@ -509,6 +509,14 @@ static Hash queryHash(const Transaction & txn, const Path & storePath) } +Hash queryPathHash(const Path & path) +{ + if (!isValidPath(path)) + throw Error(format("path `%1%' is not valid") % path); + return queryHash(noTxn, path); +} + + void registerValidPath(const Transaction & txn, const Path & _path, const Hash & hash, const PathSet & references, const Path & deriver) diff --git a/src/libstore/store.hh b/src/libstore/store.hh index 3b18664de..d5d8ea81e 100644 --- a/src/libstore/store.hh +++ b/src/libstore/store.hh @@ -89,6 +89,9 @@ void canonicalisePathMetaData(const Path & path); /* Checks whether a path is valid. */ bool isValidPath(const Path & path); +/* Queries the hash of a valid path. */ +Hash queryPathHash(const Path & path); + /* Sets the set of outgoing FS references for a store path. Use with care! */ void setReferences(const Transaction & txn, const Path & storePath, |