about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-07-17T01·04-0400
committerglittershark <grfn@gws.fyi>2020-07-17T20·37+0000
commit1b07e588c8dd8826ef2f3c6b40d31e3cf6ae405e (patch)
tree5fafe7d6ee433d3da77e8720376b06c212d99fb1
parentd36ee69061882f1054f9d2983da630e92a38d643 (diff)
feat(3p/nix/nix-daemon): Implement Worker::QuerySubstitutablePaths handler r/1359
Change-Id: I243d67b0bce29d54c7d6e08f5eee70bd395cf9a2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1234
Tested-by: BuildkiteCI
Reviewed-by: Kane York <rikingcoding@gmail.com>
-rw-r--r--third_party/nix/src/nix-daemon/nix-daemon-proto.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/third_party/nix/src/nix-daemon/nix-daemon-proto.cc b/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
index 857d49b4b157..7344811eeac4 100644
--- a/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
+++ b/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
@@ -167,6 +167,23 @@ class WorkerServiceImpl final : public WorkerService::Service {
     return Status::OK;
   }
 
+  Status QuerySubstitutablePaths(grpc::ServerContext* context,
+                                 const StorePaths* request,
+                                 StorePaths* response) override {
+    std::set<Path> paths;
+    for (const auto& path : request->paths()) {
+      paths.insert(path);
+    }
+
+    auto res = store_->querySubstitutablePaths(paths);
+
+    for (const auto& path : res) {
+      response->add_paths(path);
+    }
+
+    return Status::OK;
+  }
+
   Status QueryMissing(grpc::ServerContext* context, const StorePaths* request,
                       nix::proto::QueryMissingResponse* response) override {
     std::set<Path> targets;