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.
typedef std::list< SourceInfoSourceInfoList

Public Member Functions

 ~SourceManager ()
 Dtor.
void reset ()
 Reset the manager - discard the sources database, do not store the changes to the persistent store.
SourceInfoList knownSourceInfos (const Pathname &root_r)
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 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)

Classes

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

Detailed Description

Provide the known Sources.

Todo:
make it a resl singleton

throwing findSource is not acceptable, return either a Source or noSource.

Make restore either void or nonthrowing, but two ways of error reporting is bad.

Definition at line 82 of file SourceManager.h.


Member Typedef Documentation

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

Runtime unique numeric Source Id.

Definition at line 96 of file SourceManager.h.

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

exposition only

Definition at line 100 of file SourceManager.h.

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

Definition at line 104 of file SourceManager.h.

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

Definition at line 114 of file SourceManager.h.

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

Definition at line 124 of file SourceManager.h.

typedef std::list<SourceInfo> zypp::SourceManager::SourceInfoList
 

Definition at line 147 of file SourceManager.h.


Constructor & Destructor Documentation

zypp::SourceManager::~SourceManager  ) 
 

Dtor.

Definition at line 137 of file SourceManager.cc.

References MIL.

zypp::SourceManager::SourceManager  )  [private]
 

Singleton ctor.

Definition at line 127 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 142 of file SourceManager.cc.

References zypp::_sources.

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

Definition at line 145 of file SourceManager.cc.

References zypp::_sources.

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

Definition at line 148 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 151 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 154 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 157 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 160 of file SourceManager.cc.

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

SourceManager::SourceInfoList zypp::SourceManager::knownSourceInfos const Pathname root_r  ) 
 

Definition at line 486 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 262 of file SourceManager.cc.

References zypp::_deleted_sources, zypp::filesystem::assert_dir(), MIL, zypp::filesystem::recursive_rmdir(), and ZYPP_METADATA_PREFIX.

Referenced by disableSourcesAt(), and knownSourceInfos().

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 336 of file SourceManager.cc.

References zypp::_sources, MIL, and ZYPP_THROW.

Source_Ref zypp::SourceManager::findSource SourceId  id  ) 
 

Find a source with a specified ID.

Exceptions:
Exception 

Definition at line 515 of file SourceManager.cc.

References zypp::_sources, and ZYPP_THROW.

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

Find a source with a specified alias.

Exceptions:
Exception 

Definition at line 525 of file SourceManager.cc.

References zypp::_sources.

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 539 of file SourceManager.cc.

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

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

Return the list of the currently enabled sources.

Definition at line 237 of file SourceManager.cc.

References zypp::_sources.

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

Return ids of all sources.

Definition at line 250 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 167 of file SourceManager.cc.

References zypp::sourceTableAdd().

void zypp::SourceManager::removeSource SourceId  id  ) 
 

Remove an existing source by ID.

Definition at line 172 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 180 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 192 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 204 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 215 of file SourceManager.cc.

References zypp::_sources, and MIL.

void zypp::SourceManager::disableAllSources  ) 
 

Disable all registered sources.

Definition at line 227 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 468 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 510 of file SourceManager.cc.


The documentation for this class was generated from the following files:
Generated on Thu Jul 6 00:07:31 2006 for zypp by  doxygen 1.4.6