Skip to Content.
Sympa Menu

devel - Re: [sympa-developpers] Precising objectives regarding 7.0

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: IKEDA Soji <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-developpers] Precising objectives regarding 7.0
  • Date: Mon, 24 Mar 2014 22:51:14 +0900

Hi,

On Thu, 06 Mar 2014 18:09:00 +0100
David Verdin <address@concealed> wrote:

> * Separate clearly oo and non oo paradigm. Stop using classes to store
> states (use singletons instead)

I have some ideas on this issue.

* Conf

I suppose that Conf (Sympa::Configuration) would be purified to a
set of helper functions parsing some sorts of configration format.
So it may not be an OO package.

* Site and Log

Site would be instantiated as singleton. Log would be, too. And it
would be initialized explicitly (not referring Site parameters
internally). E.g. at the start of a program:

our ($site, $log);

# Load site config.
$site = Sympa::Site->new();
$site->load() or die 'Error in config';

# Open log (syslog).
$log = Sympa::Log->new();
$log->set_log_level($site->log_level);
$log->do_openlog($site->log_facility, $site->log_socket_type, "MYNAME");

# Attach DB log.
my $dbm = Sympa::DatabaseManager->new(
$site->db_type, $site->db_name, $site->db_user, $site->db_passwd);
$log->attach_action_log($dbm);
$log->attach_stat_log($dbm);

# The first speech.
$log->do_log(
'notice', 'MYNAME started, default log level %d', $log->log_level);

# Do the work
...

* DatabaseManager and DataSource

I suppose the both would be unified and their instances wouldn't be
singleton.

Because, for example, currently session_table will be accessed/
updated everytime when the requests by clients occur: Administrator
may wish to separate this table into local storage (SQLite) if
possible.
And for example, s/he wish to use particular datasource for
mysql_alias_manager, instead of that provided by default site config.

So they would be instantiated by each, and I believe there are no
use to determine DataSource and DatabaseManager (SDM).

However, each of their instances should be able to share common
connection cache and statement cache.


Regards,

--- Soji

--
株式会社 コンバージョン セキュリティ&OSSソリューション部 池田荘児
〒231-0004 神奈川県横浜市中区元浜町3-21-2 ヘリオス関内ビル7F
e-mail address@concealed TEL 045-640-3550
http://www.conversion.co.jp/




Archive powered by MHonArc 2.6.19+.

Top of Page