libzypp  17.7.0
Pool.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_SAT_POOL_H
13 #define ZYPP_SAT_POOL_H
14 
15 #include <iosfwd>
16 
17 #include "zypp/Pathname.h"
18 
20 #include "zypp/Repository.h"
21 #include "zypp/sat/WhatProvides.h"
22 #include "zypp/sat/SolvableSet.h"
23 #include "zypp/sat/Queue.h"
24 
26 namespace zypp
27 {
28 
29  class SerialNumber;
30  class RepoInfo;
31 
33  namespace sat
34  {
35 
37  //
38  // CLASS NAME : Pool
39  //
44  class Pool : protected detail::PoolMember
45  {
46  public:
50 
51  public:
53  static Pool instance()
54  { return Pool(); }
55 
58  {}
59 
60  public:
62  size_type capacity() const;
63 
65  const SerialNumber & serial() const;
66 
68  const SerialNumber & serialIDs() const;
69 
71  void prepare() const;
72 
74  Pathname rootDir() const;
75 
77  void rootDir( const Pathname & root_r );
78 
79  public:
81  bool reposEmpty() const;
82 
84  size_type reposSize() const;
85 
88 
91 
94  { return makeIterable( reposBegin(), reposEnd() ); }
95 
100  Repository reposInsert( const std::string & alias_r );
101 
105  Repository reposFind( const std::string & alias_r ) const;
106 
110  void reposErase( const std::string & alias_r )
111  { reposFind( alias_r ).eraseFromPool(); }
112 
118  { while ( ! reposEmpty() ) reposErase( reposBegin()->alias() ); }
119 
120  public:
122  static const std::string & systemRepoAlias();
123 
125  Repository findSystemRepo() const;
126 
129 
130  public:
136  Repository addRepoSolv( const Pathname & file_r, const std::string & name_r );
138  Repository addRepoSolv( const Pathname & file_r );
142  Repository addRepoSolv( const Pathname & file_r, const RepoInfo & info_r );
143 
144  public:
151  Repository addRepoHelix( const Pathname & file_r, const std::string & name_r );
153  Repository addRepoHelix( const Pathname & file_r );
157  Repository addRepoHelix( const Pathname & file_r, const RepoInfo & info_r );
158 
159  public:
161  bool solvablesEmpty() const;
162 
164  size_type solvablesSize() const;
165 
168 
171 
174  { return makeIterable( solvablesBegin(), solvablesEnd() ); }
175 
176  public:
179  template<class TFilter>
180  filter_iterator<TFilter,SolvableIterator> filterBegin( const TFilter & filter_r ) const
181  { return make_filter_iterator( filter_r, solvablesBegin(), solvablesEnd() ); }
182 
183  template<class TFilter>
184  filter_iterator<TFilter,SolvableIterator> filterEnd( const TFilter & filter_r ) const
185  { return make_filter_iterator( filter_r, solvablesEnd(), solvablesEnd() ); }
187 
188  public:
191  { return WhatProvides( cap_r ); }
192 
193  public:
199  void setTextLocale( const Locale & locale_r );
200 
205  void setRequestedLocales( const LocaleSet & locales_r );
206 
210  bool addRequestedLocale( const Locale & locale_r );
211 
215  bool eraseRequestedLocale( const Locale & locale_r );
216 
220  const LocaleSet & getRequestedLocales() const;
221 
223  bool isRequestedLocale( const Locale & locale_r ) const;
224 
225 
227  void initRequestedLocales( const LocaleSet & locales_r );
228 
230  const LocaleSet & getAddedRequestedLocales() const;
231 
233  const LocaleSet & getRemovedRequestedLocales() const;
234 
235 
240  const LocaleSet & getAvailableLocales() const;
241 
243  bool isAvailableLocale( const Locale & locale_r ) const;
245 
246  public:
254  const MultiversionList & multiversion() const;
258 
259  public:
263  Queue autoInstalled() const;
265  void setAutoInstalled( const Queue & autoInstalled_r );
267 
268  public:
270  detail::CPool * get() const;
271  private:
273  Pool() {}
274  };
276 
278  std::ostream & operator<<( std::ostream & str, const Pool & obj );
279 
281  inline bool operator==( const Pool & lhs, const Pool & rhs )
282  { return lhs.get() == rhs.get(); }
283 
285  inline bool operator!=( const Pool & lhs, const Pool & rhs )
286  { return lhs.get() != rhs.get(); }
287 
289  void updateSolvFileIndex( const Pathname & solvfile_r );
290 
292  } // namespace sat
295 } // namespace zypp
297 #endif // ZYPP_SAT_POOL_H
Repository reposInsert(const std::string &alias_r)
Return a Repository named alias_r.
Definition: Pool.cc:122
Container of Solvable providing a Capability (read only).
Definition: WhatProvides.h:87
const LocaleSet & getAddedRequestedLocales() const
Added since last initRequestedLocales.
Definition: Pool.cc:231
void setRequestedLocales(const LocaleSet &locales_r)
Set the requested locales.
Definition: Pool.cc:215
bool reposEmpty() const
Whether Pool contains repos.
Definition: Pool.cc:70
ZYPP_DEPRECATED bool multiversionEmpty() const
Definition: Pool.h:256
void setTextLocale(const Locale &locale_r)
Set the default language for retrieving translated texts.
Definition: Pool.cc:212
void reposEraseAll()
Remove all repos from the pool.
Definition: Pool.h:117
SolvableIterator solvablesBegin() const
Iterator to the first Solvable.
Definition: Pool.cc:116
bool isAvailableLocale(const Locale &locale_r) const
Whether this Locale is in the set of available locales.
Definition: Pool.cc:237
std::ostream & operator<<(std::ostream &str, const FileConflicts &obj)
::_Pool CPool
Wrapped libsolv C data type exposed as backdoor.
Definition: PoolMember.h:61
RepositoryIterator reposEnd() const
Iterator behind the last Repository.
Definition: Pool.cc:87
String related utilities and Regular expression matching.
void setAutoInstalled(const Queue &autoInstalled_r)
Set ident list of all autoinstalled solvables.
Definition: Pool.cc:244
What is known about a repository.
Definition: RepoInfo.h:71
bool operator==(const Pool &lhs, const Pool &rhs)
Definition: Pool.h:281
Repository addRepoHelix(const Pathname &file_r, const std::string &name_r)
Load Solvables from a helix-file into a Repository named name_r.
Definition: Pool.cc:188
filter_iterator< TFilter, SolvableIterator > filterEnd(const TFilter &filter_r) const
Definition: Pool.h:184
void reposErase(const std::string &alias_r)
Remove a Repository named alias_r.
Definition: Pool.h:110
size_type capacity() const
Internal array size for stats only.
Definition: Pool.cc:52
WhatProvides whatProvides(Capability cap_r) const
Conainer of all Solvable providing cap_r.
Definition: Pool.h:190
size_type reposSize() const
Number of repos in Pool.
Definition: Pool.cc:73
const LocaleSet & getAvailableLocales() const
Get the set of available locales.
Definition: Pool.cc:234
Repository systemRepo()
Return the system repository, create it if missing.
Definition: Pool.cc:157
void prepare() const
Update housekeeping data if necessary (e.g.
Definition: Pool.cc:61
void initRequestedLocales(const LocaleSet &locales_r)
Start tracking changes based on this locales_r.
Definition: Pool.cc:230
Pool(const detail::PoolMember &)
Ctor from PoolMember.
Definition: Pool.h:57
static Pool instance()
Singleton ctor.
Definition: Pool.h:53
Backlink to the associated PoolImpl.
Definition: PoolMember.h:88
static const std::string & systemRepoAlias()
Reserved system repository alias .
Definition: Pool.cc:46
filter_iterator< TFilter, SolvableIterator > filterBegin(const TFilter &filter_r) const
Definition: Pool.h:180
zypp::detail::RepositoryIterator RepositoryIterator
Definition: Pool.h:48
Pathname rootDir() const
Get rootdir (for file conflicts check)
Definition: Pool.cc:64
detail::CPool * get() const
Expert backdoor.
Definition: Pool.cc:49
bool empty() const
Whether the set is epmty.
Definition: SolvableSet.h:59
void updateSolvFileIndex(const Pathname &solvfile_r)
Create solv file content digest for zypper bash completion.
Definition: Pool.cc:263
const SerialNumber & serial() const
Housekeeping data serial number.
Definition: Pool.cc:55
size_type solvablesSize() const
Number of solvables in Pool.
Definition: Pool.cc:103
detail::SolvableIterator SolvableIterator
Definition: Pool.h:47
const LocaleSet & getRequestedLocales() const
Return the requested locales.
Definition: Pool.cc:224
Iterable< SolvableIterator > solvables() const
Iterate the solvables.
Definition: Pool.h:173
bool addRequestedLocale(const Locale &locale_r)
Add one Locale to the set of requested locales.
Definition: Pool.cc:218
RepositoryIterator reposBegin() const
Iterator to the first Repository.
Definition: Pool.cc:76
bool solvablesEmpty() const
Whether Pool contains solvables.
Definition: Pool.cc:90
SolvableIdType size_type
Definition: PoolMember.h:126
Simple serial number provider.
Definition: SerialNumber.h:44
const MultiversionList & multiversion() const
Definition: Pool.cc:240
&#39;Language[_Country]&#39; codes.
Definition: Locale.h:49
Libsolv Id queue wrapper.
Definition: Queue.h:34
Queue autoInstalled() const
Get ident list of all autoinstalled solvables.
Definition: Pool.cc:243
Repository reposFind(const std::string &alias_r) const
Find a Repository named alias_r.
Definition: Pool.cc:142
const LocaleSet & getRemovedRequestedLocales() const
Removed since last initRequestedLocales.
Definition: Pool.cc:232
SolvableIterator solvablesEnd() const
Iterator behind the last Solvable.
Definition: Pool.cc:119
detail::size_type size_type
Definition: Pool.h:49
Pool()
Default ctor.
Definition: Pool.h:273
Repository findSystemRepo() const
Return the system repository if it is on the pool.
Definition: Pool.cc:152
A sat capability.
Definition: Capability.h:59
void eraseFromPool()
Remove this Repository from it&#39;s Pool.
Definition: Repository.cc:297
Global sat-pool.
Definition: Pool.h:44
const SerialNumber & serialIDs() const
Serial number changing whenever resusePoolIDs==true was used.
Definition: Pool.cc:58
bool operator!=(const Pool &lhs, const Pool &rhs)
Definition: Pool.h:285
Repository addRepoSolv(const Pathname &file_r, const std::string &name_r)
Load Solvables from a solv-file into a Repository named name_r.
Definition: Pool.cc:164
#define ZYPP_DEPRECATED
The ZYPP_DEPRECATED macro can be used to trigger compile-time warnings with gcc >= 3...
Definition: APIConfig.h:88
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
Iterable< RepositoryIterator > repos() const
Iterate the repositories.
Definition: Pool.h:93
bool isRequestedLocale(const Locale &locale_r) const
Whether this Locale is in the set of requested locales.
Definition: Pool.cc:227
bool eraseRequestedLocale(const Locale &locale_r)
Erase one Locale from the set of requested locales.
Definition: Pool.cc:221
std::unordered_set< Locale > LocaleSet
Definition: Locale.h:27
SolvableSet MultiversionList
Definition: Pool.h:253
Solvable set wrapper to allow adding additional convenience iterators.
Definition: SolvableSet.h:35