diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-06-18 09:34:17 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-06-18 09:34:17 +0000 |
commit | a72709afd8ffe35613a6bacd698a36395e095a48 (patch) | |
tree | 2f549bafbed92a53bd6faea1da43667307af7593 /src/nix-worker | |
parent | 934c58aa381f5eacc86304ba7f5c6775ff456cd5 (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/nix-worker')
-rw-r--r-- | src/nix-worker/nix-worker.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/nix-worker/nix-worker.cc b/src/nix-worker/nix-worker.cc index 0d0964f3a..d8d86434e 100644 --- a/src/nix-worker/nix-worker.cc +++ b/src/nix-worker/nix-worker.cc @@ -395,23 +395,24 @@ static void performOp(unsigned int clientVersion, } case wopCollectGarbage: { - GCAction action = (GCAction) readInt(from); - PathSet pathsToDelete = readStorePaths(from); - bool ignoreLiveness = readInt(from); - - PathSet result; - unsigned long long bytesFreed; + GCOptions options; + options.action = (GCOptions::GCAction) readInt(from); + options.pathsToDelete = readStorePaths(from); + options.ignoreLiveness = readInt(from); + options.maxFreed = readLongLong(from); + options.maxLinks = readInt(from); + + GCResults results; startWork(); - if (ignoreLiveness) + if (options.ignoreLiveness) throw Error("you are not allowed to ignore liveness"); - store->collectGarbage(action, pathsToDelete, ignoreLiveness, - result, bytesFreed); + store->collectGarbage(options, results); stopWork(); - writeStringSet(result, to); - writeInt(bytesFreed & 0xffffffff, to); - writeInt(bytesFreed >> 32, to); + writeStringSet(results.paths, to); + writeLongLong(results.bytesFreed, to); + writeLongLong(results.blocksFreed, to); break; } |