12 #ifndef ZYPP_POOL_POOLIMPL_H
13 #define ZYPP_POOL_POOLIMPL_H
67 return userLock ? 1 : -1;
75 inline PoolQuery makeTrivialQuery( IdString ident_r )
77 sat::Solvable::SplitIdent ident( ident_r );
81 q.addKind( ident.kind() );
83 q.setCaseSensitive(
true);
89 unsigned s( activeLocks_r.size() );
90 activeLocks_r.remove( makeTrivialQuery( ident_r ) );
91 return( activeLocks_r.size() != s );
96 PoolQuery q( makeTrivialQuery( ident_r ) );
97 for_( it, activeLocks_r.begin(), activeLocks_r.end() )
102 activeLocks_r.push_back( q );
173 return( slv_r.
id() < mystore.size() ? mystore[slv_r.
id()] :
PoolItem() );
237 MIL <<
"HardLockQueries match " << locked.
size() <<
" Solvables." << endl;
246 MIL <<
"Apply " << newLocks_r.size() <<
" HardLockQueries" << endl;
254 MIL <<
"HardLockQueries match " << locked.
size() <<
" Solvables." << endl;
267 typedef std::tr1::unordered_set<IdString> IdentSet;
269 IdentSet removedLocks;
277 addedLocks.insert( it->satSolvable().ident() );
280 removedLocks.insert( it->satSolvable().ident() );
285 bool setChanged =
false;
286 for_( it, removedLocks.begin(), removedLocks.end() )
288 if ( addedLocks.find( *it ) != addedLocks.end() )
290 if ( hardLockQueriesRemove( activeLocks_r, *it ) && ! setChanged )
293 for_( it, addedLocks.begin(), addedLocks.end() )
295 if ( hardLockQueriesAdd( activeLocks_r, *it ) && ! setChanged )
313 MIL <<
"Apply " << newLocks_r.size() <<
" AutoSoftLocks: " << newLocks_r << endl;
318 if ( ! it->status().isKept() )
337 if ( ! ( status.isByUser() || status.isByApplLow() ) )
341 switch ( status.getTransactValue() )
345 if ( status.isRecommended() )
346 activeLocks_r.insert( it->satSolvable().ident() );
352 (status.isInstalled() ? todel : toins).insert( it->satSolvable().ident() );
356 for_( it, todel.begin(), todel.end() )
358 activeLocks_r.insert( *it );
360 for_( it, toins.begin(), toins.end() )
362 activeLocks_r.erase( *it );
373 bool addedItems =
false;
374 std::list<PoolItem> addedProducts;
389 else if ( s && ! pi )
395 addedProducts.push_back( pi );
411 if ( ! addedProducts.empty() )
413 for_( it, addedProducts.begin(), addedProducts.end() )
415 it->setBuddy( asKind<Product>(*it)->referencePackage() );
441 _id2item.insert( std::make_pair(
id, *it ) );
493 #endif // ZYPP_POOL_POOLIMPL_H
Simple serial number watcher.
ItemContainerT::size_type size_type
int IdType
Generic Id type.
bool autoSoftLockAppliesTo(sat::Solvable solv_r) const
A Solvable object within the sat Pool.
sat::detail::SolvableIdType SolvableIdType
bool contains(sat::Solvable result_r) const
Test whether some item is in the result set.
IdString ident() const
The identifier.
void SaveState(const ResObject::Kind &kind_r)
size_type reposSize() const
Number of repos in Pool.
PoolTraits::HardLockQueries HardLockQueries
static void setLock(ResStatus &status_r, bool yesno_r)
Set lock and UserLockQuery bit according to yesno_r.
std::vector< PoolItem > ItemContainerT
pure items
IdType id() const
Expert backdoor.
const_iterator end() const
DefaultIntegral< bool, true > _storeDirty
PoolTraits::autoSoftLocks_iterator autoSoftLocks_iterator
size_type knownRepositoriesSize() const
Forward list of Repositories that contribute ResObjects from sat::Pool.
unsigned SolvableIdType
Id type to connect Solvable and sat-solvable.
static const ResKind srcpackage
PoolTraits::size_type size_type
PoolTraits::Id2ItemT Id2ItemT
SerialNumberWatcher _watcher
Watch sat pools serial number.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Manipulator for ResStatus::UserLockQueryField.
const ContainerT & store() const
friend std::ostream & operator<<(std::ostream &str, const PoolImpl &obj)
filter_iterator< _Filter, typename _Container::const_iterator > make_filter_begin(_Filter f, const _Container &c)
Convenience to create filter_iterator from container::begin().
std::list< PoolQuery > HardLockQueries
hard locks from etc/zypp/locks
static int diffLock(const ResStatus &status_r)
Test whether the lock status differs from the remembered UserLockQuery bit.
PoolTraits::const_iterator const_iterator
ResPool::instance().proxy();.
void setAutoSoftLocks(const AutoSoftLocks &newLocks_r)
const SerialNumber & serial() const
Housekeeping data serial number.
size_type solvablesSize() const
Number of solvables in Pool.
DefaultIntegral< bool, true > _id2itemDirty
const AutoSoftLocks & autoSoftLocks() const
RepositoryIterator reposEnd() const
Iterator behind the last Repository.
bool setSoftLock(TransactByValue causer_r)
size_type capacity() const
Internal array size for stats only.
const_iterator begin() const
static Pool instance()
Singleton ctor.
AutoSoftLocks _autoSoftLocks
Set of solvable idents that should be soft locked per default.
std::string asString() const
Provides API related macros.
PoolTraits::ItemContainerT ContainerT
Repository reposFind(const std::string &alias_r) const
Find a Repository named alias_r.
PoolItem find(const sat::Solvable &slv_r) const
Return the corresponding PoolItem.
RepositoryIterator reposBegin() const
Iterator to the first Repository.
ResStatus & status() const
Returns the current status.
static PoolItem makePoolItem(const sat::Solvable &solvable_r)
PoolItem generator for pool::PoolImpl.
bool isUserLocked() const
bool setLock(bool toLock_r, TransactByValue causer_r)
Apply a lock (prevent transaction).
static const SolvAttr name
shared_ptr< ResPoolProxy > _poolProxy
filter_iterator< ByPoolItem, ItemContainerT::const_iterator > const_iterator
Simple serial number provider.
const sat::Pool satpool() const
convenience.
PoolTraits::repository_iterator repository_iterator
void getActiveSoftLocks(AutoSoftLocks &activeLocks_r)
void setUserLockQueryMatch(bool match_r)
PoolTraits::AutoSoftLocks AutoSoftLocks
void RestoreState(const ResObject::Kind &kind_r)
repository_iterator knownRepositoriesBegin() const
std::tr1::unordered_set< IdString > AutoSoftLocks
soft locks
repository_iterator knownRepositoriesEnd() const
size_type size() const
The number of sat::Solvables.
void prepare() const
Update housekeeping data if necessary (e.g.
HardLockQueries::const_iterator hardLockQueries_iterator
PoolTraits::hardLockQueries_iterator hardLockQueries_iterator
HardLockQueries _hardLockQueries
Set of queries that define hardlocks.
filter_iterator< _Filter, typename _Container::const_iterator > make_filter_end(_Filter f, const _Container &c)
Convenience to create filter_iterator from container::end().
const HardLockQueries & hardLockQueries() const
Reference to a PoolItem connecting ResObject and ResStatus.
IdType id() const
Expert backdoor.
Repository reposFind(const std::string &alias_r) const
const Id2ItemT & id2item() const
Helper class to collect (not only) PoolQuery results.
void setHardLockQueries(const HardLockQueries &newLocks_r)
ResPoolProxy proxy(ResPool self) const
bool isKind(const ResKind &kind_r) const
Test whether a Solvable is of a certain ResKind.
bool solvablesEmpty() const
Whether Pool contains solvables.
static const ResKind product
Pool internal filter skiping invalid/unwanted PoolItems.
std::tr1::unordered_multimap< sat::detail::IdType, PoolItem > Id2ItemT
ident index
const SerialNumber & serial() const
Housekeeping data serial number.
bool isUserLockQueryMatch() const
static void reapplyLock(ResStatus &status_r, bool yesno_r)
Update lock and UserLockQuery bit IFF the item gained the bit.
bool remember(unsigned serial_r) const
Return isDirty, storing serial_r as new value.
AutoSoftLocks::const_iterator autoSoftLocks_iterator
void reapplyHardLocks() const
bool getHardLockQueries(HardLockQueries &activeLocks_r)