diff options
author | Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com> | 2023-03-10 16:23:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-10 16:23:22 +0100 |
commit | 99af56cd0dc8e755de8d9d78484a4574055875ce (patch) | |
tree | c7b71363665ffaa5bdcb9ffc348f4de4d4fe5a0d | |
parent | 523913d091a0c090edb81d68240695b8f50f5b98 (diff) | |
parent | 4bef2016a18e64e378982db914e73d1a8eaa8855 (diff) |
Merge pull request #8015 from tweag/progress-during-nix-copy
Display progress when running copyPaths (nix copy)
-rw-r--r-- | src/libstore/store-api.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 226eb9113..19b0a7f5f 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -1101,6 +1101,8 @@ std::map<StorePath, StorePath> copyPaths( return storePathForDst; }; + uint64_t total = 0; + for (auto & missingPath : sortedMissing) { auto info = srcStore.queryPathInfo(missingPath); @@ -1121,7 +1123,13 @@ std::map<StorePath, StorePath> copyPaths( {storePathS, srcUri, dstUri}); PushActivity pact(act.id); - srcStore.narFromPath(missingPath, sink); + LambdaSink progressSink([&](std::string_view data) { + total += data.size(); + act.progress(total, info->narSize); + }); + TeeSink tee { sink, progressSink }; + + srcStore.narFromPath(missingPath, tee); }); pathsToCopy.push_back(std::pair{infoForDst, std::move(source)}); } |