libzypp  17.25.0
CommitPackageCache.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_TARGET_COMMITPACKAGECACHE_H
13 #define ZYPP_TARGET_COMMITPACKAGECACHE_H
14 
15 #include <iosfwd>
16 
17 #include <zypp/base/PtrTypes.h>
18 #include <zypp/base/Function.h>
19 
20 #include <zypp/PoolItem.h>
21 #include <zypp/Pathname.h>
22 #include <zypp/ManagedFile.h>
23 
25 namespace zypp
26 {
27  namespace target
29  {
30 
39  {
40  public:
43 
45  ManagedFile operator()( const PoolItem & pi, bool fromCache_r );
46 
47  private:
48  struct Impl;
50  };
51 
53  //
54  // CLASS NAME : CommitPackageCache
55  //
59  {
60  friend std::ostream & operator<<( std::ostream & str, const CommitPackageCache & obj );
61 
62  public:
63  typedef function<ManagedFile( const PoolItem & pi, bool fromCache_r )> PackageProvider;
64 
65  public:
67  CommitPackageCache( const PackageProvider & packageProvider_r = RepoProvidePackage() );
68 
72  CommitPackageCache( const Pathname & /*rootDir_r*/, const PackageProvider & packageProvider_r = RepoProvidePackage() ) ZYPP_DEPRECATED;
73 
76 
77  public:
79  void setCommitList( std::vector<sat::Solvable> commitList_r );
81  template <class TIterator>
82  void setCommitList( TIterator begin_r, TIterator end_r )
83  { setCommitList( std::vector<sat::Solvable>( begin_r, end_r ) ); }
84 
86  ManagedFile get( const PoolItem & citem_r );
89  { return get( PoolItem(citem_r) ); }
90 
95  bool preloaded() const;
97  void preloaded( bool newval_r );
98 
99  public:
101  class Impl;
103  explicit CommitPackageCache( Impl * pimpl_r );
104  private:
107  };
109 
111  std::ostream & operator<<( std::ostream & str, const CommitPackageCache & obj );
112 
114  } // namespace target
117 } // namespace zypp
119 #endif // ZYPP_TARGET_COMMITPACKAGECACHE_H
zypp::PoolItem
Combining sat::Solvable and ResStatus.
Definition: PoolItem.h:50
zypp::sat::Solvable
A Solvable object within the sat Pool.
Definition: Solvable.h:53
zypp::target::CommitPackageCache::get
ManagedFile get(const PoolItem &citem_r)
Provide a package.
Definition: CommitPackageCache.cc:142
zypp::ManagedFile
AutoDispose< const Pathname > ManagedFile
A Pathname plus associated cleanup code to be executed when path is no longer needed.
Definition: ManagedFile.h:27
zypp::target::RepoProvidePackage::Impl
Definition: CommitPackageCache.cc:65
PtrTypes.h
zypp::target::CommitPackageCache::operator<<
friend std::ostream & operator<<(std::ostream &str, const CommitPackageCache &obj)
Definition: CommitPackageCache.cc:155
Pathname.h
zypp::target::RepoProvidePackage::RepoProvidePackage
RepoProvidePackage()
Definition: CommitPackageCache.cc:72
zypp::target::CommitPackageCache::preloaded
bool preloaded() const
Whether preloaded hint is set.
Definition: CommitPackageCache.cc:145
zypp::target::CommitPackageCache::CommitPackageCache
CommitPackageCache(const PackageProvider &packageProvider_r=RepoProvidePackage())
Ctor.
Definition: CommitPackageCache.cc:117
zypp::target::CommitPackageCache::get
ManagedFile get(sat::Solvable citem_r)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: CommitPackageCache.h:88
zypp::RW_pointer< Impl >
zypp::target::RepoProvidePackage
Default PackageProvider for CommitPackageCache.
Definition: CommitPackageCache.h:38
zypp::target::operator<<
std::ostream & operator<<(std::ostream &str, const CommitPackageCache &obj)
Definition: CommitPackageCache.cc:155
zypp::target::CommitPackageCache
Target::commit helper optimizing package provision.
Definition: CommitPackageCache.h:58
zypp::target::CommitPackageCache::setCommitList
void setCommitList(std::vector< sat::Solvable > commitList_r)
Download(commit) sequence of solvables to compute read ahead.
Definition: CommitPackageCache.cc:139
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
zypp::target::CommitPackageCache::_pimpl
RW_pointer< Impl > _pimpl
Pointer to implementation.
Definition: CommitPackageCache.h:106
zypp::target::RepoProvidePackage::_impl
RW_pointer< Impl > _impl
Definition: CommitPackageCache.h:48
Impl
zypp::AutoDispose
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Definition: AutoDispose.h:92
zypp::target::CommitPackageCache::PackageProvider
function< ManagedFile(const PoolItem &pi, bool fromCache_r)> PackageProvider
Definition: CommitPackageCache.h:63
std
Definition: Arch.h:347
Function.h
zypp::filesystem::Pathname
Pathname.
Definition: Pathname.h:44
PoolItem.h
str
String related utilities and Regular expression matching.
ManagedFile.h
zypp::target::RepoProvidePackage::operator()
ManagedFile operator()(const PoolItem &pi, bool fromCache_r)
Provide package optionally fron cache only.
Definition: CommitPackageCache.cc:83
zypp::target::RepoProvidePackage::~RepoProvidePackage
~RepoProvidePackage()
Definition: CommitPackageCache.cc:80