Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
gc-store.hh
Go to the documentation of this file.
1#pragma once
3
5#include <boost/unordered/unordered_flat_map.hpp>
6#include <boost/unordered/unordered_flat_set.hpp>
7
8namespace nix {
9
10typedef boost::unordered_flat_map<
12 boost::unordered_flat_set<std::string, StringViewHash, std::equal_to<>>,
13 std::hash<StorePath>>
14 Roots;
15
30enum class GCAction {
31 gcReturnLive,
32 gcReturnDead,
33 gcDeleteDead,
34 gcDeleteSpecific,
35};
36
38{
39 using GCAction = nix::GCAction;
40 using enum GCAction;
41
43 {};
44
46 {
47 StorePathSet paths;
48
52 bool deleteReferrers = false;
53 };
54
55 GCAction action{gcDeleteDead};
56
63 bool ignoreLiveness{false};
64
68 using GCPaths = std::variant<WholeStore, SpecificPaths>;
69 GCPaths pathsToDelete;
70
74 uint64_t maxFreed{std::numeric_limits<uint64_t>::max()};
75};
76
78{
84
88 uint64_t bytesFreed = 0;
89};
90
117struct GcStore : public virtual Store
118{
119private:
120 void anchor() override;
121
122public:
123 inline static std::string operationName = "Garbage collection";
124
132 virtual Roots findRoots(bool censor) = 0;
133
137 virtual void collectGarbage(const GCOptions & options, GCResults & results) = 0;
138
144 virtual void deleteBuildTraces(const std::set<DrvOutput> & keys) = 0;
145};
146
147} // namespace nix
Definition path.hh:33
GCAction
Definition gc-store.hh:30
Definition gc-store.hh:46
bool deleteReferrers
Definition gc-store.hh:52
Definition gc-store.hh:43
Definition gc-store.hh:38
std::variant< WholeStore, SpecificPaths > GCPaths
Definition gc-store.hh:68
uint64_t maxFreed
Definition gc-store.hh:74
bool ignoreLiveness
Definition gc-store.hh:63
Definition gc-store.hh:78
uint64_t bytesFreed
Definition gc-store.hh:88
StringSet paths
Definition gc-store.hh:83
Definition gc-store.hh:118
virtual void collectGarbage(const GCOptions &options, GCResults &results)=0
virtual Roots findRoots(bool censor)=0
virtual void deleteBuildTraces(const std::set< DrvOutput > &keys)=0
std::set< std::string, std::less<> > StringSet
Definition types.hh:45