libzypp  15.28.6
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 Pathname & rootDir_r,
68  const PackageProvider & packageProvider_r = RepoProvidePackage() );
69 
72 
73  public:
75  void setCommitList( std::vector<sat::Solvable> commitList_r );
77  template <class TIterator>
78  void setCommitList( TIterator begin_r, TIterator end_r )
79  { setCommitList( std::vector<sat::Solvable>( begin_r, end_r ) ); }
80 
82  ManagedFile get( const PoolItem & citem_r );
84  ManagedFile get( sat::Solvable citem_r )
85  { return get( PoolItem(citem_r) ); }
86 
91  bool preloaded() const;
93  void preloaded( bool newval_r );
94 
95  public:
97  class Impl;
99  explicit CommitPackageCache( Impl * pimpl_r );
100  private:
103  };
105 
107  std::ostream & operator<<( std::ostream & str, const CommitPackageCache & obj );
108 
110  } // namespace target
113 } // namespace zypp
115 #endif // ZYPP_TARGET_COMMITPACKAGECACHE_H
A Solvable object within the sat Pool.
Definition: Solvable.h:53
CommitPackageCache(const Pathname &rootDir_r, const PackageProvider &packageProvider_r=RepoProvidePackage())
Ctor.
function< ManagedFile(const PoolItem &pi, bool fromCache_r)> PackageProvider
Helper filtering the files offered by a RepomdFileReader.
Target::commit helper optimizing package provision.
RW_pointer< Impl > _pimpl
Pointer to implementation.
ManagedFile operator()(const PoolItem &pi, bool fromCache_r)
Provide package optionally fron cache only.
void setCommitList(TIterator begin_r, TIterator end_r)
std::ostream & operator<<(std::ostream &str, const CommitPackageCache &obj)
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Definition: AutoDispose.h:92
Combining sat::Solvable and ResStatus.
Definition: PoolItem.h:50
friend std::ostream & operator<<(std::ostream &str, const CommitPackageCache &obj)
Default PackageProvider for CommitPackageCache.
void setCommitList(std::vector< sat::Solvable > commitList_r)
Download(commit) sequence of solvables to compute read ahead.
bool preloaded() const
Whether preloaded hint is set.