2004-08-25 11:43:49 +00:00
|
|
|
#ifndef __GC_H
|
|
|
|
#define __GC_H
|
|
|
|
|
2005-01-19 16:39:47 +00:00
|
|
|
#include "util.hh"
|
2004-08-25 11:43:49 +00:00
|
|
|
|
2005-01-31 10:27:25 +00:00
|
|
|
|
2005-01-27 15:21:29 +00:00
|
|
|
/* Garbage collector operation. */
|
|
|
|
typedef enum { gcReturnLive, gcReturnDead, gcDeleteDead } GCAction;
|
2004-08-25 11:43:49 +00:00
|
|
|
|
2005-01-27 15:21:29 +00:00
|
|
|
/* 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);
|
2004-08-25 11:43:49 +00:00
|
|
|
|
2005-01-31 10:27:25 +00:00
|
|
|
/* Register a temporary GC root. This root will automatically
|
2005-01-31 12:19:53 +00:00
|
|
|
disappear when this process exits. WARNING: this function should
|
|
|
|
not be called inside a BDB transaction, otherwise we can
|
|
|
|
deadlock. */
|
2005-01-31 10:27:25 +00:00
|
|
|
void addTempRoot(const Path & path);
|
|
|
|
|
2005-01-31 21:20:59 +00:00
|
|
|
/* Remove the temporary roots file for this process. Any temporary
|
|
|
|
root becomes garbage after this point unless it has been registered
|
|
|
|
as a (permanent) root. */
|
|
|
|
void removeTempRoots();
|
|
|
|
|
2005-02-01 12:36:25 +00:00
|
|
|
/* Register a permanent GC root. */
|
2005-02-01 13:48:46 +00:00
|
|
|
Path addPermRoot(const Path & storePath, const Path & gcRoot,
|
|
|
|
bool indirect);
|
2005-02-01 12:36:25 +00:00
|
|
|
|
2005-01-31 10:27:25 +00:00
|
|
|
|
2004-08-25 11:43:49 +00:00
|
|
|
#endif /* !__GC_H */
|