GPop::StoreLock Class Reference

Represents an exclusive lock on the message store. More...

#include <gpopstore.h>

List of all members.

Public Types

typedef StoreLockEntry::Size Size
typedef StoreLockEntry Entry
typedef std::list< EntryList
typedef void(* Fn )(std::ostream &, const std::string &)

Public Member Functions

 StoreLock (Store &store)
 Constructor.
void lock (const std::string &user)
 Initialisation.
bool locked () const
 Returns true if locked.
 ~StoreLock ()
 Destructor.
Size messageCount () const
 Returns the store's message count.
Size totalByteCount () const
 Returns the store's total byte count.
Size byteCount (int id) const
 Returns a message size.
std::string uidl (int id) const
 Returns a message's unique id.
bool valid (int id) const
 Validates a message number.
List list (int id=-1) const
 Lists messages in the store.
std::auto_ptr< std::istream > get (int id) const
 Retrieves the message content.
void remove (int)
 Marks the message for removal.
void rollback ()
 Rolls back remove()als but retains the lock.
void commit ()
 Commits remove()als.

Classes

struct  File
 A private implementation class used by GPop::StoreLock.


Detailed Description

Represents an exclusive lock on the message store.

See also:
RFC-1939

Definition at line 99 of file gpopstore.h.


Member Typedef Documentation

Definition at line 102 of file gpopstore.h.

Definition at line 105 of file gpopstore.h.

typedef std::list<Entry> GPop::StoreLock::List

Definition at line 106 of file gpopstore.h.

typedef void(* GPop::StoreLock::Fn)(std::ostream &, const std::string &)


Constructor & Destructor Documentation

GPop::StoreLock::StoreLock ( Store store  )  [explicit]

Constructor.

Keeps the reference.

Postcondition: !locked()

Definition at line 176 of file gpopstore.cpp.

GPop::StoreLock::~StoreLock (  ) 

Destructor.

Definition at line 227 of file gpopstore.cpp.


Member Function Documentation

void GPop::StoreLock::lock ( const std::string &  user  ) 

bool GPop::StoreLock::locked (  )  const

Returns true if locked.

Definition at line 222 of file gpopstore.cpp.

Referenced by byteCount(), commit(), get(), list(), lock(), messageCount(), remove(), rollback(), totalByteCount(), and valid().

GPop::StoreLock::Size GPop::StoreLock::messageCount (  )  const

Returns the store's message count.

Definition at line 231 of file gpopstore.cpp.

References G_ASSERT, and locked().

GPop::StoreLock::Size GPop::StoreLock::totalByteCount (  )  const

Returns the store's total byte count.

Definition at line 237 of file gpopstore.cpp.

References G_ASSERT, and locked().

GPop::StoreLock::Size GPop::StoreLock::byteCount ( int  id  )  const

Returns a message size.

Definition at line 279 of file gpopstore.cpp.

References G_ASSERT, and locked().

std::string GPop::StoreLock::uidl ( int  id  )  const

Returns a message's unique id.

Definition at line 375 of file gpopstore.cpp.

References G_ASSERT, and valid().

bool GPop::StoreLock::valid ( int  id  )  const

Validates a message number.

Definition at line 246 of file gpopstore.cpp.

References G_ASSERT, and locked().

Referenced by get(), remove(), and uidl().

GPop::StoreLock::List GPop::StoreLock::list ( int  id = -1  )  const

Lists messages in the store.

Definition at line 285 of file gpopstore.cpp.

References G_ASSERT, and locked().

std::auto_ptr< std::istream > GPop::StoreLock::get ( int  id  )  const

Retrieves the message content.

Definition at line 298 of file gpopstore.cpp.

References G_ASSERT, G_DEBUG, locked(), G::Path::str(), and valid().

void GPop::StoreLock::remove ( int  id  ) 

Marks the message for removal.

Definition at line 317 of file gpopstore.cpp.

References G_ASSERT, locked(), and valid().

void GPop::StoreLock::rollback (  ) 

Rolls back remove()als but retains the lock.

Precondition: locked() Postcondition: locked() [sic]

Definition at line 435 of file gpopstore.cpp.

References G_ASSERT, and locked().

void GPop::StoreLock::commit (  ) 

Commits remove()als.

Postcondition: !locked()

Definition at line 331 of file gpopstore.cpp.

References G_ASSERT, and locked().


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

Generated on Fri Apr 18 15:56:13 2008 for E-MailRelay by  doxygen 1.5.5