about summary refs log tree commit diff
path: root/third_party
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-07-16T22·40+0100
committertazjin <mail@tazj.in>2020-07-16T22·48+0000
commit32735eebdd18f92e526d06a2f4b4a04e27998d03 (patch)
treef3dbd2b29a869af29edfda6c831b3fea84a4fbab /third_party
parentbb66262068d0fbc495adfd7ab49ba10ab7a2c608 (diff)
feat(3p/nix/nix-daemon): Implement Worker::HasSubstitutes handler r/1339
Change-Id: I0b01b554eee4b4e31416aabb498ea3d8b8a8092b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1226
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
Diffstat (limited to 'third_party')
-rw-r--r--third_party/nix/src/nix-daemon/nix-daemon-proto.cc10
1 files changed, 10 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 35171c769a..d847ebff75 100644
--- a/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
+++ b/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
@@ -21,6 +21,16 @@ class WorkerServiceImpl final : public Worker::Service {
     return Status::OK;
   }
 
+  Status HasSubstitutes(grpc::ServerContext* context, const StorePath* request,
+                        nix::proto::HasSubstitutesResponse* response) {
+    const auto& path = request->path();
+    store_->assertStorePath(path);
+    PathSet res = store_->querySubstitutablePaths({path});
+    response->set_has_substitutes(res.find(path) != res.end());
+
+    return Status::OK;
+  }
+
  private:
   // TODO(tazjin): Who owns the store?
   nix::Store* store_;