1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Mirmon - OO interface for mirmon objects</title>
<link rev="made" href="mailto:root@localhost" />
</head>
<body style="background-color: white">
<p><a name="__index__"></a></p>
<!-- INDEX BEGIN -->
<ul>
<li><a href="#name">NAME</a></li>
<li><a href="#synopsis">SYNOPSIS</a></li>
<li><a href="#mirmon_class_methods">Mirmon class methods</a></li>
<li><a href="#mirmon_object_methods">Mirmon object methods</a></li>
<li><a href="#mirmon__conf_object_methods">Mirmon::Conf object methods</a></li>
<li><a href="#mirmon__mirror_object_methods">Mirmon::Mirror object methods</a></li>
<ul>
<li><a href="#attribute_methods">attribute methods</a></li>
<li><a href="#object_methods">object methods</a></li>
</ul>
<li><a href="#see_also">SEE ALSO</a></li>
<li><a href="#author">AUTHOR</a></li>
</ul>
<!-- INDEX END -->
<hr />
<p>
</p>
<hr />
<h1><a name="name">NAME</a></h1>
<p>Mirmon - OO interface for mirmon objects</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
use Mirmon ;</pre>
<pre>
$m = Mirmon -> new ( [ $path-to-config ] )</pre>
<pre>
$conf = $m -> conf ; # a Mirmon::Conf object
$state = $m -> state ; # the mirmon state</pre>
<pre>
for my $url ( keys %$state )
{ $mirror = $state -> { $url } ; # a Mirmon::Mirror object
$mail = $mirror -> mail ; # contact address
$mirror -> age ( time ) ; # set mirror age
}</pre>
<p>Many class and object methods can be used to get or set attributes :</p>
<pre>
$object -> attribute # get an atttibute
$object -> attribute ( $attr ) # set an atttibute</pre>
<p>
</p>
<hr />
<h1><a name="mirmon_class_methods">Mirmon class methods</a></h1>
<dl>
<dt><strong><a name="item_new"><strong>new ( [$path] )</strong></a></strong><br />
</dt>
<dd>
Create a Mirmon object from a config file found in $path,
or (by default) in the default list of possible config files.
Related objects (config, state) are created and initialised.
</dd>
<p></p>
<dt><strong><a name="item_verbosity">verbosity</a></strong><br />
</dt>
<dd>
Mirmon always reports errors. Normally it only reports
changes (inserts/deletes) found in the mirror_list ;
in <em>quiet</em> mode, it doesn't. In <em>verbose</em> mode, it
reports progress: the startup and finishing of probes.
</dd>
<dd>
<pre>
Mirmon::verbose ( [ $bool ] ) # get/set verbose
Mirmon::quiet ( [ $bool ] ) # get/set quiet
Mirmon::debug ( [ $bool ] ) # get/set debug</pre>
</dd>
<p></p></dl>
<p>
</p>
<hr />
<h1><a name="mirmon_object_methods">Mirmon object methods</a></h1>
<dl>
<dt><strong><a name="item_conf"><strong>conf</strong></a></strong><br />
</dt>
<dd>
Returns Mirmon's Mirmon::Conf object.
</dd>
<p></p>
<dt><strong><a name="item_state"><strong>state</strong></a></strong><br />
</dt>
<dd>
Returns a hashref <code>{ url => mirror, ... }</code>,
where <em>url</em> is as specified in the mirror list
and <em>mirror</em> is a Mirmon::Mirror object.
</dd>
<p></p>
<dt><strong><a name="item_regions"><strong>regions</strong></a></strong><br />
</dt>
<dd>
Returns a hashref <code>{ country_code => country_name, ... }</code>.
</dd>
<p></p>
<dt><strong><a name="item_config_list"><strong>config_list</strong></a></strong><br />
</dt>
<dd>
Returns the list of default locations for config files.
</dd>
<p></p>
<dt><strong><a name="item_get_dates"><strong>get_dates ( $get )</strong></a></strong><br />
</dt>
<dd>
Probes all mirrors if $get is <code>all</code> ; or a subset if $get is <code>update</code>.
</dd>
<p></p></dl>
<p>
</p>
<hr />
<h1><a name="mirmon__conf_object_methods">Mirmon::Conf object methods</a></h1>
<p>A Mirmon::Conf object represents a mirmon conguration.
It is normaly created by Mirmon::new().
A specified (or default) config file is read and interpreted.</p>
<dl>
<dt><strong><a name="item_attribute_methods">attribute methods</a></strong><br />
</dt>
<dd>
For every config file entry, there is an attribute method :
<strong>web_page</strong>, <strong>state</strong>, <strong>countries</strong>, <strong>mirror_list</strong>, <strong>probe</strong>,
<strong>project_name</strong>, <strong>project_url</strong>, <strong>icons</strong>, <strong>project_logo</strong>,
<strong>timeout</strong>, <strong>max_probes</strong>, <strong>min_poll</strong>, <strong>max_poll</strong>, <strong>min_sync</strong>,
<strong>max_sync</strong>, <strong>list_style</strong>, <strong>put_histo</strong>, <strong>randomize</strong>, <strong>add_slash</strong>.
</dd>
<p></p>
<dt><strong><a name="item_root"><strong>root</strong></a></strong><br />
</dt>
<dd>
Returns the file name of (the root of) the configuration file(s).
</dd>
<p></p>
<dt><strong><a name="item_site_url"><strong>site_url</strong></a></strong><br />
</dt>
<dd>
Returns a hashref <code>{ site => url, ... }</code>,
as specified in the mirmon config file.
</dd>
<p></p></dl>
<p>
</p>
<hr />
<h1><a name="mirmon__mirror_object_methods">Mirmon::Mirror object methods</a></h1>
<p>A Mirmon::Mirror object represents the last known state of a mirror.
It is normaly created by Mirmon::new() from the state file,
as specified in the mirmon config file.
Mirmon::Mirror objects can be used to probe mirrors.</p>
<p>
</p>
<h2><a name="attribute_methods">attribute methods</a></h2>
<dl>
<dt><strong><a name="item_url"><strong>url</strong></a></strong><br />
</dt>
<dd>
The url as given in the mirror list.
</dd>
<p></p>
<dt><strong><a name="item_age"><strong>age</strong></a></strong><br />
</dt>
<dd>
The mirror's timestamp found by the last successful probe,
or 'undef' if no probe was ever successful.
</dd>
<p></p>
<dt><strong><a name="item_last_status"><strong>last_status</strong></a></strong><br />
</dt>
<dd>
The status of the last probe, or 'undef' if the mirror was never probed.
</dd>
<p></p>
<dt><strong><a name="item_last_ok_probe"><strong>last_ok_probe</strong></a></strong><br />
</dt>
<dd>
The timestamp of the last successful probe or 'undef'
if the mirror was never successfully probed.
</dd>
<p></p>
<dt><strong><a name="item_probe_history"><strong>probe_history</strong></a></strong><br />
</dt>
<dd>
The probe history is a list of 's' (for success) and 'f' (for failure)
characters indicating the result of the probe. New results are appended
whenever the mirror is probed.
</dd>
<p></p>
<dt><strong><a name="item_state_history"><strong>state_history</strong></a></strong><br />
</dt>
<dd>
The state history consists of a timestamp, a '-' char, and a list of
chars indicating a past status: 's' (fresh), 'b' (oldish), 'f' (old),
'z' (bad) or 'x' (skip).
The timestamp indicates when the state history was last updated.
The current status of the mirror is determined by the mirror's age and
a few configuration parameters (min_sync, max_sync, max_poll).
The state history is updated when the mirror is probed.
If the last update of the history was less than 24 hours ago,
the last status is replaced by the current status.
If the last update of the history was more than 24 hours ago,
the current status is appended to the history.
One or more 'skip's are inserted, if the timestamp is two or more days old
(when mirmon hasn't run for more than two days).
</dd>
<p></p>
<dt><strong><a name="item_last_probe"><strong>last_probe</strong></a></strong><br />
</dt>
<dd>
The timestamp of the last probe, or 'undef' if the mirror was never probed.
</dd>
<p></p></dl>
<p>
</p>
<h2><a name="object_methods">object methods</a></h2>
<dl>
<dt><strong><a name="item_mirmon"><strong>mirmon</strong></a></strong><br />
</dt>
<dd>
Returns the parent Mirmon object.
</dd>
<p></p>
<dt><strong><a name="item_state_history_time"><strong>state_history_time</strong></a></strong><br />
</dt>
<dd>
Returns the <em>time</em> part of the state_history attribute.
</dd>
<p></p>
<dt><strong><a name="item_state_history_hist"><strong>state_history_hist</strong></a></strong><br />
</dt>
<dd>
Returns the <em>history</em> part of the state_history attribute.
</dd>
<p></p>
<dt><strong><a name="item_type_2c_site_2c_home"><strong>type</strong>, <strong>site</strong>, <strong>home</strong></a></strong><br />
</dt>
<dd>
For an url like <em><a href="ftp://www.some.org/path/to/home">ftp://www.some.org/path/to/home</a></em>,
the <strong>type</strong> is <em>ftp</em>,
the <strong>site</strong> is <em>www.some.org</em>,
and <strong>home</strong> is <em><a href="ftp://www.some.org/">ftp://www.some.org/</a></em>.
</dd>
<p></p>
<dt><strong><a name="item_age_in_days"><strong>age_in_days</strong></a></strong><br />
</dt>
<dd>
Returns the mirror's age (in fractional days), based on the mirror's
timestamp as found by the last successful probe ; or based on the
length of the state history if no probe was ever successful.
Returns 'undef' if the mirror was never probed.
</dd>
<p></p>
<dt><strong><a name="item_mail"><strong>mail</strong></a></strong><br />
</dt>
<dd>
Returns the mirror's contact address as specified in the mirror list.
</dd>
<p></p>
<dt><strong><a name="item_region"><strong>region</strong></a></strong><br />
</dt>
<dd>
Returns the mirror's country code as specified in the mirror list.
</dd>
<p></p>
<dt><strong><a name="item_start_probe"><strong>start_probe</strong></a></strong><br />
</dt>
<dd>
Start a probe for the mirror in non-blocking mode ;
returns the associated (IO::Handle) file handle.
The caller must maintain an association between
the handles and the mirror objects.
</dd>
<p></p>
<dt><strong><a name="item_finish_probe"><strong>finish_probe ( $handle )</strong></a></strong><br />
</dt>
<dd>
Sets the (IO::Handle) <strong>$handle</strong> to blocking IO ;
reads a result from the handle,
and updates the state of the mirror.
</dd>
<p></p></dl>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<A HREF="mirmon.html">mirmon(1)</A><p>
</p>
<hr />
<h1><a name="author">AUTHOR</a></h1>
© 2003-2012
<A HREF="http://people.cs.uu.nl/henkp/">Henk P. Penning</A>,
<A HREF="http://www.cs.uu.nl/">Computer Science Department</A>,
<A HREF="http://www.uu.nl/">Utrecht University</A>
<BR>
mirmon-2.6 - Fri Mar 30 09:56:03 2012 ; henkp
</body>
</html>
|