aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/daemon.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-05-15 16:50:11 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-05-15 16:50:11 -0400
commit746c6aae3f4a2f80c730575bd6eca370efe58f2e (patch)
treeb03fa431442b3d9376068d431246ea6a62120810 /src/libstore/daemon.cc
parent2524a2118647a4125dcae08fe0eb20de5f79a291 (diff)
parentf8a6a9e47314acebea2d72c0ec195360eb58bbec (diff)
Merge remote-tracking branch 'upstream/master' into best-effort-supplementary-groups
Diffstat (limited to 'src/libstore/daemon.cc')
-rw-r--r--src/libstore/daemon.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc
index af9a76f1e..5083497a9 100644
--- a/src/libstore/daemon.cc
+++ b/src/libstore/daemon.cc
@@ -401,18 +401,22 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
logger->startWork();
auto pathInfo = [&]() {
// NB: FramedSource must be out of scope before logger->stopWork();
- ContentAddressMethod contentAddressMethod = ContentAddressMethod::parse(camStr);
+ auto [contentAddressMethod, hashType_] = ContentAddressMethod::parse(camStr);
+ auto hashType = hashType_; // work around clang bug
FramedSource source(from);
// TODO this is essentially RemoteStore::addCAToStore. Move it up to Store.
return std::visit(overloaded {
- [&](const TextHashMethod &) {
+ [&](const TextIngestionMethod &) {
+ if (hashType != htSHA256)
+ throw UnimplementedError("When adding text-hashed data called '%s', only SHA-256 is supported but '%s' was given",
+ name, printHashType(hashType));
// We could stream this by changing Store
std::string contents = source.drain();
auto path = store->addTextToStore(name, contents, refs, repair);
return store->queryPathInfo(path);
},
- [&](const FixedOutputHashMethod & fohm) {
- auto path = store->addToStoreFromDump(source, name, fohm.fileIngestionMethod, fohm.hashType, repair, refs);
+ [&](const FileIngestionMethod & fim) {
+ auto path = store->addToStoreFromDump(source, name, fim, hashType, repair, refs);
return store->queryPathInfo(path);
},
}, contentAddressMethod.raw);