1Mail::SpamAssassin::BayUesseSrtoCroen(t3r)ibuted Perl DoMcauimle:n:tSaptaimoAnssassin::BayesStore(3)
2
3
4
6 Mail::SpamAssassin::BayesStore - Bayesian Storage Module
7
9 This is the public API for the Bayesian store methods. Any implementa‐
10 tion of the storage module must implement these methods.
11
13 new public class (Mail::SpamAssassin::BayesStore) new (Mail::SpamAssas‐
14 sin::Bayes $bayes)
15
16 Description: This method creates a new instance of the Mail::Spa‐
17 mAssassin::BayesStore object. You must pass in an instance of the
18 Mail::SpamAssassin:Bayes object, which is stashed for use through‐
19 out the module.
20
21 DB_VERSION
22 public instance (Integer) DB_VERSION ()
23
24 Description: This method returns the currently supported database
25 version for the implementation.
26
27 read_db_configs
28 public instance () read_db_configs ()
29
30 Description: This method reads any needed config variables from the
31 configuration object and then calls the Mail::SpamAssassin::Bayes
32 read_db_configs method.
33
34 tie_db_readonly
35 public instance (Boolean) tie_db_readonly ()
36
37 Description: This method opens up the database in readonly mode.
38
39 tie_db_writable
40 public instance (Boolean) tie_db_writable ()
41
42 Description: This method opens up the database in writable mode.
43
44 Any callers of this methods should ensure that they call untie_db()
45 afterwards.
46
47 untie_db
48 public instance () untie_db ()
49
50 Description: This method unties the database.
51
52 calculate_expire_delta
53 public instance (%) calculate_expire_delta (Integer $newest_atime,
54 Integer $start,
55 Integer
56 $max_expire_mult)
57
58 Description: This method performs a calculation on the data to
59 determine the optimum atime for token expiration.
60
61 token_expiration
62 public instance (Integer, Integer,
63 Integer, Integer) token_expiration(\% $opts,
64 Integer $new‐
65 est_atime,
66 Integer
67 $newdelta)
68
69 Description: This method performs the database specific expiration
70 of tokens based on the passed in $newest_atime and $newdelta.
71
72 expire_old_tokens
73 public instance (Boolean) expire_old_tokens (\% hashref)
74
75 Description: This method expires old tokens from the database.
76
77 expire_old_tokens_trapped
78 public instance (Boolean) expire_old_tokens_trapped (\% $opts)
79
80 Description: This methods does the actual token expiration.
81
82 XXX More docs here about the methodology and what not
83
84 sync_due
85 public instance (Boolean) sync_due ()
86
87 Description: This methods determines if a sync is due.
88
89 expiry_due
90 public instance (Boolean) expiry_due ()
91
92 Description: This methods determines if an expire is due.
93
94 seen_get
95 public instance (Char) seen_get (String $msgid)
96
97 Description: This method retrieves the stored value, if any, for
98 $msgid. The return value is the stored string ('s' for spam and
99 'h' for ham) or undef if $msgid is not found.
100
101 seen_put
102 public instance (Boolean) seen_put (String $msgid, Char $flag)
103
104 Description: This method records $msgid as the type given by $flag.
105 $flag is one of two values 's' for spam and 'h' for ham.
106
107 seen_delete
108 public instance (Boolean) seen_delete (String $msgid)
109
110 Description: This method removes $msgid from storage.
111
112 get_storage_variables
113 public instance (@) get_storage_variables ()
114
115 Description: This method retrieves the various administrative vari‐
116 ables used by the Bayes storage implementation.
117
118 The values returned in the array are in the following order:
119
120 0: scan count base
121
122 1: number of spam
123
124 2: number of ham
125
126 3: number of tokens in db
127
128 4: last expire atime
129
130 5: oldest token in db atime
131
132 6: db version value
133
134 7: last journal sync
135
136 8: last atime delta
137
138 9: last expire reduction count
139
140 10: newest token in db atime
141
142 dump_db_toks
143 public instance () dump_db_toks (String $template, String $regex, @
144 @vars)
145
146 Description: This method loops over all tokens, computing the prob‐
147 ability for the token and then printing it out according to the
148 passed in template.
149
150 set_last_expire
151 public instance (Boolean) _set_last_expire (Integer $time)
152
153 Description: This method sets the last expire time.
154
155 get_running_expire_tok
156 public instance (Time) get_running_expire_tok ()
157
158 Description: This method determines if an expire is currently run‐
159 ning and returns the time the expire started.
160
161 set_running_expire_tok
162 public instance (Time) set_running_expire_tok ()
163
164 Description: This method sets the running expire time to the cur‐
165 rent time.
166
167 remove_running_expire_tok
168 public instance (Boolean) remove_running_expire_tok ()
169
170 Description: This method removes a currently set running expire
171 time.
172
173 tok_get
174 public instance (Integer, Integer, Time) tok_get (String $token)
175
176 Description: This method retrieves the specified token ($token)
177 from storage and returns it's spam count, ham acount and last
178 access time.
179
180 tok_get_all
181 public instance (\@) tok_get_all (@ @tokens)
182
183 Description: This method retrieves the specified tokens (@tokens)
184 from storage and returns an array ref of arrays spam count, ham
185 acount and last access time.
186
187 tok_count_change
188 public instance (Boolean) tok_count_change (Integer $spam_count,
189 Integer $ham_count,
190 String $token,
191 Time $atime)
192
193 Description: This method takes a $spam_count and $ham_count and
194 adds it to $token along with updating $tokens atime with $atime.
195
196 multi_tok_count_change
197 public instance (Boolean) multi_tok_count_change (Integer
198 $spam_count,
199 Integer $ham_count,
200 \% $tokens,
201 String $atime)
202
203 Description: This method takes a $spam_count and $ham_count and
204 adds it to all of the tokens in the $tokens hash ref along with
205 updating each tokens atime with $atime.
206
207 nspam_nham_get
208 public instance (Integer, Integer) nspam_nham_get ()
209
210 Description: This method retrieves the total number of spam and the
211 total number of spam currently under storage.
212
213 nspam_nham_change
214 public instance (Boolean) nspam_nham_change (Integer $num_spam,
215 Integer $num_ham)
216
217 Description: This method updates the number of spam and the number
218 of ham in the database.
219
220 tok_touch
221 public instance (Boolean) tok_touch (String $token,
222 Time $atime)
223
224 Description: This method updates the given tokens ($token) access
225 time.
226
227 tok_touch_all
228 public instance (Boolean) tok_touch_all (\@ $tokens,
229 Time $atime)
230
231 Description: This method does a mass update of the given list of
232 tokens $tokens, if the existing token atime is < $atime.
233
234 cleanup
235 public instance (Boolean) cleanup ()
236
237 Description: This method performs any cleanup necessary before mov‐
238 ing onto the next operation.
239
240 get_magic_re
241 public instance get_magic_re (String)
242
243 Description: This method returns a regexp which indicates a magic
244 token.
245
246 sync
247 public instance (Boolean) sync (\% $opts)
248
249 Description: This method performs a sync of the database.
250
251 perform_upgrade
252 public instance (Boolean) perform_upgrade (\% $opts)
253
254 Description: This method is a utility method that performs any nec‐
255 essary upgrades between versions. It should know how to handle
256 previous versions and what needs to happen to upgrade them.
257
258 A true return value indicates success.
259
260 clear_database
261 public instance (Boolean) clear_database ()
262
263 Description: This method deletes all records for a particular user.
264
265 Callers should be aware that any errors returned by this method
266 could causes the database to be inconsistent for the given user.
267
268 backup_database
269 public instance (Boolean) backup_database ()
270
271 Description: This method will dump the users database in a marchine
272 readable format.
273
274 restore_database
275 public instance (Boolean) restore_database (String $filename, Bool‐
276 ean $showdots)
277
278 Description: This method restores a database from the given file‐
279 name, $filename.
280
281 Callers should be aware that any errors returned by this method
282 could causes the database to be inconsistent for the given user.
283
284 db_readable
285 public instance (Boolean) db_readable ()
286
287 Description: This method returns whether or not the Bayes DB is
288 available in a readable state.
289
290 db_writable
291 public instance (Boolean) db_writable ()
292
293 Description: This method returns whether or not the Bayes DB is
294 available in a writable state.
295
296
297
298perl v5.8.8 2008-01-05 Mail::SpamAssassin::BayesStore(3)