#include <flint_lock.h>

Public Types | |
| enum | reason { SUCCESS, INUSE, UNSUPPORTED, FDLIMIT, UNKNOWN } |
Public Member Functions | |
| FlintLock (const std::string &filename_) | |
| operator bool () const | |
| ~FlintLock () | |
| reason | lock (bool exclusive, std::string &explanation) |
| Attempt to obtain the lock. | |
| void | release () |
| Release the lock. | |
| void | throw_databaselockerror (FlintLock::reason why, const std::string &db_dir, const std::string &explanation) |
| Throw Xapian::DatabaseLockError. | |
Private Attributes | |
| std::string | filename |
| int | fd |
| pid_t | pid |
Definition at line 37 of file flint_lock.h.
| enum FlintLock::reason |
| FlintLock::FlintLock | ( | const std::string & | filename_ | ) | [inline] |
| FlintLock::~FlintLock | ( | ) | [inline] |
| FlintLock::reason FlintLock::lock | ( | bool | exclusive, | |
| std::string & | explanation | |||
| ) |
Attempt to obtain the lock.
If the attempt fails with code "UNKNOWN", the string supplied in the explanation parameter will be set to contain any details available of the reason for the failure.
Definition at line 51 of file flint_lock.cc.
References Assert, Xapian::Internal::closefrom(), fd, FDLIMIT, filename, INUSE, Xapian::InMemory::open(), pid, rare, SUCCESS, UNKNOWN, and UNSUPPORTED.
Referenced by FlintDatabaseReplicator::apply_changeset_from_conn(), ChertDatabaseReplicator::apply_changeset_from_conn(), BrassDatabaseReplicator::apply_changeset_from_conn(), FlintDatabase::get_database_write_lock(), ChertDatabase::get_database_write_lock(), and BrassDatabase::get_database_write_lock().
| FlintLock::operator bool | ( | ) | const [inline] |
| void FlintLock::release | ( | ) |
Release the lock.
Definition at line 252 of file flint_lock.cc.
Referenced by FlintDatabase::close(), ChertDatabase::close(), BrassDatabase::close(), and ~FlintLock().
| void FlintLock::throw_databaselockerror | ( | FlintLock::reason | why, | |
| const std::string & | db_dir, | |||
| const std::string & | explanation | |||
| ) |
Throw Xapian::DatabaseLockError.
Definition at line 285 of file flint_lock.cc.
References FDLIMIT, INUSE, UNKNOWN, and UNSUPPORTED.
Referenced by FlintDatabaseReplicator::apply_changeset_from_conn(), ChertDatabaseReplicator::apply_changeset_from_conn(), BrassDatabaseReplicator::apply_changeset_from_conn(), FlintDatabase::get_database_write_lock(), ChertDatabase::get_database_write_lock(), and BrassDatabase::get_database_write_lock().
int FlintLock::fd [private] |
std::string FlintLock::filename [private] |
pid_t FlintLock::pid [private] |