.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Mail::SpamAssassin::BayesStore 3pm" .TH Mail::SpamAssassin::BayesStore 3pm "2015-04-28" "perl v5.20.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Mail::SpamAssassin::BayesStore \- Storage Module for default Bayes classifier .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is the public \s-1API\s0 for the Bayesian store methods. Any implementation of the storage module for the default Bayes classifier must implement these methods. .SH "METHODS" .IX Header "METHODS" .IP "new" 4 .IX Item "new" public class (Mail::SpamAssassin::BayesStore) new (Mail::SpamAssassin::Plugin::Bayes \f(CW$bayes\fR) .Sp Description: This method creates a new instance of the Mail::SpamAssassin::BayesStore object. You must pass in an instance of the Mail::SpamAssassin::Plugin::Bayes object, which is stashed for use throughout the module. .IP "\s-1DB_VERSION\s0" 4 .IX Item "DB_VERSION" public instance (Integer) \s-1DB_VERSION \\fIs0()\fR .Sp Description: This method returns the currently supported database version for the implementation. .IP "read_db_configs" 4 .IX Item "read_db_configs" public instance () read_db_configs () .Sp Description: This method reads any needed config variables from the configuration object and then calls the Mail::SpamAssassin::Plugin::Bayes read_db_configs method. .IP "prefork_init" 4 .IX Item "prefork_init" public instance (Boolean) prefork_init () .Sp Description: This optional method is called in the parent process shortly before forking off child processes. .IP "spamd_child_init" 4 .IX Item "spamd_child_init" public instance (Boolean) spamd_child_init () .Sp Description: This optional method is called in a child process shortly after being spawned. .IP "tie_db_readonly" 4 .IX Item "tie_db_readonly" public instance (Boolean) tie_db_readonly () .Sp Description: This method opens up the database in readonly mode. .IP "tie_db_writable" 4 .IX Item "tie_db_writable" public instance (Boolean) tie_db_writable () .Sp Description: This method opens up the database in writable mode. .Sp Any callers of this methods should ensure that they call \fIuntie_db()\fR afterwards. .IP "untie_db" 4 .IX Item "untie_db" public instance () untie_db () .Sp Description: This method unties the database. .IP "calculate_expire_delta" 4 .IX Item "calculate_expire_delta" public instance (%) calculate_expire_delta (Integer \f(CW$newest_atime\fR, Integer \f(CW$start\fR, Integer \f(CW$max_expire_mult\fR) .Sp Description: This method performs a calculation on the data to determine the optimum atime for token expiration. .IP "token_expiration" 4 .IX Item "token_expiration" public instance (Integer, Integer, Integer, Integer) token_expiration(\e% \f(CW$opts\fR, Integer \f(CW$newest_atime\fR, Integer \f(CW$newdelta\fR) .Sp Description: This method performs the database specific expiration of tokens based on the passed in \f(CW$newest_atime\fR and \f(CW$newdelta\fR. .IP "expire_old_tokens" 4 .IX Item "expire_old_tokens" public instance (Boolean) expire_old_tokens (\e% hashref) .Sp Description: This method expires old tokens from the database. .IP "expire_old_tokens_trapped" 4 .IX Item "expire_old_tokens_trapped" public instance (Boolean) expire_old_tokens_trapped (\e% \f(CW$opts\fR) .Sp Description: This methods does the actual token expiration. .Sp \&\s-1XXX\s0 More docs here about the methodology and what not .IP "sync_due" 4 .IX Item "sync_due" public instance (Boolean) sync_due () .Sp Description: This methods determines if a sync is due. .IP "expiry_due" 4 .IX Item "expiry_due" public instance (Boolean) expiry_due () .Sp Description: This methods determines if an expire is due. .IP "seen_get" 4 .IX Item "seen_get" public instance (Char) seen_get (String \f(CW$msgid\fR) .Sp Description: This method retrieves the stored value, if any, for \f(CW$msgid\fR. The return value is the stored string ('s' for spam and 'h' for ham) or undef if \&\f(CW$msgid\fR is not found. .IP "seen_put" 4 .IX Item "seen_put" public instance (Boolean) seen_put (String \f(CW$msgid\fR, Char \f(CW$flag\fR) .Sp Description: This method records \f(CW$msgid\fR as the type given by \f(CW$flag\fR. \f(CW$flag\fR is one of two values 's' for spam and 'h' for ham. .IP "seen_delete" 4 .IX Item "seen_delete" public instance (Boolean) seen_delete (String \f(CW$msgid\fR) .Sp Description: This method removes \f(CW$msgid\fR from storage. .IP "get_storage_variables" 4 .IX Item "get_storage_variables" public instance (@) get_storage_variables () .Sp Description: This method retrieves the various administrative variables used by the Bayes storage implementation. .Sp The values returned in the array are in the following order: .Sp 0: scan count base .Sp 1: number of spam .Sp 2: number of ham .Sp 3: number of tokens in db .Sp 4: last expire atime .Sp 5: oldest token in db atime .Sp 6: db version value .Sp 7: last journal sync .Sp 8: last atime delta .Sp 9: last expire reduction count .Sp 10: newest token in db atime .IP "dump_db_toks" 4 .IX Item "dump_db_toks" public instance () dump_db_toks (String \f(CW$template\fR, String \f(CW$regex\fR, @ \f(CW@vars\fR) .Sp Description: This method loops over all tokens, computing the probability for the token and then printing it out according to the passed in template. .IP "set_last_expire" 4 .IX Item "set_last_expire" public instance (Boolean) _set_last_expire (Integer \f(CW$time\fR) .Sp Description: This method sets the last expire time. .IP "get_running_expire_tok" 4 .IX Item "get_running_expire_tok" public instance (Time) get_running_expire_tok () .Sp Description: This method determines if an expire is currently running and returns the time the expire started. .IP "set_running_expire_tok" 4 .IX Item "set_running_expire_tok" public instance (Time) set_running_expire_tok () .Sp Description: This method sets the running expire time to the current time. .IP "remove_running_expire_tok" 4 .IX Item "remove_running_expire_tok" public instance (Boolean) remove_running_expire_tok () .Sp Description: This method removes a currently set running expire time. .IP "tok_get" 4 .IX Item "tok_get" public instance (Integer, Integer, Time) tok_get (String \f(CW$token\fR) .Sp Description: This method retrieves the specified token (\f(CW$token\fR) from storage and returns it's spam count, ham acount and last access time. .IP "tok_get_all" 4 .IX Item "tok_get_all" public instance (\e@) tok_get_all (@ \f(CW@tokens\fR) .Sp Description: This method retrieves the specified tokens (\f(CW@tokens\fR) from storage and returns an array ref of arrays spam count, ham count and last access time. .IP "tok_count_change" 4 .IX Item "tok_count_change" public instance (Boolean) tok_count_change (Integer \f(CW$spam_count\fR, Integer \f(CW$ham_count\fR, String \f(CW$token\fR, Time \f(CW$atime\fR) .Sp Description: This method takes a \f(CW$spam_count\fR and \f(CW$ham_count\fR and adds it to \&\f(CW$token\fR along with updating \f(CW$token\fRs atime with \f(CW$atime\fR. .IP "multi_tok_count_change" 4 .IX Item "multi_tok_count_change" public instance (Boolean) multi_tok_count_change (Integer \f(CW$spam_count\fR, Integer \f(CW$ham_count\fR, \e% \f(CW$tokens\fR, String \f(CW$atime\fR) .Sp Description: This method takes a \f(CW$spam_count\fR and \f(CW$ham_count\fR and adds it to all of the tokens in the \f(CW$tokens\fR hash ref along with updating each tokens atime with \f(CW$atime\fR. .IP "nspam_nham_get" 4 .IX Item "nspam_nham_get" public instance (Integer, Integer) nspam_nham_get () .Sp Description: This method retrieves the total number of spam and the total number of ham currently under storage. .IP "nspam_nham_change" 4 .IX Item "nspam_nham_change" public instance (Boolean) nspam_nham_change (Integer \f(CW$num_spam\fR, Integer \f(CW$num_ham\fR) .Sp Description: This method updates the number of spam and the number of ham in the database. .IP "tok_touch" 4 .IX Item "tok_touch" public instance (Boolean) tok_touch (String \f(CW$token\fR, Time \f(CW$atime\fR) .Sp Description: This method updates the given tokens (\f(CW$token\fR) access time. .IP "tok_touch_all" 4 .IX Item "tok_touch_all" public instance (Boolean) tok_touch_all (\e@ \f(CW$tokens\fR, Time \f(CW$atime\fR) .Sp Description: This method does a mass update of the given list of tokens \f(CW$tokens\fR, if the existing token atime is < \f(CW$atime\fR. .IP "cleanup" 4 .IX Item "cleanup" public instance (Boolean) cleanup () .Sp Description: This method performs any cleanup necessary before moving onto the next operation. .IP "get_magic_re" 4 .IX Item "get_magic_re" public instance get_magic_re (String) .Sp Description: This method returns a regexp which indicates a magic token. .IP "sync" 4 .IX Item "sync" public instance (Boolean) sync (\e% \f(CW$opts\fR) .Sp Description: This method performs a sync of the database. .IP "perform_upgrade" 4 .IX Item "perform_upgrade" public instance (Boolean) perform_upgrade (\e% \f(CW$opts\fR) .Sp 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. .Sp A true return value indicates success. .IP "clear_database" 4 .IX Item "clear_database" public instance (Boolean) clear_database () .Sp Description: This method deletes all records for a particular user. .Sp Callers should be aware that any errors returned by this method could causes the database to be inconsistent for the given user. .IP "backup_database" 4 .IX Item "backup_database" public instance (Boolean) backup_database () .Sp Description: This method will dump the users database in a machine readable format. .IP "restore_database" 4 .IX Item "restore_database" public instance (Boolean) restore_database (String \f(CW$filename\fR, Boolean \f(CW$showdots\fR) .Sp Description: This method restores a database from the given filename, \f(CW$filename\fR. .Sp Callers should be aware that any errors returned by this method could causes the database to be inconsistent for the given user. .IP "db_readable" 4 .IX Item "db_readable" public instance (Boolean) db_readable () .Sp Description: This method returns whether or not the Bayes \s-1DB\s0 is available in a readable state. .IP "db_writable" 4 .IX Item "db_writable" public instance (Boolean) db_writable () .Sp Description: This method returns whether or not the Bayes \s-1DB\s0 is available in a writable state.