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