about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-08-16T15·00+0200
committerEelco Dolstra <edolstra@gmail.com>2017-08-16T18·56+0200
commit23b8b7e096d3a2a784387a09f68115706b1e9552 (patch)
tree5e8756716b67d87b8f8d48dcf5f0f108affe2219 /src/libstore
parent40bffe0a43e5f2f320c6bae7e39ea9c26906451d (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.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/libstore/optimise-store.cc b/src/libstore/optimise-store.cc
index b736307b31b4..5093305a13e3 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());
     }
 }