From 0739d428e07b59b7d44bdbf7354dafaae09dba7c Mon Sep 17 00:00:00 2001 From: Carlo Nucera Date: Wed, 5 Aug 2020 17:49:45 -0400 Subject: [PATCH] Solve template deduction problem We had to predeclare our template functions --- src/libstore/daemon.cc | 2 +- src/libstore/worker-protocol.hh | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc index e18f793c8..a420dcab0 100644 --- a/src/libstore/daemon.cc +++ b/src/libstore/daemon.cc @@ -327,7 +327,7 @@ static void performOp(TunnelLogger * logger, ref store, logger->startWork(); auto outputs = store->queryDerivationOutputMap(path); logger->stopWork(); - write(*store, to, outputs); + nix::worker_proto::write(*store, to, outputs); break; } diff --git a/src/libstore/worker-protocol.hh b/src/libstore/worker-protocol.hh index fdd700668..c50995d7c 100644 --- a/src/libstore/worker-protocol.hh +++ b/src/libstore/worker-protocol.hh @@ -78,6 +78,19 @@ struct Phantom {}; namespace worker_proto { /* FIXME maybe move more stuff inside here */ +StorePath read(const Store & store, Source & from, Phantom _); +void write(const Store & store, Sink & out, const StorePath & storePath); + +template +std::map read(const Store & store, Source & from, Phantom> _); +template +void write(const Store & store, Sink & out, const std::map & resMap); +template +std::optional read(const Store & store, Source & from, Phantom> _); +template +void write(const Store & store, Sink & out, const std::optional & optVal); + + template std::map read(const Store & store, Source & from, Phantom> _) { @@ -122,9 +135,6 @@ void write(const Store & store, Sink & out, const std::optional & optVal) nix::worker_proto::write(store, out, *optVal); } -StorePath read(const Store & store, Source & from, Phantom _); - -void write(const Store & store, Sink & out, const StorePath & storePath); }