From 33e8b0f975cd8934405c568cfa1d7e2a1edfa425 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 20 Aug 2020 03:28:35 +0100 Subject: chore(tvix): Thread a std::ostream through Store::buildPaths 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 Reviewed-by: glittershark --- third_party/nix/src/nix-daemon/nix-daemon-proto.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'third_party/nix/src/nix-daemon/nix-daemon-proto.cc') 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* /* writer */) override { + grpc::ServerWriter* 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__); } -- cgit 1.4.1