libzypp 17.37.17
|
A smart container that manages a collection of MirroredOrigin objects, automatically grouping endpoints and preserving the insertion order of their schemes. More...
#include <zypp-core/MirroredOrigin.h>
Classes | |
struct | Private |
Public Types | |
using | iterator = std::vector<MirroredOrigin>::iterator |
using | const_iterator = std::vector<MirroredOrigin>::const_iterator |
using | size_type = size_t |
using | value_type = MirroredOrigin |
Public Member Functions | |
MirroredOriginSet () | |
MirroredOriginSet (std::vector< OriginEndpoint > eps) | |
Constructs the set, initializing it with a starting list of endpoints. | |
MirroredOriginSet (std::vector< zypp::Url > urls) | |
MirroredOriginSet (std::list< zypp::Url > urls) | |
const MirroredOrigin & | at (size_type idx) const |
Accesses the MirroredOrigin at a specific index. | |
MirroredOrigin & | at (size_type idx) |
Accesses the MirroredOrigin at a specific index. | |
const_iterator | findByUrl (const zypp::Url &url) const |
Finds the MirroredOrigin that contains a specific URL. | |
iterator | findByUrl (const zypp::Url &url) |
Finds the MirroredOrigin that contains a specific URL. | |
template<typename InputIterator> | |
void | addEndpoints (InputIterator first, InputIterator last) |
A convenience method to add multiple endpoints from a range. | |
void | addEndpoint (OriginEndpoint endpoint) |
Adds a single endpoint, routing it to the correct MirroredOrigin. | |
void | addEndpoints (std::vector< OriginEndpoint > endpoints) |
A convenience method to add multiple endpoints from a vector. | |
iterator | begin () |
Returns an iterator to the first MirroredOrigin in insertion order. | |
iterator | end () |
Returns an iterator to the element following the last MirroredOrigin. | |
const_iterator | begin () const |
Returns a const_iterator to the first MirroredOrigin in insertion order. | |
const_iterator | end () const |
Returns a const_iterator to the element following the last MirroredOrigin. | |
size_type | size () const |
Returns the number of MirroredOrigin objects in the set. | |
bool | empty () const |
void | clear () |
bool | hasFallbackUrls () const |
Whether this set contains more than one Url in total (authorities or mirrors). |
Private Attributes | |
RWCOW_pointer< Private > | _pimpl |
A smart container that manages a collection of MirroredOrigin objects, automatically grouping endpoints and preserving the insertion order of their schemes.
This class acts as a high-level manager for data sources. When an OriginEndpoint is added, this set automatically determines its URL scheme (e.g., 'http', 'ftp', 'file') and adds it to the appropriate MirroredOrigin instance. Currently only schemes seen as "downloading" are grouped.
If a MirroredOrigin for a given scheme does not yet exist, it is created automatically, with the first added endpoint for that scheme becoming the authoritative endpoint. Subsequent endpoints for the same scheme are added as mirrors.
Definition at line 325 of file MirroredOrigin.h.
using zypp::MirroredOriginSet::iterator = std::vector<MirroredOrigin>::iterator |
Definition at line 328 of file MirroredOrigin.h.
using zypp::MirroredOriginSet::const_iterator = std::vector<MirroredOrigin>::const_iterator |
Definition at line 329 of file MirroredOrigin.h.
using zypp::MirroredOriginSet::size_type = size_t |
Definition at line 330 of file MirroredOrigin.h.
Definition at line 331 of file MirroredOrigin.h.
zypp::MirroredOriginSet::MirroredOriginSet | ( | ) |
Definition at line 279 of file MirroredOrigin.cc.
zypp::MirroredOriginSet::MirroredOriginSet | ( | std::vector< OriginEndpoint > | eps | ) |
Constructs the set, initializing it with a starting list of endpoints.
eps | A vector of OriginEndpoint objects to add to the set upon construction. The standard grouping logic will be applied to these endpoints. |
Definition at line 283 of file MirroredOrigin.cc.
zypp::MirroredOriginSet::MirroredOriginSet | ( | std::vector< zypp::Url > | urls | ) |
Definition at line 297 of file MirroredOrigin.cc.
zypp::MirroredOriginSet::MirroredOriginSet | ( | std::list< zypp::Url > | urls | ) |
const MirroredOrigin & zypp::MirroredOriginSet::at | ( | size_type | idx | ) | const |
Accesses the MirroredOrigin at a specific index.
idx | The index of the element to return (respects insertion order). |
std::out_of_range | if idx >= size(). |
Definition at line 304 of file MirroredOrigin.cc.
MirroredOrigin & zypp::MirroredOriginSet::at | ( | size_type | idx | ) |
Accesses the MirroredOrigin at a specific index.
idx | The index of the element to return (respects insertion order). |
std::out_of_range | if idx >= size(). |
Definition at line 309 of file MirroredOrigin.cc.
MirroredOriginSet::const_iterator zypp::MirroredOriginSet::findByUrl | ( | const zypp::Url & | url | ) | const |
Finds the MirroredOrigin that contains a specific URL.
This method searches through both the authority and all mirror URLs of every MirroredOrigin in the set.
url | The URL to search for. |
Definition at line 331 of file MirroredOrigin.cc.
MirroredOriginSet::iterator zypp::MirroredOriginSet::findByUrl | ( | const zypp::Url & | url | ) |
Finds the MirroredOrigin that contains a specific URL.
This method searches through both the authority and all mirror URLs of every MirroredOrigin in the set.
url | The URL to search for. |
Definition at line 321 of file MirroredOrigin.cc.
|
inline |
A convenience method to add multiple endpoints from a range.
InputIterator | The type of the iterator for the source range. |
first | An iterator to the beginning of the range of OriginEndpoints to insert. |
last | An iterator to the end of the range of OriginEndpoints to insert. |
Definition at line 387 of file MirroredOrigin.h.
void zypp::MirroredOriginSet::addEndpoint | ( | OriginEndpoint | endpoint | ) |
Adds a single endpoint, routing it to the correct MirroredOrigin.
Extracts the scheme from the endpoint's URL. If a MirroredOrigin for that scheme exists, the endpoint is added as a mirror. Otherwise, a new MirroredOrigin is created with this endpoint as its authority.
endpoint | The OriginEndpoint to add. |
Definition at line 341 of file MirroredOrigin.cc.
void zypp::MirroredOriginSet::addEndpoints | ( | std::vector< OriginEndpoint > | endpoints | ) |
A convenience method to add multiple endpoints from a vector.
endpoints | A vector of OriginEndpoint objects to add. |
Definition at line 359 of file MirroredOrigin.cc.
MirroredOriginSet::iterator zypp::MirroredOriginSet::begin | ( | ) |
Returns an iterator to the first MirroredOrigin in insertion order.
Definition at line 376 of file MirroredOrigin.cc.
MirroredOriginSet::iterator zypp::MirroredOriginSet::end | ( | ) |
Returns an iterator to the element following the last MirroredOrigin.
Definition at line 382 of file MirroredOrigin.cc.
MirroredOriginSet::const_iterator zypp::MirroredOriginSet::begin | ( | ) | const |
Returns a const_iterator to the first MirroredOrigin in insertion order.
Definition at line 388 of file MirroredOrigin.cc.
MirroredOriginSet::const_iterator zypp::MirroredOriginSet::end | ( | ) | const |
Returns a const_iterator to the element following the last MirroredOrigin.
Definition at line 394 of file MirroredOrigin.cc.
MirroredOriginSet::size_type zypp::MirroredOriginSet::size | ( | ) | const |
Returns the number of MirroredOrigin objects in the set.
Definition at line 399 of file MirroredOrigin.cc.
bool zypp::MirroredOriginSet::empty | ( | ) | const |
Definition at line 365 of file MirroredOrigin.cc.
void zypp::MirroredOriginSet::clear | ( | ) |
Definition at line 370 of file MirroredOrigin.cc.
bool zypp::MirroredOriginSet::hasFallbackUrls | ( | ) | const |
Whether this set contains more than one Url in total (authorities or mirrors).
Some parts of the code like to raise an interactive MediaChangeReport only if the Repository itself does not provide any fallbacks.
Definition at line 404 of file MirroredOrigin.cc.
|
private |
Definition at line 436 of file MirroredOrigin.h.