E-MailRelay
Classes | Public Types | Public Member Functions | List of all members
GPop::StoreLock Class Reference

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

#include <gpopstore.h>

Public Types

using Size = StoreLockEntry::Size
 
using Entry = StoreLockEntry
 
using List = std::list< Entry >
 
using Fn = void(*)(std::ostream &, const std::string &)
 

Public Member Functions

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

Detailed Description

Represents an exclusive lock on the message store.

See also
RFC-1939

Definition at line 102 of file gpopstore.h.

Member Typedef Documentation

◆ Entry

Definition at line 108 of file gpopstore.h.

◆ Fn

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

Definition at line 110 of file gpopstore.h.

◆ List

using GPop::StoreLock::List = std::list<Entry>

Definition at line 109 of file gpopstore.h.

◆ Size

using GPop::StoreLock::Size = StoreLockEntry::Size

Definition at line 107 of file gpopstore.h.

Constructor & Destructor Documentation

◆ StoreLock()

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

Constructor.

Keeps the reference.

Postcondition: !locked()

Definition at line 177 of file gpopstore.cpp.

Member Function Documentation

◆ byteCount()

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

Returns a message size.

Definition at line 279 of file gpopstore.cpp.

◆ commit()

void GPop::StoreLock::commit ( )

Commits remove()als.

Postcondition: !locked()

Definition at line 332 of file gpopstore.cpp.

◆ get()

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

Retrieves the message content.

Definition at line 298 of file gpopstore.cpp.

◆ list()

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

Lists messages in the store.

Definition at line 285 of file gpopstore.cpp.

◆ lock()

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

Initialisation.

Precondition: !user.empty() && !locked() Postcondition: locked()

Definition at line 182 of file gpopstore.cpp.

◆ locked()

bool GPop::StoreLock::locked ( ) const

Returns true if locked.

Definition at line 223 of file gpopstore.cpp.

◆ messageCount()

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

Returns the store's message count.

Definition at line 231 of file gpopstore.cpp.

◆ remove()

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

Marks the message for removal.

Definition at line 318 of file gpopstore.cpp.

◆ rollback()

void GPop::StoreLock::rollback ( )

Rolls back remove()als but retains the lock.

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

Definition at line 436 of file gpopstore.cpp.

◆ totalByteCount()

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

Returns the store's total byte count.

Definition at line 237 of file gpopstore.cpp.

◆ uidl()

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

Returns a message's unique id.

Definition at line 376 of file gpopstore.cpp.

◆ valid()

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

Validates a message number.

Definition at line 246 of file gpopstore.cpp.


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