feat(tvix): Implement AddIndirectRoot, SyncWithGC

Implement RPC handlers and client methods for the AddWithRoot and
SyncWithGC calls. With this and sandboxing disabled, the following
derivation is now building successfully:

    derivation {
      name = "test";
      builder = "/bin/sh";
      args = [ "-c" "echo 1 > $out" ];
      system = "x86_64-linux";
    }

Co-authored-by: Vincent Ambo <mail@tazj.in>
Change-Id: I245dca0dfca882e2eae5d93364287a8b79fead71
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1637
Reviewed-by: tazjin <mail@tazj.in>
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Tested-by: BuildkiteCI
This commit is contained in:
Griffin Smith 2020-08-03 22:32:53 -04:00 committed by glittershark
parent d8386d6f7e
commit 5feed69260
2 changed files with 32 additions and 2 deletions

View file

@ -15,6 +15,7 @@
#include <grpcpp/impl/codegen/status.h>
#include <grpcpp/impl/codegen/sync_stream.h>
#include <grpcpp/security/credentials.h>
#include <sys/ucontext.h>
#include "libproto/worker.grpc.pb.h"
#include "libproto/worker.pb.h"
@ -355,11 +356,15 @@ void RpcStore::addTempRoot(const Path& path) {
}
void RpcStore::addIndirectRoot(const Path& path) {
throw Unsupported(absl::StrCat("Not implemented ", __func__));
ClientContext ctx;
google::protobuf::Empty response;
SuccessOrThrow(stub_->AddIndirectRoot(&ctx, StorePath(path), &response));
}
void RpcStore::syncWithGC() {
throw Unsupported(absl::StrCat("Not implemented ", __func__));
ClientContext ctx;
google::protobuf::Empty response;
SuccessOrThrow(stub_->SyncWithGC(&ctx, kEmpty, &response));
}
Roots RpcStore::findRoots(bool censor) {