about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/store.cc10
-rw-r--r--src/libstore/store.hh4
2 files changed, 14 insertions, 0 deletions
diff --git a/src/libstore/store.cc b/src/libstore/store.cc
index 49a9d273422d..631984784fdc 100644
--- a/src/libstore/store.cc
+++ b/src/libstore/store.cc
@@ -272,6 +272,16 @@ void queryReferences(const Path & storePath, PathSet & references)
 }
 
 
+void queryReferers(const Path & storePath, PathSet & referers)
+{
+    Paths referers2;
+    if (!isValidPath(storePath))
+        throw Error(format("path `%1%' is not valid") % storePath);
+    nixDB.queryStrings(noTxn, dbReferers, storePath, referers2);
+    referers.insert(referers2.begin(), referers2.end());
+}
+
+
 static Substitutes readSubstitutes(const Transaction & txn,
     const Path & srcPath)
 {
diff --git a/src/libstore/store.hh b/src/libstore/store.hh
index 239493a88b3f..8f5190f804c5 100644
--- a/src/libstore/store.hh
+++ b/src/libstore/store.hh
@@ -84,6 +84,10 @@ void setReferences(const Transaction & txn, const Path & storePath,
    result is not cleared. */
 void queryReferences(const Path & storePath, PathSet & references);
 
+/* Queries the set of incoming FS references for a store path.  The
+   result is not cleared. */
+void queryReferers(const Path & storePath, PathSet & referers);
+
 /* Constructs a unique store path name. */
 Path makeStorePath(const string & type,
     const Hash & hash, const string & suffix);