Now the mid term evaluations are done, I would be building the command
line shell, as planned. I would like to present how I would like to
tackle the requirement at hand.
As mentioned in my proposal and the most logical approach, all the
common functionalities between the shell and the already built command
line tools would use the same classes, the ones built for the command tools.
As this is a command shell, I wish to give it a SQL like feel. However,
The SQL commands SELECT, INSERT INTO do not look nice in Mailman
context, as we are dealing with objects and not tables. I would be using
the object related terms like SHOW, CREATE etc for the respective actions.
However, I would like to discuss about the support for the WHERE clause
by the shell.
The WHERE clause is not mentioned in my proposal, but I feel that this
feature ought to be in the project.
If the commands require to support a WHERE clause, as SQL does,
>>> show users where display_name = 'foo' and subscribed_list_ids
contains = 'list(a)domain.org <mailto:%email@example.com>'
The steps involved in processing a command with a WHERE clause would be
1.Parse the command
2.Filter the results from the database
3.Perform the action using the command line tool methods if possible
else write a new procedure.
For the Step 2, there are two approaches in hand:
1.Use the Storm library to query the database directly, as mailman core
2.Use the REST API
By using the first approach, a good performance improvement is achieved,
by leaving the data filtering to database engine. But this limits the
usability of of the CLI to the system in which the mailman database
exists, as the remote connections to DB servers are usually disabled.
By using the second approach, the performance is bad, as it requires a
normal python `for` loop that compares the the results one by one.
However, this approach might be easier in case that the mailman
installation be managed remotely, if its OK to enable the REST API to
accept connections from remote machines.(I believe this is currently not
supported/disabled by default.)
By building the WHERE clause, its costlier to reuse the command line
tools methods in many use cases, like delete, subscribe etc. Further, as
I have already mentioned to Abhilash, it demands more time. I am not
sure if that will fit into GSoC time frame. I am confident that I can
make significant progress, but not sure if it can be 'completed'. Also,
I am fine on completing it even after GSoC.
So, the final question is, Should the CLI support filtering using the
WHERE clause? Or should I proceed as per my proposal, building a basic
Mailman shell and leave the rest to be completed in future?