Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
gc-store.hh
Go to the documentation of this file.
1#pragma once
3
6
7
8namespace nix {
9
10
14typedef std::unordered_map<StorePath, std::unordered_set<std::string>> Roots;
18typedef std::unordered_map<Path, std::unordered_set<std::string>> UncheckedRoots;
19
20
22{
42 typedef enum {
43 gcReturnLive,
44 gcReturnDead,
45 gcDeleteDead,
46 gcDeleteSpecific,
47 gcTryDeleteSpecific,
48 } GCAction;
49
50 GCAction action{gcDeleteDead};
51
58 bool ignoreLiveness{false};
59
63 StorePathSet pathsToDelete;
64
68 uint64_t maxFreed{std::numeric_limits<uint64_t>::max()};
69};
70
71
73{
78 PathSet paths;
79
84 PathSet kept;
85
90 uint64_t bytesFreed = 0;
91};
92
93
120struct GcStore : public virtual Store
121{
122 inline static std::string operationName = "Garbage collection";
123
131 virtual kj::Promise<Result<Roots>> findRoots(bool censor) = 0;
132
136 virtual kj::Promise<Result<void>>
137 collectGarbage(const GCOptions & options, GCResults & results) = 0;
138};
139
140}
std::unordered_map< StorePath, std::unordered_set< std::string > > Roots
Definition gc-store.hh:14
std::unordered_map< Path, std::unordered_set< std::string > > UncheckedRoots
Definition gc-store.hh:18
Definition gc-store.hh:22
uint64_t maxFreed
Definition gc-store.hh:68
GCAction
Definition gc-store.hh:42
bool ignoreLiveness
Definition gc-store.hh:58
StorePathSet pathsToDelete
Definition gc-store.hh:63
Definition gc-store.hh:73
PathSet paths
Definition gc-store.hh:78
PathSet kept
Definition gc-store.hh:84
uint64_t bytesFreed
Definition gc-store.hh:90
Definition gc-store.hh:121
virtual kj::Promise< Result< void > > collectGarbage(const GCOptions &options, GCResults &results)=0
virtual kj::Promise< Result< Roots > > findRoots(bool censor)=0