about summary refs log tree commit diff
path: root/src/nix-worker/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix-worker/main.cc')
-rw-r--r--src/nix-worker/main.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/nix-worker/main.cc b/src/nix-worker/main.cc
index e772421f39bc..4fa43f643cc9 100644
--- a/src/nix-worker/main.cc
+++ b/src/nix-worker/main.cc
@@ -281,6 +281,28 @@ static void performOp(Source & from, Sink & to, unsigned int op)
         break;
     }
 
+    case wopCollectGarbage: {
+        GCAction action = (GCAction) readInt(from);
+        PathSet pathsToDelete = readStorePaths(from);
+        bool ignoreLiveness = readInt(from);
+
+        PathSet result;
+        unsigned long long bytesFreed;
+        
+        startWork();
+        if (ignoreLiveness)
+            throw Error("you are not allowed to ignore liveness");
+        store->collectGarbage(action, pathsToDelete, ignoreLiveness,
+            result, bytesFreed);
+        stopWork();
+        
+        writeStringSet(result, to);
+        writeInt(bytesFreed & 0xffffffff, to);
+        writeInt(bytesFreed >> 32, to);
+        
+        break;
+    }
+            
     default:
         throw Error(format("invalid operation %1%") % op);
     }