diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-08-16 17:00:24 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-08-16 20:56:03 +0200 |
commit | 23b8b7e096d3a2a784387a09f68115706b1e9552 (patch) | |
tree | 5e8756716b67d87b8f8d48dcf5f0f108affe2219 /src/libstore | |
parent | 40bffe0a43e5f2f320c6bae7e39ea9c26906451d (diff) |
nix optimise-store: Add
This replaces "nix-store --optimise". Main difference is that it has a
progress indicator.
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/optimise-store.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/libstore/optimise-store.cc b/src/libstore/optimise-store.cc index b736307b3..5093305a1 100644 --- a/src/libstore/optimise-store.cc +++ b/src/libstore/optimise-store.cc @@ -249,14 +249,24 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHa void LocalStore::optimiseStore(OptimiseStats & stats) { + Activity act(*logger, actOptimiseStore); + PathSet paths = queryAllValidPaths(); InodeHash inodeHash = loadInodeHash(); + act.progress(0, paths.size()); + + uint64_t done = 0; + for (auto & i : paths) { addTempRoot(i); if (!isValidPath(i)) continue; /* path was GC'ed, probably */ - //Activity act(*logger, lvlChatty, format("hashing files in '%1%'") % i); - optimisePath_(stats, realStoreDir + "/" + baseNameOf(i), inodeHash); + { + Activity act(*logger, actUnknown, fmt("optimising path '%s'", i)); + optimisePath_(stats, realStoreDir + "/" + baseNameOf(i), inodeHash); + } + done++; + act.progress(done, paths.size()); } } |