"pickle" refers to the Python standard object serialization library cPickle
"pipermail" refers to one of the default pluggable archivers packaged with Mailman 3
I believe that the simplest way to approach this (at least for right now) is to take not of all existing functionality and to write a class that pipermail can use instead of pickle. For example, the following is in Archiving/pipermail.py:
self.articleIndex[article.msgid] = pickle.dumps(article)In order to replicate this behavior, I will write a similar method that would provide the same functionality while interfacing with a SQL database via the STORM API instead of pickle's object serialization. See #1 of To Do for details
To Do for Archiver/pipermail.py:
1. The method store_article in the Database class, which defines the basic sorting logic for a database, uses the cPickle.dumps() method to return the article as a string representation instead of writing it to a file. This returned string is then stored in a dictionary instance variable (articleIndex) with its message id as the key. When implementing the STORM conversion, there needs to be a mechanism for generating and returning the article's message id for this same purpose.
2. The __init__(...) method of class T (Python formatter class) attempts (in a try-except block) to reload the previously pickled data and creates a new directory of no pickled data exists. However, according to the comment documentation within the method the code is only run for legacy lists and this functionality is replicated within Archiver.py. Archiver.py in turn contains doctest that states that archives such as pipermail should be pointed to the correct directories in order to perform the archiving, so for now I'm going to ignore this second part and rewrite the pickle functionality in T's __init__ method for legacy lists.
3. The T class's close() method "Close[s] an archive, save[s] its state, and update[s] any changed archives." To accomplish this, it calls pickle.dump() and passes its current state (the namespace content for the object) and the file object opened to the externally-defined based directory and pipermail pickle. This method pickles the archive state by calling pickle.dump() and passing a path to the pickle file and a reference to the __dict__ property (which contains the namespace contents of the object). In this method, I will map the pipermail schema from the pickle instance to a SQL schema instead and write to a database file instead of a .pck file.
4. The only other call to a pickle method in Archiver/pipermail.py is in the class BSDDBdatabase, which is an extension to the Database class and further defines database sorting logic. In its getArticle() method, it attempts to load pickle data from the pickle representation in self.articleIndex[msgid], which was previously created in the store_article method (inherited from Database - see #1). In this method in my STORM class, I'll need to perform the reverse of what I do in number 1 and load the article with the proper articleIndex from the database.
As of now, the above plan describes what I envision implementing to replace pickling with SQL for archiving messages. I'm going to consult with Barry and Terri (I've been meaning to contact her) to determine whether or not this is a valid course of action or whether it will not suit the needs of the default archiving system.