about summary refs log tree commit diff
path: root/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-07-17T01·00-0400
committerglittershark <grfn@gws.fyi>2020-07-17T20·37+0000
commitd36ee69061882f1054f9d2983da630e92a38d643 (patch)
tree5bbabbbc484f88a9fe8cb5a629497bc31ba354eb /third_party/nix/src/nix-daemon/nix-daemon-proto.cc
parent1933e4f97f1067bb50fcba2897bc0c6ec81f2632 (diff)
feat(3p/nix/nix-daemon): Implement Worker::QueryValidPaths handler r/1358
Change-Id: I221dcd2a3fa53ead3ea9ac47830d968bb587c6e5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1233
Tested-by: BuildkiteCI
Reviewed-by: isomer <isomer@tvl.fyi>
Diffstat (limited to 'third_party/nix/src/nix-daemon/nix-daemon-proto.cc')
-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 3c34e8bfa6c2..857d49b4b157 100644
--- a/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
+++ b/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
@@ -150,6 +150,23 @@ class WorkerServiceImpl final : public WorkerService::Service {
     return Status::OK;
   }
 
+  Status QueryValidPaths(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_->queryValidPaths(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;