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 <grfn@gws.fyi>
This commit is contained in:
parent
bb66262068
commit
32735eebdd
1 changed files with 10 additions and 0 deletions
|
@ -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_;
|
||||
|
|
Loading…
Reference in a new issue