libzypp 17.38.15
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#include <vector>
17
18#include <zypp-core/Pathname.h>
19
21#include <zypp/Repository.h>
24#include <zypp/sat/Queue.h>
25
27namespace zypp
28{
29
30 class SerialNumber;
31 class RepoInfo;
32
34 namespace sat
35 {
36
37 class SolvableSpec;
38
40 //
41 // CLASS NAME : Pool
42 //
48 {
49 public:
53
54 public:
56 static Pool instance()
57 { return Pool(); }
58
61 {}
62
63 public:
65 size_type capacity() const;
66
68 const SerialNumber & serial() const;
69
71 const SerialNumber & serialIDs() const;
72
74 void prepare() const;
75
77 Pathname rootDir() const;
78
80 void rootDir( const Pathname & root_r );
81
82 public:
84 bool reposEmpty() const;
85
87 size_type reposSize() const;
88
90 RepositoryIterator reposBegin() const;
91
93 RepositoryIterator reposEnd() const;
94
98
103 Repository reposInsert( const std::string & alias_r );
104
108 Repository reposFind( const std::string & alias_r ) const;
109
113 void reposErase( const std::string & alias_r )
114 { reposFind( alias_r ).eraseFromPool(); }
115
121 { while ( ! reposEmpty() ) reposErase( reposBegin()->alias() ); }
122
123 public:
125 static const std::string & systemRepoAlias();
126
128 Repository findSystemRepo() const;
129
131 Repository systemRepo();
132
133 public:
139 Repository addRepoSolv( const Pathname & file_r, const std::string & name_r );
141 Repository addRepoSolv( const Pathname & file_r );
145 Repository addRepoSolv( const Pathname & file_r, const RepoInfo & info_r );
146
151 void reserveIds( unsigned numid_r, unsigned numrel_r );
152
161 bool mapSnapshot( const Pathname & path_r, const std::string & cookie_r );
162 bool writeSnapshot( const Pathname & path_r, const std::string & cookie_r ) const;
164 static bool snapshotMapped();
175 void setSnapshotCandidate( const Pathname & path_r, const std::string & cookie_r, const std::vector<std::string> & aliases_r );
189
190
191 public:
198 Repository addRepoHelix( const Pathname & file_r, const std::string & name_r );
200 Repository addRepoHelix( const Pathname & file_r );
204 Repository addRepoHelix( const Pathname & file_r, const RepoInfo & info_r );
205
206 public:
208 bool solvablesEmpty() const;
209
211 size_type solvablesSize() const;
212
215
218
222
223 public:
226 template<class TFilter>
228 { return make_filter_iterator( filter_r, solvablesBegin(), solvablesEnd() ); }
229
230 template<class TFilter>
231 filter_iterator<TFilter,SolvableIterator> filterEnd( const TFilter & filter_r ) const
232 { return make_filter_iterator( filter_r, solvablesEnd(), solvablesEnd() ); }
233
234
235 public:
238 { return WhatProvides( cap_r ); }
239
240 Queue whatMatchesDep( const SolvAttr &attr, const Capability &cap ) const;
241 Queue whatMatchesSolvable ( const SolvAttr &attr, const Solvable &solv ) const;
242 Queue whatContainsDep ( const SolvAttr &attr, const Capability &cap ) const;
243
244 public:
247
250 void setTextLocale( const Locale & locale_r );
251
256 void setRequestedLocales( const LocaleSet & locales_r );
257
261 bool addRequestedLocale( const Locale & locale_r );
262
266 bool eraseRequestedLocale( const Locale & locale_r );
267
271 const LocaleSet & getRequestedLocales() const;
272
274 bool isRequestedLocale( const Locale & locale_r ) const;
275
276
278 void initRequestedLocales( const LocaleSet & locales_r );
279
281 const LocaleSet & getAddedRequestedLocales() const;
282
284 const LocaleSet & getRemovedRequestedLocales() const;
285
286
291 const LocaleSet & getAvailableLocales() const;
292
294 bool isAvailableLocale( const Locale & locale_r ) const;
296
297 public:
305 const MultiversionList & multiversion() const;
307 ZYPP_DEPRECATED bool multiversionEmpty() const { return multiversion().empty(); }
309
310 public:
313
314 Queue autoInstalled() const;
316 void setAutoInstalled( const Queue & autoInstalled_r );
318
319 public:
322
323 void setNeedrebootSpec( sat::SolvableSpec needrebootSpec_r );
325
326 public:
328 detail::CPool * get() const;
329 private:
331 Pool() {}
332 };
333
334
336 std::ostream & operator<<( std::ostream & str, const Pool & obj ) ZYPP_API;
337
339 inline bool operator==( const Pool & lhs, const Pool & rhs )
340 { return lhs.get() == rhs.get(); }
341
343 inline bool operator!=( const Pool & lhs, const Pool & rhs )
344 { return lhs.get() != rhs.get(); }
345
347 void updateSolvFileIndex( const Pathname & solvfile_r );
348
350 } // namespace sat
353} // namespace zypp
355#endif // ZYPP_SAT_POOL_H
#define ZYPP_DEPRECATED
The ZYPP_DEPRECATED macro can be used to trigger compile-time warnings with gcc >= 3....
Definition Globals.h:117
An iterator over the subset of elements of some sequence which satisfy a given predicate.
A sat capability.
Definition Capability.h:63
'Language[_Country]' codes.
Definition Locale.h:51
What is known about a repository.
Definition RepoInfo.h:72
Simple serial number provider.
ClaimingSnapshotRepos & operator=(const ClaimingSnapshotRepos &)=delete
ClaimingSnapshotRepos(const ClaimingSnapshotRepos &)=delete
Global sat-pool.
Definition Pool.h:48
filter_iterator< TFilter, SolvableIterator > filterEnd(const TFilter &filter_r) const
Definition Pool.h:231
Pool(const detail::PoolMember &)
Ctor from PoolMember.
Definition Pool.h:60
RepositoryIterator reposEnd() const
Iterator behind the last Repository.
Definition Pool.cc:90
detail::SolvableIterator SolvableIterator
Definition Pool.h:50
const MultiversionList & multiversion() const
Definition Pool.cc:324
Iterable< RepositoryIterator > repos() const
Iterate the repositories.
Definition Pool.h:96
Pool()
Default ctor.
Definition Pool.h:331
bool solvablesEmpty() const
Whether Pool contains solvables.
Definition Pool.cc:93
WhatProvides whatProvides(Capability cap_r) const
Conainer of all Solvable providing cap_r.
Definition Pool.h:237
filter_iterator< TFilter, SolvableIterator > filterBegin(const TFilter &filter_r) const
Definition Pool.h:227
void reposErase(const std::string &alias_r)
Remove a Repository named alias_r.
Definition Pool.h:113
SolvableIterator solvablesEnd() const
Iterator behind the last Solvable.
Definition Pool.cc:122
Iterable< SolvableIterator > solvables() const
Iterate the solvables.
Definition Pool.h:220
SolvableSet MultiversionList
Definition Pool.h:304
detail::size_type size_type
Definition Pool.h:52
RepositoryIterator reposBegin() const
Iterator to the first Repository.
Definition Pool.cc:79
Repository reposFind(const std::string &alias_r) const
Find a Repository named alias_r.
Definition Pool.cc:166
size_type solvablesSize() const
Number of solvables in Pool.
Definition Pool.cc:106
void reposEraseAll()
Remove all repos from the pool.
Definition Pool.h:120
static Pool instance()
Singleton ctor.
Definition Pool.h:56
ZYPP_DEPRECATED bool multiversionEmpty() const
Definition Pool.h:307
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:272
zypp::detail::RepositoryIterator RepositoryIterator
Definition Pool.h:51
SolvableIterator solvablesBegin() const
Iterator to the first Solvable.
Definition Pool.cc:119
detail::CPool * get() const
Expert backdoor.
Definition Pool.cc:52
bool reposEmpty() const
Whether Pool contains repos.
Definition Pool.cc:73
Libsolv Id queue wrapper.
Definition Queue.h:36
Solvable attribute keys.
Definition SolvAttr.h:41
Solvable set wrapper to allow adding additional convenience iterators.
Definition SolvableSet.h:36
A Solvable object within the sat Pool.
Definition Solvable.h:54
Container of Solvable providing a Capability (read only).
Iterate over valid Solvables in the pool.
Definition Solvable.h:552
String related utilities and Regular expression matching.
SolvableIdType size_type
Definition PoolDefines.h:66
::s_Pool CPool
Wrapped libsolv C data type exposed as backdoor.
Definition PoolDefines.h:36
Libsolv interface
bool operator!=(const FileConflicts &lhs, const FileConflicts &rhs)
relates: FileConflicts
bool operator==(const FileConflicts &lhs, const FileConflicts &rhs)
relates: FileConflicts
void updateSolvFileIndex(const Pathname &solvfile_r)
Create solv file content digest for zypper bash completion.
Definition Pool.cc:349
Easy-to use interface to the ZYPP dependency resolver.
Iterable< TIterator > makeIterable(TIterator &&begin_r, TIterator &&end_r)
relates: Iterable convenient construction.
Definition Iterable.h:88
std::unordered_set< Locale > LocaleSet
Definition Locale.h:29
const Arch Arch_empty ZYPP_API
relates: Arch This is an empty Arch represented by an empty string.
Definition Arch.h:173
std::ostream & operator<<(std::ostream &str, const Capabilities &obj)
relates: Capabilities Stream output
Backlink to the associated PoolImpl.
Definition PoolMember.h:53