libzypp 17.36.7

commitpackagepreloader_p.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
9
10#ifndef ZYPP_TARGET_PRIVATE_COMMITPACKAGEPRELOADER_H
11#define ZYPP_TARGET_PRIVATE_COMMITPACKAGEPRELOADER_H
12
13#include <zypp-core/Pathname.h>
14#include <zypp-core/zyppng/base/zyppglobal.h>
15#include <zypp/sat/Transaction.h>
16#include <zypp/media/UrlResolverPlugin.h>
17#include <zypp/media/detail/DownloadProgressTracker.h>
18#include <zypp/ZYppCallbacks.h>
19
20#include <map>
21#include <deque>
22
23 namespace zyppng {
24 ZYPP_FWD_DECL_TYPE_WITH_REFS(NetworkRequestDispatcher);
25 ZYPP_FWD_DECL_TYPE_WITH_REFS(NetworkRequest);
26}
27
28 namespace zypp {
29
30 class CommitPackagePreloader
31{
32 public:
33 CommitPackagePreloader();
34
35 void preloadTransaction( const std::vector<sat::Transaction::Step> &steps );
36 void cleanupCaches();
37 bool missed() const;
38
39 private:
40 class PreloadWorker;
41 struct RepoUrl {
42 zypp::Url baseUrl;
43 media::UrlResolverPlugin::HeaderList headers;
44 int refs = 0; //< how many workers operate on the mirror
45 int miss = 0; //< how many times this mirror had files misses
46 };
47
48 struct RepoDownloadData {
49 std::vector<RepoUrl> _baseUrls;
50 };
51
52 void reportBytesDownloaded ( ByteCount newBytes );
53
54 std::map<Repository::IdType, RepoDownloadData> _dlRepoInfo;
55 std::deque<PoolItem> _requiredDls;
56 std::vector<zyppng::Ref<PreloadWorker>> _workers;
57 ByteCount _requiredBytes;
58 ByteCount _downloadedBytes;
59 bool _missedDownloads = false;
60
61 callback::SendReport<media::CommitPreloadReport> _report;
62 zyppng::Ref<internal::ProgressTracker> _pTracker;
63
64 zyppng::NetworkRequestDispatcherRef _dispatcher;
65};
66
67}
68
69#endif // ZYPP_TARGET_PRIVATE_COMMITPACKAGEPRELOADER_H
DownloadProgressTracker.h
Transaction.h
UrlResolverPlugin.h
ZYppCallbacks.h
zypp::ByteCount
Store and operate with byte count.
Definition ByteCount.h:32
zypp::CommitPackagePreloader::PreloadWorker
Definition commitpackagepreloader.cc:50
zypp::CommitPackagePreloader::_report
callback::SendReport< media::CommitPreloadReport > _report
Definition commitpackagepreloader_p.h:61
zypp::CommitPackagePreloader::_downloadedBytes
ByteCount _downloadedBytes
Definition commitpackagepreloader_p.h:58
zypp::CommitPackagePreloader::_pTracker
zyppng::Ref< internal::ProgressTracker > _pTracker
Definition commitpackagepreloader_p.h:62
zypp::CommitPackagePreloader::_dlRepoInfo
std::map< Repository::IdType, RepoDownloadData > _dlRepoInfo
Definition commitpackagepreloader_p.h:54
zypp::CommitPackagePreloader::_requiredBytes
ByteCount _requiredBytes
Definition commitpackagepreloader_p.h:57
zypp::CommitPackagePreloader::_workers
std::vector< zyppng::Ref< PreloadWorker > > _workers
Definition commitpackagepreloader_p.h:56
zypp::CommitPackagePreloader::reportBytesDownloaded
void reportBytesDownloaded(ByteCount newBytes)
Definition commitpackagepreloader.cc:594
zypp::CommitPackagePreloader::preloadTransaction
void preloadTransaction(const std::vector< sat::Transaction::Step > &steps)
Definition commitpackagepreloader.cc:432
zypp::CommitPackagePreloader::CommitPackagePreloader
CommitPackagePreloader()
Definition commitpackagepreloader.cc:429
zypp::CommitPackagePreloader::_dispatcher
zyppng::NetworkRequestDispatcherRef _dispatcher
Definition commitpackagepreloader_p.h:64
zypp::CommitPackagePreloader::_missedDownloads
bool _missedDownloads
Definition commitpackagepreloader_p.h:59
zypp::CommitPackagePreloader::missed
bool missed() const
Definition commitpackagepreloader.cc:589
zypp::CommitPackagePreloader::cleanupCaches
void cleanupCaches()
Definition commitpackagepreloader.cc:578
zypp::CommitPackagePreloader::_requiredDls
std::deque< PoolItem > _requiredDls
Definition commitpackagepreloader_p.h:55
zypp::Url
Url manipulation class.
Definition Url.h:93
zypp::media::UrlResolverPlugin::HeaderList
std::multimap< std::string, std::string > HeaderList
Definition UrlResolverPlugin.h:39
zyppng::NetworkRequest
Definition request.h:43
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
zyppng
Definition MediaCurl2.h:22
zyppng::Ref
std::shared_ptr< T > Ref
Definition zyppglobal.h:110
zypp::CommitPackagePreloader::RepoDownloadData
Definition commitpackagepreloader_p.h:48
zypp::CommitPackagePreloader::RepoDownloadData::_baseUrls
std::vector< RepoUrl > _baseUrls
Definition commitpackagepreloader_p.h:49
zypp::CommitPackagePreloader::RepoUrl
Definition commitpackagepreloader_p.h:41
zypp::CommitPackagePreloader::RepoUrl::refs
int refs
Definition commitpackagepreloader_p.h:44
zypp::CommitPackagePreloader::RepoUrl::headers
media::UrlResolverPlugin::HeaderList headers
Definition commitpackagepreloader_p.h:43
zypp::CommitPackagePreloader::RepoUrl::miss
int miss
Definition commitpackagepreloader_p.h:45
zypp::CommitPackagePreloader::RepoUrl::baseUrl
zypp::Url baseUrl
Definition commitpackagepreloader_p.h:42
zypp::callback::SendReport
Definition Callback.h:237
Pathname.h
zyppglobal.h
ZYPP_FWD_DECL_TYPE_WITH_REFS
#define ZYPP_FWD_DECL_TYPE_WITH_REFS(T)
Definition zyppglobal.h:126