aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/profiles.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-07-16 15:14:22 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-07-16 15:18:21 +0200
commit5517eee17e37565a1d5b7fb19f9e810068c9428d (patch)
tree04abf32edddb025da0d433ec914830aba34f964a /src/libstore/profiles.hh
parent8807ff902e1b543410a9572cc146efa6c90dec87 (diff)
Generations API cleanup
Diffstat (limited to 'src/libstore/profiles.hh')
-rw-r--r--src/libstore/profiles.hh25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/libstore/profiles.hh b/src/libstore/profiles.hh
index 78645d8b6..abe507f0e 100644
--- a/src/libstore/profiles.hh
+++ b/src/libstore/profiles.hh
@@ -9,37 +9,32 @@
namespace nix {
+typedef unsigned int GenerationNumber;
+
struct Generation
{
- int number;
+ GenerationNumber number;
Path path;
time_t creationTime;
- Generation()
- {
- number = -1;
- }
- operator bool() const
- {
- return number != -1;
- }
};
-typedef list<Generation> Generations;
+typedef std::list<Generation> Generations;
/* Returns the list of currently present generations for the specified
- profile, sorted by generation number. */
-Generations findGenerations(Path profile, int & curGen);
+ profile, sorted by generation number. Also returns the number of
+ the current generation. */
+std::pair<Generations, std::optional<GenerationNumber>> findGenerations(Path profile);
class LocalFSStore;
Path createGeneration(ref<LocalFSStore> store, Path profile, Path outPath);
-void deleteGeneration(const Path & profile, unsigned int gen);
+void deleteGeneration(const Path & profile, GenerationNumber gen);
-void deleteGenerations(const Path & profile, const std::set<unsigned int> & gensToDelete, bool dryRun);
+void deleteGenerations(const Path & profile, const std::set<GenerationNumber> & gensToDelete, bool dryRun);
-void deleteGenerationsGreaterThan(const Path & profile, const int max, bool dryRun);
+void deleteGenerationsGreaterThan(const Path & profile, GenerationNumber max, bool dryRun);
void deleteOldGenerations(const Path & profile, bool dryRun);