libzypp  10.5.0
CommitPackageCache.cc
Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #include <iostream>
00013 #include "zypp/base/Logger.h"
00014 #include "zypp/base/Exception.h"
00015 
00016 #include "zypp/target/CommitPackageCache.h"
00017 #include "zypp/target/CommitPackageCacheImpl.h"
00018 #include "zypp/target/CommitPackageCacheReadAhead.h"
00019 
00020 using std::endl;
00021 
00023 namespace zypp
00024 { 
00025 
00026   namespace target
00027   { 
00028 
00030     //
00031     //  CLASS NAME : CommitPackageCache
00032     //
00034 
00035     CommitPackageCache::CommitPackageCache( Impl * pimpl_r )
00036     : _pimpl( pimpl_r )
00037     {
00038       assert( _pimpl );
00039     }
00040 
00041     CommitPackageCache::CommitPackageCache( const Pathname &        rootDir_r,
00042                                             const PackageProvider & packageProvider_r )
00043     {
00044       if ( getenv("ZYPP_COMMIT_NO_PACKAGE_CACHE") )
00045         {
00046           MIL << "$ZYPP_COMMIT_NO_PACKAGE_CACHE is set." << endl;
00047           _pimpl.reset( new Impl( packageProvider_r ) ); // no cache
00048         }
00049       else
00050         {
00051           _pimpl.reset( new CommitPackageCacheReadAhead( rootDir_r, packageProvider_r ) );
00052         }
00053       assert( _pimpl );
00054     }
00055 
00056     CommitPackageCache::~CommitPackageCache()
00057     {}
00058 
00059     void CommitPackageCache::setCommitList( std::vector<sat::Solvable> commitList_r )
00060     {
00061       _pimpl->setCommitList( commitList_r );
00062     }
00063 
00064     ManagedFile CommitPackageCache::get( const PoolItem & citem_r )
00065     { return _pimpl->get( citem_r ); }
00066 
00067     /******************************************************************
00068     **
00069     **  FUNCTION NAME : operator<<
00070     **  FUNCTION TYPE : std::ostream &
00071     */
00072     std::ostream & operator<<( std::ostream & str, const CommitPackageCache & obj )
00073     { return str << *obj._pimpl; }
00074 
00076   } // namespace target
00079 } // namespace zypp