You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2007/07/25 14:52:48 UTC

svn commit: r559437 [2/13] - in /spamassassin/site/full/3.2.x: ./ doc/

Added: spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_AsyncLoop.txt
URL: http://svn.apache.org/viewvc/spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_AsyncLoop.txt?view=auto&rev=559437
==============================================================================
--- spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_AsyncLoop.txt (added)
+++ spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_AsyncLoop.txt Wed Jul 25 05:52:42 2007
@@ -0,0 +1,103 @@
+NAME
+    Mail::SpamAssassin::AsyncLoop - scanner asynchronous event loop
+
+DESCRIPTION
+    An asynchronous event loop used for long-running operations, performed
+    "in the background" during the Mail::SpamAssassin::check() scan
+    operation, such as DNS blocklist lookups.
+
+METHODS
+    $obj = $async->start_lookup($obj)
+        Register the start of a long-running asynchronous lookup operation.
+        $obj is a hash reference containing the following items:
+
+        key (required)
+            A key string, unique to this lookup. This is what is reported in
+            debug messages, used as the key for "get_lookup()", etc.
+
+        id (required)
+            An ID string, also unique to this lookup. Typically, this is the
+            DNS packet ID as returned by DnsResolver's "bgsend" method.
+            Sadly, the Net::DNS architecture forces us to keep a separate ID
+            string for this task instead of reusing "key" -- if you are not
+            using DNS lookups through DnsResolver, it should be OK to just
+            reuse "key".
+
+        type (required)
+            A string, typically one word, used to describe the type of
+            lookup in log messages, such as "DNSBL", "MX", "TXT".
+
+        poll_callback (optional)
+            A code reference, which will be called periodically during the
+            background-processing period. If you will be performing an async
+            lookup on a non-DNS-based service, you will need to implement
+            this so that it checks for new responses and calls
+            "set_response_packet()" or "report_id_complete()" as
+            appropriate. DNS-based lookups can leave it undefined, since
+            DnsResolver::poll_responses() will be called automatically
+            anyway.
+
+            The code reference will be called with one argument, the $ent
+            object.
+
+        completed_callback (optional)
+            A code reference, which will be called when the lookup has been
+            reported as complete via "set_response_packet()" or
+            "report_id_complete()".
+
+            The code reference will be called with one argument, the $ent
+            object.
+
+        $obj is returned by this method.
+
+    $obj = $async->get_lookup($key)
+        Retrieve the pending-lookup object for the given key $key.
+
+        If the lookup is complete, this will return "undef".
+
+        Note that a lookup is still considered "pending" until
+        "complete_lookups()" is called, even if it has been reported as
+        complete via "set_response_packet()" or "report_id_complete()".
+
+    @objs = $async->get_pending_lookups()
+        Retrieve the lookup objects for all pending lookups.
+
+        Note that a lookup is still considered "pending" until
+        "complete_lookups()" is called, even if it has been reported as
+        complete via "set_response_packet()" or "report_id_complete()".
+
+    $alldone = $async->complete_lookups()
+        Perform a poll of the pending lookups, to see if any are completed;
+        if they are, their <completed_callback> is called with the entry
+        object for that lookup.
+
+        If there are no lookups remaining, or if too long has elapsed since
+        any results were returned, 1 is returned, otherwise 0.
+
+    $async->abort_remaining_lookups()
+        Abort any remaining lookups.
+
+    $async->set_response_packet($id, $pkt)
+        Register a "response packet" for a given query. $id is the ID for
+        the query, and must match the "id" supplied in "start_lookup()".
+        $pkt is the packet object for the response.
+
+        If this was called, $pkt will be available in the
+        "completed_callback" function as "$ent-<gt"{response_packet}>.
+
+        One or the other of "set_response_packet()" or
+        "report_id_complete()" should be called, but not both.
+
+    $async->report_id_complete($id)
+        Register that a query has completed, and is no longer "pending". $id
+        is the ID for the query, and must match the "id" supplied in
+        "start_lookup()".
+
+        One or the other of "set_response_packet()" or
+        "report_id_complete()" should be called, but not both.
+
+    $time = $async->get_last_start_lookup_time()
+        Get the time of the last call to "start_lookup()". If
+        "start_lookup()" was never called or "abort_remaining_lookups()" has
+        been called "get_last_start_lookup_time()" will return undef.
+

Added: spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_AutoWhitelist.html
URL: http://svn.apache.org/viewvc/spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_AutoWhitelist.html?view=auto&rev=559437
==============================================================================
--- spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_AutoWhitelist.html (added)
+++ spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_AutoWhitelist.html Wed Jul 25 05:52:42 2007
@@ -0,0 +1,89 @@
+<!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>Mail::SpamAssassin::AutoWhitelist - auto-whitelist handler for SpamAssassin</title>
+<link rev="made" href="mailto:jm@apache.org" />
+</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="#description">DESCRIPTION</a></li>
+	<li><a href="#methods">METHODS</a></li>
+</ul>
+<!-- INDEX END -->
+
+<hr />
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>Mail::SpamAssassin::AutoWhitelist - auto-whitelist handler for SpamAssassin</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<pre>
+  (see Mail::SpamAssassin)</pre>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>Mail::SpamAssassin is a module to identify spam using text analysis and
+several internet-based realtime blacklists.</p>
+<p>This class is used internally by SpamAssassin to manage the automatic
+whitelisting functionality.  Please refer to the <code>Mail::SpamAssassin</code>
+documentation for public interfaces.</p>
+<p>
+</p>
+<hr />
+<h1><a name="methods">METHODS</a></h1>
+<dl>
+<dt><strong><a name="item_check_address">$meanscore = awl-&gt;check_address($addr, $originating_ip);</a></strong><br />
+</dt>
+<dd>
+This method will return the mean score of all messages associated with the
+given address, or undef if the address hasn't been seen before.
+</dd>
+<dd>
+<p>If <strong>$originating_ip</strong> is supplied, it will be used in the lookup.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_count">awl-&gt;count();</a></strong><br />
+</dt>
+<dd>
+This method will return the count of messages used in determining the
+whitelist correction.
+</dd>
+<p></p>
+<dt><strong><a name="item_add_score">awl-&gt;add_score($score);</a></strong><br />
+</dt>
+<dd>
+This method will add half the score to the current entry.  Half the
+score is used, so that repeated use of the same From and IP address
+combination will gradually reduce the score.
+</dd>
+<p></p>
+<dt><strong><a name="item_add_known_good_address">awl-&gt;add_known_good_address($addr);</a></strong><br />
+</dt>
+<dd>
+This method will add a score of -100 to the given address -- effectively
+``bootstrapping'' the address as being one that should be whitelisted.
+</dd>
+<p></p>
+<dt><strong><a name="item_add_known_bad_address">awl-&gt;add_known_bad_address($addr);</a></strong><br />
+</dt>
+<dd>
+This method will add a score of 100 to the given address -- effectively
+``bootstrapping'' the address as being one that should be blacklisted.
+</dd>
+<p></p></dl>
+
+</body>
+
+</html>

Added: spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_AutoWhitelist.txt
URL: http://svn.apache.org/viewvc/spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_AutoWhitelist.txt?view=auto&rev=559437
==============================================================================
--- spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_AutoWhitelist.txt (added)
+++ spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_AutoWhitelist.txt Wed Jul 25 05:52:42 2007
@@ -0,0 +1,42 @@
+NAME
+    Mail::SpamAssassin::AutoWhitelist - auto-whitelist handler for
+    SpamAssassin
+
+SYNOPSIS
+      (see Mail::SpamAssassin)
+
+DESCRIPTION
+    Mail::SpamAssassin is a module to identify spam using text analysis and
+    several internet-based realtime blacklists.
+
+    This class is used internally by SpamAssassin to manage the automatic
+    whitelisting functionality. Please refer to the "Mail::SpamAssassin"
+    documentation for public interfaces.
+
+METHODS
+    $meanscore = awl->check_address($addr, $originating_ip);
+        This method will return the mean score of all messages associated
+        with the given address, or undef if the address hasn't been seen
+        before.
+
+        If $originating_ip is supplied, it will be used in the lookup.
+
+    awl->count();
+        This method will return the count of messages used in determining
+        the whitelist correction.
+
+    awl->add_score($score);
+        This method will add half the score to the current entry. Half the
+        score is used, so that repeated use of the same From and IP address
+        combination will gradually reduce the score.
+
+    awl->add_known_good_address($addr);
+        This method will add a score of -100 to the given address --
+        effectively "bootstrapping" the address as being one that should be
+        whitelisted.
+
+    awl->add_known_bad_address($addr);
+        This method will add a score of 100 to the given address --
+        effectively "bootstrapping" the address as being one that should be
+        blacklisted.
+

Added: spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_Bayes.html
URL: http://svn.apache.org/viewvc/spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_Bayes.html?view=auto&rev=559437
==============================================================================
--- spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_Bayes.html (added)
+++ spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_Bayes.html Wed Jul 25 05:52:42 2007
@@ -0,0 +1,50 @@
+<!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>Mail::SpamAssassin::Bayes - determine spammishness using a Bayesian classifier</title>
+<link rev="made" href="mailto:jm@apache.org" />
+</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="#description">DESCRIPTION</a></li>
+	<li><a href="#methods">METHODS</a></li>
+</ul>
+<!-- INDEX END -->
+
+<hr />
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>Mail::SpamAssassin::Bayes - determine spammishness using a Bayesian classifier</p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>This is a Bayesian-like form of probability-analysis classification, using an
+algorithm based on the one detailed in Paul Graham's <em>A Plan For Spam</em> paper
+at:</p>
+<pre>
+  <a href="http://www.paulgraham.com/spam.html">http://www.paulgraham.com/spam.html</a></pre>
+<p>It also incorporates some other aspects taken from Graham Robinson's webpage
+on the subject at:</p>
+<pre>
+  <a href="http://radio.weblogs.com/0101454/stories/2002/09/16/spamDetection.html">http://radio.weblogs.com/0101454/stories/2002/09/16/spamDetection.html</a></pre>
+<p>And the chi-square probability combiner as described here:</p>
+<pre>
+  <a href="http://www.linuxjournal.com/print.php?sid=6467">http://www.linuxjournal.com/print.php?sid=6467</a></pre>
+<p>The results are incorporated into SpamAssassin as the BAYES_* rules.</p>
+<p>
+</p>
+<hr />
+<h1><a name="methods">METHODS</a></h1>
+
+</body>
+
+</html>

Added: spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_Bayes.txt
URL: http://svn.apache.org/viewvc/spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_Bayes.txt?view=auto&rev=559437
==============================================================================
--- spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_Bayes.txt (added)
+++ spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_Bayes.txt Wed Jul 25 05:52:42 2007
@@ -0,0 +1,23 @@
+NAME
+    Mail::SpamAssassin::Bayes - determine spammishness using a Bayesian
+    classifier
+
+DESCRIPTION
+    This is a Bayesian-like form of probability-analysis classification,
+    using an algorithm based on the one detailed in Paul Graham's *A Plan
+    For Spam* paper at:
+
+      http://www.paulgraham.com/spam.html
+
+    It also incorporates some other aspects taken from Graham Robinson's
+    webpage on the subject at:
+
+      http://radio.weblogs.com/0101454/stories/2002/09/16/spamDetection.html
+
+    And the chi-square probability combiner as described here:
+
+      http://www.linuxjournal.com/print.php?sid=6467
+
+    The results are incorporated into SpamAssassin as the BAYES_* rules.
+
+METHODS

Added: spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore.html
URL: http://svn.apache.org/viewvc/spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore.html?view=auto&rev=559437
==============================================================================
--- spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore.html (added)
+++ spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore.html Wed Jul 25 05:52:42 2007
@@ -0,0 +1,512 @@
+<!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>Mail::SpamAssassin::BayesStore - Bayesian Storage Module</title>
+<link rev="made" href="mailto:jm@apache.org" />
+</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="#description">DESCRIPTION</a></li>
+	<li><a href="#methods">METHODS</a></li>
+</ul>
+<!-- INDEX END -->
+
+<hr />
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>Mail::SpamAssassin::BayesStore - Bayesian Storage Module</p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>This is the public API for the Bayesian store methods.  Any implementation of
+the storage module must implement these methods.</p>
+<p>
+</p>
+<hr />
+<h1><a name="methods">METHODS</a></h1>
+<dl>
+<dt><strong><a name="item_new">new</a></strong><br />
+</dt>
+<dd>
+public class (Mail::SpamAssassin::BayesStore) new (Mail::SpamAssassin::Bayes $bayes)
+</dd>
+<dd>
+<p>Description:
+This method creates a new instance of the Mail::SpamAssassin::BayesStore
+object.  You must pass in an instance of the Mail::SpamAssassin:Bayes object,
+which is stashed for use throughout the module.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_db_version">DB_VERSION</a></strong><br />
+</dt>
+<dd>
+public instance (Integer) DB_VERSION ()
+</dd>
+<dd>
+<p>Description:
+This method returns the currently supported database version for the
+implementation.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_read_db_configs">read_db_configs</a></strong><br />
+</dt>
+<dd>
+public instance () read_db_configs ()
+</dd>
+<dd>
+<p>Description:
+This method reads any needed config variables from the configuration
+object and then calls the Mail::SpamAssassin::Bayes read_db_configs method.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_tie_db_readonly">tie_db_readonly</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) tie_db_readonly ()
+</dd>
+<dd>
+<p>Description:
+This method opens up the database in readonly mode.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_tie_db_writable">tie_db_writable</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) tie_db_writable ()
+</dd>
+<dd>
+<p>Description:
+This method opens up the database in writable mode.</p>
+</dd>
+<dd>
+<p>Any callers of this methods should ensure that they call <a href="#item_untie_db"><code>untie_db()</code></a>
+afterwards.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_untie_db">untie_db</a></strong><br />
+</dt>
+<dd>
+public instance () untie_db ()
+</dd>
+<dd>
+<p>Description:
+This method unties the database.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_calculate_expire_delta">calculate_expire_delta</a></strong><br />
+</dt>
+<dd>
+public instance (%) calculate_expire_delta (Integer $newest_atime,
+                                             Integer $start,
+                                             Integer $max_expire_mult)
+</dd>
+<dd>
+<p>Description:
+This method performs a calculation on the data to determine the optimum
+atime for token expiration.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_token_expiration">token_expiration</a></strong><br />
+</dt>
+<dd>
+public instance (Integer, Integer,
+                 Integer, Integer) token_expiration(\% $opts,
+                                                    Integer $newest_atime,
+                                                    Integer $newdelta)
+</dd>
+<dd>
+<p>Description:
+This method performs the database specific expiration of tokens based on
+the passed in <code>$newest_atime</code> and <code>$newdelta</code>.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_expire_old_tokens">expire_old_tokens</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) expire_old_tokens (\% hashref)
+</dd>
+<dd>
+<p>Description:
+This method expires old tokens from the database.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_expire_old_tokens_trapped">expire_old_tokens_trapped</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) expire_old_tokens_trapped (\% $opts)
+</dd>
+<dd>
+<p>Description:
+This methods does the actual token expiration.</p>
+</dd>
+<dd>
+<p>XXX More docs here about the methodology and what not</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_sync_due">sync_due</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) sync_due ()
+</dd>
+<dd>
+<p>Description:
+This methods determines if a sync is due.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_expiry_due">expiry_due</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) expiry_due ()
+</dd>
+<dd>
+<p>Description:
+This methods determines if an expire is due.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_seen_get">seen_get</a></strong><br />
+</dt>
+<dd>
+public instance (Char) seen_get (String $msgid)
+</dd>
+<dd>
+<p>Description:
+This method retrieves the stored value, if any, for <code>$msgid</code>.  The return
+value is the stored string ('s' for spam and 'h' for ham) or undef if
+<code>$msgid</code> is not found.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_seen_put">seen_put</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) seen_put (String $msgid, Char $flag)
+</dd>
+<dd>
+<p>Description:
+This method records <code>$msgid</code> as the type given by <code>$flag</code>.  <code>$flag</code> is
+one of two values 's' for spam and 'h' for ham.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_seen_delete">seen_delete</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) seen_delete (String $msgid)
+</dd>
+<dd>
+<p>Description:
+This method removes <code>$msgid</code> from storage.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_get_storage_variables">get_storage_variables</a></strong><br />
+</dt>
+<dd>
+public instance (@) get_storage_variables ()
+</dd>
+<dd>
+<p>Description:
+This method retrieves the various administrative variables used by
+the Bayes storage implementation.</p>
+</dd>
+<dd>
+<p>The values returned in the array are in the following order:</p>
+</dd>
+<dd>
+<p>0: scan count base</p>
+</dd>
+<dd>
+<p>1: number of spam</p>
+</dd>
+<dd>
+<p>2: number of ham</p>
+</dd>
+<dd>
+<p>3: number of tokens in db</p>
+</dd>
+<dd>
+<p>4: last expire atime</p>
+</dd>
+<dd>
+<p>5: oldest token in db atime</p>
+</dd>
+<dd>
+<p>6: db version value</p>
+</dd>
+<dd>
+<p>7: last journal sync</p>
+</dd>
+<dd>
+<p>8: last atime delta</p>
+</dd>
+<dd>
+<p>9: last expire reduction count</p>
+</dd>
+<dd>
+<p>10: newest token in db atime</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_dump_db_toks">dump_db_toks</a></strong><br />
+</dt>
+<dd>
+public instance () dump_db_toks (String $template, String $regex, @ @vars)
+</dd>
+<dd>
+<p>Description:
+This method loops over all tokens, computing the probability for the token
+and then printing it out according to the passed in template.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_set_last_expire">set_last_expire</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) _set_last_expire (Integer $time)
+</dd>
+<dd>
+<p>Description:
+This method sets the last expire time.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_get_running_expire_tok">get_running_expire_tok</a></strong><br />
+</dt>
+<dd>
+public instance (Time) get_running_expire_tok ()
+</dd>
+<dd>
+<p>Description:
+This method determines if an expire is currently running and returns the time
+the expire started.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_set_running_expire_tok">set_running_expire_tok</a></strong><br />
+</dt>
+<dd>
+public instance (Time) set_running_expire_tok ()
+</dd>
+<dd>
+<p>Description:
+This method sets the running expire time to the current time.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_remove_running_expire_tok">remove_running_expire_tok</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) remove_running_expire_tok ()
+</dd>
+<dd>
+<p>Description:
+This method removes a currently set running expire time.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_tok_get">tok_get</a></strong><br />
+</dt>
+<dd>
+public instance (Integer, Integer, Time) tok_get (String $token)
+</dd>
+<dd>
+<p>Description:
+This method retrieves the specified token (<code>$token</code>) from storage and returns
+it's spam count, ham acount and last access time.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_tok_get_all">tok_get_all</a></strong><br />
+</dt>
+<dd>
+public instance (\@) tok_get_all (@ @tokens)
+</dd>
+<dd>
+<p>Description:
+This method retrieves the specified tokens (<code>@tokens</code>) from storage and returns
+an array ref of arrays spam count, ham acount and last access time.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_tok_count_change">tok_count_change</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) tok_count_change (Integer $spam_count,
+                                            Integer $ham_count,
+                                            String $token,
+                                            Time $atime)
+</dd>
+<dd>
+<p>Description:
+This method takes a <code>$spam_count</code> and <code>$ham_count</code> and adds it to
+<code>$token</code> along with updating <code>$token</code>s atime with <code>$atime</code>.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_multi_tok_count_change">multi_tok_count_change</a></strong><br />
+</dt>
+<dd>
+<table cellspacing="0" cellpadding="0"><tr><td>public instance (Boolean) multi_tok_count_change (Integer $spam_count,
+<tr><td> <td>          Integer $ham_count,
+<tr><td><td> <td>          \% $tokens,
+<tr><td><td>          String $atime)</table>
+</dd>
+<dd>
+<p>Description:
+This method takes a <code>$spam_count</code> and <code>$ham_count</code> and adds it to all
+of the tokens in the <code>$tokens</code> hash ref along with updating each tokens
+atime with <code>$atime</code>.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_nspam_nham_get">nspam_nham_get</a></strong><br />
+</dt>
+<dd>
+public instance (Integer, Integer) nspam_nham_get ()
+</dd>
+<dd>
+<p>Description:
+This method retrieves the total number of spam and the total number of spam
+currently under storage.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_nspam_nham_change">nspam_nham_change</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) nspam_nham_change (Integer $num_spam,
+                                             Integer $num_ham)
+</dd>
+<dd>
+<p>Description:
+This method updates the number of spam and the number of ham in the database.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_tok_touch">tok_touch</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) tok_touch (String $token,
+                                     Time $atime)
+</dd>
+<dd>
+<p>Description:
+This method updates the given tokens (<code>$token</code>) access time.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_tok_touch_all">tok_touch_all</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) tok_touch_all (\@ $tokens,
+                                         Time $atime)
+</dd>
+<dd>
+<p>Description:
+This method does a mass update of the given list of tokens <code>$tokens</code>, if the existing token
+atime is &lt; <code>$atime</code>.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_cleanup">cleanup</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) cleanup ()
+</dd>
+<dd>
+<p>Description:
+This method performs any cleanup necessary before moving onto the next
+operation.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_get_magic_re">get_magic_re</a></strong><br />
+</dt>
+<dd>
+public instance get_magic_re (String)
+</dd>
+<dd>
+<p>Description:
+This method returns a regexp which indicates a magic token.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_sync">sync</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) sync (\% $opts)
+</dd>
+<dd>
+<p>Description:
+This method performs a sync of the database.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_perform_upgrade">perform_upgrade</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) perform_upgrade (\% $opts)
+</dd>
+<dd>
+<p>Description:
+This method is a utility method that performs any necessary upgrades
+between versions.  It should know how to handle previous versions and
+what needs to happen to upgrade them.</p>
+</dd>
+<dd>
+<p>A true return value indicates success.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_clear_database">clear_database</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) clear_database ()
+</dd>
+<dd>
+<p>Description:
+This method deletes all records for a particular user.</p>
+</dd>
+<dd>
+<p>Callers should be aware that any errors returned by this method
+could causes the database to be inconsistent for the given user.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_backup_database">backup_database</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) backup_database ()
+</dd>
+<dd>
+<p>Description:
+This method will dump the users database in a marchine readable format.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_restore_database">restore_database</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) restore_database (String $filename, Boolean $showdots)
+</dd>
+<dd>
+<p>Description:
+This method restores a database from the given filename, <code>$filename</code>.</p>
+</dd>
+<dd>
+<p>Callers should be aware that any errors returned by this method
+could causes the database to be inconsistent for the given user.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_db_readable">db_readable</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) db_readable ()
+</dd>
+<dd>
+<p>Description:
+This method returns whether or not the Bayes DB is available in a
+readable state.</p>
+</dd>
+<p></p>
+<dt><strong><a name="item_db_writable">db_writable</a></strong><br />
+</dt>
+<dd>
+public instance (Boolean) db_writable ()
+</dd>
+<dd>
+<p>Description:
+This method returns whether or not the Bayes DB is available in a
+writable state.</p>
+</dd>
+<p></p></dl>
+
+</body>
+
+</html>

Added: spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore.txt
URL: http://svn.apache.org/viewvc/spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore.txt?view=auto&rev=559437
==============================================================================
--- spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore.txt (added)
+++ spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore.txt Wed Jul 25 05:52:42 2007
@@ -0,0 +1,278 @@
+NAME
+    Mail::SpamAssassin::BayesStore - Bayesian Storage Module
+
+DESCRIPTION
+    This is the public API for the Bayesian store methods. Any
+    implementation of the storage module must implement these methods.
+
+METHODS
+    new public class (Mail::SpamAssassin::BayesStore) new
+        (Mail::SpamAssassin::Bayes $bayes)
+
+        Description: This method creates a new instance of the
+        Mail::SpamAssassin::BayesStore object. You must pass in an instance
+        of the Mail::SpamAssassin:Bayes object, which is stashed for use
+        throughout the module.
+
+    DB_VERSION
+        public instance (Integer) DB_VERSION ()
+
+        Description: This method returns the currently supported database
+        version for the implementation.
+
+    read_db_configs
+        public instance () read_db_configs ()
+
+        Description: This method reads any needed config variables from the
+        configuration object and then calls the Mail::SpamAssassin::Bayes
+        read_db_configs method.
+
+    tie_db_readonly
+        public instance (Boolean) tie_db_readonly ()
+
+        Description: This method opens up the database in readonly mode.
+
+    tie_db_writable
+        public instance (Boolean) tie_db_writable ()
+
+        Description: This method opens up the database in writable mode.
+
+        Any callers of this methods should ensure that they call untie_db()
+        afterwards.
+
+    untie_db
+        public instance () untie_db ()
+
+        Description: This method unties the database.
+
+    calculate_expire_delta
+        public instance (%) calculate_expire_delta (Integer $newest_atime,
+        Integer $start, Integer $max_expire_mult)
+
+        Description: This method performs a calculation on the data to
+        determine the optimum atime for token expiration.
+
+    token_expiration
+        public instance (Integer, Integer, Integer, Integer)
+        token_expiration(\% $opts, Integer $newest_atime, Integer $newdelta)
+
+        Description: This method performs the database specific expiration
+        of tokens based on the passed in $newest_atime and $newdelta.
+
+    expire_old_tokens
+        public instance (Boolean) expire_old_tokens (\% hashref)
+
+        Description: This method expires old tokens from the database.
+
+    expire_old_tokens_trapped
+        public instance (Boolean) expire_old_tokens_trapped (\% $opts)
+
+        Description: This methods does the actual token expiration.
+
+        XXX More docs here about the methodology and what not
+
+    sync_due
+        public instance (Boolean) sync_due ()
+
+        Description: This methods determines if a sync is due.
+
+    expiry_due
+        public instance (Boolean) expiry_due ()
+
+        Description: This methods determines if an expire is due.
+
+    seen_get
+        public instance (Char) seen_get (String $msgid)
+
+        Description: This method retrieves the stored value, if any, for
+        $msgid. The return value is the stored string ('s' for spam and 'h'
+        for ham) or undef if $msgid is not found.
+
+    seen_put
+        public instance (Boolean) seen_put (String $msgid, Char $flag)
+
+        Description: This method records $msgid as the type given by $flag.
+        $flag is one of two values 's' for spam and 'h' for ham.
+
+    seen_delete
+        public instance (Boolean) seen_delete (String $msgid)
+
+        Description: This method removes $msgid from storage.
+
+    get_storage_variables
+        public instance (@) get_storage_variables ()
+
+        Description: This method retrieves the various administrative
+        variables used by the Bayes storage implementation.
+
+        The values returned in the array are in the following order:
+
+        0: scan count base
+
+        1: number of spam
+
+        2: number of ham
+
+        3: number of tokens in db
+
+        4: last expire atime
+
+        5: oldest token in db atime
+
+        6: db version value
+
+        7: last journal sync
+
+        8: last atime delta
+
+        9: last expire reduction count
+
+        10: newest token in db atime
+
+    dump_db_toks
+        public instance () dump_db_toks (String $template, String $regex, @
+        @vars)
+
+        Description: This method loops over all tokens, computing the
+        probability for the token and then printing it out according to the
+        passed in template.
+
+    set_last_expire
+        public instance (Boolean) _set_last_expire (Integer $time)
+
+        Description: This method sets the last expire time.
+
+    get_running_expire_tok
+        public instance (Time) get_running_expire_tok ()
+
+        Description: This method determines if an expire is currently
+        running and returns the time the expire started.
+
+    set_running_expire_tok
+        public instance (Time) set_running_expire_tok ()
+
+        Description: This method sets the running expire time to the current
+        time.
+
+    remove_running_expire_tok
+        public instance (Boolean) remove_running_expire_tok ()
+
+        Description: This method removes a currently set running expire
+        time.
+
+    tok_get
+        public instance (Integer, Integer, Time) tok_get (String $token)
+
+        Description: This method retrieves the specified token ($token) from
+        storage and returns it's spam count, ham acount and last access
+        time.
+
+    tok_get_all
+        public instance (\@) tok_get_all (@ @tokens)
+
+        Description: This method retrieves the specified tokens (@tokens)
+        from storage and returns an array ref of arrays spam count, ham
+        acount and last access time.
+
+    tok_count_change
+        public instance (Boolean) tok_count_change (Integer $spam_count,
+        Integer $ham_count, String $token, Time $atime)
+
+        Description: This method takes a $spam_count and $ham_count and adds
+        it to $token along with updating $tokens atime with $atime.
+
+    multi_tok_count_change
+        public instance (Boolean) multi_tok_count_change (Integer
+        $spam_count, Integer $ham_count, \% $tokens, String $atime)
+
+        Description: This method takes a $spam_count and $ham_count and adds
+        it to all of the tokens in the $tokens hash ref along with updating
+        each tokens atime with $atime.
+
+    nspam_nham_get
+        public instance (Integer, Integer) nspam_nham_get ()
+
+        Description: This method retrieves the total number of spam and the
+        total number of spam currently under storage.
+
+    nspam_nham_change
+        public instance (Boolean) nspam_nham_change (Integer $num_spam,
+        Integer $num_ham)
+
+        Description: This method updates the number of spam and the number
+        of ham in the database.
+
+    tok_touch
+        public instance (Boolean) tok_touch (String $token, Time $atime)
+
+        Description: This method updates the given tokens ($token) access
+        time.
+
+    tok_touch_all
+        public instance (Boolean) tok_touch_all (\@ $tokens, Time $atime)
+
+        Description: This method does a mass update of the given list of
+        tokens $tokens, if the existing token atime is < $atime.
+
+    cleanup
+        public instance (Boolean) cleanup ()
+
+        Description: This method performs any cleanup necessary before
+        moving onto the next operation.
+
+    get_magic_re
+        public instance get_magic_re (String)
+
+        Description: This method returns a regexp which indicates a magic
+        token.
+
+    sync
+        public instance (Boolean) sync (\% $opts)
+
+        Description: This method performs a sync of the database.
+
+    perform_upgrade
+        public instance (Boolean) perform_upgrade (\% $opts)
+
+        Description: This method is a utility method that performs any
+        necessary upgrades between versions. It should know how to handle
+        previous versions and what needs to happen to upgrade them.
+
+        A true return value indicates success.
+
+    clear_database
+        public instance (Boolean) clear_database ()
+
+        Description: This method deletes all records for a particular user.
+
+        Callers should be aware that any errors returned by this method
+        could causes the database to be inconsistent for the given user.
+
+    backup_database
+        public instance (Boolean) backup_database ()
+
+        Description: This method will dump the users database in a marchine
+        readable format.
+
+    restore_database
+        public instance (Boolean) restore_database (String $filename,
+        Boolean $showdots)
+
+        Description: This method restores a database from the given
+        filename, $filename.
+
+        Callers should be aware that any errors returned by this method
+        could causes the database to be inconsistent for the given user.
+
+    db_readable
+        public instance (Boolean) db_readable ()
+
+        Description: This method returns whether or not the Bayes DB is
+        available in a readable state.
+
+    db_writable
+        public instance (Boolean) db_writable ()
+
+        Description: This method returns whether or not the Bayes DB is
+        available in a writable state.
+

Added: spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore_MySQL.html
URL: http://svn.apache.org/viewvc/spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore_MySQL.html?view=auto&rev=559437
==============================================================================
--- spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore_MySQL.html (added)
+++ spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore_MySQL.html Wed Jul 25 05:52:42 2007
@@ -0,0 +1,194 @@
+<!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>Mail::SpamAssassin::BayesStore::MySQL - MySQL Specific Bayesian Storage Module Implementation</title>
+<link rev="made" href="mailto:jm@apache.org" />
+</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="#description">DESCRIPTION</a></li>
+	<li><a href="#methods">METHODS</a></li>
+	<ul>
+
+		<li><a href="#token_expiration">token_expiration</a></li>
+		<li><a href="#seen_put">seen_put</a></li>
+		<li><a href="#seen_delete">seen_delete</a></li>
+		<li><a href="#set_last_expire">set_last_expire</a></li>
+		<li><a href="#set_running_expire_tok">set_running_expire_tok</a></li>
+		<li><a href="#remove_running_expire_tok">remove_running_expire_tok</a></li>
+		<li><a href="#nspam_nham_change">nspam_nham_change</a></li>
+		<li><a href="#tok_touch">tok_touch</a></li>
+		<li><a href="#tok_touch_all">tok_touch_all</a></li>
+		<li><a href="#cleanup">cleanup</a></li>
+		<li><a href="#clear_database">clear_database</a></li>
+	</ul>
+
+	<li><a href="#private_methods">Private Methods</a></li>
+	<ul>
+
+		<li><a href="#_connect_db">_connect_db</a></li>
+		<li><a href="#_initialize_db">_initialize_db</a></li>
+		<li><a href="#_put_token">_put_token</a></li>
+		<li><a href="#_put_tokens">_put_tokens</a></li>
+	</ul>
+
+</ul>
+<!-- INDEX END -->
+
+<hr />
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>Mail::SpamAssassin::BayesStore::MySQL - MySQL Specific Bayesian Storage Module Implementation</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>This module implements a MySQL specific based bayesian storage module.  It
+requires that you are running at least version 4.1 of MySQL, if you are running
+a version of MySQL &lt; 4.1 then several aspects of this module will fail and
+possibly corrupt your bayes database data.</p>
+<p>In addition, this module will support rollback on error, if you are
+using the InnoDB database table type in MySQL.  For more information
+please review the instructions in sql/README.bayes.</p>
+<p>
+</p>
+<hr />
+<h1><a name="methods">METHODS</a></h1>
+<p>
+</p>
+<h2><a name="token_expiration">token_expiration</a></h2>
+<p>public instance (Integer, Integer,
+                 Integer, Integer) token_expiration(\% $opts,
+                                                    Integer $newdelta,
+                                                    @ @vars)</p>
+<p>Description:
+This method performs the database specific expiration of tokens based on
+the passed in <code>$newdelta</code> and <code>@vars</code>.</p>
+<p>
+</p>
+<h2><a name="seen_put">seen_put</a></h2>
+<p>public (Boolean) seen_put (string $msgid, char $flag)</p>
+<p>Description:
+This method records <code>$msgid</code> as the type given by <code>$flag</code>.  <code>$flag</code> is one of
+two values 's' for spam and 'h' for ham.</p>
+<p>
+</p>
+<h2><a name="seen_delete">seen_delete</a></h2>
+<p>public instance (Boolean) seen_delete (string $msgid)</p>
+<p>Description:
+This method removes <code>$msgid</code> from the database.</p>
+<p>
+</p>
+<h2><a name="set_last_expire">set_last_expire</a></h2>
+<p>public instance (Boolean) set_last_expire (Integer $time)</p>
+<p>Description:
+This method sets the last expire time.</p>
+<p>
+</p>
+<h2><a name="set_running_expire_tok">set_running_expire_tok</a></h2>
+<p>public instance (String $time) set_running_expire_tok ()</p>
+<p>Description:
+This method sets the time that an expire starts running.</p>
+<p>
+</p>
+<h2><a name="remove_running_expire_tok">remove_running_expire_tok</a></h2>
+<p>public instance (Boolean) remove_running_expire_tok ()</p>
+<p>Description:
+This method removes the row in the database that indicates that
+and expire is currently running.</p>
+<p>
+</p>
+<h2><a name="nspam_nham_change">nspam_nham_change</a></h2>
+<p>public instance (Boolean) nspam_nham_change (Integer $num_spam,
+                                             Integer $num_ham)</p>
+<p>Description:
+This method updates the number of spam and the number of ham in the database.</p>
+<p>
+</p>
+<h2><a name="tok_touch">tok_touch</a></h2>
+<p>public instance (Boolean) tok_touch (String $token,
+                                     String $atime)</p>
+<p>Description:
+This method updates the given tokens (<code>$token</code>) atime.</p>
+<p>The assumption is that the token already exists in the database.</p>
+<p>
+</p>
+<h2><a name="tok_touch_all">tok_touch_all</a></h2>
+<p>public instance (Boolean) tok_touch (\@ $tokens
+                                     String $atime)</p>
+<p>Description:
+This method does a mass update of the given list of tokens <code>$tokens</code>, if the existing token
+atime is &lt; <code>$atime</code>.</p>
+<p>The assumption is that the tokens already exist in the database.</p>
+<p>We should never be touching more than N_SIGNIFICANT_TOKENS, so we can make
+some assumptions about how to handle the data (ie no need to batch like we
+do in tok_get_all)</p>
+<p>
+</p>
+<h2><a name="cleanup">cleanup</a></h2>
+<p>public instance (Boolean) cleanup ()</p>
+<p>Description:
+This method peroms any cleanup necessary before moving onto the next
+operation.</p>
+<p>
+</p>
+<h2><a name="clear_database">clear_database</a></h2>
+<p>public instance (Boolean) clear_database ()</p>
+<p>Description:
+This method deletes all records for a particular user.</p>
+<p>Callers should be aware that any errors returned by this method
+could causes the database to be inconsistent for the given user.</p>
+<p>
+</p>
+<hr />
+<h1><a name="private_methods">Private Methods</a></h1>
+<p>
+</p>
+<h2><a name="_connect_db">_connect_db</a></h2>
+<p>private instance (Boolean) _connect_db ()</p>
+<p>Description:
+This method connects to the SQL database.</p>
+<p>
+</p>
+<h2><a name="_initialize_db">_initialize_db</a></h2>
+<p>private instance (Boolean) _initialize_db ()</p>
+<p>Description:
+This method will check to see if a user has had their bayes variables
+initialized. If not then it will perform this initialization.</p>
+<p>
+</p>
+<h2><a name="_put_token">_put_token</a></h2>
+<p>private instance (Boolean) _put_token (string $token,
+                                       integer $spam_count,
+                                       integer $ham_count,
+				       string $atime)</p>
+<p>Description:
+This method performs the work of either inserting or updating a token in
+the database.</p>
+<p>
+</p>
+<h2><a name="_put_tokens">_put_tokens</a></h2>
+<p>private instance (Boolean) _put_tokens (\% $tokens,
+                                        integer $spam_count,
+                                        integer $ham_count,
+			 	        string $atime)</p>
+<p>Description:
+This method performs the work of either inserting or updating tokens in
+the database.</p>
+
+</body>
+
+</html>

Added: spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore_MySQL.txt
URL: http://svn.apache.org/viewvc/spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore_MySQL.txt?view=auto&rev=559437
==============================================================================
--- spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore_MySQL.txt (added)
+++ spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore_MySQL.txt Wed Jul 25 05:52:42 2007
@@ -0,0 +1,116 @@
+NAME
+    Mail::SpamAssassin::BayesStore::MySQL - MySQL Specific Bayesian Storage
+    Module Implementation
+
+SYNOPSIS
+DESCRIPTION
+    This module implements a MySQL specific based bayesian storage module.
+    It requires that you are running at least version 4.1 of MySQL, if you
+    are running a version of MySQL < 4.1 then several aspects of this module
+    will fail and possibly corrupt your bayes database data.
+
+    In addition, this module will support rollback on error, if you are
+    using the InnoDB database table type in MySQL. For more information
+    please review the instructions in sql/README.bayes.
+
+METHODS
+  token_expiration
+    public instance (Integer, Integer, Integer, Integer) token_expiration(\%
+    $opts, Integer $newdelta, @ @vars)
+
+    Description: This method performs the database specific expiration of
+    tokens based on the passed in $newdelta and @vars.
+
+  seen_put
+    public (Boolean) seen_put (string $msgid, char $flag)
+
+    Description: This method records $msgid as the type given by $flag.
+    $flag is one of two values 's' for spam and 'h' for ham.
+
+  seen_delete
+    public instance (Boolean) seen_delete (string $msgid)
+
+    Description: This method removes $msgid from the database.
+
+  set_last_expire
+    public instance (Boolean) set_last_expire (Integer $time)
+
+    Description: This method sets the last expire time.
+
+  set_running_expire_tok
+    public instance (String $time) set_running_expire_tok ()
+
+    Description: This method sets the time that an expire starts running.
+
+  remove_running_expire_tok
+    public instance (Boolean) remove_running_expire_tok ()
+
+    Description: This method removes the row in the database that indicates
+    that and expire is currently running.
+
+  nspam_nham_change
+    public instance (Boolean) nspam_nham_change (Integer $num_spam, Integer
+    $num_ham)
+
+    Description: This method updates the number of spam and the number of
+    ham in the database.
+
+  tok_touch
+    public instance (Boolean) tok_touch (String $token, String $atime)
+
+    Description: This method updates the given tokens ($token) atime.
+
+    The assumption is that the token already exists in the database.
+
+  tok_touch_all
+    public instance (Boolean) tok_touch (\@ $tokens String $atime)
+
+    Description: This method does a mass update of the given list of tokens
+    $tokens, if the existing token atime is < $atime.
+
+    The assumption is that the tokens already exist in the database.
+
+    We should never be touching more than N_SIGNIFICANT_TOKENS, so we can
+    make some assumptions about how to handle the data (ie no need to batch
+    like we do in tok_get_all)
+
+  cleanup
+    public instance (Boolean) cleanup ()
+
+    Description: This method peroms any cleanup necessary before moving onto
+    the next operation.
+
+  clear_database
+    public instance (Boolean) clear_database ()
+
+    Description: This method deletes all records for a particular user.
+
+    Callers should be aware that any errors returned by this method could
+    causes the database to be inconsistent for the given user.
+
+Private Methods
+  _connect_db
+    private instance (Boolean) _connect_db ()
+
+    Description: This method connects to the SQL database.
+
+  _initialize_db
+    private instance (Boolean) _initialize_db ()
+
+    Description: This method will check to see if a user has had their bayes
+    variables initialized. If not then it will perform this initialization.
+
+  _put_token
+    private instance (Boolean) _put_token (string $token, integer
+    $spam_count, integer $ham_count, string $atime)
+
+    Description: This method performs the work of either inserting or
+    updating a token in the database.
+
+  _put_tokens
+    private instance (Boolean) _put_tokens (\% $tokens, integer $spam_count,
+    integer $ham_count, string $atime)
+
+    Description: This method performs the work of either inserting or
+    updating tokens in the database.
+

Added: spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore_PgSQL.html
URL: http://svn.apache.org/viewvc/spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore_PgSQL.html?view=auto&rev=559437
==============================================================================
--- spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore_PgSQL.html (added)
+++ spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore_PgSQL.html Wed Jul 25 05:52:42 2007
@@ -0,0 +1,208 @@
+<!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>Mail::SpamAssassin::BayesStore::PgSQL - PostgreSQL Specific Bayesian Storage Module Implementation</title>
+<link rev="made" href="mailto:jm@apache.org" />
+</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="#description">DESCRIPTION</a></li>
+	<li><a href="#methods">METHODS</a></li>
+	<ul>
+
+		<li><a href="#token_expiration">token_expiration</a></li>
+		<li><a href="#seen_put">seen_put</a></li>
+		<li><a href="#seen_delete">seen_delete</a></li>
+		<li><a href="#set_last_expire">set_last_expire</a></li>
+		<li><a href="#set_running_expire_tok">set_running_expire_tok</a></li>
+		<li><a href="#remove_running_expire_tok">remove_running_expire_tok</a></li>
+		<li><a href="#tok_get">tok_get</a></li>
+		<li><a href="#tok_get_all">tok_get_all</a></li>
+		<li><a href="#nspam_nham_change">nspam_nham_change</a></li>
+		<li><a href="#tok_touch">tok_touch</a></li>
+		<li><a href="#tok_touch_all">tok_touch_all</a></li>
+		<li><a href="#cleanup">cleanup</a></li>
+		<li><a href="#clear_database">clear_database</a></li>
+	</ul>
+
+	<li><a href="#private_methods">Private Methods</a></li>
+	<ul>
+
+		<li><a href="#_connect_db">_connect_db</a></li>
+		<li><a href="#_put_token">_put_token</a></li>
+		<li><a href="#_put_tokens">_put_tokens</a></li>
+		<li><a href="#_token_select_string">_token_select_string</a></li>
+	</ul>
+
+</ul>
+<!-- INDEX END -->
+
+<hr />
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>Mail::SpamAssassin::BayesStore::PgSQL - PostgreSQL Specific Bayesian Storage Module Implementation</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>This module implementes a PostgresSQL specific bayesian storage module.</p>
+<p>It subclasses Mail::SpamAssassin::BayesStore::SQL and overrides any methods
+which makes SQL calls involving the token column.  Since PostgreSQL uses BYTEA
+for the token column type you must make sure that the DBD driver does the proper
+quoting.  You can accomplish this by binding the token column to a specific type.</p>
+<p>
+</p>
+<hr />
+<h1><a name="methods">METHODS</a></h1>
+<p>
+</p>
+<h2><a name="token_expiration">token_expiration</a></h2>
+<p>public instance (Integer, Integer,
+                 Integer, Integer) token_expiration(\% $opts,
+                                                    Integer $newdelta,
+                                                    @ @vars)</p>
+<p>Description:
+This method performs the database specific expiration of tokens based on
+the passed in <code>$newdelta</code> and <code>@vars</code>.</p>
+<p>
+</p>
+<h2><a name="seen_put">seen_put</a></h2>
+<p>public (Boolean) seen_put (string $msgid, char $flag)</p>
+<p>Description:
+This method records <code>$msgid</code> as the type given by <code>$flag</code>.  <code>$flag</code> is one of
+two values 's' for spam and 'h' for ham.</p>
+<p>
+</p>
+<h2><a name="seen_delete">seen_delete</a></h2>
+<p>public instance (Boolean) seen_delete (string $msgid)</p>
+<p>Description:
+This method removes <code>$msgid</code> from the database.</p>
+<p>
+</p>
+<h2><a name="set_last_expire">set_last_expire</a></h2>
+<p>public instance (Boolean) set_last_expire (Integer $time)</p>
+<p>Description:
+This method sets the last expire time.</p>
+<p>
+</p>
+<h2><a name="set_running_expire_tok">set_running_expire_tok</a></h2>
+<p>public instance (String $time) set_running_expire_tok ()</p>
+<p>Description:
+This method sets the time that an expire starts running.</p>
+<p>
+</p>
+<h2><a name="remove_running_expire_tok">remove_running_expire_tok</a></h2>
+<p>public instance (Boolean) remove_running_expire_tok ()</p>
+<p>Description:
+This method removes the row in the database that indicates that
+and expire is currently running.</p>
+<p>
+</p>
+<h2><a name="tok_get">tok_get</a></h2>
+<p>public instance (Integer, Integer, Integer) tok_get (String $token)</p>
+<p>Description:
+This method retrieves a specificed token (<code>$token</code>) from the database
+and returns it's spam_count, ham_count and last access time.</p>
+<p>
+</p>
+<h2><a name="tok_get_all">tok_get_all</a></h2>
+<p>public instance (\@) tok_get (@ $tokens)</p>
+<p>Description:
+This method retrieves the specified tokens (<code>$tokens</code>) from storage and returns
+an array ref of arrays spam count, ham acount and last access time.</p>
+<p>
+</p>
+<h2><a name="nspam_nham_change">nspam_nham_change</a></h2>
+<p>public instance (Boolean) nspam_nham_change (Integer $num_spam,
+                                             Integer $num_ham)</p>
+<p>Description:
+This method updates the number of spam and the number of ham in the database.</p>
+<p>
+</p>
+<h2><a name="tok_touch">tok_touch</a></h2>
+<p>public instance (Boolean) tok_touch (String $token,
+                                     String $atime)</p>
+<p>Description:
+This method updates the given tokens (<code>$token</code>) atime.</p>
+<p>The assumption is that the token already exists in the database.</p>
+<p>
+</p>
+<h2><a name="tok_touch_all">tok_touch_all</a></h2>
+<p>public instance (Boolean) tok_touch (\@ $tokens
+                                     String $atime)</p>
+<p>Description:
+This method does a mass update of the given list of tokens <code>$tokens</code>, if the existing token
+atime is &lt; <code>$atime</code>.</p>
+<p>The assumption is that the tokens already exist in the database.</p>
+<p>We should never be touching more than N_SIGNIFICANT_TOKENS, so we can make
+some assumptions about how to handle the data (ie no need to batch like we
+do in tok_get_all)</p>
+<p>
+</p>
+<h2><a name="cleanup">cleanup</a></h2>
+<p>public instance (Boolean) cleanup ()</p>
+<p>Description:
+This method peroms any cleanup necessary before moving onto the next
+operation.</p>
+<p>
+</p>
+<h2><a name="clear_database">clear_database</a></h2>
+<p>public instance (Boolean) clear_database ()</p>
+<p>Description:
+This method deletes all records for a particular user.</p>
+<p>Callers should be aware that any errors returned by this method
+could causes the database to be inconsistent for the given user.</p>
+<p>
+</p>
+<hr />
+<h1><a name="private_methods">Private Methods</a></h1>
+<p>
+</p>
+<h2><a name="_connect_db">_connect_db</a></h2>
+<p>private instance (Boolean) _connect_db ()</p>
+<p>Description:
+This method connects to the SQL database.</p>
+<p>
+</p>
+<h2><a name="_put_token">_put_token</a></h2>
+<p>private instance (Boolean) _put_token (string $token,
+                                       integer $spam_count,
+                                       integer $ham_count,
+				       string $atime)</p>
+<p>Description:
+This method performs the work of either inserting or updating a token in
+the database.</p>
+<p>
+</p>
+<h2><a name="_put_tokens">_put_tokens</a></h2>
+<p>private instance (Boolean) _put_tokens (\% $token,
+                                        integer $spam_count,
+                                        integer $ham_count,
+	 			        string $atime)</p>
+<p>Description:
+This method performs the work of either inserting or updating tokens in
+the database.</p>
+<p>
+</p>
+<h2><a name="_token_select_string">_token_select_string</a></h2>
+<p>private instance (String) _token_select_string</p>
+<p>Description:
+This method returns the string to be used in SELECT statements to represent
+the token column.</p>
+
+</body>
+
+</html>

Added: spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore_PgSQL.txt
URL: http://svn.apache.org/viewvc/spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore_PgSQL.txt?view=auto&rev=559437
==============================================================================
--- spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore_PgSQL.txt (added)
+++ spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore_PgSQL.txt Wed Jul 25 05:52:42 2007
@@ -0,0 +1,128 @@
+NAME
+    Mail::SpamAssassin::BayesStore::PgSQL - PostgreSQL Specific Bayesian
+    Storage Module Implementation
+
+SYNOPSIS
+DESCRIPTION
+    This module implementes a PostgresSQL specific bayesian storage module.
+
+    It subclasses Mail::SpamAssassin::BayesStore::SQL and overrides any
+    methods which makes SQL calls involving the token column. Since
+    PostgreSQL uses BYTEA for the token column type you must make sure that
+    the DBD driver does the proper quoting. You can accomplish this by
+    binding the token column to a specific type.
+
+METHODS
+  token_expiration
+    public instance (Integer, Integer, Integer, Integer) token_expiration(\%
+    $opts, Integer $newdelta, @ @vars)
+
+    Description: This method performs the database specific expiration of
+    tokens based on the passed in $newdelta and @vars.
+
+  seen_put
+    public (Boolean) seen_put (string $msgid, char $flag)
+
+    Description: This method records $msgid as the type given by $flag.
+    $flag is one of two values 's' for spam and 'h' for ham.
+
+  seen_delete
+    public instance (Boolean) seen_delete (string $msgid)
+
+    Description: This method removes $msgid from the database.
+
+  set_last_expire
+    public instance (Boolean) set_last_expire (Integer $time)
+
+    Description: This method sets the last expire time.
+
+  set_running_expire_tok
+    public instance (String $time) set_running_expire_tok ()
+
+    Description: This method sets the time that an expire starts running.
+
+  remove_running_expire_tok
+    public instance (Boolean) remove_running_expire_tok ()
+
+    Description: This method removes the row in the database that indicates
+    that and expire is currently running.
+
+  tok_get
+    public instance (Integer, Integer, Integer) tok_get (String $token)
+
+    Description: This method retrieves a specificed token ($token) from the
+    database and returns it's spam_count, ham_count and last access time.
+
+  tok_get_all
+    public instance (\@) tok_get (@ $tokens)
+
+    Description: This method retrieves the specified tokens ($tokens) from
+    storage and returns an array ref of arrays spam count, ham acount and
+    last access time.
+
+  nspam_nham_change
+    public instance (Boolean) nspam_nham_change (Integer $num_spam, Integer
+    $num_ham)
+
+    Description: This method updates the number of spam and the number of
+    ham in the database.
+
+  tok_touch
+    public instance (Boolean) tok_touch (String $token, String $atime)
+
+    Description: This method updates the given tokens ($token) atime.
+
+    The assumption is that the token already exists in the database.
+
+  tok_touch_all
+    public instance (Boolean) tok_touch (\@ $tokens String $atime)
+
+    Description: This method does a mass update of the given list of tokens
+    $tokens, if the existing token atime is < $atime.
+
+    The assumption is that the tokens already exist in the database.
+
+    We should never be touching more than N_SIGNIFICANT_TOKENS, so we can
+    make some assumptions about how to handle the data (ie no need to batch
+    like we do in tok_get_all)
+
+  cleanup
+    public instance (Boolean) cleanup ()
+
+    Description: This method peroms any cleanup necessary before moving onto
+    the next operation.
+
+  clear_database
+    public instance (Boolean) clear_database ()
+
+    Description: This method deletes all records for a particular user.
+
+    Callers should be aware that any errors returned by this method could
+    causes the database to be inconsistent for the given user.
+
+Private Methods
+  _connect_db
+    private instance (Boolean) _connect_db ()
+
+    Description: This method connects to the SQL database.
+
+  _put_token
+    private instance (Boolean) _put_token (string $token, integer
+    $spam_count, integer $ham_count, string $atime)
+
+    Description: This method performs the work of either inserting or
+    updating a token in the database.
+
+  _put_tokens
+    private instance (Boolean) _put_tokens (\% $token, integer $spam_count,
+    integer $ham_count, string $atime)
+
+    Description: This method performs the work of either inserting or
+    updating tokens in the database.
+
+  _token_select_string
+    private instance (String) _token_select_string
+
+    Description: This method returns the string to be used in SELECT
+    statements to represent the token column.
+

Added: spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore_SQL.html
URL: http://svn.apache.org/viewvc/spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore_SQL.html?view=auto&rev=559437
==============================================================================
--- spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore_SQL.html (added)
+++ spamassassin/site/full/3.2.x/doc/Mail_SpamAssassin_BayesStore_SQL.html Wed Jul 25 05:52:42 2007
@@ -0,0 +1,434 @@
+<!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>Mail::SpamAssassin::BayesStore::SQL - SQL Bayesian Storage Module Implementation</title>
+<link rev="made" href="mailto:jm@apache.org" />
+</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="#description">DESCRIPTION</a></li>
+	<li><a href="#methods">METHODS</a></li>
+	<ul>
+
+		<li><a href="#new">new</a></li>
+		<li><a href="#tie_db_readonly">tie_db_readonly</a></li>
+		<li><a href="#tie_db_writable">tie_db_writable</a></li>
+		<li><a href="#untie_db">untie_db</a></li>
+		<li><a href="#calculate_expire_delta">calculate_expire_delta</a></li>
+		<li><a href="#token_expiration">token_expiration</a></li>
+		<li><a href="#sync_due">sync_due</a></li>
+		<li><a href="#seen_get">seen_get</a></li>
+		<li><a href="#seen_put">seen_put</a></li>
+		<li><a href="#seen_delete">seen_delete</a></li>
+		<li><a href="#get_storage_variables">get_storage_variables</a></li>
+		<li><a href="#dump_db_toks">dump_db_toks</a></li>
+		<li><a href="#set_last_expire">set_last_expire</a></li>
+		<li><a href="#get_running_expire_tok">get_running_expire_tok</a></li>
+		<li><a href="#set_running_expire_tok">set_running_expire_tok</a></li>
+		<li><a href="#remove_running_expire_tok">remove_running_expire_tok</a></li>
+		<li><a href="#tok_get">tok_get</a></li>
+		<li><a href="#tok_get_all">tok_get_all</a></li>
+		<li><a href="#tok_count_change">tok_count_change</a></li>
+		<li><a href="#multi_tok_count_change">multi_tok_count_change</a></li>
+		<li><a href="#nspam_nham_get">nspam_nham_get</a></li>
+		<li><a href="#nspam_nham_change">nspam_nham_change</a></li>
+		<li><a href="#tok_touch">tok_touch</a></li>
+		<li><a href="#tok_touch_all">tok_touch_all</a></li>
+		<li><a href="#cleanup">cleanup</a></li>
+		<li><a href="#get_magic_re">get_magic_re</a></li>
+		<li><a href="#sync">sync</a></li>
+		<li><a href="#perform_upgrade">perform_upgrade</a></li>
+		<li><a href="#clear_database">clear_database</a></li>
+		<li><a href="#backup_database">backup_database</a></li>
+		<li><a href="#restore_database">restore_database</a></li>
+		<li><a href="#db_readable">db_readable</a></li>
+		<li><a href="#db_writable">db_writable</a></li>
+	</ul>
+
+	<li><a href="#private_methods">Private Methods</a></li>
+	<ul>
+
+		<li><a href="#_connect_db">_connect_db</a></li>
+		<li><a href="#_get_db_version">_get_db_version</a></li>
+		<li><a href="#_initialize_db">_initialize_db</a></li>
+		<li><a href="#_put_token">_put_token</a></li>
+		<li><a href="#_put_tokens">_put_tokens</a></li>
+		<li><a href="#_get_oldest_token_age">_get_oldest_token_age</a></li>
+		<li><a href="#_get_num_hapaxes">_get_num_hapaxes</a></li>
+		<li><a href="#_get_num_lowfreq">_get_num_lowfreq</a></li>
+		<li><a href="#_token_select_string">_token_select_string</a></li>
+	</ul>
+
+</ul>
+<!-- INDEX END -->
+
+<hr />
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>Mail::SpamAssassin::BayesStore::SQL - SQL Bayesian Storage Module Implementation</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>This module implementes a SQL based bayesian storage module.</p>
+<p>
+</p>
+<hr />
+<h1><a name="methods">METHODS</a></h1>
+<p>
+</p>
+<h2><a name="new">new</a></h2>
+<p>public class (Mail::SpamAssassin::BayesStore::SQL) new (Mail::Spamassassin::Bayes $bayes)</p>
+<p>Description:
+This methods creates a new instance of the Mail::SpamAssassin::BayesStore::SQL
+object.  It expects to be passed an instance of the Mail::SpamAssassin:Bayes
+object which is passed into the Mail::SpamAssassin::BayesStore parent object.</p>
+<p>This method sets up the database connection and determines the username to
+use in queries.</p>
+<p>
+</p>
+<h2><a name="tie_db_readonly">tie_db_readonly</a></h2>
+<p>public instance (Boolean) tie_db_readonly ();</p>
+<p>Description:
+This method ensures that the database connection is properly setup
+and working.  If necessary it will initialize a user's bayes variables
+so that they can begin using the database immediately.</p>
+<p>
+</p>
+<h2><a name="tie_db_writable">tie_db_writable</a></h2>
+<p>public instance (Boolean) tie_db_writable ()</p>
+<p>Description:
+This method ensures that the database connetion is properly setup
+and working. If necessary it will initialize a users bayes variables
+so that they can begin using the database immediately.</p>
+<p>
+</p>
+<h2><a name="untie_db">untie_db</a></h2>
+<p>public instance () untie_db ()</p>
+<p>Description:
+This method is unused for the SQL based implementation.</p>
+<p>
+</p>
+<h2><a name="calculate_expire_delta">calculate_expire_delta</a></h2>
+<p>public instance (%) calculate_expire_delta (Integer $newest_atime,
+                                             Integer $start,
+                                             Integer $max_expire_mult)</p>
+<p>Description:
+This method performs a calculation on the data to determine the optimum
+atime for token expiration.</p>
+<p>
+</p>
+<h2><a name="token_expiration">token_expiration</a></h2>
+<p>public instance (Integer, Integer,
+                 Integer, Integer) token_expiration(\% $opts,
+                                                    Integer $newdelta,
+                                                    @ @vars)</p>
+<p>Description:
+This method performs the database specific expiration of tokens based on
+the passed in <code>$newdelta</code> and <code>@vars</code>.</p>
+<p>
+</p>
+<h2><a name="sync_due">sync_due</a></h2>
+<p>public instance (Boolean) sync_due ()</p>
+<p>Description:
+This method determines if a database sync is currently required.</p>
+<p>Unused for SQL based implementation.</p>
+<p>
+</p>
+<h2><a name="seen_get">seen_get</a></h2>
+<p>public instance (String) seen_get (string $msgid)</p>
+<p>Description:
+This method retrieves the stored value, if any, for <code>$msgid</code>.  The return value
+is the stored string ('s' for spam and 'h' for ham) or undef if <code>$msgid</code> is not
+found.</p>
+<p>
+</p>
+<h2><a name="seen_put">seen_put</a></h2>
+<p>public (Boolean) seen_put (string $msgid, char $flag)</p>
+<p>Description:
+This method records <code>$msgid</code> as the type given by <code>$flag</code>.  <code>$flag</code> is one of
+two values 's' for spam and 'h' for ham.</p>
+<p>
+</p>
+<h2><a name="seen_delete">seen_delete</a></h2>
+<p>public instance (Boolean) seen_delete (string $msgid)</p>
+<p>Description:
+This method removes <code>$msgid</code> from the database.</p>
+<p>
+</p>
+<h2><a name="get_storage_variables">get_storage_variables</a></h2>
+<p>public instance (@) get_storage_variables ()</p>
+<p>Description:
+This method retrieves the various administrative variables used by
+the Bayes process and database.</p>
+<p>The values returned in the array are in the following order:</p>
+<p>0: scan count base</p>
+<p>1: number of spam</p>
+<p>2: number of ham</p>
+<p>3: number of tokens in db</p>
+<p>4: last expire atime</p>
+<p>5: oldest token in db atime</p>
+<p>6: db version value</p>
+<p>7: last journal sync</p>
+<p>8: last atime delta</p>
+<p>9: last expire reduction count</p>
+<p>10: newest token in db atime</p>
+<p>
+</p>
+<h2><a name="dump_db_toks">dump_db_toks</a></h2>
+<p>public instance () dump_db_toks (String $template, String $regex, Array @vars)</p>
+<p>Description:
+This method loops over all tokens, computing the probability for the token and then
+printing it out according to the passed in token.</p>
+<p>
+</p>
+<h2><a name="set_last_expire">set_last_expire</a></h2>
+<p>public instance (Boolean) set_last_expire (Integer $time)</p>
+<p>Description:
+This method sets the last expire time.</p>
+<p>
+</p>
+<h2><a name="get_running_expire_tok">get_running_expire_tok</a></h2>
+<p>public instance (String $time) get_running_expire_tok ()</p>
+<p>Description:
+This method determines if an expire is currently running and returns
+the last time set.</p>
+<p>There can be multiple times, so we just pull the greatest (most recent)
+value.</p>
+<p>
+</p>
+<h2><a name="set_running_expire_tok">set_running_expire_tok</a></h2>
+<p>public instance (String $time) set_running_expire_tok ()</p>
+<p>Description:
+This method sets the time that an expire starts running.</p>
+<p>
+</p>
+<h2><a name="remove_running_expire_tok">remove_running_expire_tok</a></h2>
+<p>public instance (Boolean) remove_running_expire_tok ()</p>
+<p>Description:
+This method removes the row in the database that indicates that
+and expire is currently running.</p>
+<p>
+</p>
+<h2><a name="tok_get">tok_get</a></h2>
+<p>public instance (Integer, Integer, Integer) tok_get (String $token)</p>
+<p>Description:
+This method retrieves a specificed token (<code>$token</code>) from the database
+and returns it's spam_count, ham_count and last access time.</p>
+<p>
+</p>
+<h2><a name="tok_get_all">tok_get_all</a></h2>
+<p>public instance (\@) tok_get (@ $tokens)</p>
+<p>Description:
+This method retrieves the specified tokens (<code>$tokens</code>) from storage and returns
+an array ref of arrays spam count, ham acount and last access time.</p>
+<p>
+</p>
+<h2><a name="tok_count_change">tok_count_change</a></h2>
+<p><table cellspacing="0" cellpadding="0"><tr><td>public instance (Boolean) tok_count_change (Integer $spam_count,
+<tr><td><td>    Integer $ham_count,
+<tr><td><td>    String $token,
+<tr><td><td>    String $atime)</table></p>
+<p>Description:
+This method takes a <code>$spam_count</code> and <code>$ham_count</code> and adds it to
+<code>$tok</code> along with updating <code>$tok</code>s atime with <code>$atime</code>.</p>
+<p>
+</p>
+<h2><a name="multi_tok_count_change">multi_tok_count_change</a></h2>
+<p><table cellspacing="0" cellpadding="0"><tr><td>public instance (Boolean) multi_tok_count_change (Integer $spam_count,
+<tr><td> <td>          Integer $ham_count,
+<tr><td><td> <td>          \% $tokens,
+<tr><td><td>          String $atime)</table></p>
+<p>Description:
+This method takes a <code>$spam_count</code> and <code>$ham_count</code> and adds it to all
+of the tokens in the <code>$tokens</code> hash ref along with updating each tokens
+atime with <code>$atime</code>.</p>
+<p>
+</p>
+<h2><a name="nspam_nham_get">nspam_nham_get</a></h2>
+<p>public instance ($spam_count, $ham_count) nspam_nham_get ()</p>
+<p>Description:
+This method retrieves the total number of spam and the total number of
+ham learned.</p>
+<p>
+</p>
+<h2><a name="nspam_nham_change">nspam_nham_change</a></h2>
+<p>public instance (Boolean) nspam_nham_change (Integer $num_spam,
+                                             Integer $num_ham)</p>
+<p>Description:
+This method updates the number of spam and the number of ham in the database.</p>
+<p>
+</p>
+<h2><a name="tok_touch">tok_touch</a></h2>
+<p>public instance (Boolean) tok_touch (String $token,
+                                     String $atime)</p>
+<p>Description:
+This method updates the given tokens (<code>$token</code>) atime.</p>
+<p>The assumption is that the token already exists in the database.</p>
+<p>
+</p>
+<h2><a name="tok_touch_all">tok_touch_all</a></h2>
+<p>public instance (Boolean) tok_touch (\@ $tokens
+                                     String $atime)</p>
+<p>Description:
+This method does a mass update of the given list of tokens <code>$tokens</code>, if the existing token
+atime is &lt; <code>$atime</code>.</p>
+<p>The assumption is that the tokens already exist in the database.</p>
+<p>We should never be touching more than N_SIGNIFICANT_TOKENS, so we can make
+some assumptions about how to handle the data (ie no need to batch like we
+do in tok_get_all)</p>
+<p>
+</p>
+<h2><a name="cleanup">cleanup</a></h2>
+<p>public instance (Boolean) cleanup ()</p>
+<p>Description:
+This method peroms any cleanup necessary before moving onto the next
+operation.</p>
+<p>
+</p>
+<h2><a name="get_magic_re">get_magic_re</a></h2>
+<p>public instance get_magic_re (String)</p>
+<p>Description:
+This method returns a regexp which indicates a magic token.</p>
+<p>Unused in SQL implementation.</p>
+<p>
+</p>
+<h2><a name="sync">sync</a></h2>
+<p>public instance (Boolean) sync (\% $opts)</p>
+<p>Description:
+This method performs a sync of the database</p>
+<p>
+</p>
+<h2><a name="perform_upgrade">perform_upgrade</a></h2>
+<p>public instance (Boolean) perform_upgrade (\% $opts);</p>
+<p>Description:
+Performs an upgrade of the database from one version to another, not
+currently used in this implementation.</p>
+<p>
+</p>
+<h2><a name="clear_database">clear_database</a></h2>
+<p>public instance (Boolean) clear_database ()</p>
+<p>Description:
+This method deletes all records for a particular user.</p>
+<p>Callers should be aware that any errors returned by this method
+could causes the database to be inconsistent for the given user.</p>
+<p>
+</p>
+<h2><a name="backup_database">backup_database</a></h2>
+<p>public instance (Boolean) backup_database ()</p>
+<p>Description:
+This method will dump the users database in a marchine readable format.</p>
+<p>
+</p>
+<h2><a name="restore_database">restore_database</a></h2>
+<p>public instance (Boolean) restore_database (String $filename, Boolean $showdots)</p>
+<p>Description:
+This method restores a database from the given filename, <code>$filename</code>.</p>
+<p>Callers should be aware that any errors returned by this method
+could causes the database to be inconsistent for the given user.</p>
+<p>
+</p>
+<h2><a name="db_readable">db_readable</a></h2>
+<p>public instance (Boolean) <code>db_readable()</code></p>
+<p>Description:
+This method returns a boolean value indicating if the database is in a
+readable state.</p>
+<p>
+</p>
+<h2><a name="db_writable">db_writable</a></h2>
+<p>public instance (Boolean) <code>db_writeable()</code></p>
+<p>Description:
+This method returns a boolean value indicating if the database is in a
+writable state.</p>
+<p>
+</p>
+<hr />
+<h1><a name="private_methods">Private Methods</a></h1>
+<p>
+</p>
+<h2><a name="_connect_db">_connect_db</a></h2>
+<p>private instance (Boolean) _connect_db ()</p>
+<p>Description:
+This method connects to the SQL database.</p>
+<p>
+</p>
+<h2><a name="_get_db_version">_get_db_version</a></h2>
+<p>private instance (Integer) _get_db_version ()</p>
+<p>Description:
+Gets the current version of the database from the special global vars
+tables.</p>
+<p>
+</p>
+<h2><a name="_initialize_db">_initialize_db</a></h2>
+<p>private instance (Boolean) _initialize_db ()</p>
+<p>Description:
+This method will check to see if a user has had their bayes variables
+initialized. If not then it will perform this initialization.</p>
+<p>
+</p>
+<h2><a name="_put_token">_put_token</a></h2>
+<p>private instance (Boolean) _put_token (string $token,
+                                       integer $spam_count,
+                                       integer $ham_count,
+				       string $atime)</p>
+<p>Description:
+This method performs the work of either inserting or updating a token in
+the database.</p>
+<p>
+</p>
+<h2><a name="_put_tokens">_put_tokens</a></h2>
+<p>private instance (Boolean) _put_tokens (\% $tokens,
+                                        integer $spam_count,
+                                        integer $ham_count,
+	 			        string $atime)</p>
+<p>Description:
+This method performs the work of either inserting or updating tokens in
+the database.</p>
+<p>
+</p>
+<h2><a name="_get_oldest_token_age">_get_oldest_token_age</a></h2>
+<p>private instance (Integer) _get_oldest_token_age ()</p>
+<p>Description:
+This method finds the atime of the oldest token in the database.</p>
+<p>The use of <code>min(atime)</code> in the SQL is ugly and but really the most efficient
+way of getting the oldest_token_age after we've done a mass expire.  It should
+only be called at expire time.</p>
+<p>
+</p>
+<h2><a name="_get_num_hapaxes">_get_num_hapaxes</a></h2>
+<p>private instance (Integer) _get_num_hapaxes ()</p>
+<p>Description:
+This method gets the total number of hapaxes (spam_count + ham_count == 1) in
+the token database for a user.</p>
+<p>
+</p>
+<h2><a name="_get_num_lowfreq">_get_num_lowfreq</a></h2>
+<p>private instance (Integer) _get_num_lowfreq ()</p>
+<p>Description:
+This method gets the total number of lowfreq tokens (spam_count &lt; 8 and
+ham_count &lt; 8) in the token database for a user</p>
+<p>
+</p>
+<h2><a name="_token_select_string">_token_select_string</a></h2>
+<p>private instance (String) _token_select_string</p>
+<p>Description:
+This method returns the string to be used in SELECT statements to represent
+the token column.</p>
+<p>The default is to use the RPAD function to pad the token out to 5 characters.</p>
+
+</body>
+
+</html>