Author: eelco
Date: Wed Nov 17 12:08:01 2010
New Revision: 24727
URL: https://svn.nixos.org/websvn/nix/?rev=24727&sc=1

Log:
* Implement RemoteStore::queryPathInfo().

Modified:
   nix/branches/sqlite/src/libstore/remote-store.cc
   nix/branches/sqlite/src/libstore/worker-protocol.hh
   nix/branches/sqlite/src/nix-worker/nix-worker.cc

Modified: nix/branches/sqlite/src/libstore/remote-store.cc
==============================================================================
--- nix/branches/sqlite/src/libstore/remote-store.cc    Wed Nov 17 10:43:04 
2010        (r24726)
+++ nix/branches/sqlite/src/libstore/remote-store.cc    Wed Nov 17 12:08:01 
2010        (r24727)
@@ -249,7 +249,19 @@
 
 ValidPathInfo RemoteStore::queryPathInfo(const Path & path)
 {
-    throw Error("not implemented");
+    openConnection();
+    writeInt(wopQueryPathInfo, to);
+    writeString(path, to);
+    processStderr();
+    ValidPathInfo info;
+    info.path = path;
+    info.deriver = readString(from);
+    if (info.deriver != "") assertStorePath(info.deriver);
+    info.hash = parseHash(htSHA256, readString(from));
+    info.references = readStorePaths(from);
+    info.registrationTime = readInt(from);
+    info.narSize = readLongLong(from);
+    return info;
 }
 
 

Modified: nix/branches/sqlite/src/libstore/worker-protocol.hh
==============================================================================
--- nix/branches/sqlite/src/libstore/worker-protocol.hh Wed Nov 17 10:43:04 
2010        (r24726)
+++ nix/branches/sqlite/src/libstore/worker-protocol.hh Wed Nov 17 12:08:01 
2010        (r24727)
@@ -38,6 +38,7 @@
     wopQueryValidPaths = 23,
     wopQueryFailedPaths = 24,
     wopClearFailedPaths = 25,
+    wopQueryPathInfo = 26,
 } WorkerOp;
 
 

Modified: nix/branches/sqlite/src/nix-worker/nix-worker.cc
==============================================================================
--- nix/branches/sqlite/src/nix-worker/nix-worker.cc    Wed Nov 17 10:43:04 
2010        (r24726)
+++ nix/branches/sqlite/src/nix-worker/nix-worker.cc    Wed Nov 17 12:08:01 
2010        (r24727)
@@ -550,6 +550,19 @@
         break;
     }
 
+    case wopQueryPathInfo: {
+        Path path = readStorePath(from);
+        startWork();
+        ValidPathInfo info = store->queryPathInfo(path);
+        stopWork();
+        writeString(info.deriver, to);
+        writeString(printHash(info.hash), to);
+        writeStringSet(info.references, to);
+        writeInt(info.registrationTime, to);
+        writeLongLong(info.narSize, to);
+        break;
+    }
+
     default:
         throw Error(format("invalid operation %1%") % op);
     }
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to