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);
|
|
|
|
|
|
|
|
|
2004-08-25 11:43:49 +00:00
|
|
|
#endif /* !__GC_H */
|