Skip to content

StorageABC

email_profile.core.abc.StorageABC

Bases: ABC

Contract for a message-persistence backend.

Source code in email_profile/core/abc.py
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
class StorageABC(ABC):
    """Contract for a message-persistence backend."""

    @abstractmethod
    def save(self, raw: RawSerializer) -> None:
        """Persist the complete RFC822 source for one email."""
        ...

    @abstractmethod
    def get(self, message_id: str) -> Optional[RawSerializer]:
        """Retrieve the RFC822 source by email id. None if not stored."""
        ...

    @abstractmethod
    def ids(self, mailbox: Optional[str] = None) -> set[str]: ...

    @abstractmethod
    def uids(self, mailbox: str) -> set[str]: ...

get(message_id) abstractmethod

Retrieve the RFC822 source by email id. None if not stored.

Source code in email_profile/core/abc.py
52
53
54
55
@abstractmethod
def get(self, message_id: str) -> Optional[RawSerializer]:
    """Retrieve the RFC822 source by email id. None if not stored."""
    ...

ids(mailbox=None) abstractmethod

Source code in email_profile/core/abc.py
57
58
@abstractmethod
def ids(self, mailbox: Optional[str] = None) -> set[str]: ...

save(raw) abstractmethod

Persist the complete RFC822 source for one email.

Source code in email_profile/core/abc.py
47
48
49
50
@abstractmethod
def save(self, raw: RawSerializer) -> None:
    """Persist the complete RFC822 source for one email."""
    ...

uids(mailbox) abstractmethod

Source code in email_profile/core/abc.py
60
61
@abstractmethod
def uids(self, mailbox: str) -> set[str]: ...