about summary refs log tree commit diff
path: root/third_party/nix/src/nix-daemon
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-08-20T02·28+0100
committertazjin <mail@tazj.in>2020-08-20T11·48+0000
commit33e8b0f975cd8934405c568cfa1d7e2a1edfa425 (patch)
tree2d67c57661cd424bfe6c87d33c4d38212f9a4e3c /third_party/nix/src/nix-daemon
parentf7fa77f14dedad98ab9e8a014d3bcfd60565dfd0 (diff)
chore(tvix): Thread a std::ostream through Store::buildPaths r/1689
This part of the store API needs to carry a handle to the log sink
from now on, so that it can be passed in as appropriate from the gRPC
handlers.

In all places where there is no such handler available at the moment,
the discarding log sink has been inserted. This can be used as a
convenient grep target in the future.

Change-Id: I26628e30b4c6437dccdf8f722ca2e8ed827dfc19
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1797
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Reviewed-by: glittershark <grfn@gws.fyi>
Diffstat (limited to 'third_party/nix/src/nix-daemon')
-rw-r--r--third_party/nix/src/nix-daemon/nix-daemon-proto.cc7
1 files changed, 5 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 cbc5452a7177..6d18fc40964f 100644
--- a/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
+++ b/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
@@ -290,7 +290,7 @@ class WorkerServiceImpl final : public WorkerService::Service {
 
   Status BuildPaths(
       grpc::ServerContext*, const nix::proto::BuildPathsRequest* request,
-      grpc::ServerWriter<nix::proto::BuildEvent>* /* writer */) override {
+      grpc::ServerWriter<nix::proto::BuildEvent>* writer) override {
     return HandleExceptions(
         [&]() -> Status {
           PathSet drvs;
@@ -303,11 +303,14 @@ class WorkerServiceImpl final : public WorkerService::Service {
             return Status(grpc::StatusCode::INTERNAL, "Invalid build mode");
           }
 
+          BuildLogStreambuf log_buffer(writer);
+          std::ostream log_sink(&log_buffer);
+
           // TODO(grfn): If mode is repair and not trusted, we need to return an
           // error here (but we can't yet because we don't know anything about
           // trusted users)
           return nix::util::proto::AbslToGRPCStatus(
-              store_->buildPaths(drvs, mode.value()));
+              store_->buildPaths(log_sink, drvs, mode.value()));
         },
         __FUNCTION__);
   }