libstore: convert dumpPath to a generator
Change-Id: Ic4cf5562504aa29130304469936f958c0426e5ef
This commit is contained in:
@@ -383,16 +383,14 @@ StorePath BinaryCacheStore::addToStore(
|
||||
|
||||
HashSink sink { hashAlgo };
|
||||
if (method == FileIngestionMethod::Recursive) {
|
||||
dumpPath(srcPath, sink, filter);
|
||||
sink << dumpPath(srcPath, filter);
|
||||
} else {
|
||||
readFileSource(srcPath)->drainInto(sink);
|
||||
}
|
||||
auto h = sink.finish().first;
|
||||
|
||||
auto source = sinkToSource([&](Sink & sink) {
|
||||
dumpPath(srcPath, sink, filter);
|
||||
});
|
||||
return addToStoreCommon(*source, repair, CheckSigs, [&](HashResult nar) {
|
||||
auto source = GeneratorSource{dumpPath(srcPath, filter)};
|
||||
return addToStoreCommon(source, repair, CheckSigs, [&](HashResult nar) {
|
||||
ValidPathInfo info {
|
||||
*this,
|
||||
name,
|
||||
@@ -425,7 +423,7 @@ StorePath BinaryCacheStore::addTextToStore(
|
||||
return path;
|
||||
|
||||
StringSink sink;
|
||||
dumpString(s, sink);
|
||||
sink << dumpString(s);
|
||||
StringSource source(sink.s);
|
||||
return addToStoreCommon(source, repair, CheckSigs, [&](HashResult nar) {
|
||||
ValidPathInfo info {
|
||||
|
||||
Reference in New Issue
Block a user