21 #ifndef G_SMTP_FILE_STORE_H
22 #define G_SMTP_FILE_STORE_H
44 class DirectoryReader ;
65 G_EXCEPTION( InvalidDirectory ,
"invalid spool directory" ) ;
66 G_EXCEPTION( GetError ,
"error reading specific message" ) ;
68 FileStore(
const G::Path & dir ,
bool optimise =
false ,
unsigned long max_size = 0UL ) ;
97 virtual bool empty()
const ;
100 virtual std::auto_ptr<StoredMessage>
get(
unsigned long id ) ;
109 virtual std::auto_ptr<NewMessage>
newMessage(
const std::string & from ) ;
112 static std::string
x() ;
115 static std::string
format() ;
119 static bool knownFormat(
const std::string & format ) ;
136 static void checkPath(
const G::Path & dir ) ;
137 G::Path fullPath(
const std::string & filename )
const ;
138 std::string filePrefix(
unsigned long seq )
const ;
139 std::string getline( std::istream & )
const ;
140 std::string value(
const std::string & )
const ;
141 static const std::string & crlf() ;
142 bool emptyCore()
const ;
145 unsigned long m_seq ;
150 unsigned long m_max_size ;
151 unsigned long m_pid_modifier ;
static std::string format()
Returns an identifier for the storage format implemented by this class.
G::Path contentPath(unsigned long seq) const
Returns the path for a content file.
SMTP and message-store classes.
static std::string x()
Returns the prefix for envelope header lines.
FileWriter()
Default constructor.
virtual void unfailAll()
Final override from GSmtp::MessageStore.
virtual G::Signal1< bool > & signal()
Final override from GSmtp::MessageStore.
virtual std::auto_ptr< NewMessage > newMessage(const std::string &from)
Final override from GSmtp::MessageStore.
virtual MessageStore::Iterator iterator(bool lock)
Final override from GSmtp::MessageStore.
Used by GSmtp::FileStore, GSmtp::NewFile and GSmtp::StoredFile to claim read permissions for reading ...
A class which acquires the process's special privileges on construction and releases them on destruct...
Used to temporarily modify the process umask.
Used by GSmtp::FileStore, GSmtp::NewFile and GSmtp::StoredFile to claim write permissions.
std::auto_ptr< std::ostream > stream(const G::Path &path)
Returns a stream to the given content.
~DirectoryReader()
Destructor. Switches identity back.
A class which allows SMTP messages (envelope+content) to be stored and retrieved. ...
FileStore(const G::Path &dir, bool optimise=false, unsigned long max_size=0UL)
Constructor.
virtual MessageStore::Iterator failures()
Final override from GSmtp::MessageStore.
virtual bool empty() const
Final override from GSmtp::MessageStore.
~FileReader()
Destructor. Switches identity back.
~FileWriter()
Destructor. Switches identity back.
#define G_EXCEPTION(class_name, description)
define as a function rather than a type if optimising for size
A concrete implementation of the MessageStore interface dealing in paired flat files and with an opti...
G::Path envelopePath(unsigned long seq) const
Returns the path for an envelope file.
virtual void updated()
Final override from GSmtp::MessageStore.
DirectoryReader()
Default constructor.
static bool knownFormat(const std::string &format)
Returns true if the storage format string is recognised and supported for reading.
unsigned long newSeq()
Hands out a new non-zero sequence number.
Used by GSmtp::FileStore, GSmtp::NewFile and GSmtp::StoredFile to claim read permissions for reading ...
virtual void repoll()
Final override from GSmtp::MessageStore.
A Path object represents a file system path.
FileReader()
Default constructor.
G::Path envelopeWorkingPath(unsigned long seq) const
Returns the path for an envelope file which is in the process of being written.
An iterator class for GSmtp::MessageStore.