.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) .\" .\" 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 .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . 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 >0, 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 .\" ======================================================================== .\" .IX Title "Mail::SpamAssassin::BayesStore 3" .TH Mail::SpamAssassin::BayesStore 3 2024-09-01 "perl v5.40.0" "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 API 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 DB_VERSION 4 .IX Item "DB_VERSION" public instance (Integer) DB_VERSION () .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 \fBuntie_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 XXX 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 count 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 DB 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 DB is available in a writable state.