RAII transactions
All checks were successful
Main LMDBAL workfow / Archlinux (push) Successful in 40s
All checks were successful
Main LMDBAL workfow / Archlinux (push) Successful in 40s
This commit is contained in:
parent
a9aa6b549f
commit
de741eda21
22 changed files with 689 additions and 222 deletions
13
src/base.h
13
src/base.h
|
@ -36,6 +36,8 @@
|
|||
namespace LMDBAL {
|
||||
|
||||
class iStorage;
|
||||
class Transaction;
|
||||
class WriteTransaction;
|
||||
|
||||
template<class T>
|
||||
class Serializer;
|
||||
|
@ -51,6 +53,8 @@ typedef uint32_t SizeType; /**<\brief All LMDBAL si
|
|||
|
||||
class Base {
|
||||
friend class iStorage;
|
||||
friend class Transaction;
|
||||
friend class WriteTransaction;
|
||||
public:
|
||||
|
||||
Base(const QString& name, uint16_t mapSize = 10);
|
||||
|
@ -62,12 +66,11 @@ public:
|
|||
bool removeDirectory();
|
||||
QString createDirectory();
|
||||
QString getName() const;
|
||||
QString getPath() const;
|
||||
void drop();
|
||||
|
||||
TransactionID beginReadOnlyTransaction() const;
|
||||
TransactionID beginTransaction() const;
|
||||
void commitTransaction(TransactionID id);
|
||||
void abortTransaction(TransactionID id) const;
|
||||
Transaction beginReadOnlyTransaction() const;
|
||||
WriteTransaction beginTransaction();
|
||||
|
||||
template <class K, class V>
|
||||
LMDBAL::Storage<K, V>* addStorage(const std::string& storageName, bool duplicates = false);
|
||||
|
@ -85,6 +88,8 @@ private:
|
|||
typedef std::map<std::string, LMDBAL::iStorage*> Storages; /**<\brief Storage and Cache pointers are saved in the std::map*/
|
||||
typedef std::set<TransactionID> Transactions; /**<\brief Piblic transaction IDs are saved in the std::set*/
|
||||
|
||||
void commitTransaction(TransactionID id);
|
||||
void abortTransaction(TransactionID id) const;
|
||||
TransactionID beginReadOnlyTransaction(const std::string& storageName) const;
|
||||
TransactionID beginTransaction(const std::string& storageName) const;
|
||||
void commitTransaction(TransactionID id, const std::string& storageName);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue