E-MailRelay
|
A concrete implementation of the MessageStore interface dealing in paired flat files. More...
#include <gfilestore.h>
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 |
![]() | |
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 G::Path | defaultDirectory () |
Returns a default spool directory, such as "/var/spool/emailrelay". More... | |
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.
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.
Returns the path for a content file.
Definition at line 200 of file gfilestore.cpp.
|
overridevirtual |
Override from GSmtp::MessageStore.
Implements GSmtp::MessageStore.
Definition at line 224 of file gfilestore.cpp.
Returns the path for an envelope file.
Definition at line 205 of file gfilestore.cpp.
|
overridevirtual |
Override from GSmtp::MessageStore.
Implements GSmtp::MessageStore.
Definition at line 243 of file gfilestore.cpp.
|
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.
|
overridevirtual |
Override from GSmtp::MessageStore.
Implements GSmtp::MessageStore.
Definition at line 248 of file gfilestore.cpp.
|
overridevirtual |
Override from GSmtp::MessageStore.
Implements GSmtp::MessageStore.
Definition at line 233 of file gfilestore.cpp.
|
static |
Returns true if the storage format string is recognised and supported for reading.
Definition at line 145 of file gfilestore.cpp.
|
overridevirtual |
Override from GSmtp::MessageStore.
Implements GSmtp::MessageStore.
Definition at line 185 of file gfilestore.cpp.
|
overridevirtual |
Override from GSmtp::MessageStore.
Implements GSmtp::MessageStore.
Definition at line 285 of file gfilestore.cpp.
|
overridevirtual |
Override from GSmtp::MessageStore.
Implements GSmtp::MessageStore.
Definition at line 280 of file gfilestore.cpp.
GSmtp::MessageId GSmtp::FileStore::newId | ( | ) |
Hands out a new message id.
Definition at line 211 of file gfilestore.cpp.
|
overridevirtual |
Override from GSmtp::MessageStore.
Implements GSmtp::MessageStore.
Definition at line 267 of file gfilestore.cpp.
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.
|
overridevirtual |
Override from GSmtp::MessageStore.
Implements GSmtp::MessageStore.
Definition at line 274 of file gfilestore.cpp.
|
static |
Returns the prefix for envelope header lines.
Definition at line 129 of file gfilestore.cpp.