diff options
| author | Barry Warsaw | 2008-02-27 01:26:18 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2008-02-27 01:26:18 -0500 |
| commit | a1c73f6c305c7f74987d99855ba59d8fa823c253 (patch) | |
| tree | 65696889450862357c9e05c8e9a589f1bdc074ac /Mailman/interfaces/messages.py | |
| parent | 3f31f8cce369529d177cfb5a7c66346ec1e12130 (diff) | |
| download | mailman-a1c73f6c305c7f74987d99855ba59d8fa823c253.tar.gz mailman-a1c73f6c305c7f74987d99855ba59d8fa823c253.tar.zst mailman-a1c73f6c305c7f74987d99855ba59d8fa823c253.zip | |
Diffstat (limited to 'Mailman/interfaces/messages.py')
| -rw-r--r-- | Mailman/interfaces/messages.py | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/Mailman/interfaces/messages.py b/Mailman/interfaces/messages.py deleted file mode 100644 index e65101a97..000000000 --- a/Mailman/interfaces/messages.py +++ /dev/null @@ -1,102 +0,0 @@ -# Copyright (C) 2007-2008 by the Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -# USA. - -"""The message storage service.""" - -from zope.interface import Interface, Attribute - - - -class IMessageStore(Interface): - """The interface of the global message storage service. - - All messages that are stored in the system live in the message storage - service. A message stored in this service must have a Message-ID header. - The store writes an X-Message-ID-Hash header which contains the Base32 - encoded SHA1 hash of the message's Message-ID header. Any existing - X-Message-ID-Hash header is overwritten. - - Either the Message-ID or the X-Message-ID-Hash header can be used to - uniquely identify this message in the storage service. While it is - possible to see duplicate Message-IDs, this is never correct and the - service is allowed to drop any subsequent colliding messages, or overwrite - earlier messages with later ones. - - The combination of the List-Archive header and either the Message-ID or - X-Message-ID-Hash header can be used to retrieve the message from the - internet facing interface for the message store. This can be considered a - globally unique URI to the message. - - For example, a message with the following headers: - - Message-ID: <87myycy5eh.fsf@uwakimon.sk.tsukuba.ac.jp> - Date: Wed, 04 Jul 2007 16:49:58 +0900 - List-Archive: http://archive.example.com/ - X-Message-ID-Hash: RXTJ357KFOTJP3NFJA6KMO65X7VQOHJI - - the globally unique URI would be: - - http://archive.example.com/RXTJ357KFOTJP3NFJA6KMO65X7VQOHJI - """ - - def add(message): - """Add the message to the store. - - :param message: An email.message.Message instance containing at least - a unique Message-ID header. The message will be given an - X-Message-ID-Hash header, overriding any existing such header. - :returns: The calculated X-Message-ID-Hash header. - :raises ValueError: if the message is missing a Message-ID header. - The storage service is also allowed to raise this exception if it - find, but disallows collisions. - """ - - def get_message_by_id(message_id): - """Return the message with a matching Message-ID. - - :param message_id: The Message-ID header contents to search for. - :returns: The message, or None if no matching message was found. - """ - - def get_message_by_hash(message_id_hash): - """Return the message with the matching X-Message-ID-Hash. - - :param message_id_hash: The X-Message-ID-Hash header contents to - search for. - :returns: The message, or None if no matching message was found. - """ - - def delete_message(message_id): - """Remove the given message from the store. - - :param message: The Message-ID of the mesage to delete from the store. - :raises LookupError: if there is no such message. - """ - - messages = Attribute( - """An iterator over all messages in this message store.""") - - - -class IMessage(Interface): - """The representation of an email message.""" - - message_id = Attribute("""The message's Message-ID header.""") - - message_id_hash = Attribute("""The unique SHA1 hash of the message.""") - - path = Attribute("""The filesystem path to the message object.""") |
