diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-22 18:32:24 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-23 12:28:39 +0200 |
commit | 1b4917d40e5b4bbfeae5146bc826299bbc27898f (patch) | |
tree | 564fcf5b016f8b2300729fc97023bedaa197bdb2 /src/other_tools/just_mr/fetch.cpp | |
parent | 59292b03024f7e82abf9a04cc3e2ba4142abf579 (diff) | |
download | justbuild-1b4917d40e5b4bbfeae5146bc826299bbc27898f.tar.gz |
just-mr: Remove progress and statistics singletons
...and instead use simple instances created in setup, fetch, and
update, respectively. The various maps and the progress reporter
get access to these instances via not_null pointers.
Diffstat (limited to 'src/other_tools/just_mr/fetch.cpp')
-rw-r--r-- | src/other_tools/just_mr/fetch.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/other_tools/just_mr/fetch.cpp b/src/other_tools/just_mr/fetch.cpp index 11a11306..b6495a6f 100644 --- a/src/other_tools/just_mr/fetch.cpp +++ b/src/other_tools/just_mr/fetch.cpp @@ -473,6 +473,10 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config, } } + // setup progress and statistics instances + JustMRStatistics stats{}; + JustMRProgress progress{nr_a + nr_gt}; + // create async maps auto crit_git_op_ptr = std::make_shared<CriticalGitOpGuard>(); auto critical_git_op_map = CreateCriticalGitOpMap(crit_git_op_ptr); @@ -487,7 +491,7 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config, &storage, &(*apis.local), has_remote_api ? &*apis.remote : nullptr, - &JustMRProgress::Instance(), + &progress, common_args.jobs); auto archive_fetch_map = CreateArchiveFetchMap( @@ -497,7 +501,7 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config, &(*apis.local), (fetch_args.backup_to_remote and has_remote_api) ? &*apis.remote : nullptr, - &JustMRStatistics::Instance(), + &stats, common_args.jobs); auto import_to_git_map = @@ -517,15 +521,13 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config, &(*apis.local), has_remote_api ? &*apis.remote : nullptr, fetch_args.backup_to_remote, - &JustMRProgress::Instance(), + &progress, common_args.jobs); // set up progress observer - JustMRProgress::Instance().SetTotal(static_cast<int>(nr_a + nr_gt)); std::atomic<bool> done{false}; std::condition_variable cv{}; - auto reporter = JustMRProgressReporter::Reporter( - &JustMRStatistics::Instance(), &JustMRProgress::Instance()); + auto reporter = JustMRProgressReporter::Reporter(&stats, &progress); auto observer = std::thread([reporter, &done, &cv]() { reporter(&done, &cv); }); |