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 std::string snapshotCookie( const Pathname & path_r );
166 static bool snapshotMapped();
170 void setSnapshotCandidate( const Pathname & path_r, const std::string & cookie_r, const std::vector<std::string> & aliases_r );
172
173 public:
180 Repository addRepoHelix( const Pathname & file_r, const std::string & name_r );
182 Repository addRepoHelix( const Pathname & file_r );
186 Repository addRepoHelix( const Pathname & file_r, const RepoInfo & info_r );
187
188 public:
190 bool solvablesEmpty() const;
191
193 size_type solvablesSize() const;
194
196 SolvableIterator solvablesBegin() const;
197
199 SolvableIterator solvablesEnd() const;
200
204
205 public:
208 template<class TFilter>
210 { return make_filter_iterator( filter_r, solvablesBegin(), solvablesEnd() ); }
211
212 template<class TFilter>
213 filter_iterator<TFilter,SolvableIterator> filterEnd( const TFilter & filter_r ) const
214 { return make_filter_iterator( filter_r, solvablesEnd(), solvablesEnd() ); }
215
216
217 public:
220 { return WhatProvides( cap_r ); }
221
222 Queue whatMatchesDep( const SolvAttr &attr, const Capability &cap ) const;
223 Queue whatMatchesSolvable ( const SolvAttr &attr, const Solvable &solv ) const;
224 Queue whatContainsDep ( const SolvAttr &attr, const Capability &cap ) const;
225
226 public:
229
232 void setTextLocale( const Locale & locale_r );
233
238 void setRequestedLocales( const LocaleSet & locales_r );
239
243 bool addRequestedLocale( const Locale & locale_r );
244
248 bool eraseRequestedLocale( const Locale & locale_r );
249
253 const LocaleSet & getRequestedLocales() const;
254
256 bool isRequestedLocale( const Locale & locale_r ) const;
257
258
260 void initRequestedLocales( const LocaleSet & locales_r );
261
263 const LocaleSet & getAddedRequestedLocales() const;
264
266 const LocaleSet & getRemovedRequestedLocales() const;
267
268
273 const LocaleSet & getAvailableLocales() const;
274
276 bool isAvailableLocale( const Locale & locale_r ) const;
278
279 public:
287 const MultiversionList & multiversion() const;
289 ZYPP_DEPRECATED bool multiversionEmpty() const { return multiversion().empty(); }
291
292 public:
295
296 Queue autoInstalled() const;
298 void setAutoInstalled( const Queue & autoInstalled_r );
300
301 public:
304
305 void setNeedrebootSpec( sat::SolvableSpec needrebootSpec_r );
307
308 public:
310 detail::CPool * get() const;
311 private:
313 Pool() {}
314 };
315
316
318 std::ostream & operator<<( std::ostream & str, const Pool & obj ) ZYPP_API;
319
321 inline bool operator==( const Pool & lhs, const Pool & rhs )
322 { return lhs.get() == rhs.get(); }
323
325 inline bool operator!=( const Pool & lhs, const Pool & rhs )
326 { return lhs.get() != rhs.get(); }
327
329 void updateSolvFileIndex( const Pathname & solvfile_r );
330
332 } // namespace sat
335} // namespace zypp
337#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.
Global sat-pool.
Definition Pool.h:48
filter_iterator< TFilter, SolvableIterator > filterEnd(const TFilter &filter_r) const
Definition Pool.h:213
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:325
Iterable< RepositoryIterator > repos() const
Iterate the repositories.
Definition Pool.h:96
Pool()
Default ctor.
Definition Pool.h:313
WhatProvides whatProvides(Capability cap_r) const
Conainer of all Solvable providing cap_r.
Definition Pool.h:219
filter_iterator< TFilter, SolvableIterator > filterBegin(const TFilter &filter_r) const
Definition Pool.h:209
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:202
SolvableSet MultiversionList
Definition Pool.h:286
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
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:289
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
std::ostream & operator<<(std::ostream &str, const FileConflicts &obj)
relates: FileConflicts Stream output
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:350
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
Backlink to the associated PoolImpl.
Definition PoolMember.h:53