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() 47 Impl &operator=(
const Impl &) =
delete;
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)) )
84 RepoManager::~RepoManager()
87 bool RepoManager::repoEmpty()
const 88 {
return _pimpl->ngMgr().repoEmpty(); }
91 {
return _pimpl->ngMgr().repoSize(); }
94 {
return _pimpl->ngMgr().repoBegin(); }
97 {
return _pimpl->ngMgr().repoEnd(); }
99 RepoInfo RepoManager::getRepo(
const std::string & alias )
const 100 {
return _pimpl->ngMgr().getRepo( alias ); }
102 bool RepoManager::hasRepo(
const std::string & alias )
const 103 {
return _pimpl->ngMgr().hasRepo( alias ); }
105 std::string RepoManager::makeStupidAlias(
const Url & url_r )
113 std::string host( url_r.
getHost() );
114 if ( ! host.empty() )
126 {
return _pimpl->ngMgr().metadataStatus( info ).unwrap(); }
129 {
return _pimpl->ngMgr().checkIfToRefreshMetadata( info, url, policy ).unwrap(); }
132 {
return _pimpl->ngMgr().metadataPath( info ).unwrap(); }
135 {
return _pimpl->ngMgr().packagesPath( info ).unwrap(); }
141 return _pimpl->ngMgr().refreshMetadata( info, policy,
nullptr ).unwrap();
145 {
return _pimpl->ngMgr().cleanMetadata( info,
nullptr ).unwrap(); }
148 {
return _pimpl->ngMgr().cleanPackages( info,
nullptr ).unwrap(); }
151 {
return _pimpl->ngMgr().cacheStatus( info ).unwrap(); }
157 return _pimpl->ngMgr().buildCache( info, policy, adapt.observer() ).unwrap();
161 {
return _pimpl->ngMgr().cleanCache( info,
nullptr ).unwrap(); }
163 bool RepoManager::isCached(
const RepoInfo &info )
const 164 {
return _pimpl->ngMgr().isCached( info ).unwrap(); }
167 {
return _pimpl->ngMgr().loadFromCache( info,
nullptr ).unwrap(); }
170 {
return _pimpl->ngMgr().cleanCacheDirGarbage(
nullptr ).unwrap(); }
173 {
return _pimpl->ngMgr().probe( url, path ).unwrap(); }
176 {
return _pimpl->ngMgr().probe( url ).unwrap(); }
182 RepoInfo updatedRepo = _pimpl->ngMgr().addRepository( info, adapt.observer() ).unwrap();
186 RepoInfo & oinfo( const_cast<RepoInfo &>(info) );
193 {
return _pimpl->ngMgr().addRepositories( url,
nullptr ).unwrap(); }
199 return _pimpl->ngMgr().removeRepository( info, adapt.observer() ).unwrap();
204 RepoInfo updated = _pimpl->ngMgr().modifyRepository( alias, newinfo,
nullptr ).unwrap();
207 RepoInfo & oinfo( const_cast<RepoInfo &>(newinfo) );
214 {
return _pimpl->ngMgr().getRepositoryInfo( alias ).unwrap(); }
217 {
return _pimpl->ngMgr().getRepositoryInfo( url, urlview ).unwrap(); }
219 bool RepoManager::serviceEmpty()
const 220 {
return _pimpl->ngMgr().serviceEmpty(); }
223 {
return _pimpl->ngMgr().serviceSize(); }
226 {
return _pimpl->ngMgr().serviceBegin(); }
229 {
return _pimpl->ngMgr().serviceEnd(); }
231 ServiceInfo RepoManager::getService(
const std::string & alias )
const 232 {
return _pimpl->ngMgr().getService( alias ); }
234 bool RepoManager::hasService(
const std::string & alias )
const 235 {
return _pimpl->ngMgr().hasService( alias ); }
238 {
return _pimpl->ngMgr().probeService( url ).unwrap(); }
240 void RepoManager::addService(
const std::string & alias,
const Url& url )
241 {
return _pimpl->ngMgr().addService( alias, url ).unwrap(); }
244 {
return _pimpl->ngMgr().addService( service ).unwrap(); }
246 void RepoManager::removeService(
const std::string & alias )
247 {
return _pimpl->ngMgr().removeService( alias ).unwrap(); }
250 {
return _pimpl->ngMgr().removeService( service ).unwrap(); }
253 {
return _pimpl->ngMgr().refreshServices( options_r ).unwrap(); }
256 {
return _pimpl->ngMgr().refreshService( alias, options_r ).unwrap(); }
259 {
return _pimpl->ngMgr().refreshService( service, options_r ).unwrap(); }
261 void RepoManager::modifyService(
const std::string & oldAlias,
const ServiceInfo & service )
262 {
return _pimpl->ngMgr().modifyService( oldAlias, service ).unwrap(); }
265 { (void) _pimpl->ngMgr().refreshGeoIp( urls ); }
static expected< std::shared_ptr< RepoManager< ZyppContextRefType > > > create(Args &&...args)
std::string getScheme() const
Returns the scheme name of the URL.
Pathname filepath() const
File where this repo was read from.
RepoSet::size_type RepoSizeType
RepoManagerFlags::RefreshServiceFlags RefreshServiceOptions
Options tuning RefreshService.
Impl * clone() const
clone for RWCOW_pointer
AsyncOpRef< expected< repo::AsyncRefreshContextRef > > refreshMetadata(repo::AsyncRefreshContextRef refCtx, LazyMediaHandle< Provide > medium, ProgressObserverRef progressObserver)
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
Impl(zyppng::SyncContextRef &&ctx, RepoManagerOptions &&opt)
static SyncContextRef defaultContext()
String related utilities and Regular expression matching.
void setFilepath(const Pathname &filename)
set the path to the .repo file
What is known about a repository.
AsyncOpRef< expected< repo::AsyncRefreshContextRef > > buildCache(repo::AsyncRefreshContextRef refCtx, zypp::RepoManagerFlags::CacheBuildPolicy policy, ProgressObserverRef progressObserver)
Url::asString() view options.
expected< zypp::Pathname > packagescache_path_for_repoinfo(const RepoManagerOptions &opt, const RepoInfo &info)
Calculates the packages cache path for a repository.
std::list< RepoInfo > readRepoFile(const Url &repo_file)
Parses repo_file and returns a list of RepoInfo objects corresponding to repositories found within th...
Service type enumeration.
RepoManagerRef< SyncContextRef > SyncRepoManagerRef
void setMetadataPath(const Pathname &path)
Set the path where the local metadata is stored.
std::string asCompleteString() const
Returns a complete string representation of the Url object.
ServiceSet::size_type ServiceSizeType
std::ostream & operator<<(std::ostream &str, const zypp::sat::detail::CDataiterator *obj)
void setPackagesPath(const Pathname &path)
set the path where the local packages are stored
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
std::string getHost(EEncoding eflag=zypp::url::E_DECODED) const
Returns the hostname or IP from the URL authority.
AsyncOpRef< expected< void > > refreshService(AsyncRepoManagerRef repoMgr, ServiceInfo info, zypp::RepoManagerFlags::RefreshServiceOptions options)
zyppng::SyncRepoManagerRef _ngMgr
RepoSet::const_iterator RepoConstIterator
AsyncOpRef< expected< repo::RefreshCheckStatus > > checkIfToRefreshMetadata(repo::AsyncRefreshContextRef refCtx, LazyMediaHandle< Provide > medium, ProgressObserverRef progressObserver)
RefreshCheckStatus
Possibly return state of RepoManager::checkIfToRefreshMetadata function.
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.
Track changing files or directories.
The RepoManager class Provides knowledge and methods to maintain repo settings and metadata for a giv...
AsyncOpRef< expected< RepoInfo > > addRepository(AsyncRepoManagerRef mgr, RepoInfo info, ProgressObserverRef myProgress)
urls_size_type baseUrlsSize() const
number of repository urls
AsyncOpRef< expected< std::list< RepoInfo > > > readRepoFile(ContextRef ctx, zypp::Url repoFileUrl)
Easy-to use interface to the ZYPP dependency resolver.
AsyncOpRef< expected< void > > addRepositories(AsyncRepoManagerRef mgr, zypp::Url url, ProgressObserverRef myProgress)
const zyppng::SyncRepoManager & ngMgr() const
std::string hexstring(char n, int w=4)
RepoManager implementation.
std::ostream & operator<<(std::ostream &str, const RepoManager::Impl &obj)
zypp::RepoManagerOptions RepoManagerOptions
zyppng::SyncRepoManager & ngMgr()
RepoManager(RepoManagerOptions options=RepoManagerOptions())
Repository type enumeration.
ServiceSet::const_iterator ServiceConstIterator