37 class StoreLockEntry ;
48 G_EXCEPTION( InvalidDirectory ,
"invalid spool directory" ) ;
50 Store(
G::Path spool_dir ,
bool by_name ,
bool allow_delete ) ;
65 void operator=(
const Store & ) ;
66 static void checkPath(
G::Path ,
bool ,
bool ) ;
67 static bool valid(
G::Path ,
bool ) ;
83 typedef unsigned long Size ;
86 StoreLockEntry(
int id_ , Size size_ ,
const std::string & uidl_ ) :
101 G_EXCEPTION( CannotDelete ,
"cannot delete message file" ) ;
102 G_EXCEPTION( CannotRead ,
"cannot read message file" ) ;
103 typedef StoreLockEntry::Size Size ;
105 typedef std::list<Entry> List ;
106 typedef void (*Fn)(std::ostream&,
const std::string&) ;
113 void lock(
const std::string & user ) ;
134 std::string
uidl(
int id )
const ;
137 bool valid(
int id )
const ;
140 List
list(
int id = -1 )
const ;
143 unique_ptr<std::istream>
get(
int id )
const ;
163 StoreLockEntry::Size size ;
164 explicit File(
const G::Path & ) ;
165 File(
const std::string & name_ ,
const std::string & size_string ) ;
166 bool operator<(
const File & )
const ;
167 static StoreLockEntry::Size toSize(
const std::string & s ) ;
169 typedef std::set<File> Set ;
173 void operator=(
const StoreLock & ) ;
174 Set::iterator find(
const std::string & ) ;
175 Set::const_iterator find(
int id )
const ;
176 Set::iterator find(
int id ) ;
177 void doCommit(
Store & )
const ;
179 G::Path path(
const std::string & ,
bool fallback )
const ;
180 std::string envelopeName(
const std::string & )
const ;
181 std::string contentName(
const std::string & )
const ;
182 G::Path contentPath(
const std::string & )
const ;
183 G::Path contentPath(
const File & )
const ;
184 G::Path envelopePath(
const File & )
const ;
185 void deleteFile(
const G::Path & ,
bool & )
const ;
186 bool unlinked(
Store & ,
const File & )
const ;
G::Path dir() const
Returns the spool directory path.
void rollback()
Rolls back remove()als but retains the lock.
bool locked() const
Returns true if locked.
Store(G::Path spool_dir, bool by_name, bool allow_delete)
Constructor.
Size messageCount() const
Returns the store's message count.
Represents a file in the GPop::Store.
bool allowDelete() const
Returns true if files can be deleted.
Size totalByteCount() const
Returns the store's total byte count.
Represents an exclusive lock on the message store.
void lock(const std::string &user)
Initialisation.
Size byteCount(int id) const
Returns a message size.
void commit()
Commits remove()als.
bool byName() const
Returns true if the spool directory is affected by the user name.
bool valid(int id) const
Validates a message number.
StoreLock(Store &store)
Constructor.
A Path object represents a file system path.
List list(int id=-1) const
Lists messages in the store.
std::string uidl(int id) const
Returns a message's unique id.