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, bool optimise=false, unsigned long max_size=0UL)
 Constructor. More...
 
unsigned long newSeq ()
 Hands out a new non-zero sequence number.
 
unique_ptr< std::ostream > stream (const G::Path &path)
 Returns a stream to the given content.
 
G::Path contentPath (unsigned long seq) const
 Returns the path for a content file.
 
G::Path envelopePath (unsigned long seq) const
 Returns the path for an envelope file.
 
G::Path envelopeWorkingPath (unsigned long seq) const
 Returns the path for an envelope file which is in the process of being written. More...
 
virtual bool empty () const override
 Override from GSmtp::MessageStore.
 
virtual unique_ptr< StoredMessage > get (unsigned long id) override
 Override from GSmtp::MessageStore.
 
virtual MessageStore::Iterator iterator (bool lock) override
 Override from GSmtp::MessageStore.
 
virtual MessageStore::Iterator failures () override
 Override from GSmtp::MessageStore.
 
virtual 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.
 
virtual void rescan () override
 Override from GSmtp::MessageStore.
 
virtual void unfailAll () override
 Override from GSmtp::MessageStore.
 
virtual void updated () override
 Override from GSmtp::MessageStore.
 
virtual G::Slot::Signal0 & messageStoreUpdateSignal () override
 Override from GSmtp::MessageStore.
 
virtual G::Slot::Signal0 & messageStoreRescanSignal () override
 Override from GSmtp::MessageStore.
 
- Public Member Functions inherited from GSmtp::MessageStore
virtual ~MessageStore ()
 Destructor.
 

Static Public Member Functions

static std::string x ()
 Returns the prefix for envelope header lines.
 
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 58 of file gfilestore.h.

Constructor & Destructor Documentation

GSmtp::FileStore::FileStore ( const G::Path &  dir,
bool  optimise = false,
unsigned long  max_size = 0UL 
)

Constructor.

Throws an exception if the storage directory is invalid.

If the optimise flag is set then the implementation of empty() will be efficient for an empty filestore (ignoring failed and local-delivery messages). This might be useful for applications in which the main event loop is used to check for pending jobs. The disadvantage is that this process will not be sensititive to messages deposited into its spool directory by other processes.

Definition at line 105 of file gfilestore.cpp.

Member Function Documentation

G::Path GSmtp::FileStore::envelopeWorkingPath ( unsigned long  seq) const

Returns the path for an envelope file which is in the process of being written.

Definition at line 192 of file gfilestore.cpp.

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 130 of file gfilestore.cpp.

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 140 of file gfilestore.cpp.


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