Author: dmacvicar Date: Fri Aug 10 14:17:37 2007 New Revision: 6572 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6572&view=rev Log: - dont create a second CacheStore in the same scope, will lock... #297627 - Don't commit on internal repo clean. The operation will do it. Makes cleaning faster Modified: trunk/libzypp/zypp/RepoManager.cc trunk/libzypp/zypp/RepoManager.h Modified: trunk/libzypp/zypp/RepoManager.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoManager.cc?rev=6572&r1=6571&r2=6572&view=diff ============================================================================== --- trunk/libzypp/zypp/RepoManager.cc (original) +++ trunk/libzypp/zypp/RepoManager.cc Fri Aug 10 14:17:37 2007 @@ -99,6 +99,34 @@ //////////////////////////////////////////////////////////////////////////// + /** + * \short Internal version of clean cache + * + * Takes an extra CacheStore reference, so we avoid internally + * having 2 CacheStores writing to the same database. + */ + static void cleanCacheInternal( cache::CacheStore &store, + const RepoInfo &info, + const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ) + { + ProgressData progress; + callback::SendReport<ProgressReport> report; + progress.sendTo( ProgressReportAdaptor( progressrcv, report ) ); + progress.name(str::form(_("Cleaning repository '%s' cache"), info.alias().c_str())); + + if ( !store.isCached(info.alias()) ) + return; + + MIL << info.alias() << " cleaning cache..." << endl; + data::RecordId id = store.lookupRepository(info.alias()); + + CombinedProgressData subprogrcv(progress); + + store.cleanRepository(id, subprogrcv); + } + + //////////////////////////////////////////////////////////////////////////// + /** * Reads RepoInfo's from a repo file. * @@ -509,7 +537,7 @@ } } - cleanCache(info); + cleanCacheInternal( store, info); } MIL << info.alias() << " building cache..." << endl; @@ -615,28 +643,14 @@ return repo::RepoType::NONE; } - + //////////////////////////////////////////////////////////////////////////// - + void RepoManager::cleanCache( const RepoInfo &info, const ProgressData::ReceiverFnc & progressrcv ) { - ProgressData progress; - callback::SendReport<ProgressReport> report; - progress.sendTo( ProgressReportAdaptor( progressrcv, report ) ); - progress.name(str::form(_("Cleaning repository '%s' cache"), info.alias().c_str())); - cache::CacheStore store(_pimpl->options.repoCachePath); - - if ( !store.isCached(info.alias()) ) - return; - - MIL << info.alias() << " cleaning cache..." << endl; - data::RecordId id = store.lookupRepository(info.alias()); - - CombinedProgressData subprogrcv(progress); - - store.cleanRepository(id, subprogrcv); + cleanCacheInternal( store, info, progressrcv ); store.commit(); } @@ -922,7 +936,7 @@ CombinedProgressData subprogrcv(progress); // now delete it from cache - cleanCache(todelete, subprogrcv); + cleanCache( todelete, subprogrcv); MIL << todelete.alias() << " sucessfully deleted." << endl; return; Modified: trunk/libzypp/zypp/RepoManager.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoManager.h?rev=6572&r1=6571&r2=6572&view=diff ============================================================================== --- trunk/libzypp/zypp/RepoManager.h (original) +++ trunk/libzypp/zypp/RepoManager.h Fri Aug 10 14:17:37 2007 @@ -308,6 +308,7 @@ protected: RepoStatus rawMetadataStatus( const RepoInfo &info ); RepoStatus cacheStatus( const RepoInfo &info ); + public: private: -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org