diff options
author | eldritch horrors <pennae@lix.systems> | 2024-03-24 00:44:57 +0100 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-07-05 22:28:16 +0000 |
commit | f4f6d1d8e24a092422fcec601e21683179b735c9 (patch) | |
tree | e90edb17aea9aefc7449d1b3723ffb3b0a5bec59 /src/libstore/store-api.cc | |
parent | 06220a71c1430c97bfcd8012b00530a987e40e97 (diff) |
libutil: convert readFileSource to a generator
Change-Id: I5f92b15fd367d46eb047d74ab6e317b4f51a46d3
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r-- | src/libstore/store-api.cc | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 2dad1f5f6..683da1129 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -275,13 +275,11 @@ StorePath Store::addToStore( const StorePathSet & references) { Path srcPath(absPath(_srcPath)); - auto source = sinkToSource([&](Sink & sink) { - if (method == FileIngestionMethod::Recursive) - sink << dumpPath(srcPath, filter); - else - readFileSource(srcPath)->drainInto(sink); - }); - return addToStoreFromDump(*source, name, method, hashAlgo, repair, references); + auto source = GeneratorSource{ + method == FileIngestionMethod::Recursive ? dumpPath(srcPath, filter).decay() + : readFileSource(srcPath) + }; + return addToStoreFromDump(source, name, method, hashAlgo, repair, references); } void Store::addMultipleToStore( |