15#include <zypp-core/zyppng/pipelines/Lift>
21#undef ZYPP_BASE_LOGGER_LOGGROUP
22#define ZYPP_BASE_LOGGER_LOGGROUP "zypp::repomanager"
28#define OPT_PROGRESS const ProgressData::ReceiverFnc & = ProgressData::ReceiverFnc()
63 friend Impl * rwcowClone<Impl>(
const Impl * rhs );
66 {
return new Impl( zyppng::SyncContextRef(_ngMgr->zyppContext()),
RepoManagerOptions(_ngMgr->options()) ); }
72 {
return str <<
"RepoManager::Impl"; }
81 : _pimpl( new
Impl(
zyppng::SyncContext::defaultContext(),
std::move(opt)) )
113 std::string host( url_r.
getHost() );
114 if ( ! host.empty() )
static Date now()
Return the current time.
std::string digest()
get hex string representation of the digest
static const std::string & sha1()
sha1
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
What is known about a repository.
urls_size_type baseUrlsSize() const
number of repository urls
void setPackagesPath(const Pathname &path)
set the path where the local packages are stored
void setMetadataPath(const Pathname &path)
Set the path where the local metadata is stored.
creates and provides information about known sources.
bool hasRepo(const std::string &alias) const
Return whether there is a known repository for alias.
void cleanCacheDirGarbage(const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Remove any subdirectories of cache directories which no longer belong to any of known repositories.
friend std::ostream & operator<<(std::ostream &str, const RepoManager &obj)
void cleanMetadata(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Clean local metadata.
bool serviceEmpty() const
Gets true if no service is in RepoManager (so no one in specified location)
bool hasService(const std::string &alias) const
Return whether there is a known service for alias.
ServiceSet::const_iterator ServiceConstIterator
void addService(const std::string &alias, const Url &url)
Adds a new service by its alias and URL.
bool isCached(const RepoInfo &info) const
Whether a repository exists in cache.
void removeService(const std::string &alias)
Removes service specified by its name.
RepoInfo getRepo(const std::string &alias) const
Find RepoInfo by alias or return RepoInfo::noRepo.
repo::ServiceType probeService(const Url &url) const
Probe the type or the service.
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
void cleanCache(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
clean local cache
void refreshServices(const RefreshServiceOptions &options_r=RefreshServiceOptions())
Refreshes all enabled services.
void addRepository(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Adds a repository to the list of known repositories.
Pathname metadataPath(const RepoInfo &info) const
Path where the metadata is downloaded and kept.
ServiceSet::size_type ServiceSizeType
Pathname packagesPath(const RepoInfo &info) const
Path where the rpm packages are downloaded and kept.
RepoStatus cacheStatus(const RepoInfo &info) const
Status of metadata cache.
void addRepositories(const Url &url, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Adds repositores from a repo file to the list of known repositories.
void refreshMetadata(const RepoInfo &info, RawMetadataRefreshPolicy policy=RefreshIfNeeded, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Refresh local raw cache.
void refreshGeoIp(const RepoInfo::url_set &urls)
void refreshService(const std::string &alias, const RefreshServiceOptions &options_r=RefreshServiceOptions())
Refresh specific service.
ServiceConstIterator serviceEnd() const
Iterator to place behind last service in internal storage.
ServiceConstIterator serviceBegin() const
Iterator to first service in internal storage.
RepoSizeType repoSize() const
void modifyRepository(const std::string &alias, const RepoInfo &newinfo, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Modify repository attributes.
void removeRepository(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Remove the best matching repository from known repos list.
RepoInfo getRepositoryInfo(const std::string &alias, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Find a matching repository info.
ServiceSizeType serviceSize() const
Gets count of service in RepoManager (in specified location)
ServiceInfo getService(const std::string &alias) const
Finds ServiceInfo by alias or return ServiceInfo::noService.
RefreshCheckStatus checkIfToRefreshMetadata(const RepoInfo &info, const Url &url, RawMetadataRefreshPolicy policy=RefreshIfNeeded)
Checks whether to refresh metadata for specified repository and url.
RepoSet::size_type RepoSizeType
RepoConstIterator repoBegin() const
void buildCache(const RepoInfo &info, CacheBuildPolicy policy=BuildIfNeeded, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Refresh local cache.
RepoManagerFlags::RefreshServiceFlags RefreshServiceOptions
Options tuning RefreshService.
RepoManager(RepoManagerOptions options=RepoManagerOptions())
void loadFromCache(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Load resolvables into the pool.
void cleanPackages(const RepoInfo &info, const ProgressData::ReceiverFnc &progressrcv=ProgressData::ReceiverFnc())
Clean local package cache.
RepoConstIterator repoEnd() const
RepoStatus metadataStatus(const RepoInfo &info) const
Status of local metadata.
void modifyService(const std::string &oldAlias, const ServiceInfo &service)
Modifies service file (rewrites it with new values) and underlying repositories if needed.
RepoSet::const_iterator RepoConstIterator
static std::string makeStupidAlias(const Url &url_r=Url())
Some stupid string but suitable as alias for your url if nothing better is available.
repo::RepoType probe(const Url &url, const Pathname &path) const
Probe repo metadata type.
Track changing files or directories.
std::string getScheme() const
Returns the scheme name of the URL.
std::string asCompleteString() const
Returns a complete string representation of the Url object.
std::string getHost(EEncoding eflag=zypp::url::E_DECODED) const
Returns the hostname or IP from the URL authority.
void setFilepath(const Pathname &filename)
set the path to the .repo file
Pathname filepath() const
File where this repo was read from.
The RepoManager class Provides knowledge and methods to maintain repo settings and metadata for a giv...
expected< RepoStatus > cacheStatus(const RepoInfo &info) const
expected< void > refreshServices(const RefreshServiceOptions &options_r)
RepoInfo getRepo(const std::string &alias) const
bool serviceEmpty() const
expected< void > refreshMetadata(const RepoInfo &info, RawMetadataRefreshPolicy policy, ProgressObserverRef myProgress=nullptr)
Refresh local raw cache.
expected< void > modifyService(const std::string &oldAlias, const ServiceInfo &newService)
ServiceConstIterator serviceBegin() const
RepoConstIterator repoBegin() const
expected< zypp::Pathname > metadataPath(const RepoInfo &info) const
expected< void > addService(const ServiceInfo &service)
expected< void > refreshGeoIp(const RepoInfo::url_set &urls)
expected< void > removeService(const std::string &alias)
expected< void > cleanPackages(const RepoInfo &info, ProgressObserverRef myProgress=nullptr, bool isAutoClean=false)
ServiceSizeType serviceSize() const
expected< RepoInfo > getRepositoryInfo(const std::string &alias)
expected< RepoInfo > modifyRepository(const std::string &alias, const RepoInfo &newinfo_r, ProgressObserverRef myProgress=nullptr)
expected< zypp::repo::RepoType > probe(const zypp::Url &url, const zypp::Pathname &path=zypp::Pathname()) const
Probe the metadata type of a repository located at url.
RepoSizeType repoSize() const
expected< void > cleanCacheDirGarbage(ProgressObserverRef myProgress=nullptr)
expected< RefreshCheckStatus > checkIfToRefreshMetadata(const RepoInfo &info, const zypp::Url &url, RawMetadataRefreshPolicy policy)
bool hasRepo(const std::string &alias) const
expected< RepoInfo > addRepository(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
RepoConstIterator repoEnd() const
expected< zypp::repo::ServiceType > probeService(const zypp::Url &url) const
bool hasService(const std::string &alias) const
expected< void > buildCache(const RepoInfo &info, CacheBuildPolicy policy, ProgressObserverRef myProgress=nullptr)
expected< zypp::Pathname > packagesPath(const RepoInfo &info) const
ServiceInfo getService(const std::string &alias) const
expected< void > addRepositories(const zypp::Url &url, ProgressObserverRef myProgress=nullptr)
static expected< std::shared_ptr< RepoManager< ZyppContextRefType > > > create(Args &&...args)
expected< void > cleanCache(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
expected< void > loadFromCache(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
expected< bool > isCached(const RepoInfo &info) const
expected< void > cleanMetadata(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
static expected< RepoStatus > metadataStatus(const RepoInfo &info, const RepoManagerOptions &options)
expected< void > removeRepository(const RepoInfo &info, ProgressObserverRef myProgress=nullptr)
expected< void > refreshService(const std::string &alias, const RefreshServiceOptions &options_r)
const RepoManagerOptions & options() const
ServiceConstIterator serviceEnd() const
static SyncContextRef defaultContext()
String related utilities and Regular expression matching.
RefreshCheckStatus
Possibly return state of RepoManager::checkIfToRefreshMetadata function.
std::string hexstring(char n, int w=4)
Easy-to use interface to the ZYPP dependency resolver.
std::list< RepoInfo > readRepoFile(const Url &repo_file)
Parses repo_file and returns a list of RepoInfo objects corresponding to repositories found within th...
AsyncOpRef< expected< std::list< RepoInfo > > > readRepoFile(ContextRef ctx, zypp::Url repoFileUrl)
expected< zypp::Pathname > rawcache_path_for_repoinfo(const RepoManagerOptions &opt, const RepoInfo &info)
Calculates the raw cache path for a repository, this is usually /var/cache/zypp/alias.
RepoManagerRef< SyncContextRef > SyncRepoManagerRef
expected< zypp::Pathname > packagescache_path_for_repoinfo(const RepoManagerOptions &opt, const RepoInfo &info)
Calculates the packages cache path for a repository.
RepoManager implementation.
Impl & operator=(const Impl &)=delete
Impl(zyppng::SyncContextRef &&ctx, RepoManagerOptions &&opt)
zyppng::SyncRepoManager & ngMgr()
zyppng::SyncRepoManagerRef _ngMgr
Impl(const Impl &)=delete
std::ostream & operator<<(std::ostream &str, const RepoManager::Impl &obj)
Stream output.
Impl * clone() const
clone for RWCOW_pointer
Impl & operator=(Impl &&)=delete
const zyppng::SyncRepoManager & ngMgr() const
Repository type enumeration.
Service type enumeration.
Url::asString() view options.