mostly documentation mostly for Cursor, some corner cases testing

This commit is contained in:
Blue 2023-08-10 20:07:12 -03:00
parent 8cb1e97e30
commit 8ff5672655
Signed by: blue
GPG key ID: 9B203B252A63EE38
6 changed files with 368 additions and 22 deletions

View file

@ -667,7 +667,7 @@ void LMDBAL::Storage<K, V>::removeRecord(const K& key) {
* This function schedules a record removal, but doesn't immidiately execute it.
* You can obtain LMDBAL::TransactionID calling LMDBAL::Base::beginTransaction().
*
* \param[in] key key of the record you wish to be removed
* \param[in] key key of the record you wish to be removed
* \param[in] txn transaction ID, needs to be a writable transaction!
*
* \exception LMDBAL::Closed thrown if the database was not opened
@ -706,6 +706,11 @@ void LMDBAL::Storage<K, V>::close() {
iStorage::close();
}
/**
* \brief Creates cursor
*
* \returns LMDBAL::Cursor for this storage and returs you a pointer to a created cursor
*/
template<class K, class V>
LMDBAL::Cursor<K, V>* LMDBAL::Storage<K, V>::createCursor() {
Cursor<K, V>* cursor = new Cursor<K, V>(this);
@ -714,18 +719,44 @@ LMDBAL::Cursor<K, V>* LMDBAL::Storage<K, V>::createCursor() {
return cursor;
}
/**
* \brief Destroys cursor
*
* This a normal way to discard a cursor you don't need anymore
*
* \param[in] cursor a pointer to a cursor you want to destroy
*
* \throws LMDBAL::Unknown thrown if you try to destroy something that this storage didn't create
*/
template<class K, class V>
void LMDBAL::Storage<K, V>::destroyCursor(Cursor<K, V>* cursor) {
cursors.erase(cursor);
typename std::set<Cursor<K, V>*>::const_iterator itr = cursors.find(cursor);
if (itr == cursors.end())
throwUnknown("An attempt to destroy a cursor the storage doesn't own");
cursors.erase(itr);
delete cursor;
}
/**
* \brief A private virtual function that cursor calls when he reads a record, does nothing here but populates the LMDBAL::Cache
*
* \param[in] key a key of discovered record
* \param[in] value a value of discovered record
*/
template<class K, class V>
void LMDBAL::Storage<K, V>::discoveredRecord(const K& key, const V& value) const {
UNUSED(key);
UNUSED(value);
}
/**
* \brief A private virtual function that cursor calls when he reads a record, does nothing here but populates the LMDBAL::Cache
*
* \param[in] key a key of discovered record
* \param[in] value a value of discovered record
* \param[in] txn TransactionID under which the dicovery happened, to avoid not commited changes collisions
*/
template<class K, class V>
void LMDBAL::Storage<K, V>::discoveredRecord(const K& key, const V& value, TransactionID txn) const {
UNUSED(key);