mirror of
https://github.com/NixOS/nix.git
synced 2025-11-14 06:22:42 +01:00
* Some refactoring: put the GC options / results in separate structs.
* The garbage collector now also prints the number of blocks freed.
This commit is contained in:
parent
934c58aa38
commit
a72709afd8
15 changed files with 252 additions and 166 deletions
|
|
@ -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);
|
||||
GCOptions options;
|
||||
options.action = (GCOptions::GCAction) readInt(from);
|
||||
options.pathsToDelete = readStorePaths(from);
|
||||
options.ignoreLiveness = readInt(from);
|
||||
options.maxFreed = readLongLong(from);
|
||||
options.maxLinks = readInt(from);
|
||||
|
||||
PathSet result;
|
||||
unsigned long long bytesFreed;
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue