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() 
   72  { 
return str << 
"RepoManager::Impl"; }
 
 
   88  { 
return _pimpl->ngMgr().repoEmpty(); }
 
 
   91  { 
return _pimpl->ngMgr().repoSize(); }
 
 
   94  { 
return _pimpl->ngMgr().repoBegin(); }
 
 
   97  { 
return _pimpl->ngMgr().repoEnd(); }
 
 
  100  { 
return _pimpl->ngMgr().getRepo( alias ); }
 
 
  103  { 
return _pimpl->ngMgr().hasRepo( alias ); }
 
 
  113    std::string host( url_r.
getHost() );
 
  114    if ( ! host.empty() )
 
 
  126  { 
return _pimpl->ngMgr().metadataStatus( info ).unwrap(); }
 
 
  129  { 
return _pimpl->ngMgr().checkIfToRefreshMetadata( info, origin, policy ).unwrap(); }
 
 
  132  { 
return _pimpl->ngMgr().checkIfToRefreshMetadata( info, 
url, policy ).unwrap(); }
 
 
  135  { 
return _pimpl->ngMgr().metadataPath( info ).unwrap(); }
 
 
  138  { 
return _pimpl->ngMgr().packagesPath( info ).unwrap(); }
 
 
  144    return _pimpl->ngMgr().refreshMetadata( info, policy, 
nullptr ).unwrap();
 
 
  148  { 
return _pimpl->ngMgr().cleanMetadata( info, 
nullptr ).unwrap(); }
 
 
  151  { 
return _pimpl->ngMgr().cleanPackages( info, 
nullptr ).unwrap(); }
 
 
  154  { 
return _pimpl->ngMgr().cacheStatus( info ).unwrap(); }
 
 
  160    return _pimpl->ngMgr().buildCache( info, policy, adapt.observer() ).unwrap();
 
 
  164  { 
return _pimpl->ngMgr().cleanCache( info, 
nullptr ).unwrap(); }
 
 
  167  { 
return _pimpl->ngMgr().isCached( info ).unwrap(); }
 
 
  170  { 
return _pimpl->ngMgr().loadFromCache( info, 
nullptr ).unwrap(); }
 
 
  173  { 
return _pimpl->ngMgr().cleanCacheDirGarbage( 
nullptr ).unwrap(); }
 
 
  176  { 
return _pimpl->ngMgr().probe( {
url}, path ).unwrap(); }
 
 
  179  { 
return _pimpl->ngMgr().probe( {
url} ).unwrap(); }
 
 
  185    RepoInfo updatedRepo = 
_pimpl->ngMgr().addRepository( info, adapt.observer(), forcedProbe ).unwrap();
 
 
  199  { 
return _pimpl->ngMgr().addRepositories( 
url, 
nullptr ).unwrap(); }
 
 
  205    return _pimpl->ngMgr().removeRepository( info, adapt.observer() ).unwrap();
 
 
  210    RepoInfo updated = 
_pimpl->ngMgr().modifyRepository( alias, newinfo, 
nullptr ).unwrap();
 
 
  220  { 
return _pimpl->ngMgr().getRepositoryInfo( alias ).unwrap(); }
 
 
  223  { 
return _pimpl->ngMgr().getRepositoryInfo( 
url, urlview ).unwrap(); }
 
 
  226  { 
return _pimpl->ngMgr().serviceEmpty(); }
 
 
  229  { 
return _pimpl->ngMgr().serviceSize(); }
 
 
  232  { 
return _pimpl->ngMgr().serviceBegin(); }
 
 
  235  { 
return _pimpl->ngMgr().serviceEnd(); }
 
 
  238  { 
return _pimpl->ngMgr().getService( alias ); }
 
 
  241  { 
return _pimpl->ngMgr().hasService( alias ); }
 
 
  244  { 
return _pimpl->ngMgr().probeService( 
url ).unwrap(); }
 
 
  247  { 
return _pimpl->ngMgr().addService( alias, 
url ).unwrap(); }
 
 
  250  { 
return _pimpl->ngMgr().addService( service ).unwrap(); }
 
 
  253  { 
return _pimpl->ngMgr().removeService( alias ).unwrap(); }
 
 
  256  { 
return _pimpl->ngMgr().removeService( service ).unwrap(); }
 
 
  259  { 
return _pimpl->ngMgr().refreshServices( options_r ).unwrap(); }
 
 
  262  { 
return _pimpl->ngMgr().refreshService( alias, options_r ).unwrap(); }
 
 
  265  { 
return _pimpl->ngMgr().refreshService( service, options_r ).unwrap(); }
 
 
  268  { 
return _pimpl->ngMgr().modifyService( oldAlias, service ).unwrap(); }
 
 
  271  { (void) 
_pimpl->ngMgr().refreshGeoIp( urls ); }
 
 
static Date now()
Return the current time.
std::string digest()
get hex string representation of the digest
static const std::string & sha1()
sha1
bool hasFallbackUrls() const
Whether this set contains more than one Url in total (authorities or mirrors).
Manages a data source characterized by an authoritative URL and a list of mirror URLs.
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
What is known about a repository.
MirroredOriginSet repoOrigins() const
The repodata origins.
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.
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.
RepoManagerFlags::RawMetadataRefreshPolicy RawMetadataRefreshPolicy
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.
RepoManagerFlags::CacheBuildPolicy CacheBuildPolicy
ServiceConstIterator serviceBegin() const
Iterator to first service in internal storage.
RepoManagerFlags::RefreshCheckStatus RefreshCheckStatus
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.
static expected< std::shared_ptr< RepoManager< SyncContextRef > > > create(Args &&...args)
static SyncContextRef defaultContext()
String related utilities and Regular expression matching.
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...
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
AsyncOpRef< expected< std::list< RepoInfo > > > readRepoFile(ContextRef ctx, zypp::Url repoFileUrl)
RepoManager< SyncContextRef > SyncRepoManager
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.
friend Impl * rwcowClone(const Impl *rhs)
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.