1Mail::SpamAssassin::BayUesseSrtoCroen:t:rBiDbBu(t3e)d PeMralilD:o:cSupmaemnAtsastaisosnin::BayesStore::BDB(3)
2
3
4

NAME

6       Mail::SpamAssassin::BayesStore::BDB - BerkeleyDB Bayesian Storage
7       Module Implementation
8

DESCRIPTION

10       This module implements a BDB based bayesian storage module.
11

METHODS

13   new
14       public class (Mail::SpamAssassin::BayesStore::SQL) new
15       (Mail::Spamassassin::Plugin::Bayes $bayes)
16
17       Description: This methods creates a new instance of the
18       Mail::SpamAssassin::BayesStore::BDB object.  It expects to be passed an
19       instance of the Mail::SpamAssassin:Bayes object which is passed into
20       the Mail::SpamAssassin::BayesStore parent object.
21
22   tie_db_readonly
23       public instance (Boolean) tie_db_readonly ();
24
25       Description: This method ensures that the database connection is
26       properly setup and working.
27
28   tie_db_writable
29       public instance (Boolean) tie_db_writable ()
30
31       Description: This method ensures that the database connection is
32       properly setup and working. If necessary it will initialize the
33       database so that they can begin using the database immediately.
34
35   _open_db
36       private instance (Boolean) _open_db (Boolean $writable)
37
38       Description: This method ensures that the database connection is
39       properly setup and working.  It will initialize a users bayes variables
40       so that they can begin using the database immediately.
41
42   untie_db
43       public instance () untie_db ()
44
45       Description: Closes any open db handles.  You can safely call this at
46       any time.
47
48   calculate_expire_delta
49       public instance (%) calculate_expire_delta (
50         Integer $newest_atime, Integer $start, Integer $max_expire_mult)
51
52       Description: This method performs a calculation on the data to
53       determine the optimum atime for token expiration.
54
55   token_expiration
56       public instance (Integer, Integer,
57                        Integer, Integer) token_expiration (\% $opts,
58                                                            Integer $newdelta,
59                                                            @ @vars)
60
61       Description: This method performs the database specific expiration of
62       tokens based on the passed in $newdelta and @vars.
63
64   sync_due
65       public instance (Boolean) sync_due ()
66
67       Description: This method determines if a database sync is currently
68       required.
69
70       Unused for BDB implementation.
71
72   seen_get
73       public instance (String) seen_get (string $msgid)
74
75       Description: This method retrieves the stored value, if any, for
76       $msgid.  The return value is the stored string ('s' for spam and 'h'
77       for ham) or undef if $msgid is not found.
78
79   seen_put
80       public (Boolean) seen_put (string $msgid, char $flag)
81
82       Description: This method records $msgid as the type given by $flag.
83       $flag is one of two values 's' for spam and 'h' for ham.
84
85   seen_delete
86       public instance (Boolean) seen_delete (string $msgid)
87
88       Description: This method removes $msgid from the database.
89
90   get_storage_variables
91       public instance (@) get_storage_variables ()
92
93       Description: This method retrieves the various administrative variables
94       used by the Bayes process and database.
95
96       The values returned in the array are in the following order:
97
98       0: scan count base
99
100       1: number of spam
101
102       2: number of ham
103
104       3: number of tokens in db
105
106       4: last expire atime
107
108       5: oldest token in db atime
109
110       6: db version value
111
112       7: last journal sync
113
114       8: last atime delta
115
116       9: last expire reduction count
117
118       10: newest token in db atime
119
120   dump_tokens
121       public instance () dump_tokens (String $template, String $regex, Array
122       @vars)
123
124       Description: This method loops over all tokens, computing the
125       probability for the token and then printing it out according to the
126       passed in token.
127
128   set_last_expire
129       public instance (Boolean) set_last_expire (Integer $time)
130
131       Description: This method sets the last expire time.
132
133   get_running_expire_tok
134       public instance (String $time) get_running_expire_tok ()
135
136       Description: This method determines if an expire is currently running
137       and returns the last time set.
138
139       There can be multiple times, so we just pull the greatest (most recent)
140       value.
141
142   set_running_expire_tok
143       public instance (String $time) set_running_expire_tok ()
144
145       Description: This method sets the time that an expire starts running.
146
147   remove_running_expire_tok
148       public instance (Boolean) remove_running_expire_tok ()
149
150       Description: This method removes the row in the database that indicates
151       that and expire is currently running.
152
153   tok_get
154       public instance (Integer, Integer, Integer) tok_get (String $token)
155
156       Description: This method retrieves a specified token ($token) from the
157       database and returns its spam_count, ham_count and last access time.
158
159   tok_get_all
160       public instance (\@) tok_get (@ $tokens)
161
162       Description: This method retrieves the specified tokens ($tokens) from
163       storage and returns an array ref of arrays spam count, ham count and
164       last access time.
165
166   tok_count_change
167       public instance (Boolean) tok_count_change (
168         Integer $dspam, Integer $dham, String $token, String $newatime)
169
170       Description: This method takes a $spam_count and $ham_count and adds it
171       to $tok along with updating $toks atime with $atime.
172
173   multi_tok_count_change
174       public instance (Boolean) multi_tok_count_change (
175         Integer $dspam, Integer $dham, \% $tokens, String $newatime)
176
177       Description: This method takes a $dspam and $dham and adds it to all of
178       the tokens in the $tokens hash ref along with updating each tokens
179       atime with $atime.
180
181   nspam_nham_get
182       public instance ($spam_count, $ham_count) nspam_nham_get ()
183
184       Description: This method retrieves the total number of spam and the
185       total number of ham learned.
186
187   nspam_nham_change
188       public instance (Boolean) nspam_nham_change (Integer $num_spam,
189                                                    Integer $num_ham)
190
191       Description: This method updates the number of spam and the number of
192       ham in the database.
193
194   tok_touch
195       public instance (Boolean) tok_touch (String $token,
196                                            String $atime)
197
198       Description: This method updates the given tokens ($token) atime.
199
200       The assumption is that the token already exists in the database.
201
202       We will never update to an older atime
203
204   tok_touch_all
205       public instance (Boolean) tok_touch (\@ $tokens
206                                            String $atime)
207
208       Description: This method does a mass update of the given list of tokens
209       $tokens, if the existing token atime is < $atime.
210
211       The assumption is that the tokens already exist in the database.
212
213       We should never be touching more than N_SIGNIFICANT_TOKENS, so we can
214       make some assumptions about how to handle the data (ie no need to batch
215       like we do in tok_get_all)
216
217   cleanup
218       public instance (Boolean) cleanup ()
219
220       Description: This method performs any cleanup necessary before moving
221       onto the next operation.
222
223   get_magic_re
224       public instance (String) get_magic_re ()
225
226       Description: This method returns a regexp which indicates a magic
227       token.
228
229       Unused in BDB implementation.
230
231   sync
232       public instance (Boolean) sync (\% $opts)
233
234       Description: This method performs a sync of the database
235
236   perform_upgrade
237       public instance (Boolean) perform_upgrade (\% $opts);
238
239       Description: Performs an upgrade of the database from one version to
240       another, not currently used in this implementation.
241
242   clear_database
243       public instance (Boolean) clear_database ()
244
245       Description: This method deletes all records for a particular user.
246
247       Callers should be aware that any errors returned by this method could
248       causes the database to be inconsistent for the given user.
249
250   backup_database
251       public instance (Boolean) backup_database ()
252
253       Description: This method will dump the users database in a machine
254       readable format.
255
256   restore_database
257       public instance (Boolean) restore_database (String $filename, Boolean
258       $showdots)
259
260       Description: This method restores a database from the given filename,
261       $filename.
262
263       Callers should be aware that any errors returned by this method could
264       causes the database to be inconsistent for the given user.
265
266   db_readable
267       public instance (Boolean) db_readable()
268
269       Description: This method returns a boolean value indicating if the
270       database is in a readable state.
271
272   db_writable
273       public instance (Boolean) db_writable()
274
275       Description: This method returns a boolean value indicating if the
276       database is in a writable state.
277
278   _extract_atime
279       private instance () _extract_atime (String $token,
280                                           String $value,
281                                           String $index)
282
283       Description: This method ensures that the database connection is
284       properly setup and working. If appropriate it will initialize a users
285       bayes variables so that they can begin using the database immediately.
286
287   _put_token
288       FIXME: This is rarely a good interface, because of the churn that will
289       often happen in the "magic" tokens.  Open-code this stuff in the
290       presence of loops.
291
292
293
294perl v5.30.1                      2020-02M-a0i3l::SpamAssassin::BayesStore::BDB(3)
Impressum