some transaction methods for cache, some more tests for transactions
This commit is contained in:
parent
150a0b0da9
commit
f99d5559cd
6 changed files with 571 additions and 15 deletions
|
@ -40,7 +40,7 @@ void LMDBAL::Storage<K, V>::addRecord(const K& key, const V& value) {
|
|||
ensureOpened(addRecordMethodName);
|
||||
TransactionID txn = beginTransaction();
|
||||
try {
|
||||
addRecord(key, value, txn);
|
||||
Storage<K, V>::addRecord(key, value, txn);
|
||||
} catch (...) {
|
||||
abortTransaction(txn);
|
||||
throw;
|
||||
|
@ -68,7 +68,7 @@ bool LMDBAL::Storage<K, V>::forceRecord(const K& key, const V& value) {
|
|||
TransactionID txn = beginTransaction();
|
||||
bool added;
|
||||
try {
|
||||
added = forceRecord(key, value, txn);
|
||||
added = Storage<K, V>::forceRecord(key, value, txn);
|
||||
} catch (...) {
|
||||
abortTransaction(txn);
|
||||
throw;
|
||||
|
@ -113,7 +113,7 @@ void LMDBAL::Storage<K, V>::changeRecord(const K& key, const V& value) {
|
|||
|
||||
TransactionID txn = beginTransaction();
|
||||
try {
|
||||
changeRecord(key, value, txn);
|
||||
Storage<K, V>::changeRecord(key, value, txn);
|
||||
} catch (...) {
|
||||
abortTransaction(txn);
|
||||
throw;
|
||||
|
@ -139,7 +139,7 @@ V LMDBAL::Storage<K, V>::getRecord(const K& key) const {
|
|||
ensureOpened(getRecordMethodName);
|
||||
|
||||
V value;
|
||||
getRecord(key, value);
|
||||
Storage<K, V>::getRecord(key, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ void LMDBAL::Storage<K, V>::getRecord(const K& key, V& value) const {
|
|||
|
||||
TransactionID txn = beginReadOnlyTransaction();
|
||||
try {
|
||||
getRecord(key, value, txn);
|
||||
Storage<K, V>::getRecord(key, value, txn);
|
||||
} catch (...) {
|
||||
abortTransaction(txn);
|
||||
throw;
|
||||
|
@ -163,7 +163,7 @@ V LMDBAL::Storage<K, V>::getRecord(const K& key, TransactionID txn) const {
|
|||
ensureOpened(getRecordMethodName);
|
||||
|
||||
V value;
|
||||
getRecord(key, value, txn);
|
||||
Storage<K, V>::getRecord(key, value, txn);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ bool LMDBAL::Storage<K, V>::checkRecord(const K& key) const {
|
|||
TransactionID txn = beginReadOnlyTransaction();
|
||||
bool result;
|
||||
try {
|
||||
result = checkRecord(key, txn);
|
||||
result = Storage<K, V>::checkRecord(key, txn);
|
||||
} catch (...) {
|
||||
abortTransaction(txn);
|
||||
throw;
|
||||
|
@ -220,7 +220,7 @@ std::map<K, V> LMDBAL::Storage<K, V>::readAll() const {
|
|||
ensureOpened(readAllMethodName);
|
||||
|
||||
std::map<K, V> result;
|
||||
readAll(result);
|
||||
Storage<K, V>::readAll(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ void LMDBAL::Storage<K, V>::readAll(std::map<K, V>& result) const {
|
|||
|
||||
TransactionID txn = beginReadOnlyTransaction();
|
||||
try {
|
||||
readAll(result, txn);
|
||||
Storage<K, V>::readAll(result, txn);
|
||||
} catch (...) {
|
||||
abortTransaction(txn);
|
||||
throw;
|
||||
|
@ -244,7 +244,7 @@ std::map<K, V> LMDBAL::Storage<K, V>::readAll(TransactionID txn) const {
|
|||
ensureOpened(readAllMethodName);
|
||||
|
||||
std::map<K, V> result;
|
||||
readAll(result, txn);
|
||||
Storage<K, V>::readAll(result, txn);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ void LMDBAL::Storage<K, V>::replaceAll(const std::map<K, V>& data) {
|
|||
|
||||
TransactionID txn = beginTransaction();
|
||||
try {
|
||||
replaceAll(data, txn);
|
||||
Storage<K, V>::replaceAll(data, txn);
|
||||
} catch (...) {
|
||||
abortTransaction(txn);
|
||||
throw;
|
||||
|
@ -313,7 +313,7 @@ uint32_t LMDBAL::Storage<K, V>::addRecords(const std::map<K, V>& data, bool over
|
|||
TransactionID txn = beginTransaction();
|
||||
uint32_t amount;
|
||||
try {
|
||||
amount = addRecords(data, txn, overwrite);
|
||||
amount = Storage<K, V>::addRecords(data, txn, overwrite);
|
||||
} catch (...) {
|
||||
abortTransaction(txn);
|
||||
throw;
|
||||
|
@ -352,7 +352,7 @@ void LMDBAL::Storage<K, V>::removeRecord(const K& key) {
|
|||
|
||||
TransactionID txn = beginTransaction();
|
||||
try {
|
||||
removeRecord(key, txn);
|
||||
Storage<K, V>::removeRecord(key, txn);
|
||||
} catch (...) {
|
||||
abortTransaction(txn);
|
||||
throw;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue