tests, set method, tests for set method
All checks were successful
Main LMDBAL workfow / Archlinux (push) Successful in 46s

This commit is contained in:
Blue 2023-11-01 19:45:42 -03:00
parent 96d7d9ef64
commit 3307860ca6
Signed by: blue
GPG key ID: 9B203B252A63EE38
7 changed files with 316 additions and 15 deletions

View file

@ -1022,6 +1022,9 @@ void LMDBAL::Storage<K, V>::close() {
/**
* \brief Creates cursor
*
* This is a legitimate way to aquire cursor to a storage.
* Aquired cursor is RAII safe, automatic destructor will free everything it occupied.
*
* \returns LMDBAL::Cursor for this storage and returs you a pointer to a created cursor
*/
template<class K, class V>
@ -1029,6 +1032,29 @@ LMDBAL::Cursor<K, V> LMDBAL::Storage<K, V>::createCursor() {
return Cursor<K, V>(this);
}
/**
* \brief Frees cursor
*
* This is a legitimate way to free cursor.
* You don't actually need to do it manually,
* you can just reassign cursor, let it be destroyed by leaving the scope
* or call LMDBAL::Cursor<K, V>::drop, but you may if you wish.
*
* \param[in] cursor cursor you wish to destroy
*
* \exception LMDBAL::Unknown thrown if you try to destroy a cursor this storage didn't create
*/
template<class K, class V>
void LMDBAL::Storage<K, V>::destroyCursor(LMDBAL::Cursor<K, V>& cursor) {
typename std::map<uint32_t, Cursor<K, V>*>::iterator itr = cursors.find(cursor.id);
if (itr == cursors.end())
throwUnknown("An attempt to destroy a cursor the storage doesn't own");
cursor.close();
cursors.erase(itr);
cursor.freed();
}
/**
* \brief Reads current storage flags it was opened with
*