E-MailRelay

Public Member Functions | Static Public Member Functions | List of all members
GSmtp::FileStore Class Reference

A concrete implementation of the MessageStore interface dealing in paired flat files. More...

`#include <gfilestore.h>`

Inheritance diagram for GSmtp::FileStore:

## Public Member Functions
| FileStore (const G::Path &dir, unsigned long max_size, bool test_for_eight_bit)
| Constructor. More...
MessageId | newId ()
| Hands out a new message id. More...
std::unique_ptr< std::ofstream > | stream (const G::Path &path)
| Returns a stream to the given content. More...
G::Path | contentPath (const MessageId &) const
| Returns the path for a content file. More...
G::Path | envelopePath (const MessageId &, const char *modifier="") const
| Returns the path for an envelope file. More...
bool | empty () const override
| Override from GSmtp::MessageStore. More...
std::string | location (const MessageId &) const override
| Override from GSmtp::MessageStore. More...
std::unique_ptr< StoredMessage > | get (const MessageId &) override
| Override from GSmtp::MessageStore. More...
std::shared_ptr< MessageStore::Iterator > | iterator (bool lock) override
| Override from GSmtp::MessageStore. More...
std::shared_ptr< MessageStore::Iterator > | failures () override
| Override from GSmtp::MessageStore. More...
std::unique_ptr< NewMessage > | newMessage (const std::string &from, const std::string &from_auth_in, const std::string &from_auth_out) override
| Override from GSmtp::MessageStore. More...
void | updated () override
| Override from GSmtp::MessageStore. More...
G::Slot::Signal & | messageStoreUpdateSignal () override
| Override from GSmtp::MessageStore. More...
G::Slot::Signal & | messageStoreRescanSignal () override
| Override from GSmtp::MessageStore. More...
| FileStore (const FileStore &)=delete
| FileStore (FileStore &&)=delete
void | operator= (const FileStore &)=delete
void | operator= (FileStore &&)=delete
Public Member Functions inherited from GSmtp::MessageStore
virtual | ~MessageStore ()=default
| Destructor.
virtual std::unique_ptr< NewMessage > | newMessage (const std::string &from, const std::string &from_auth_in, const std::string &from_auth_out)=0
| Creates a new message. More...
virtual bool | empty () const =0
| Returns true if the message store is empty. More...
virtual std::string | location (const MessageId &) const =0
| Returns the location of the given message. More...
virtual std::unique_ptr< StoredMessage > | get (const MessageId &)=0
| Pulls the specified message out of the store. More...
virtual std::shared_ptr< Iterator > | iterator (bool lock)=0
| Returns an iterator for stored messages. More...
virtual std::shared_ptr< Iterator > | failures ()=0
| Returns an iterator for failed messages. More...
virtual void | unfailAll ()=0
| Causes messages marked as failed to be unmarked.
virtual void | rescan ()=0
| Requests that a messageStoreRescanSignal() is emitted.
virtual void | updated ()=0
| Called by associated classes to indicate that the store has changed. More...
virtual G::Slot::Signal & | messageStoreUpdateSignal ()=0
| Provides a signal which is when something might have changed in the store. More...
virtual G::Slot::Signal & | messageStoreRescanSignal ()=0
| Provides a signal which is emitted when rescan() is called. More...

## Static Public Member Functions
static std::string | x ()
| Returns the prefix for envelope header lines. More...
static std::string | format (int generation=0)
| Returns an identifier for the storage format implemented by this class, or some older generation of it (eg. More...
static bool | knownFormat (const std::string &format)
| Returns true if the storage format string is recognised and supported for reading. More...
Static Public Member Functions inherited from GSmtp::MessageStore
static G::Path | defaultDirectory ()
| Returns a default spool directory, such as "/var/spool/emailrelay". More...

## Detailed Description

A concrete implementation of the MessageStore interface dealing in paired flat files.

The implementation puts separate envelope and content files in the spool directory. The content file is written first. The presence of a matching envelope file is used to indicate that the content file is valid and that it has been commited to the care of the SMTP system for delivery.

Passes out unique sequence numbers, filesystem paths and i/o streams to NewMessageImp.

Definition at line 57 of file gfilestore.h.

## Constructor & Destructor Documentation

## ◆ FileStore()

GSmtp::FileStore::FileStore | ( | const G::Path & | dir,
|  | unsigned long | max_size,
|  | bool | test_for_eight_bit
| ) |  |

Constructor.

Throws an exception if the storage directory is invalid.

Definition at line 107 of file gfilestore.cpp.

## Member Function Documentation

## ◆ contentPath()

G::Path GSmtp::FileStore::contentPath | ( | const MessageId & | id | ) | const

Returns the path for a content file.

Definition at line 200 of file gfilestore.cpp.

## ◆ empty()

bool GSmtp::FileStore::empty | ( |  | ) | const
| override virtual

Override from GSmtp::MessageStore.

Implements GSmtp::MessageStore.

Definition at line 224 of file gfilestore.cpp.

## ◆ envelopePath()

G::Path GSmtp::FileStore::envelopePath | ( | const MessageId & | id,
|  | const char * | modifier = `""`
| ) |  | const

Returns the path for an envelope file.

Definition at line 205 of file gfilestore.cpp.

## ◆ failures()

std::shared_ptr< GSmtp::MessageStore::Iterator > GSmtp::FileStore::failures | ( |  | ) |
| override virtual

Override from GSmtp::MessageStore.

Implements GSmtp::MessageStore.

Definition at line 243 of file gfilestore.cpp.

## ◆ format()

std::string GSmtp::FileStore::format | ( | int | generation = `0` | ) |
| static

Returns an identifier for the storage format implemented by this class, or some older generation of it (eg.

-1).

Definition at line 134 of file gfilestore.cpp.

## ◆ get()

std::unique_ptr< GSmtp::StoredMessage > GSmtp::FileStore::get | ( | const MessageId & | id | ) |
| override virtual

Override from GSmtp::MessageStore.

Implements GSmtp::MessageStore.

Definition at line 248 of file gfilestore.cpp.

## ◆ iterator()

std::shared_ptr< GSmtp::MessageStore::Iterator > GSmtp::FileStore::iterator | ( | bool | lock | ) |
| override virtual

Override from GSmtp::MessageStore.

Implements GSmtp::MessageStore.

Definition at line 233 of file gfilestore.cpp.

## ◆ knownFormat()

bool GSmtp::FileStore::knownFormat | ( | const std::string & | format | ) |
| static

Returns true if the storage format string is recognised and supported for reading.

Definition at line 145 of file gfilestore.cpp.

## ◆ location()

std::string GSmtp::FileStore::location | ( | const MessageId & | id | ) | const
| override virtual

Override from GSmtp::MessageStore.

Implements GSmtp::MessageStore.

Definition at line 185 of file gfilestore.cpp.

## ◆ messageStoreRescanSignal()

G::Slot::Signal & GSmtp::FileStore::messageStoreRescanSignal | ( |  | ) |
| override virtual

Override from GSmtp::MessageStore.

Implements GSmtp::MessageStore.

Definition at line 285 of file gfilestore.cpp.

## ◆ messageStoreUpdateSignal()

G::Slot::Signal & GSmtp::FileStore::messageStoreUpdateSignal | ( |  | ) |
| override virtual

Override from GSmtp::MessageStore.

Implements GSmtp::MessageStore.

Definition at line 280 of file gfilestore.cpp.

## ◆ newId()

GSmtp::MessageId GSmtp::FileStore::newId | ( |  | ) |

Hands out a new message id.

Definition at line 211 of file gfilestore.cpp.

## ◆ newMessage()

std::unique_ptr< GSmtp::NewMessage > GSmtp::FileStore::newMessage | ( | const std::string & | from,
|  | const std::string & | from_auth_in,
|  | const std::string & | from_auth_out
| ) |  |
| override virtual

Override from GSmtp::MessageStore.

Implements GSmtp::MessageStore.

Definition at line 267 of file gfilestore.cpp.

## ◆ stream()

std::unique_ptr< std::ofstream > GSmtp::FileStore::stream | ( | const G::Path & | path | ) |

Returns a stream to the given content.

Definition at line 190 of file gfilestore.cpp.

## ◆ updated()

void GSmtp::FileStore::updated | ( |  | ) |
| override virtual

Override from GSmtp::MessageStore.

Implements GSmtp::MessageStore.

Definition at line 274 of file gfilestore.cpp.

## ◆ x()

std::string GSmtp::FileStore::x | ( |  | ) |
| static

Returns the prefix for envelope header lines.

Definition at line 129 of file gfilestore.cpp.

The documentation for this class was generated from the following files:

- /usr/src/slapt-src-x86_64/network/emailrelay/emailrelay-2.3/src/gsmtp/gfilestore.h
- /usr/src/slapt-src-x86_64/network/emailrelay/emailrelay-2.3/src/gsmtp/gfilestore.cpp