12#ifndef ZYPP_POOL_POOLIMPL_H
13#define ZYPP_POOL_POOLIMPL_H
17#include <zypp/base/Easy.h>
18#include <zypp/base/LogTools.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 );
133 if ( pi.status().validate() != vorig )
226 return( slv_r.
id() < mystore.size() ? mystore[slv_r.
id()] :
PoolItem() );
298 MIL <<
"HardLockQueries match " << locked.
size() <<
" Solvables." << endl;
307 MIL <<
"Apply " << newLocks_r.size() <<
" HardLockQueries" << endl;
315 MIL <<
"HardLockQueries match " << locked.
size() <<
" Solvables." << endl;
328 typedef std::unordered_set<IdString> IdentSet;
330 IdentSet removedLocks;
338 addedLocks.insert( it->satSolvable().ident() );
341 removedLocks.insert( it->satSolvable().ident() );
346 bool setChanged =
false;
347 for_( it, removedLocks.begin(), removedLocks.end() )
349 if ( addedLocks.find( *it ) != addedLocks.end() )
351 if ( hardLockQueriesRemove( activeLocks_r, *it ) && ! setChanged )
354 for_( it, addedLocks.begin(), addedLocks.end() )
356 if ( hardLockQueriesAdd( activeLocks_r, *it ) && ! setChanged )
369 bool addedItems =
false;
371 std::list<PoolItem> addedProducts;
386 else if ( reusedIDs || (s && ! pi) )
392 addedProducts.push_back( pi );
403 if ( ! addedProducts.empty() )
405 for_( it, addedProducts.begin(), addedProducts.end() )
407 it->setBuddy( asKind<Product>(*it)->referencePackage() );
437 _id2item.insert( std::make_pair(
id, *it ) );
Provides API related macros.
Integral type with defined initial value when default constructed.
std::string asString() const
IdType id() const
Expert backdoor.
Combining sat::Solvable and ResStatus.
static PoolItem makePoolItem(const sat::Solvable &solvable_r)
PoolItem generator for pool::PoolImpl.
Helper class to collect (not only) PoolQuery results.
size_type size() const
The number of sat::Solvables.
bool contains(sat::Solvable result_r) const
Test whether some item is in the result set.
static const ResKind srcpackage
static const ResKind product
ResPool::instance().proxy();.
Store initial establish status of pseudo installed items.
ResStatus::ValidateValue validateValue(sat::Queue::size_type i) const
ResPool::EstablishedStates::ChangedPseudoInstalled changedPseudoInstalled() const
Return all pseudo installed items whose current state differs from their initial one.
A copy of the Pools initial ValidateValues of pseudo installed items.
std::map< PoolItem, ResStatus::ValidateValue > ChangedPseudoInstalled
Map holding pseudo installed items where current and established status differ.
void setUserLockQueryMatch(bool match_r)
bool isUserLockQueryMatch() const
bool setLock(bool toLock_r, TransactByValue causer_r)
Apply a lock (prevent transaction).
bool isUserLocked() const
Simple serial number watcher.
bool remember(unsigned serial_r) const
Return isDirty, storing serial_r as new value.
Simple serial number provider.
PoolTraits::Id2ItemT Id2ItemT
PoolTraits::size_type size_type
PoolTraits::const_iterator const_iterator
const_iterator begin() const
void reapplyHardLocks() const
PoolItem find(const sat::Solvable &slv_r) const
Return the corresponding PoolItem.
HardLockQueries _hardLockQueries
Set of queries that define hardlocks.
ResPool::EstablishedStates establishedStates() const
True factory for ResPool::EstablishedStates.
Repository reposFind(const std::string &alias_r) const
shared_ptr< ResPoolProxy > _poolProxy
const HardLockQueries & hardLockQueries() const
repository_iterator knownRepositoriesBegin() const
PoolTraits::hardLockQueries_iterator hardLockQueries_iterator
void RestoreState(const ResKind &kind_r)
const SerialNumber & serial() const
Housekeeping data serial number.
friend std::ostream & operator<<(std::ostream &str, const PoolImpl &obj)
DefaultIntegral< bool, true > _id2itemDirty
shared_ptr< EstablishedStatesImpl > _establishedStates
const_iterator end() const
ResPool::EstablishedStates::Impl EstablishedStatesImpl
ResPoolProxy proxy(ResPool self) const
PoolTraits::repository_iterator repository_iterator
sat::detail::SolvableIdType SolvableIdType
DefaultIntegral< bool, true > _storeDirty
void SaveState(const ResKind &kind_r)
PoolTraits::HardLockQueries HardLockQueries
PoolTraits::ItemContainerT ContainerT
void setHardLockQueries(const HardLockQueries &newLocks_r)
SerialNumberWatcher _watcherIDs
Watch sat pools Serial number of IDs - changes whenever resusePoolIDs==true - ResPool must also inval...
const sat::Pool satpool() const
convenience.
SerialNumberWatcher _watcher
Watch sat pools serial number.
bool getHardLockQueries(HardLockQueries &activeLocks_r)
size_type knownRepositoriesSize() const
Forward list of Repositories that contribute ResObjects from sat::Pool.
const Id2ItemT & id2item() const
const ContainerT & store() const
repository_iterator knownRepositoriesEnd() const
const SerialNumber & serialIDs() const
Serial number changing whenever resusePoolIDs==true was used.
RepositoryIterator reposEnd() const
Iterator behind the last Repository.
size_type reposSize() const
Number of repos in Pool.
bool solvablesEmpty() const
Whether Pool contains solvables.
size_type capacity() const
Internal array size for stats only.
RepositoryIterator reposBegin() const
Iterator to the first Repository.
Repository reposFind(const std::string &alias_r) const
Find a Repository named alias_r.
size_type solvablesSize() const
Number of solvables in Pool.
const SerialNumber & serial() const
Housekeeping data serial number.
static Pool instance()
Singleton ctor.
void prepare() const
Update housekeeping data if necessary (e.g.
Libsolv Id queue wrapper.
static const SolvAttr name
A Solvable object within the sat Pool.
IdType id() const
Expert backdoor.
bool isKind(const ResKind &kind_r) const
Test whether a Solvable is of a certain ResKind.
IdString ident() const
The identifier.
String related utilities and Regular expression matching.
int IdType
Generic Id type.
unsigned SolvableIdType
Id type to connect Solvable and sat-solvable.
void establish(sat::Queue &pseudoItems_r, sat::Queue &pseudoFlags_r)
ResPool helper to compute the initial status of Patches etc.
Easy-to use interface to the ZYPP dependency resolver.
filter_iterator< TFilter, typename TContainer::const_iterator > make_filter_begin(TFilter f, const TContainer &c)
Convenience to create filter_iterator from container::begin().
filter_iterator< TFilter, typename TContainer::const_iterator > make_filter_end(TFilter f, const TContainer &c)
Convenience to create filter_iterator from container::end().
Pool internal filter skiping invalid/unwanted PoolItems.
filter_iterator< ByPoolItem, ItemContainerT::const_iterator > const_iterator
std::vector< PoolItem > ItemContainerT
pure items
std::unordered_multimap< sat::detail::IdType, PoolItem > Id2ItemT
ident index
std::list< PoolQuery > HardLockQueries
hard locks from etc/zypp/locks
HardLockQueries::const_iterator hardLockQueries_iterator
ItemContainerT::size_type size_type
Manipulator for ResStatus::UserLockQueryField.
static void setLock(ResStatus &status_r, bool yesno_r)
Set lock and UserLockQuery bit according to yesno_r.
static void reapplyLock(ResStatus &status_r, bool yesno_r)
Update lock and UserLockQuery bit IFF the item gained the bit.
static int diffLock(const ResStatus &status_r)
Test whether the lock status differs from the remembered UserLockQuery bit.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.