diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2018-09-25 18:55:37 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2019-10-29 13:38:24 +0100 |
commit | 992a2ad4757f43c02f3d06771c632a408d90ded0 (patch) | |
tree | e1c19063bab26372f1b626c404a4d9c960ae21ef /src | |
parent | 05819d013fb39eb9902d952978fff7f69e0e326e (diff) |
Move addToStoreFromDump to Store
Diffstat (limited to 'src')
-rw-r--r-- | src/libstore/daemon.cc | 5 | ||||
-rw-r--r-- | src/libstore/local-store.hh | 2 | ||||
-rw-r--r-- | src/libstore/store-api.hh | 7 |
3 files changed, 9 insertions, 5 deletions
diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc index cc1436f90..64147027b 100644 --- a/src/libstore/daemon.cc +++ b/src/libstore/daemon.cc @@ -316,10 +316,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store, logger->startWork(); if (!savedRegular.regular) throw Error("regular file expected"); - auto store2 = store.dynamic_pointer_cast<LocalStore>(); - if (!store2) throw Error("operation is only supported by LocalStore"); - - Path path = store2->addToStoreFromDump(recursive ? *savedNAR.data : savedRegular.s, baseName, recursive, hashAlgo); + Path path = store->addToStoreFromDump(recursive ? *savedNAR.data : savedRegular.s, baseName, recursive, hashAlgo); logger->stopWork(); to << path; diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh index 379a06af8..77253fa4a 100644 --- a/src/libstore/local-store.hh +++ b/src/libstore/local-store.hh @@ -157,7 +157,7 @@ public: true) or simply the contents of a regular file (if recursive == false). */ Path addToStoreFromDump(const string & dump, const string & name, - bool recursive = true, HashType hashAlgo = htSHA256, RepairFlag repair = NoRepair); + bool recursive = true, HashType hashAlgo = htSHA256, RepairFlag repair = NoRepair) override; Path addTextToStore(const string & name, const string & s, const PathSet & references, RepairFlag repair) override; diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index 250e1a4bc..115b23cbf 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -422,6 +422,13 @@ public: bool recursive = true, HashType hashAlgo = htSHA256, PathFilter & filter = defaultPathFilter, RepairFlag repair = NoRepair) = 0; + // FIXME: remove? + virtual Path addToStoreFromDump(const string & dump, const string & name, + bool recursive = true, HashType hashAlgo = htSHA256, RepairFlag repair = NoRepair) + { + throw Error("addToStoreFromDump() is not supported by this store"); + } + /* Like addToStore, but the contents written to the output path is a regular file containing the given string. */ virtual Path addTextToStore(const string & name, const string & s, |