From 32735eebdd18f92e526d06a2f4b4a04e27998d03 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 16 Jul 2020 23:40:53 +0100 Subject: feat(3p/nix/nix-daemon): Implement Worker::HasSubstitutes handler Change-Id: I0b01b554eee4b4e31416aabb498ea3d8b8a8092b Reviewed-on: https://cl.tvl.fyi/c/depot/+/1226 Tested-by: BuildkiteCI Reviewed-by: glittershark --- third_party/nix/src/nix-daemon/nix-daemon-proto.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'third_party/nix/src') 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 35171c769ab8..d847ebff758b 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_; -- cgit 1.4.1