summary refs log tree commit diff
path: root/src/libstore/store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-01-19 16:59:56 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-01-19 16:59:56 +0000
commite0f4e587c3a5110f57fbf4e85e14fdc606b1eaf6 (patch)
treec10ad0a943e6dac38b553b49633288dfee9ce84e /src/libstore/store.cc
parent96de272b48f8e9bdabffddb699ed4f2292d4f1d7 (diff)
downloadguix-e0f4e587c3a5110f57fbf4e85e14fdc606b1eaf6.tar.gz
* Nix-store queries `--references' and `referers' to query the pointer
  graph.  That is, `nix-store --query --references PATH' shows the set
  of paths referenced by PATH, and `nix-store --query --referers PATH'
  shows the set of paths referencing PATH.

Diffstat (limited to 'src/libstore/store.cc')
-rw-r--r--src/libstore/store.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstore/store.cc b/src/libstore/store.cc
index 49a9d27342..631984784f 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)
 {