12 #ifndef ZYPP_POOL_POOLIMPL_H 13 #define ZYPP_POOL_POOLIMPL_H 67 return userLock ? 1 : -1;
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 );
144 {
return satpool().
serial(); }
152 {
return satpool().solvablesEmpty(); }
156 {
return satpool().solvablesSize(); }
161 const_iterator
end()
const 172 const ContainerT & mystore( store() );
173 return( slv_r.
id() < mystore.size() ? mystore[slv_r.
id()] :
PoolItem() );
182 void SaveState(
const ResKind & kind_r );
184 void RestoreState(
const ResKind & kind_r );
204 { checkSerial();
return satpool().reposSize(); }
207 { checkSerial();
return satpool().reposBegin(); }
210 { checkSerial();
return satpool().reposEnd(); }
213 { checkSerial();
return satpool().reposFind( alias_r ); }
223 {
return _hardLockQueries; }
231 MIL <<
"Re-apply " << _hardLockQueries.size() <<
" HardLockQueries" << endl;
233 for_( it, _hardLockQueries.begin(), _hardLockQueries.end() )
237 MIL <<
"HardLockQueries match " << locked.
size() <<
" Solvables." << endl;
238 for_( it, begin(), end() )
246 MIL <<
"Apply " << newLocks_r.size() <<
" HardLockQueries" << endl;
247 _hardLockQueries = newLocks_r;
250 for_( it, _hardLockQueries.begin(), _hardLockQueries.end() )
254 MIL <<
"HardLockQueries match " << locked.
size() <<
" Solvables." << endl;
255 for_( it, begin(), end() )
263 activeLocks_r = _hardLockQueries;
267 typedef std::unordered_set<IdString> IdentSet;
269 IdentSet removedLocks;
270 for_( it, begin(), end() )
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 )
308 bool addedItems =
false;
309 bool reusedIDs = _watcherIDs.remember( pool.
serialIDs() );
310 std::list<PoolItem> addedProducts;
325 else if ( reusedIDs || (s && ! pi) )
331 addedProducts.push_back( pi );
342 if ( ! addedProducts.empty() )
344 for_( it, addedProducts.begin(), addedProducts.end() )
346 it->setBuddy( asKind<Product>(*it)->referencePackage() );
365 _id2item = Id2ItemT( size() );
366 for_( it, begin(), end() )
372 _id2item.insert( std::make_pair(
id, *it ) );
375 _id2itemDirty =
false;
386 if ( _watcher.remember( serial() ) )
394 _id2itemDirty =
true;
424 #endif // ZYPP_POOL_POOLIMPL_H
Simple serial number watcher.
ItemContainerT::size_type size_type
int IdType
Generic Id type.
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.
void addAttribute(const sat::SolvAttr &attr, const std::string &value="")
Filter by the value of the specified attr attribute.
IdString ident() const
The identifier.
SerialNumberWatcher _watcherIDs
Watch sat pools Serial number of IDs - changes whenever resusePoolIDs==true - ResPool must also inval...
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
String related utilities and Regular expression matching.
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
void setCaseSensitive(bool value=true)
Turn case sentitivity on or off (unsets or sets SEARCH_NOCASE flag).
Access to the sat-pools string space.
PoolTraits::size_type size_type
PoolTraits::Id2ItemT Id2ItemT
void addKind(const ResKind &kind)
Filter by selectable kind.
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
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
filter_iterator< TFilter, typename TContainer::const_iterator > make_filter_end(TFilter f, const TContainer &c)
Convenience to create filter_iterator from container::end().
ResPool::instance().proxy();.
DefaultIntegral< bool, true > _id2itemDirty
std::string asString() const
Conversion to std::string
size_type capacity() const
Internal array size for stats only.
const_iterator begin() const
static Pool instance()
Singleton ctor.
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Provides API related macros.
PoolTraits::ItemContainerT ContainerT
PoolItem find(const sat::Solvable &slv_r) const
Return the corresponding PoolItem.
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).
const SerialNumber & serialIDs() const
Serial number changing whenever resusePoolIDs==true was used.
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 setUserLockQueryMatch(bool match_r)
std::unordered_multimap< sat::detail::IdType, PoolItem > Id2ItemT
ident index
void setMatchExact()
Set to match exact string instead of substring.
repository_iterator knownRepositoriesBegin() const
repository_iterator knownRepositoriesEnd() const
Helper that splits an identifier into kind and name or vice versa.
size_type size() const
The number of sat::Solvables.
HardLockQueries::const_iterator hardLockQueries_iterator
PoolTraits::hardLockQueries_iterator hardLockQueries_iterator
HardLockQueries _hardLockQueries
Set of queries that define hardlocks.
const HardLockQueries & hardLockQueries() const
Combining sat::Solvable and ResStatus.
IdType id() const
Expert backdoor.
filter_iterator< TFilter, typename TContainer::const_iterator > make_filter_begin(TFilter f, const TContainer &c)
Convenience to create filter_iterator from container::begin().
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.
static const ResKind product
Pool internal filter skiping invalid/unwanted PoolItems.
Easy-to use interface to the ZYPP dependency resolver.
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.
void reapplyHardLocks() const
bool getHardLockQueries(HardLockQueries &activeLocks_r)