about summary refs log tree commit diff
path: root/src/libstore/gc.hh
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-01-27T15·21+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-01-27T15·21+0000
commitc505702265833a762d681952bcc72562d64a242e (patch)
treeda6f095532755b766d7752d6925ea865ba0cefe2 /src/libstore/gc.hh
parent59682e618805701f9c249736514df6db457895f9 (diff)
* Fix and simplify the garbage collector (it's still not concurrent,
  though).  In particular it's now much easier to register a GC root.
  Just place a symlink to whatever store path it is that you want to
  keep in /nix/var/nix/gcroots.

Diffstat (limited to 'src/libstore/gc.hh')
-rw-r--r--src/libstore/gc.hh27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/libstore/gc.hh b/src/libstore/gc.hh
index d1ca5c63e4d0..2ea851abc041 100644
--- a/src/libstore/gc.hh
+++ b/src/libstore/gc.hh
@@ -3,24 +3,15 @@
 
 #include "util.hh"
 
+/* Garbage collector operation. */
+typedef enum { gcReturnLive, gcReturnDead, gcDeleteDead } GCAction;
 
-/* Determine the set of "live" store paths, given a set of root store
-   expressions.  The live store paths are those that are reachable
-   from the roots.  The roots are reachable by definition.  Any path
-   mentioned in a reachable store expression is also reachable.  If a
-   derivation store expression is reachable, then its successor (if it
-   exists) if also reachable.  It is not an error for store
-   expressions not to exist (since this can happen on derivation store
-   expressions, for instance, due to the substitute mechanism), but
-   successor links are followed even for non-existant derivations. */
-PathSet findLivePaths(const Paths & roots);
-
-/* Given a set of "live" store paths, determine the set of "dead"
-   store paths (which are simply all store paths that are not in the
-   live set).  The value `minAge' specifies the minimum age in seconds
-   for an unreachable file to be considered dead (0 meaning that any
-   unreachable file is dead). */
-PathSet findDeadPaths(const PathSet & live, time_t minAge);
-
+/* If `action' is set to `soReturnLive', return the set of paths
+   reachable from (i.e. in the closure of) the specified roots.  If
+   `action' is `soReturnDead', return the set of paths not reachable
+   from the roots.  If `action' is `soDeleteDead', actually delete the
+   latter set. */
+void collectGarbage(const PathSet & roots, GCAction action,
+    PathSet & result);
 
 #endif /* !__GC_H */