about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-07-17T01·34-0400
committerglittershark <grfn@gws.fyi>2020-07-17T20·37+0000
commitb32274120c6e7abd2a30c1654dd7368939ac85dd (patch)
tree508e7667ee7ccbbd3cf5359eb3fd24010770953c
parentd18246f8b2633602b8a05320c2b3167fd0ad4a6d (diff)
feat(3p/nix/nix-daemon): Implement Worker::VerifyStore handler r/1361
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 <isomer@tvl.fyi>
Reviewed-by: Kane York <rikingcoding@gmail.com>
-rw-r--r--third_party/nix/src/nix-daemon/nix-daemon-proto.cc11
-rw-r--r--third_party/nix/src/proto/worker.proto5
2 files changed, 14 insertions, 2 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 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<RepairFlag>(request->repair()));
+
+    response->set_errors(errors);
+
+    return Status::OK;
+  }
+
   Status QueryMissing(grpc::ServerContext* context, const StorePaths* request,
                       nix::proto::QueryMissingResponse* response) override {
     std::set<Path> 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 {