libzypp  11.13.5
CommitPackageCache.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #include <iostream>
13 #include "zypp/base/Logger.h"
14 #include "zypp/base/Exception.h"
15 
19 
20 using std::endl;
21 
23 namespace zypp
24 {
25 
26  namespace target
27  {
28 
30  //
31  // CLASS NAME : CommitPackageCache
32  //
34 
36  : _pimpl( pimpl_r )
37  {
38  assert( _pimpl );
39  }
40 
41  CommitPackageCache::CommitPackageCache( const Pathname & rootDir_r,
42  const PackageProvider & packageProvider_r )
43  {
44  if ( getenv("ZYPP_COMMIT_NO_PACKAGE_CACHE") )
45  {
46  MIL << "$ZYPP_COMMIT_NO_PACKAGE_CACHE is set." << endl;
47  _pimpl.reset( new Impl( packageProvider_r ) ); // no cache
48  }
49  else
50  {
51  _pimpl.reset( new CommitPackageCacheReadAhead( rootDir_r, packageProvider_r ) );
52  }
53  assert( _pimpl );
54  }
55 
57  {}
58 
59  void CommitPackageCache::setCommitList( std::vector<sat::Solvable> commitList_r )
60  {
61  _pimpl->setCommitList( commitList_r );
62  }
63 
65  { return _pimpl->get( citem_r ); }
66 
67  /******************************************************************
68  **
69  ** FUNCTION NAME : operator<<
70  ** FUNCTION TYPE : std::ostream &
71  */
72  std::ostream & operator<<( std::ostream & str, const CommitPackageCache & obj )
73  { return str << *obj._pimpl; }
74 
76  } // namespace target
79 } // namespace zypp