about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-11-17T12·08+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-11-17T12·08+0000
commit1db6259076b1b8f667451da8d2e44a55ece19056 (patch)
tree38a730f554924b1186514b5e8ed787cf967bd0c0 /src
parenta3883cbd28057a3dd2573f77dcda9a26faaac555 (diff)
* Implement RemoteStore::queryPathInfo().
Diffstat (limited to 'src')
-rw-r--r--src/libstore/remote-store.cc14
-rw-r--r--src/libstore/worker-protocol.hh1
-rw-r--r--src/nix-worker/nix-worker.cc13
3 files changed, 27 insertions, 1 deletions
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index 517c886b4f9b..08969a623d14 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -249,7 +249,19 @@ bool RemoteStore::querySubstitutablePathInfo(const Path & path,
 
 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;
 }
 
 
diff --git a/src/libstore/worker-protocol.hh b/src/libstore/worker-protocol.hh
index a4dc690b74d9..2764f82c2ce0 100644
--- a/src/libstore/worker-protocol.hh
+++ b/src/libstore/worker-protocol.hh
@@ -38,6 +38,7 @@ typedef enum {
     wopQueryValidPaths = 23,
     wopQueryFailedPaths = 24,
     wopClearFailedPaths = 25,
+    wopQueryPathInfo = 26,
 } WorkerOp;
 
 
diff --git a/src/nix-worker/nix-worker.cc b/src/nix-worker/nix-worker.cc
index 9be733d8c748..dbcd90be1b2e 100644
--- a/src/nix-worker/nix-worker.cc
+++ b/src/nix-worker/nix-worker.cc
@@ -550,6 +550,19 @@ static void performOp(unsigned int clientVersion,
         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);
     }