class NewsStorage: """ A generic interface to metadata/data pairs """ def lookupByHeader(self, predicate, max = 1): """ Search for a message by examining its headers. 'predicate' is called with a mapping of header name/values. If it returns a true value, the Message-ID of the message is added to the result list. When the result list is 'max' items long, or there are no more articles, it is returned. If 'max' is None, it is disregarded. """ def searchHeaders(self, predicate, max = None): """ Collect a list of headers. 'predicate' is called with a mapping of header name/values. If it returns something other than None, that object is added to the result list. When the result list is 'max' items long, or there are no more articles, it is returned. If 'max' is None, it is disregarded. """ def lookupByBody(self, predicate, max = 1): """ Search by a message by examining its body. 'predicate' is passed the body of each message in the database. If it returns a true value, the Message-ID of the message is added to the result list. When the result list is 'max' items long, or there are no more articles, it is returned. If 'max' is None, it is disregarded. """ def lookupByID(self, id): """ Return the headers and body for the article with the specified Message-ID. """ def insertMessage(self, headers, body): """ Insert a new message. 'header' is a mapping of header name/values. If it does not contain a 'Message-ID' header one will be added. If the Message-ID is already assigned """ def removeMessage(self, id): """ Remove the message with the specified Message-ID """