pyzor.engines.common

Common library shared by different engines.

class pyzor.engines.common.DBHandle(single_threaded, multi_threaded, multi_processing, prefork)

Bases: tuple

multi_processing

Alias for field number 2

multi_threaded

Alias for field number 1

prefork

Alias for field number 3

single_threaded

Alias for field number 0

exception pyzor.engines.common.DatabaseError

Bases: exceptions.Exception

class pyzor.engines.common.Record(r_count=0, wl_count=0, r_entered=None, r_updated=None, wl_entered=None, wl_updated=None)

Bases: object

Prefix conventions used in this class: r = report (spam) wl = whitelist

r_increment()
r_update()
wl_increment()
wl_update()
class pyzor.engines.common.BaseEngine

Bases: object

Base class for Pyzor engines.

absolute_source = True
classmethod get_prefork_connections(fn, mode, max_age=None)

Yields an unlimited number of partial functions that return a new engine instance, suitable for using toghether with the Pre-Fork server.

handles_one_step = False
items()

Return a list of (key, record).

iteritems()

Iterate over pairs of (key, record).

report(keys)

Report the corresponding key as spam, incrementing the report count.

Engines that implement don’t implement this method should have handles_one_step set to False.

whitelist(keys)

Report the corresponding key as ham, incrementing the whitelist count.

Engines that implement don’t implement this method should have handles_one_step set to False.