def setUp(self):
     self.log = getQueueStorageLogger('test')
Exemplo n.º 2
0
"""Package implementing the :mod:`slimta.queue` system on top of a
:func:`dict()` backend. This backend can be implemented as a :mod:`shelve` to
provide basic persistence.

"""

from __future__ import absolute_import

import uuid

from slimta import logging
from . import QueueStorage

__all__ = ['DictStorage']

log = logging.getQueueStorageLogger(__name__)


class DictStorage(QueueStorage):
    """Stores |Envelope| and queue metadata in two basic dictionary objects.

    :param envelope_db: The dictionary object to hold |Envelope| objects, keyed
                        by a unique string. Defaults to an empty :func:`dict`.
    :param meta_db: The dictionary object to hold envelope metadata, keyed by
                    the same string as ``envelope_db``. Defaults to an empty
                    :func:`dict`.

    """
    def __init__(self, envelope_db=None, meta_db=None):
        super(DictStorage, self).__init__()
        self.env_db = envelope_db if envelope_db is not None else {}
Exemplo n.º 3
0
.. _Cloud Files: http://www.rackspace.com/cloud/files/
.. _Cloud Queues: http://www.rackspace.com/cloud/queues/
.. _S3: http://aws.amazon.com/s3/
.. _SQS: http://aws.amazon.com/sqs/

"""

from __future__ import absolute_import

from slimta.queue import QueueError, QueueStorage
from slimta import logging

__all__ = ['CloudStorageError', 'CloudStorage']

log = logging.getQueueStorageLogger(__name__)


class CloudStorageError(QueueError):
    """Base exception for all exceptions in the package.

    """
    pass


class CloudStorage(QueueStorage):
    """This class implements a :class:`~slimta.queue.QueueStorage` backend that
    uses cloud services to store messages. It coordinates the storage of
    messages and metadata (using `Cloud Files`_ or `S3`_) with the optional
    message queue mechanisms (using `Cloud Queues`_ or `SQS`_) that can alert
    other *slimta* processes that a new message is available in the object
Exemplo n.º 4
0
 def setUp(self):
     self.log = getQueueStorageLogger('test')