jigdo API
UrlMapping Class Reference
Object which represents a "Label:some/path" mapping, abstract base class. More...
#include <url-mapping.hh>

Public Member Functions | |
UrlMapping () | |
virtual | ~UrlMapping ()=0 |
void | setUrl (const string &url, string::size_type pos=0, string::size_type n=string::npos) |
Set value of URL part, starting with offset url[pos], up to n characters. | |
const string & | url () const |
Get URL value. | |
const char * | parseOptions (const vector< string > &value) |
Parse options from .jigdo file: --try-first[=. | |
void | setPrepend (UrlMapping *um) |
If this UrlMapping is based on the string "Label:some/path" in a .jigdo file, then url()=="some/path" and prepend() points to the mapping(s) for "Label". | |
UrlMapping * | prepend () const |
void | insertNext (UrlMapping *um) |
Insert a mapping into the singly linked list, it will be returned by the next call to next(). | |
UrlMapping * | next () const |
Return right peer of this object, or null. | |
bool | empty () const |
Return true iff url().empty() && prepend() == 0. | |
Static Public Member Functions | |
static void | setNoRandomInitialWeight () |
For url-mapping-test: Do not init weight randomly. | |
Static Public Attributes | |
static const double | RANDOM_INIT_RANGE = 0.03125 |
Various knobs for the scoring algorithm. | |
Friends | |
class | ServerUrlMapping |
class | PartUrlMapping |
Detailed Description
Object which represents a "Label:some/path" mapping, abstract base class.The "some/path" string is stored in the object, and the Label is represented with a pointer to another UrlMapping, whose output URL(s) need to be prepended to "some/path". UrlMappings can be chained into a linked list - that list is a list of alternative mappings for the same label.
Constructor & Destructor Documentation
UrlMapping::UrlMapping | ( | ) |
References r, RANDOM_INIT_RANGE, and randomInit.
UrlMapping::~UrlMapping | ( | ) | [pure virtual] |
Member Function Documentation
void UrlMapping::setNoRandomInitialWeight | ( | ) | [static] |
void UrlMapping::setUrl | ( | const string & | url, | |
string::size_type | pos = 0 , |
|||
string::size_type | n = string::npos | |||
) | [inline] |
Set value of URL part, starting with offset url[pos], up to n characters.
Referenced by UrlMap::addServer().
const string& UrlMapping::url | ( | ) | const [inline] |
const char * UrlMapping::parseOptions | ( | const vector< string > & | value | ) |
Parse options from .jigdo file: --try-first[=.
.], --try-last[=..]. Unrecognized parameters are ignored, to make extensions of the .jigdo file format easier.
- Returns:
- null on success, else error message.
References _, and compat_compare().
Referenced by UrlMap::addServer().
void UrlMapping::setPrepend | ( | UrlMapping * | um | ) | [inline] |
If this UrlMapping is based on the string "Label:some/path" in a .jigdo file, then url()=="some/path" and prepend() points to the mapping(s) for "Label".
Referenced by UrlMap::addServer().
UrlMapping* UrlMapping::prepend | ( | ) | const [inline] |
References SmartPtr< X >::get().
Referenced by UrlMap::addServer(), UrlMap::dumpJigdoInfo(), and empty().
void UrlMapping::insertNext | ( | UrlMapping * | um | ) | [inline] |
Insert a mapping into the singly linked list, it will be returned by the next call to next().
References SmartPtr< X >::isNull(), nextVal, and Paranoid.
UrlMapping* UrlMapping::next | ( | ) | const [inline] |
Return right peer of this object, or null.
References SmartPtr< X >::get().
Referenced by UrlMap::dumpJigdoInfo(), and PartUrlMapping::enumerate().
bool UrlMapping::empty | ( | ) | const [inline] |
Friends And Related Function Documentation
friend class ServerUrlMapping [friend] |
friend class PartUrlMapping [friend] |
Member Data Documentation
const double UrlMapping::RANDOM_INIT_RANGE = 0.03125 [static] |
Various knobs for the scoring algorithm.
If two servers are rated equal by the scoring algorithm, the order in which the servers are tried should be random. Otherwise, if gazillions of people try to download the same thing using default settings (e.g. no country preference), the first server in its list shouldn't be hit too hard. In practice, we achieve randomisation by initializing the weight with a small random value, in the range [-RANDOM_INIT_RANGE,RANDOM_INIT_RANGE)
Referenced by UrlMapping().
The documentation for this class was generated from the following files:
- job/url-mapping.hh
- job/url-mapping.cc
Generated on Tue Sep 23 14:27:43 2008 for jigdo by
