aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libstore/daemon.cc5
-rw-r--r--src/libstore/remote-store.cc9
-rw-r--r--src/libstore/remote-store.hh2
3 files changed, 9 insertions, 7 deletions
diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc
index f2d789699..9f7350217 100644
--- a/src/libstore/daemon.cc
+++ b/src/libstore/daemon.cc
@@ -353,6 +353,9 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
auto name = readString(from);
auto camStr = readString(from);
auto refs = readStorePaths<StorePathSet>(*store, from);
+ bool repairBool;
+ from >> repairBool;
+ auto repair = RepairFlag{repairBool};
logger->startWork();
StorePath path = [&]() -> StorePath {
@@ -368,7 +371,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
[&](FixedOutputHashMethod &fohm) -> StorePath {
if (!refs.empty())
throw UnimplementedError("cannot yet have refs with flat or nar-hashed data");
- return store->addToStoreFromDump(source, name, fohm.fileIngestionMethod, fohm.hashType);
+ return store->addToStoreFromDump(source, name, fohm.fileIngestionMethod, fohm.hashType, repair);
},
}, contentAddressMethod);
}();
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index cfbf23ac4..54d70e3e1 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -526,7 +526,7 @@ std::optional<StorePath> RemoteStore::queryPathFromHashPart(const std::string &
}
-StorePath RemoteStore::addCAToStore(Source & dump, const string & name, ContentAddressMethod caMethod, StorePathSet references)
+StorePath RemoteStore::addCAToStore(Source & dump, const string & name, ContentAddressMethod caMethod, StorePathSet references, RepairFlag repair)
{
auto conn(getConnection());
@@ -537,6 +537,7 @@ StorePath RemoteStore::addCAToStore(Source & dump, const string & name, ContentA
<< name
<< renderContentAddressMethod(caMethod);
writeStorePaths(*this, conn->to, references);
+ conn->to << repair;
conn.withFramedSink([&](Sink & sink) {
dump.drainInto(sink);
@@ -597,9 +598,8 @@ StorePath RemoteStore::addCAToStore(Source & dump, const string & name, ContentA
StorePath RemoteStore::addToStoreFromDump(Source & dump, const string & name,
FileIngestionMethod method, HashType hashType, RepairFlag repair)
{
- if (repair) throw Error("repairing is not supported when adding to store through the Nix daemon");
StorePathSet references;
- return addCAToStore(dump, name, FixedOutputHashMethod{ .fileIngestionMethod = method, .hashType = hashType }, references);
+ return addCAToStore(dump, name, FixedOutputHashMethod{ .fileIngestionMethod = method, .hashType = hashType }, references, repair);
}
@@ -659,9 +659,8 @@ void RemoteStore::addToStore(const ValidPathInfo & info, Source & source,
StorePath RemoteStore::addTextToStore(const string & name, const string & s,
const StorePathSet & references, RepairFlag repair)
{
- if (repair) throw Error("repairing is not supported when building through the Nix daemon");
StringSource source(s);
- return addCAToStore(source, name, TextHashMethod{}, references);
+ return addCAToStore(source, name, TextHashMethod{}, references, repair);
}
diff --git a/src/libstore/remote-store.hh b/src/libstore/remote-store.hh
index 2c775cb79..23f7b8425 100644
--- a/src/libstore/remote-store.hh
+++ b/src/libstore/remote-store.hh
@@ -63,7 +63,7 @@ public:
void querySubstitutablePathInfos(const StorePathCAMap & paths,
SubstitutablePathInfos & infos) override;
- StorePath addCAToStore(Source & dump, const string & name, ContentAddressMethod caMethod, StorePathSet references);
+ StorePath addCAToStore(Source & dump, const string & name, ContentAddressMethod caMethod, StorePathSet references, RepairFlag repair);
StorePath addToStoreFromDump(Source & dump, const string & name,
FileIngestionMethod method = FileIngestionMethod::Recursive, HashType hashAlgo = htSHA256, RepairFlag repair = NoRepair) override;