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 <rikingcoding@gmail.com>
Reviewed-by: glittershark <grfn@gws.fyi>
This commit is contained in:
Vincent Ambo 2020-08-20 03:28:35 +01:00 committed by tazjin
parent f7fa77f14d
commit 33e8b0f975
15 changed files with 63 additions and 43 deletions

View file

@ -69,7 +69,8 @@ static PathSet realisePath(Path path, bool build = true) {
if (isDerivation(p.first)) {
if (build) {
util::OkOrThrow(store->buildPaths({path}));
auto discard_logs = DiscardLogsSink();
util::OkOrThrow(store->buildPaths(discard_logs, {path}));
}
Derivation drv = store->derivationFromPath(p.first);
rootNr++;
@ -185,8 +186,9 @@ static void opRealise(Strings opFlags, Strings opArgs) {
}
/* Build all paths at the same time to exploit parallelism. */
util::OkOrThrow(
store->buildPaths(PathSet(paths.begin(), paths.end()), buildMode));
auto discard_logs = DiscardLogsSink();
util::OkOrThrow(store->buildPaths(
discard_logs, PathSet(paths.begin(), paths.end()), buildMode));
if (!ignoreUnknown) {
for (auto& i : paths) {
@ -1004,7 +1006,8 @@ static void opServe(Strings opFlags, Strings opArgs) {
does one path at a time. */
if (!willSubstitute.empty()) {
try {
util::OkOrThrow(store->buildPaths(willSubstitute));
auto discard_logs = DiscardLogsSink();
util::OkOrThrow(store->buildPaths(discard_logs, willSubstitute));
} catch (Error& e) {
LOG(WARNING) << e.msg();
}
@ -1066,7 +1069,8 @@ static void opServe(Strings opFlags, Strings opArgs) {
try {
MonitorFdHup monitor(in.fd);
util::OkOrThrow(store->buildPaths(paths));
auto discard_logs = DiscardLogsSink();
util::OkOrThrow(store->buildPaths(discard_logs, paths));
out << 0;
} catch (Error& e) {
assert(e.status);