aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/daemon.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/daemon.cc')
-rw-r--r--src/libstore/daemon.cc29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc
index 1f950de63..356479f5a 100644
--- a/src/libstore/daemon.cc
+++ b/src/libstore/daemon.cc
@@ -73,6 +73,18 @@ struct TunnelLogger : public Logger
enqueueMsg(*buf.s);
}
+ void logEI(const ErrorInfo & ei) override
+ {
+ if (ei.level > verbosity) return;
+
+ std::stringstream oss;
+ oss << ei;
+
+ StringSink buf;
+ buf << STDERR_NEXT << oss.str() << "\n"; // (fs.s + "\n");
+ enqueueMsg(*buf.s);
+ }
+
/* startWork() means that we're starting an operation for which we
want to send out stderr to the client. */
void startWork()
@@ -290,7 +302,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
auto path = store->parseStorePath(readString(from));
logger->startWork();
StorePathSet paths; // FIXME
- paths.insert(path.clone());
+ paths.insert(path);
auto res = store->querySubstitutablePaths(paths);
logger->stopWork();
to << (res.count(path) != 0);
@@ -324,7 +336,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
StorePathSet paths;
if (op == wopQueryReferences)
for (auto & i : store->queryPathInfo(path)->references)
- paths.insert(i.clone());
+ paths.insert(i);
else if (op == wopQueryReferrers)
store->queryReferrers(path, paths);
else if (op == wopQueryValidDerivers)
@@ -338,8 +350,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
case wopQueryDerivationOutputNames: {
auto path = store->parseStorePath(readString(from));
logger->startWork();
- StringSet names;
- names = store->queryDerivationOutputNames(path);
+ auto names = store->readDerivation(path).outputNames();
logger->stopWork();
to << names;
break;
@@ -367,8 +378,10 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
std::string s, baseName;
FileIngestionMethod method;
{
- bool fixed, recursive;
+ bool fixed; uint8_t recursive;
from >> baseName >> fixed /* obsolete */ >> recursive >> s;
+ if (recursive > (uint8_t) FileIngestionMethod::Recursive)
+ throw Error("unsupported FileIngestionMethod with value of %i; you may need to upgrade nix-daemon", recursive);
method = FileIngestionMethod { recursive };
/* Compatibility hack. */
if (!fixed) {
@@ -589,9 +602,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
auto path = store->parseStorePath(readString(from));
logger->startWork();
SubstitutablePathInfos infos;
- StorePathSet paths;
- paths.insert(path.clone()); // FIXME
- store->querySubstitutablePathInfos(paths, infos);
+ store->querySubstitutablePathInfos({path}, infos);
logger->stopWork();
auto i = infos.find(path);
if (i == infos.end())
@@ -752,7 +763,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
}
default:
- throw Error(format("invalid operation %1%") % op);
+ throw Error("invalid operation %1%", op);
}
}