- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

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 and with an optional external preprocessor program which is used to process files once they have been stored. 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. More...
std::auto_ptr< std::ostream > | stream (const G::Path &path)
| Returns a stream to the given content. More...
G::Path | contentPath (unsigned long seq) const
| Returns the path for a content file. More...
G::Path | envelopePath (unsigned long seq) const
| Returns the path for an envelope file. More...
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
| Final override from GSmtp::MessageStore. More...
virtual std::auto_ptr< StoredMessage > | get (unsigned long id)
| Final override from GSmtp::MessageStore. More...
virtual MessageStore::Iterator | iterator (bool lock)
| Final override from GSmtp::MessageStore. More...
virtual MessageStore::Iterator | failures ()
| Final override from GSmtp::MessageStore. More...
virtual std::auto_ptr< NewMessage > | newMessage (const std::string &from)
| Final override from GSmtp::MessageStore. More...
virtual void | repoll ()
| Final override from GSmtp::MessageStore. More...
virtual void | unfailAll ()
| Final override from GSmtp::MessageStore. More...
virtual void | updated ()
| Final override from GSmtp::MessageStore. More...
virtual G::Signal1< bool > & | signal ()
| Final override from GSmtp::MessageStore. More...
Public Member Functions inherited from GSmtp::MessageStore
virtual | ~MessageStore ()
| Destructor. More...

## Static Public Member Functions
static std::string | x ()
| Returns the prefix for envelope header lines. More...
static std::string | format ()
| Returns an identifier for the storage format implemented by this class. 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 "/usr/local/var/spool/emailrelay". More...

## Detailed Description

A concrete implementation of the MessageStore interface dealing in paired flat files and with an optional external preprocessor program which is used to process files once they have been stored.

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

References G::DateTime::now().

## Member Function Documentation

G::Path GSmtp::FileStore::contentPath | ( | unsigned long | seq | ) | const

Returns the path for a content file.

Definition at line 161 of file gfilestore.cpp.

Referenced by GSmtp::NewFile::NewFile().

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

Final override from GSmtp::MessageStore.

Implements GSmtp::MessageStore.

Definition at line 199 of file gfilestore.cpp.

G::Path GSmtp::FileStore::envelopePath | ( | unsigned long | seq | ) | const

Returns the path for an envelope file.

Definition at line 166 of file gfilestore.cpp.

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

GSmtp::MessageStore::Iterator GSmtp::FileStore::failures | ( |  | ) |
| virtual

Final override from GSmtp::MessageStore.

Implements GSmtp::MessageStore.

Definition at line 227 of file gfilestore.cpp.

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

Returns an identifier for the storage format implemented by this class.

Definition at line 115 of file gfilestore.cpp.

std::auto_ptr< GSmtp::StoredMessage > GSmtp::FileStore::get | ( | unsigned long | id | ) |
| virtual

Final override from GSmtp::MessageStore.

Implements GSmtp::MessageStore.

Definition at line 232 of file gfilestore.cpp.

References G_LOG, and G::Path::str().

GSmtp::MessageStore::Iterator GSmtp::FileStore::iterator | ( | bool | lock | ) |
| virtual

Final override from GSmtp::MessageStore.

Implements GSmtp::MessageStore.

Definition at line 222 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 120 of file gfilestore.cpp.

std::auto_ptr< GSmtp::NewMessage > GSmtp::FileStore::newMessage | ( | const std::string & | from | ) |
| virtual

Final override from GSmtp::MessageStore.

Implements GSmtp::MessageStore.

Definition at line 255 of file gfilestore.cpp.

unsigned long GSmtp::FileStore::newSeq | ( |  | ) |

Hands out a new non-zero sequence number.

Definition at line 191 of file gfilestore.cpp.

Referenced by GSmtp::NewFile::NewFile().

void GSmtp::FileStore::repoll | ( |  | ) |
| virtual

Final override from GSmtp::MessageStore.

Implements GSmtp::MessageStore.

Definition at line 274 of file gfilestore.cpp.

G::Signal1< bool > & GSmtp::FileStore::signal | ( |  | ) |
| virtual

Final override from GSmtp::MessageStore.

Implements GSmtp::MessageStore.

Definition at line 269 of file gfilestore.cpp.

std::auto_ptr< std::ostream > GSmtp::FileStore::stream | ( | const G::Path & | path | ) |

Returns a stream to the given content.

Definition at line 152 of file gfilestore.cpp.

References G::Path::str().

Referenced by GSmtp::NewFile::NewFile().

void GSmtp::FileStore::unfailAll | ( |  | ) |
| virtual

Final override from GSmtp::MessageStore.

Implements GSmtp::MessageStore.

Definition at line 279 of file gfilestore.cpp.

References G_DEBUG, and GSmtp::MessageStore::Iterator::next().

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

Final override from GSmtp::MessageStore.

Implements GSmtp::MessageStore.

Definition at line 261 of file gfilestore.cpp.

References G_DEBUG.

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

Returns the prefix for envelope header lines.

Definition at line 110 of file gfilestore.cpp.

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

- gfilestore.h
- gfilestore.cpp