#include <InstSrcManager.h>
Public Types | |
typedef InstSrcError | Error |
typedef InstSrcError | Error |
typedef PM::ISrcId | ISrcId |
typedef PM::ISrcIdList | ISrcIdList |
typedef PM::SrcState | SrcState |
typedef PM::SrcStateVector | SrcStateVector |
typedef PM::InstOrder | InstOrder |
Public Member Functions | |
PMError | scanMedia (ISrcIdList &idlist_r, const Url &mediaurl_r) |
PMError | scanMedia (ISrcId &isrc_r, const Url &mediaurl_r, const Pathname &product_dir_r) |
PMError | enableSource (const ISrcId &isrc_r) |
PMError | disableSource (const ISrcId &isrc_r) |
PMError | setAutoenable (const ISrcId isrc_r, const bool yesno) |
PMError | rankUp (const ISrcId isrc_r) |
PMError | rankDown (const ISrcId isrc_r) |
PMError | rankBehind (const ISrcId isrc_r, const ISrcId point_r) |
PMError | rankBefore (const ISrcId isrc_r, const ISrcId point_r) |
PMError | setNewRanks () |
PMError | deleteSource (ISrcId &isrc_r) |
PMError | rewriteUrl (const ISrcId isrc_r, const Url &newUrl_r) |
SrcStateVector | editGet () const |
PMError | editSet (const SrcStateVector &keep_r) |
unsigned | knownSources () const |
ISrcIdList | getSources (const bool enabled_only=false) const |
void | getSources (ISrcIdList &idlist_r, const bool enabled_only=false) const |
ISrcId | getSourceByID (PM::NumericISrcID srcID_r) const |
void | disableAllSources () |
void | enableDefaultSources () |
PMError | releaseMedia (const ISrcId isrc_r, bool if_removable_r=false) const |
PMError | releaseAllMedia (bool if_removable_r=false) const |
void | preferredLocaleChanged () const |
PMError | cacheCopyTo (const Pathname &newRoot_r) |
void | setInstOrder (const InstOrder &newOrder_r) |
void | setDefaultInstOrder () |
const InstOrder & | instOrder () const |
ISrcIdList | instOrderSources () const |
int | instOrderIndex (const ISrcId &isrc_r) const |
PkgPubkeyCache & | pkgPubkeyCache () |
Static Public Attributes | |
const unsigned | NO_RANK = unsigned(-1) |
Private Types | |
typedef std::set< ProductEntry > | ProductSet |
typedef std::list< InstSrcPtr > | ISrcPool |
Private Member Functions | |
InstSrcManager & | operator= (const InstSrcManager &) |
InstSrcManager (const InstSrcManager &) | |
InstSrcManager (const bool autoEnable_r=true) | |
~InstSrcManager () | |
Pathname | cachePath (const Pathname &sub_r) const |
Pathname | cache_root_dir () const |
Pathname | cache_tmp_dir () const |
Pathname | cache_pubkey_dir () const |
Pathname | genSrcCacheName () const |
PMError | scanProductsFile (const Pathname &file_r, ProductSet &pset_r) const |
PMError | initSrcPool (const bool autoEnable_r) |
PMError | scanSrcCache (const Pathname &srccache_r) |
PMError | writeNewRanks () |
ISrcPool::iterator | poolHandle (const ISrcId &isrc_r) |
InstSrcPtr | lookupId (const ISrcId &isrc_r) const |
InstSrcPtr | lookupSourceByID (PM::NumericISrcID srcID_r) const |
ISrcId | poolAdd (InstSrcPtr nsrc_r, bool rankcheck_r=true) |
PMError | activateSource (const InstSrcPtr &isrc_r, bool yesno_r) |
PMError | activateSource (const ISrcId &isrc_r, bool yesno_r) |
PMError | intern_cacheCopyTo () |
Private Attributes | |
ISrcPool | _knownSources |
bool | _want_sources_enabled |
InstOrder | _instOrder |
PkgPubkeyCache | _pubkeyCache |
Static Private Attributes | |
Pathname | _cache_root_dir |
const Pathname | _cache_tmp_dir |
const Pathname | _cache_pubkey_dir |
Friends | |
std::ostream & | operator<< (std::ostream &str, const InstSrcManager &obj) |
|
default error class |
|
default error class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Enable/disable isrc_r according to yesno_r. |
|
Enable/disable isrc_r according to yesno_r. |
|
Full path of cache_pubkey_dir |
|
Full path of cache_root_dir |
|
Full path of cache_tmp_dir (for downloads, etc.) |
|
Used during installation/Upadte (where caching is disabled) to install the caches on the system. So InstSrc'es will be available in the running system after boot. |
|
Helper function to combine _cache_root_dir and subpaths. |
|
Delete InstSrc. Erase it together with all cached info. Note: The ISrcId passed will be set to NULL. It should be the last ISrcId remembered somewhere. Otherwise deletion is delayed untill all autstanding references were cleared. |
|
Disable all InstSrc'es. |
|
Disable InstSrc. Provided Objects are withdrawn from Manager classes. |
|
Return list of all known sources numeric srcID and default state (as pair). the list is sorted in priority order (highest first). |
|
Rearange known InstSrces rank and default state according to keep_r (highest priority first). Known sources not mentioned in keep_r are deleted. |
|
Enable/disable all InstSrc'es according to their default state (see setAutoenable). |
|
Enable InstSrc. Let it provide it's Objects to the Manager classes. |
|
Return a new (not existing) directory name in cache_root_dir |
|
Convert the numeric srcID back to an ISrcId. As an ISrcId basically is a 'constInstSrcPtr', it may get reused by deleting and creating InstSrc'es. Besides this an ISrcId keeps an open reference to the InstSrc. So they are not intended to be stored longer than necessary. Rut each InstSrc owns a unique numeric ID, which may be retrieved by calling InstSrc::srcID. Providing this srcID, the coresponding ISrcId is returned, or NULL, if the InstSrc not found in the list of known InstSrces (e.g. meanwhile deleted). |
|
Return the ISrcId's of all known InstSrces. Or enabled InsrSrces only, if enabled_only == true. TODO: Should be replaced by some Iterator. |
|
Return the ISrcId's of all known InstSrces. Or enabled InsrSrces only, if enabled_only == true. TODO: Should be replaced by some Iterator. |
|
Preload all cached InstSrces. |
|
Return the current InstOrder. |
|
Return the index [0..n] of isrc_r in instOrderSources, or -1 if isrc_r is not enabled or NULL. |
|
Return the ISrcId's of all enabled InstSrces in install order. The default install order is sorted by rank, thus the same as returned by getSources(true). See setInstOrder. |
|
helper for cacheCopyTo fake |
|
Return the number of known InstSrc'es. |
|
Find InstSrcPtr in _knownSources by ISrcId. Return NULL if not in _knownSources. |
|
Find InstSrcPtr in _knownSources by numeric srcID. Return NULL if not in _knownSources. |
|
|
|
|
|
Add nsrc_r to _knownSources if same product is not yet present. Return ISrcId for the added nsrc_r, or NULL if duplicate. If nsrc has no rank assigned, it gets least priority. Note:</> If norankcheck_r is true, ranks are not checked, and added sources are not attached to the InstSrcManager. This is to be used by initSrcPool/scanSrcCache at startup only! They take care of ranking and attaching after all cached sources were loaded. |
|
Return _knownSources iterator to ISrcId. Return _knownSources.end() if not in _knownSources. |
|
Trigger change of preferredLocale. Propagated to all known InstSrces. |
|
Adjust isrc priority to be directly before point. If point is NULL it will get highest priority. |
|
Adjust isrc priority to be directly behind point. If point is NULL it will get least priority. |
|
Lower priority by one |
|
Raise priority by one |
|
Let all InstSrc'es release their media. if_removable is true: release if CD/DVD only. |
|
Let a certain InstSrc release it's media. if_removable is true: release if CD/DVD only.
|
|
|
Load a certain InstSrc located on mediaurl in product_dir. This is what the above scanMedia function calls, for each product found in a /media.1/products file. |
|
Access media. Detect kind of InstSrc(es) available on media by scanning /media.1/products if available. Otherwise assume the InstSrc is located directly below mediaurl. Load the InstSrc(es) (add them to ISrcPool). |
|
|
|
Create InstSrc from cache and add it to ISrcPool. |
|
Set whether this source should be automaticaly enabled on startup. Note that this is something different, than calling enableSource/disableSource. setAutoenable determines the desired state of an InstSrc when the InstSrcManager is started (auto enable it or not). enableSource/disableSource actually enabale/disable an InstSrc (i.e. let it provide/withdraw Objects). |
|
The default install order is sorted by rank, thus the same as returned by getSources(true). |
|
Explicitly set an install order. orderedSrcID_r is expected to contain valid numeric InstSrc IDs (see getSourceByID). instOrderSources will then put all enabled InstSrces according to orderedSrcID_r in front of the list. Enabled InstSrces not mentioned in orderedSrcID_r will be appended in default order. |
|
To be called by InstSrc Editor to write the current ranking to disk. |
|
Rewrite rank values of all known sources. Used by initSrcPool. |
|
|
|
Subpath (below _cache_root_dir) for gpg-pubkeys. |
|
Cachedir to use. |
|
Subpath (below _cache_root_dir) for InstSrcManager downloads. |
|
|
|
|
|
|
|
Turned on at startup or by enableDefaultSources, turned off by disableAllSources. Evaluated by editSet to see whether the sources should be activated, or stay as they are. |
|
|