From b32274120c6e7abd2a30c1654dd7368939ac85dd Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Thu, 16 Jul 2020 21:34:10 -0400 Subject: feat(3p/nix/nix-daemon): Implement Worker::VerifyStore handler Also adds the missing check_contents field to the VerifyStoreRequest proto message, since it was missed in the original pass. This is done using a renumbering, which is fine in this case since the proto hasn't been deployed yet Change-Id: I92bf4e48a71a25ae02ae02b3deaf6e7c71fe5da7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1237 Tested-by: BuildkiteCI Reviewed-by: isomer Reviewed-by: Kane York --- third_party/nix/src/nix-daemon/nix-daemon-proto.cc | 11 +++++++++++ third_party/nix/src/proto/worker.proto | 5 +++-- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'third_party') 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 3740a26b8f85..1ba440522a75 100644 --- a/third_party/nix/src/nix-daemon/nix-daemon-proto.cc +++ b/third_party/nix/src/nix-daemon/nix-daemon-proto.cc @@ -193,6 +193,17 @@ class WorkerServiceImpl final : public WorkerService::Service { return Status::OK; } + Status VerifyStore(grpc::ServerContext* context, + const nix::proto::VerifyStoreRequest* request, + nix::proto::VerifyStoreResponse* response) override { + auto errors = store_->verifyStore( + request->check_contents(), static_cast(request->repair())); + + response->set_errors(errors); + + return Status::OK; + } + Status QueryMissing(grpc::ServerContext* context, const StorePaths* request, nix::proto::QueryMissingResponse* response) override { std::set targets; diff --git a/third_party/nix/src/proto/worker.proto b/third_party/nix/src/proto/worker.proto index 90af308f85dc..8e629da70967 100644 --- a/third_party/nix/src/proto/worker.proto +++ b/third_party/nix/src/proto/worker.proto @@ -277,9 +277,10 @@ message HashPart { } message VerifyStoreRequest { - bool repair = 1; + bool check_contents = 1; + bool repair = 2; // TODO(grfn): Remove double-negative - bool dont_check_sigs = 2; + bool dont_check_sigs = 3; } message VerifyStoreResponse { -- cgit 1.4.1