E-MailRelay
|
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 |
Represents an exclusive lock on the message store.
Definition at line 102 of file gpopstore.h.
using GPop::StoreLock::Entry = StoreLockEntry |
Definition at line 108 of file gpopstore.h.
using GPop::StoreLock::Fn = void (*)(std::ostream &, const std::string &) |
Definition at line 110 of file gpopstore.h.
using GPop::StoreLock::List = std::list<Entry> |
Definition at line 109 of file gpopstore.h.
using GPop::StoreLock::Size = StoreLockEntry::Size |
Definition at line 107 of file gpopstore.h.
|
explicit |
Constructor.
Keeps the reference.
Postcondition: !locked()
Definition at line 177 of file gpopstore.cpp.
GPop::StoreLock::Size GPop::StoreLock::byteCount | ( | int | id | ) | const |
Returns a message size.
Definition at line 279 of file gpopstore.cpp.
void GPop::StoreLock::commit | ( | ) |
std::unique_ptr< std::istream > GPop::StoreLock::get | ( | int | id | ) | const |
Retrieves the message content.
Definition at line 298 of file gpopstore.cpp.
GPop::StoreLock::List GPop::StoreLock::list | ( | int | id = -1 | ) | const |
Lists messages in the store.
Definition at line 285 of file gpopstore.cpp.
void GPop::StoreLock::lock | ( | const std::string & | user | ) |
Initialisation.
Precondition: !user.empty() && !locked() Postcondition: locked()
Definition at line 182 of file gpopstore.cpp.
bool GPop::StoreLock::locked | ( | ) | const |
Returns true if locked.
Definition at line 223 of file gpopstore.cpp.
GPop::StoreLock::Size GPop::StoreLock::messageCount | ( | ) | const |
Returns the store's message count.
Definition at line 231 of file gpopstore.cpp.
void GPop::StoreLock::remove | ( | int | id | ) |
Marks the message for removal.
Definition at line 318 of file gpopstore.cpp.
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.
GPop::StoreLock::Size GPop::StoreLock::totalByteCount | ( | ) | const |
Returns the store's total byte count.
Definition at line 237 of file gpopstore.cpp.
std::string GPop::StoreLock::uidl | ( | int | id | ) | const |
Returns a message's unique id.
Definition at line 376 of file gpopstore.cpp.
bool GPop::StoreLock::valid | ( | int | id | ) | const |
Validates a message number.
Definition at line 246 of file gpopstore.cpp.