feat(3p/nix/nix-daemon): Implement Worker::IsValidPath handler
Change-Id: I741c2b9b58f234a21850640e2b0c071ff4441234 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1223 Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: glittershark <grfn@gws.fyi>
This commit is contained in:
parent
f1aa62c9ee
commit
bb66262068
2 changed files with 30 additions and 0 deletions
29
third_party/nix/src/nix-daemon/nix-daemon-proto.cc
vendored
Normal file
29
third_party/nix/src/nix-daemon/nix-daemon-proto.cc
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include "libproto/worker.grpc.pb.h"
|
||||
#include "libproto/worker.pb.h"
|
||||
#include "libstore/store-api.hh"
|
||||
|
||||
namespace nix::daemon {
|
||||
|
||||
using ::grpc::Status;
|
||||
using ::nix::proto::StorePath;
|
||||
using ::nix::proto::Worker;
|
||||
|
||||
class WorkerServiceImpl final : public Worker::Service {
|
||||
public:
|
||||
WorkerServiceImpl(nix::Store* store) : store_(store) {}
|
||||
|
||||
Status IsValidPath(grpc::ServerContext* context, const StorePath* request,
|
||||
nix::proto::IsValidPathResponse* response) {
|
||||
const auto& path = request->path();
|
||||
store_->assertStorePath(path);
|
||||
response->set_is_valid(store_->isValidPath(path));
|
||||
|
||||
return Status::OK;
|
||||
}
|
||||
|
||||
private:
|
||||
// TODO(tazjin): Who owns the store?
|
||||
nix::Store* store_;
|
||||
};
|
||||
|
||||
} // namespace nix::daemon
|
||||
Loading…
Add table
Add a link
Reference in a new issue