feat(3p/nix): Implement AddToStore rpc client

Implement the AddToStore RPC client method, which uses an
AddToStorePathWriterSink (the dual of the AddToStorePathReaderSource on
the server side) to hook into the dumpPath machinery (which we should
refactor not to use sinks or sources, but not yet) and write dumped
paths as binary data over gRPC. With this commit and sandboxing
disabled, the following derivation builds cleanly:

    derivation {
      name = "test";
      builder = ./build.sh;
      system = "x86_64-linux";
    }

where build.sh has chmod +x and contains:

    #!/bin/sh
    echo 1 > $out

Change-Id: I94cab86f0825a3a9993262a9807130645c13bf44
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1638
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Tested-by: BuildkiteCI
This commit is contained in:
Griffin Smith 2020-08-03 23:50:42 -04:00 committed by glittershark
parent b15b447fcb
commit 28c7e926ea
4 changed files with 69 additions and 2 deletions

View file

@ -146,7 +146,7 @@ class WorkerServiceImpl final : public WorkerService::Service {
proto::AddToStoreRequest metadata_request;
auto has_metadata = reader->Read(&metadata_request);
if (!has_metadata || metadata_request.has_meta()) {
if (!has_metadata || !metadata_request.has_meta()) {
return Status(grpc::StatusCode::INVALID_ARGUMENT,
"Metadata must be set before sending file content");
}