aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/gc-store.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/gc-store.hh')
-rw-r--r--src/libstore/gc-store.hh35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/libstore/gc-store.hh b/src/libstore/gc-store.hh
index 2c26c65c4..ab1059fb1 100644
--- a/src/libstore/gc-store.hh
+++ b/src/libstore/gc-store.hh
@@ -71,20 +71,37 @@ struct GCResults
};
+/**
+ * Mix-in class for \ref Store "stores" which expose a notion of garbage
+ * collection.
+ *
+ * Garbage collection will allow deleting paths which are not
+ * transitively "rooted".
+ *
+ * The notion of GC roots actually not part of this class.
+ *
+ * - The base `Store` class has `Store::addTempRoot()` because for a store
+ * that doesn't support garbage collection at all, a temporary GC root is
+ * safely implementable as no-op.
+ *
+ * @todo actually this is not so good because stores are *views*.
+ * Some views have only a no-op temp roots even though others to the
+ * same store allow triggering GC. For instance one can't add a root
+ * over ssh, but that doesn't prevent someone from gc-ing that store
+ * accesed via SSH locally).
+ *
+ * - The derived `LocalFSStore` class has `LocalFSStore::addPermRoot`,
+ * which is not part of this class because it relies on the notion of
+ * an ambient file system. There are stores (`ssh-ng://`, for one),
+ * that *do* support garbage collection but *don't* expose any file
+ * system, and `LocalFSStore::addPermRoot` thus does not make sense
+ * for them.
+ */
struct GcStore : public virtual Store
{
inline static std::string operationName = "Garbage collection";
/**
- * Add an indirect root, which is merely a symlink to `path` from
- * `/nix/var/nix/gcroots/auto/<hash of path>`. `path` is supposed
- * to be a symlink to a store path. The garbage collector will
- * automatically remove the indirect root when it finds that
- * `path` has disappeared.
- */
- virtual void addIndirectRoot(const Path & path) = 0;
-
- /**
* Find the roots of the garbage collector. Each root is a pair
* `(link, storepath)` where `link` is the path of the symlink
* outside of the Nix store that point to `storePath`. If