Skip to Content.
Sympa Menu

devel - Re: [sympa-developpers] Proposal on refactoring about message, spool and pipeline

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: Guillaume Rousse <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-developpers] Proposal on refactoring about message, spool and pipeline
  • Date: Thu, 03 Jul 2014 17:58:24 +0200

Le 30/06/2014 05:02, IKEDA Soji a écrit :
Hi developers,

I planned to make this proposal after release of 6.2b.1. However,
recently I feel there aren't sufficient mutual-understanding on
coming development. So I make proposal for now.

Especially Guillaume and David, I want your comments and suggestions
to my proposal. I believe it will help to make discussion among us
more or less smooth.
I like the Pipeline idea, it should introduce a intermediate level between the executable and the various objects they manipulate.

I'm less convinced by the context tracking issue.

Basically, I'm not really sure a message should keep itself a constant link toward its context. In most case, that's just to access configuration parameter that could be passed directly by the method invocator.

For instance, when checking DKIM status, checking tham DKIM status is actually required could be done by the caller, rather than embedding this check in the object itself:
$message->get_dkim_status if $robot->dkim_feature eq 'on';

But this suppose than the caller has another way to identify the message context than retrieving it from the message object, and I lack proper knowledge of sympa internal to ensure it is always true. So let's forget about it.

However, I'm quite sure than keeping this link as a permanent reference to full blown Sympa::List or Sympa::Robot objects has drawbacks.

First, it create a dependency from the Spool classes to those Sympa::List and Sympa::Robot classes, because every time a message is deserialized, those references are established immediatly, even if they aren't used thereafter.

Second, it creates references between objets, and David already told me about heavy memory usage issues probably caused by circular dependencies between objects preventing them to be freed by the garbage collector.

So I'd rather favor a lazy initialisation model:
- when a message object is deserialized, it only retains a list ID or a robot ID
- when the context is accessed from the message objet, because it is actually used, this identifier is converted to an object

That's transparent for the caller side, and leverage both issues.

ie, something as:

sub get_list {
my ($self) = @_;

if (!$self->{list}) {
require Sympa::List;
$self->{list} = Sympa::List->new($self->{list_id};
}

return $self->{list};
}

--
Guillaume Rousse
INRIA, Direction des systèmes d'information
Domaine de Voluceau
Rocquencourt - BP 105
78153 Le Chesnay
Tel: 01 39 63 58 31

Attachment: smime.p7s
Description: Signature cryptographique S/MIME




Archive powered by MHonArc 2.6.19+.

Top of Page