zypp::SourceManager Class Reference

Provide the known Sources. More...

#include <SourceManager.h>

Inheritance diagram for zypp::SourceManager:

zypp::base::ReferenceCounted NonCopyable List of all members.

Iterate over all known SourceIds.

typedef MapKVIteratorTraits<
SourceMap >::Key_const_iterator 
SourceId_const_iterator
SourceId_const_iterator SourceId_begin () const
SourceId_const_iterator SourceId_end () const

Iterate over all known Sources.

typedef MapKVIteratorTraits<
SourceMap >::Value_const_iterator 
Source_const_iterator
Source_const_iterator Source_begin () const
Source_const_iterator Source_end () const

Iterate over all (SourceId,Source_Ref) pairs.

typedef SourceMap::const_iterator const_iterator
const_iterator begin () const
const_iterator end () const

Public Types

typedef Source_Ref::NumericId SourceId
 Runtime unique numeric Source Id.

Public Member Functions

 ~SourceManager ()
 Dtor.
void reset ()
 Reset the manager - discard the sources database, do not store the changes to the persistent store.
source::SourceInfoList knownSourceInfos (const Pathname &root_r)
 List the known aliases and urls ( no need to restore first ).
void store (Pathname root_r, bool metadata_cache)
 Store the current state to the given path.
bool restore (Pathname root_r, bool use_caches=true, const std::string &alias_filter="", const std::string &url_filter="")
Source_Ref findSource (SourceId id)
 Find a source with a specified ID.
Source_Ref findSource (const std::string &alias_r)
 Find a source with a specified alias.
Source_Ref findSourceByUrl (const Url &url_r)
 Find a source with a specified URL.
std::list< SourceIdenabledSources () const
 Return the list of the currently enabled sources.
std::list< SourceIdallSources () const
 Return ids of all sources.
SourceId addSource (Source_Ref source_r)
 Add a new source.
void renameSource (SourceId id, const std::string &new_alias_r)
 Rename an existing source by Alias.
void removeSource (SourceId id)
 Remove an existing source by ID.
void removeSource (const std::string &alias_r)
 Remove an existing source by Alias.
void removeSourceByUrl (const Url &url_r)
 Remove an existing source by Url.
void releaseAllSources ()
 Release all medias held by all sources.
void reattachSources (const Pathname &attach_point)
 Reattach all sources which are not mounted, but downloaded, to different directory.
void disableAllSources ()
 Disable all registered sources.

Static Public Member Functions

static SourceManager_Ptr sourceManager ()
 Singleton access.
static void disableSourcesAt (const Pathname &root)
 Helper function to disable all sources in the persistent store on the given location.

Private Types

typedef std::map< SourceId,
Source_Ref
SourceMap
 exposition only

Private Member Functions

 SourceManager ()
 Singleton ctor.

Friends

std::ostream & operator<< (std::ostream &str, const SourceManager &obj)
 Stream output.

Detailed Description

Provide the known Sources.

Todo:
make it a resl singleton
Todo:
throwing findSource is not acceptable, return either a Source or noSource.
Todo:
Make restore either void or nonthrowing, but two ways of error reporting is bad.

Definition at line 84 of file SourceManager.h.


Member Typedef Documentation

typedef Source_Ref::NumericId zypp::SourceManager::SourceId

Runtime unique numeric Source Id.

Definition at line 98 of file SourceManager.h.

typedef std::map<SourceId, Source_Ref> zypp::SourceManager::SourceMap [private]

exposition only

Definition at line 102 of file SourceManager.h.

typedef SourceMap::const_iterator zypp::SourceManager::const_iterator [private]

Definition at line 106 of file SourceManager.h.

typedef MapKVIteratorTraits<SourceMap>::Key_const_iterator zypp::SourceManager::SourceId_const_iterator

Definition at line 116 of file SourceManager.h.

typedef MapKVIteratorTraits<SourceMap>::Value_const_iterator zypp::SourceManager::Source_const_iterator

Definition at line 126 of file SourceManager.h.


Constructor & Destructor Documentation

zypp::SourceManager::~SourceManager (  ) 

Dtor.

Definition at line 138 of file SourceManager.cc.

References MIL.

zypp::SourceManager::SourceManager (  )  [private]

Singleton ctor.

Definition at line 128 of file SourceManager.cc.

References MIL.


Member Function Documentation

SourceManager_Ptr zypp::SourceManager::sourceManager (  )  [static]

Singleton access.

Definition at line 45 of file SourceManager.cc.

Referenced by zypp::source::SourceImpl::provideDirTree(), zypp::source::SourceImpl::provideJustFile(), and zypp::SourceCache::restoreSources().

SourceManager::const_iterator zypp::SourceManager::begin (  )  const [private]

Definition at line 143 of file SourceManager.cc.

References zypp::_sources.

SourceManager::const_iterator zypp::SourceManager::end (  )  const [private]

Definition at line 148 of file SourceManager.cc.

References zypp::_sources.

SourceManager::SourceId_const_iterator zypp::SourceManager::SourceId_begin (  )  const

Definition at line 153 of file SourceManager.cc.

References zypp::_sources, and zypp::make_map_key_begin().

SourceManager::SourceId_const_iterator zypp::SourceManager::SourceId_end (  )  const

Definition at line 158 of file SourceManager.cc.

References zypp::_sources, and zypp::make_map_key_end().

SourceManager::Source_const_iterator zypp::SourceManager::Source_begin (  )  const

Definition at line 163 of file SourceManager.cc.

References zypp::_sources, and zypp::make_map_value_begin().

SourceManager::Source_const_iterator zypp::SourceManager::Source_end (  )  const

Definition at line 168 of file SourceManager.cc.

References zypp::_sources, and zypp::make_map_value_end().

void zypp::SourceManager::reset (  ) 

Reset the manager - discard the sources database, do not store the changes to the persistent store.

Exceptions:
Exception 

Definition at line 173 of file SourceManager.cc.

References zypp::_deleted_sources, zypp::_sources, and MIL.

source::SourceInfoList zypp::SourceManager::knownSourceInfos ( const Pathname &  root_r  ) 

List the known aliases and urls ( no need to restore first ).

Exceptions:
Exception 

Definition at line 526 of file SourceManager.cc.

References MIL, and store().

void zypp::SourceManager::store ( Pathname  root_r,
bool  metadata_cache 
)

Store the current state to the given path.

Parameters:
root_r root path for storing the source definitions
metadata_cache if true, this will also store/update metadata caches for the sources.
Exceptions:
Exception 

Definition at line 291 of file SourceManager.cc.

References zypp::_deleted_sources, zypp::_renamed_sources, zypp::_sources, zypp::filesystem::assert_dir(), zypp::source::SourceInfo::cacheDir(), MIL, zypp::filesystem::recursive_rmdir(), zypp::source::SourceInfo::setAlias(), zypp::source::SourceInfo::setAutorefresh(), zypp::source::SourceInfo::setCacheDir(), zypp::source::SourceInfo::setEnabled(), zypp::source::SourceInfo::setPath(), zypp::source::SourceInfo::setType(), WAR, and ZYPP_METADATA_PREFIX.

Referenced by disableSourcesAt(), knownSourceInfos(), and restore().

bool zypp::SourceManager::restore ( Pathname  root_r,
bool  use_caches = true,
const std::string &  alias_filter = "",
const std::string &  url_filter = "" 
)

If the sources database is not empty, it throws an exception

Parameters:
use_caches if true, source creation will try to use source cache and it's behavior on autorefresh. If false, it will not use the cache at all.
alias_filter if non-empty, restore only a source matching this alias.
url_filter if non-empty, restore only a source matching this url.
The alias_filter take precedence over the url_filter.

Returns:
true on success
Exceptions:
Exception 

Definition at line 376 of file SourceManager.cc.

References zypp::_sources, addSource(), zypp::Url::asString(), DBG, zypp::Source_Ref::disable(), zypp::dumpSourceTableOn(), zypp::Source_Ref::enable(), ERR, findSource(), zypp::Url::getQueryParam(), zypp::Url::getScheme(), MIL, report, zypp::Url::setQueryParam(), store(), ZYPP_CAUGHT, and ZYPP_THROW.

Source_Ref zypp::SourceManager::findSource ( SourceId  id  ) 

Find a source with a specified ID.

Exceptions:
Exception 

Definition at line 547 of file SourceManager.cc.

References zypp::_sources, and ZYPP_THROW.

Referenced by renameSource(), and restore().

Source_Ref zypp::SourceManager::findSource ( const std::string &  alias_r  ) 

Find a source with a specified alias.

Exceptions:
Exception 

Definition at line 557 of file SourceManager.cc.

References zypp::_sources, and ZYPP_THROW.

Source_Ref zypp::SourceManager::findSourceByUrl ( const Url url_r  ) 

Find a source with a specified URL.

URLs are unique in zenworks but NOT in zypp. A bug in SL 10.1 causes alias mismatches so we have to resort to URLs. #177543

Exceptions:
Exception 

Definition at line 572 of file SourceManager.cc.

References zypp::_sources, zypp::Url::asCompleteString(), zypp::Url::asString(), and ZYPP_THROW.

std::list< SourceManager::SourceId > zypp::SourceManager::enabledSources (  )  const

Return the list of the currently enabled sources.

Definition at line 266 of file SourceManager.cc.

References zypp::_sources.

std::list< SourceManager::SourceId > zypp::SourceManager::allSources (  )  const

Return ids of all sources.

Definition at line 279 of file SourceManager.cc.

References zypp::_sources.

SourceManager::SourceId zypp::SourceManager::addSource ( Source_Ref  source_r  ) 

Add a new source.

An attempt to add Source_Ref::noSource does nothing but returning Source_Ref::noSource.numericId(). Thus it results in adding no Source.

Definition at line 180 of file SourceManager.cc.

References zypp::sourceTableAdd().

Referenced by restore().

void zypp::SourceManager::renameSource ( SourceId  id,
const std::string &  new_alias_r 
)

Rename an existing source by Alias.

Definition at line 185 of file SourceManager.cc.

References zypp::_renamed_sources, zypp::Source_Ref::alias(), findSource(), and zypp::Source_Ref::setAlias().

void zypp::SourceManager::removeSource ( SourceId  id  ) 

Remove an existing source by ID.

Definition at line 201 of file SourceManager.cc.

References zypp::_sources, zypp::sourceTableRemove(), and WAR.

void zypp::SourceManager::removeSource ( const std::string &  alias_r  ) 

Remove an existing source by Alias.

Definition at line 209 of file SourceManager.cc.

References zypp::_sources, zypp::sourceTableRemove(), and WAR.

void zypp::SourceManager::removeSourceByUrl ( const Url url_r  ) 

Remove an existing source by Url.

Definition at line 221 of file SourceManager.cc.

References zypp::_sources, zypp::Url::asString(), zypp::sourceTableRemove(), and WAR.

void zypp::SourceManager::releaseAllSources (  ) 

Release all medias held by all sources.

Exceptions:
Exception 

Definition at line 233 of file SourceManager.cc.

References zypp::_sources, and MIL.

void zypp::SourceManager::reattachSources ( const Pathname &  attach_point  ) 

Reattach all sources which are not mounted, but downloaded, to different directory.

Exceptions:
Exception 

Definition at line 244 of file SourceManager.cc.

References zypp::_sources, and MIL.

void zypp::SourceManager::disableAllSources (  ) 

Disable all registered sources.

Definition at line 256 of file SourceManager.cc.

References zypp::_sources, and MIL.

void zypp::SourceManager::disableSourcesAt ( const Pathname &  root  )  [static]

Helper function to disable all sources in the persistent store on the given location.

Does not manipulate with the current status of the source manager.

Exceptions:
Exception ...

Definition at line 508 of file SourceManager.cc.

References MIL, and store().


Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  str,
const SourceManager obj 
) [friend]

Stream output.

Definition at line 542 of file SourceManager.cc.


The documentation for this class was generated from the following files:
Generated on Tue Nov 28 16:49:37 2006 for zypp by  doxygen 1.5.0