about summary refs log tree commit diff
path: root/src/libstore/remote-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2008-06-18T09·34+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2008-06-18T09·34+0000
commita72709afd8ffe35613a6bacd698a36395e095a48 (patch)
tree2f549bafbed92a53bd6faea1da43667307af7593 /src/libstore/remote-store.cc
parent934c58aa381f5eacc86304ba7f5c6775ff456cd5 (diff)
* Some refactoring: put the GC options / results in separate structs.
* The garbage collector now also prints the number of blocks freed.

Diffstat (limited to 'src/libstore/remote-store.cc')
-rw-r--r--src/libstore/remote-store.cc22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index 14412b8c8b60..274196a2b6a9 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -372,24 +372,20 @@ Roots RemoteStore::findRoots()
 }
 
 
-void RemoteStore::collectGarbage(GCAction action, const PathSet & pathsToDelete,
-    bool ignoreLiveness, PathSet & result, unsigned long long & bytesFreed)
+void RemoteStore::collectGarbage(const GCOptions & options, GCResults & results)
 {
-    result.clear();
-    bytesFreed = 0;
     writeInt(wopCollectGarbage, to);
-    writeInt(action, to);
-    writeStringSet(pathsToDelete, to);
-    writeInt(ignoreLiveness, to);
+    writeInt(options.action, to);
+    writeStringSet(options.pathsToDelete, to);
+    writeInt(options.ignoreLiveness, to);
+    writeLongLong(options.maxFreed, to);
+    writeInt(options.maxLinks, to);
     
     processStderr();
     
-    result = readStringSet(from);
-
-    /* Ugh - NAR integers are 64 bits, but read/writeInt() aren't. */
-    unsigned int lo = readInt(from);
-    unsigned int hi = readInt(from);
-    bytesFreed = (((unsigned long long) hi) << 32) | lo;
+    results.paths = readStringSet(from);
+    results.bytesFreed = readLongLong(from);
+    results.blocksFreed = readLongLong(from);
 }