From a72709afd8ffe35613a6bacd698a36395e095a48 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 18 Jun 2008 09:34:17 +0000 Subject: * Some refactoring: put the GC options / results in separate structs. * The garbage collector now also prints the number of blocks freed. --- src/libstore/remote-store.cc | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'src/libstore/remote-store.cc') diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index 14412b8c8b..274196a2b6 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); } -- cgit 1.4.1