17 #include <zypp-core/ng/pipelines/Lift> 23 #undef ZYPP_BASE_LOGGER_LOGGROUP 24 #define ZYPP_BASE_LOGGER_LOGGROUP "zypp::repomanager" 30 #define OPT_PROGRESS const ProgressData::ReceiverFnc & = ProgressData::ReceiverFnc() 49 Impl &operator=(
const Impl &) =
delete;
65 friend Impl * rwcowClone<Impl>(
const Impl * rhs );
74 {
return str <<
"RepoManager::Impl"; }
83 : _pimpl( new
Impl(
zyppng::Context::defaultContext(),
std::move(opt)) )
86 RepoManager::~RepoManager()
89 bool RepoManager::repoEmpty()
const 90 {
return _pimpl->ngMgr().repoEmpty(); }
93 {
return _pimpl->ngMgr().repoSize(); }
96 {
return _pimpl->ngMgr().repoBegin(); }
99 {
return _pimpl->ngMgr().repoEnd(); }
101 RepoInfo RepoManager::getRepo(
const std::string & alias )
const 102 {
return _pimpl->ngMgr().getRepo( alias ); }
104 bool RepoManager::hasRepo(
const std::string & alias )
const 105 {
return _pimpl->ngMgr().hasRepo( alias ); }
107 std::string RepoManager::makeStupidAlias(
const Url & url_r )
115 std::string host( url_r.
getHost() );
116 if ( ! host.empty() )
128 {
return _pimpl->ngMgr().metadataStatus( info ).unwrap(); }
131 {
return _pimpl->ngMgr().checkIfToRefreshMetadata( info, origin, policy ).unwrap(); }
134 {
return _pimpl->ngMgr().checkIfToRefreshMetadata( info, url, policy ).unwrap(); }
137 {
return _pimpl->ngMgr().metadataPath( info ).unwrap(); }
140 {
return _pimpl->ngMgr().packagesPath( info ).unwrap(); }
146 return _pimpl->ngMgr().refreshMetadata( info, policy,
nullptr ).unwrap();
150 {
return _pimpl->ngMgr().cleanMetadata( info,
nullptr ).unwrap(); }
153 {
return _pimpl->ngMgr().cleanPackages( info,
nullptr ).unwrap(); }
156 {
return _pimpl->ngMgr().cacheStatus( info ).unwrap(); }
162 return _pimpl->ngMgr().buildCache( info, policy, adapt.observer() ).unwrap();
166 {
return _pimpl->ngMgr().cleanCache( info,
nullptr ).unwrap(); }
168 bool RepoManager::isCached(
const RepoInfo &info )
const 169 {
return _pimpl->ngMgr().isCached( info ).unwrap(); }
172 {
return _pimpl->ngMgr().loadFromCache( info,
nullptr ).unwrap(); }
175 {
return _pimpl->ngMgr().cleanCacheDirGarbage(
nullptr ).unwrap(); }
178 {
return _pimpl->ngMgr().probe( {url}, path ).unwrap(); }
181 {
return _pimpl->ngMgr().probe( {url} ).unwrap(); }
187 RepoInfo updatedRepo = _pimpl->ngMgr().addRepository( info, adapt.observer(), forcedProbe ).unwrap();
191 RepoInfo & oinfo( const_cast<RepoInfo &>(info) );
201 {
return _pimpl->ngMgr().addRepositories( url,
nullptr ).unwrap(); }
207 return _pimpl->ngMgr().removeRepository( info, adapt.observer() ).unwrap();
212 RepoInfo updated = _pimpl->ngMgr().modifyRepository( alias, newinfo,
nullptr ).unwrap();
215 RepoInfo & oinfo( const_cast<RepoInfo &>(newinfo) );
222 {
return _pimpl->ngMgr().getRepositoryInfo( alias ).unwrap(); }
225 {
return _pimpl->ngMgr().getRepositoryInfo( url, urlview ).unwrap(); }
227 bool RepoManager::serviceEmpty()
const 228 {
return _pimpl->ngMgr().serviceEmpty(); }
231 {
return _pimpl->ngMgr().serviceSize(); }
234 {
return _pimpl->ngMgr().serviceBegin(); }
237 {
return _pimpl->ngMgr().serviceEnd(); }
239 ServiceInfo RepoManager::getService(
const std::string & alias )
const 240 {
return _pimpl->ngMgr().getService( alias ); }
242 bool RepoManager::hasService(
const std::string & alias )
const 243 {
return _pimpl->ngMgr().hasService( alias ); }
246 {
return _pimpl->ngMgr().probeService( url ).unwrap(); }
248 void RepoManager::addService(
const std::string & alias,
const Url& url )
249 {
return _pimpl->ngMgr().addService( alias, url ).unwrap(); }
252 {
return _pimpl->ngMgr().addService( service ).unwrap(); }
254 void RepoManager::removeService(
const std::string & alias )
255 {
return _pimpl->ngMgr().removeService( alias ).unwrap(); }
258 {
return _pimpl->ngMgr().removeService( service ).unwrap(); }
261 {
return _pimpl->ngMgr().refreshServices( options_r ).unwrap(); }
264 {
return _pimpl->ngMgr().refreshService( alias, options_r ).unwrap(); }
267 {
return _pimpl->ngMgr().refreshService( service, options_r ).unwrap(); }
269 void RepoManager::modifyService(
const std::string & oldAlias,
const ServiceInfo & service )
270 {
return _pimpl->ngMgr().modifyService( oldAlias, service ).unwrap(); }
273 { (void) _pimpl->ngMgr().refreshGeoIp( urls ); }
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
MaybeAwaitable< expected< repo::RefreshContextRef > > refreshMetadata(repo::RefreshContextRef refCtx, LazyMediaHandle< Provide > medium, ProgressObserverRef progressObserver)
std::ostream & operator<<(std::ostream &str, const DeltaCandidates::Impl &obj)
relates: DeltaCandidates::Impl Stream output
RepoManagerFlags::RefreshServiceFlags RefreshServiceOptions
Options tuning RefreshService.
Impl * clone() const
clone for RWCOW_pointer
MirroredOriginSet repoOrigins() const
The repodata origins.
MaybeAwaitable< expected< repo::RefreshContextRef > > buildCache(repo::RefreshContextRef refCtx, zypp::RepoManagerFlags::CacheBuildPolicy policy, ProgressObserverRef progressObserver)
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
MaybeAwaitable< expected< void > > refreshService(RepoManagerRef repoMgr, ServiceInfo info, zypp::RepoManagerFlags::RefreshServiceOptions options)
String related utilities and Regular expression matching.
MaybeAwaitable< expected< RepoInfo > > addRepository(RepoManagerRef mgr, RepoInfo info, ProgressObserverRef myProgress, const zypp::TriBool &forcedProbe)
void setFilepath(const Pathname &filename)
set the path to the .repo file
What is known about a repository.
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.
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
zyppng::RepoManager & ngMgr()
std::list< RepoInfo > readRepoFile(const Url &repo_file)
Parses repo_file and returns a list of RepoInfo objects corresponding to repositories found within th...
Manages a data source characterized by an authoritative URL and a list of mirror URLs.
Service type enumeration.
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.
std::ostream & operator<<(std::ostream &str, const RepoManager &obj)
relates: RepoManager Stream output
MaybeAwaitable< expected< repo::RefreshCheckStatus > > checkIfToRefreshMetadata(repo::RefreshContextRef refCtx, LazyMediaHandle< Provide > medium, ProgressObserverRef progressObserver)
ServiceSet::size_type ServiceSizeType
Impl(zyppng::ContextRef &&ctx, RepoManagerOptions &&opt)
static ContextRef defaultContext()
bool hasFallbackUrls() const
Whether this set contains more than one Url in total (authorities or mirrors).
void setPackagesPath(const Pathname &path)
set the path where the local packages are stored
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
MaybeAwaitable< expected< void > > addRepositories(RepoManagerRef mgr, zypp::Url url, ProgressObserverRef myProgress)
std::string getHost(EEncoding eflag=zypp::url::E_DECODED) const
Returns the hostname or IP from the URL authority.
const zyppng::RepoManager & ngMgr() const
RepoSet::const_iterator RepoConstIterator
static expected< std::shared_ptr< RepoManager > > create(Args &&...args)
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...
zyppng::RepoManagerRef _ngMgr
Easy-to use interface to the ZYPP dependency resolver.
std::string hexstring(char n, int w=4)
RepoManager implementation.
MaybeAwaitable< expected< std::list< RepoInfo > > > readRepoFile(ContextRef ctx, zypp::Url repoFileUrl)
zypp::RepoManagerOptions RepoManagerOptions
RepoManager(RepoManagerOptions options=RepoManagerOptions())
Repository type enumeration.
ServiceSet::const_iterator ServiceConstIterator