Fix typos, fix some warnings, added more compile options, moved to forgejo CI
This commit is contained in:
parent
3ae1fd15c0
commit
1585b8e4f5
15 changed files with 204 additions and 120 deletions
23
src/base.cpp
23
src/base.cpp
|
@ -28,13 +28,13 @@
|
|||
* \brief Database abstraction
|
||||
*
|
||||
* This is a basic class that represents the database as a collection of storages.
|
||||
* Storages is something key-value database has instead of tables in classic SQL databases.
|
||||
* Storages are something that key-value databases have instead of tables in classic SQL databases.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Creates the database
|
||||
*
|
||||
* \param[in] _name - name of the database, it is going to affect folder name that is created to store data
|
||||
* \param[in] _name - name of the database, it is going to affect the folder name that is created to store data
|
||||
* \param[in] _mapSize - LMDB map size (MiB), multiplied by 1024^2 and passed to <a class="el" href="http://www.lmdb.tech/doc/group__mdb.html#gaa2506ec8dab3d969b0e609cd82e619e5">mdb_env_set_mapsize</a> during the call of LMDBAL::Base::open()
|
||||
*/
|
||||
LMDBAL::Base::Base(const QString& _name, uint16_t _mapSize):
|
||||
|
@ -60,13 +60,13 @@ LMDBAL::Base::~Base() {
|
|||
* \brief Closes the database
|
||||
*
|
||||
* Closes all lmdb handles, aborts all public transactions.
|
||||
* This function will do nothing on closed database
|
||||
* This function will do nothing on a closed database
|
||||
*
|
||||
* \exception LMDBAL::Unknown - thrown if something went wrong aborting transactions
|
||||
*/
|
||||
void LMDBAL::Base::close() {
|
||||
if (opened) {
|
||||
for (const std::pair<LMDBAL::TransactionID, LMDBAL::Transaction*> pair : transactions) {
|
||||
for (const std::pair<TransactionID, Transaction*> pair : transactions) {
|
||||
abortTransaction(pair.first, emptyName);
|
||||
pair.second->reset();
|
||||
}
|
||||
|
@ -84,8 +84,8 @@ void LMDBAL::Base::close() {
|
|||
* \brief Opens the database
|
||||
*
|
||||
* Almost every LMDBAL::Base require it to be opened, this function does it.
|
||||
* It laso creates the directory for the database if it was an initial launch.
|
||||
* This function will do nothing on opened database
|
||||
* It also creates the directory for the database if it was an initial launch.
|
||||
* This function will do nothing on an opened database
|
||||
*
|
||||
* \exception LMDBAL::Unknown - thrown if something went wrong opening storages and caches
|
||||
*/
|
||||
|
@ -94,15 +94,14 @@ void LMDBAL::Base::open() {
|
|||
mdb_env_create(&environment);
|
||||
QString path = createDirectory();
|
||||
|
||||
mdb_env_set_maxdbs(environment, storages.size());
|
||||
mdb_env_set_maxdbs(environment, static_cast<MDB_dbi>(storages.size()));
|
||||
mdb_env_set_mapsize(environment, size * 1024UL * 1024UL);
|
||||
mdb_env_open(environment, path.toStdString().c_str(), 0, 0664);
|
||||
|
||||
TransactionID txn = beginPrivateTransaction(emptyName);
|
||||
for (const std::pair<const std::string, StorageCommon*>& pair : storages) {
|
||||
StorageCommon* storage = pair.second;
|
||||
int rc = storage->open(txn);
|
||||
if (rc)
|
||||
if (const int rc = storage->open(txn))
|
||||
throw Unknown(name, mdb_strerror(rc));
|
||||
}
|
||||
commitPrivateTransaction(txn, emptyName);
|
||||
|
@ -113,9 +112,9 @@ void LMDBAL::Base::open() {
|
|||
/**
|
||||
* \brief Removes database directory
|
||||
*
|
||||
* \returns true if removal was successfull of if no directory was created where it's expected to be, false otherwise
|
||||
* \returns true if removal was successful of if no directory was created where it's expected to be, false otherwise
|
||||
*
|
||||
* \exception LMDBAL::Opened - thrown if this function was called on opened database
|
||||
* \exception LMDBAL::Opened - thrown if this function was called on an opened database
|
||||
*/
|
||||
bool LMDBAL::Base::removeDirectory() {
|
||||
if (opened)
|
||||
|
@ -141,7 +140,7 @@ bool LMDBAL::Base::removeDirectory() {
|
|||
*
|
||||
* \returns the path of the created directory
|
||||
*
|
||||
* \exception LMDBAL::Opened - thrown if called on opened database
|
||||
* \exception LMDBAL::Opened - thrown if called on an opened database
|
||||
* \exception LMDBAL::Directory - if the database couldn't create the folder
|
||||
*/
|
||||
QString LMDBAL::Base::createDirectory() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue