[prev in list] [next in list] [prev in thread] [next in thread]
List: spamassassin-devel
Subject: [Bug 6517] New: New infrastructure triggering actions when their
From: bugzilla-daemon () issues ! apache ! org
Date: 2010-11-30 16:28:02
Message-ID: bug-6517-26 () https ! issues ! apache ! org/SpamAssassin/
[Download RAW message or body]
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6517
Summary: New infrastructure triggering actions when their
dependency tags become available
Product: Spamassassin
Version: SVN Trunk (Latest Devel Version)
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: Libraries
AssignedTo: dev@spamassassin.apache.org
ReportedBy: Mark.Martinec@ijs.si
Here is a relatively small enhancement to PerMsgStatus in a form of
three new subroutines, which I needed to implement the Spamhaus DWL
lookups plugin (Bug 6344). As it is a rather general purpose concept
and may be useful for other enhancements, I'm opening a dedicated
bug entry for documenting the new feature and collecting comments.
The patch adds one public API routine to PerMsgStatus:
action_depends_on_tags
and two private routines:
tag_is_ready, and report_unsatisfied_actions.
Think of actions as processes, and tags as events on which these
actions may be blocking (waiting). When all dependencies of a
pending action are fulfilled, it becomes runnable and is called
immediately.
The existing sub set_tag() now calls tag_is_ready() implicitly.
For this reason the patch also modifies a few remaining plugins
which were mucking with $self->{tag_data} directly instead of
going through the public API set_tag().
Here are the documentation bits from the patch:
=item $status->action_depends_on_tags($tags, $code, @args)
Enqueue the supplied subroutine reference $code, to become runnable
when all the specified tags become available. The $tags may be a
simple scalar - a tag name, or a listref of tag names. The subroutine
&$code when called will be passed a permessagestatus object as its
first argument, followed by the supplied (optional) list @args .
sub tag_is_ready:
# tag_is_ready() will be called by set_tag(), indicating that a given
# tag just received its value, possibly unblocking an action routine
# as declared by action_depends_on_tags().
#
# Well-behaving plugins should call set_tag() once when a tag is fully
# assembled and ready. Multiple calls to set the same tag value are handled
# gracefully, but may result in premature activation of a pending action.
# Setting tag values by plugins should not be done directly but only through
# the public API set_tag(), otherwise a pending action release may be missed.
sub report_unsatisfied_actions:
# debugging aid: show actions that are still pending, waiting for their
# tags to receive a value
--
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic