LMDBAL 0.5.4
LMDB (Lightning Memory-Mapped Database Manager) Abstraction Layer
|
Storage with additional caching in std::map. More...
#include <cache.hpp>
Public Member Functions | |
virtual int | drop (const WriteTransaction &transaction) override |
Drops content of a storage interface (public transaction variant) | |
virtual void | addRecord (const K &key, const V &value) override |
Adds a key-value record to the storage. | |
virtual bool | forceRecord (const K &key, const V &value) override |
Adds a key-value record to the storage, overwrites if it already exists. | |
virtual void | changeRecord (const K &key, const V &value) override |
Changes key-value record to the storage. | |
virtual void | removeRecord (const K &key) override |
Removes one of the records. | |
virtual bool | checkRecord (const K &key) const override |
Chechs if storage has value. | |
virtual void | getRecord (const K &key, V &out) const override |
Gets the record from the database (reference variant) | |
virtual V | getRecord (const K &key) const override |
Gets the record from the database. | |
virtual SizeType | count () const override |
Storage size. | |
virtual std::map< K, V > | readAll () const override |
Reads whole storage into a map. | |
virtual void | readAll (std::map< K, V > &out) const override |
Reads whole storage into a map (reference variant) | |
virtual void | replaceAll (const std::map< K, V > &data) override |
Replaces the content of the whole storage with the given. | |
virtual SizeType | addRecords (const std::map< K, V > &data, bool overwrite=false) override |
Adds records in bulk. | |
Public Member Functions inherited from LMDBAL::Storage< K, V > | |
virtual void | addRecord (const K &key, const V &value, const WriteTransaction &txn) |
Adds a key-value record to the storage (public transaction variant) | |
virtual bool | forceRecord (const K &key, const V &value, const WriteTransaction &txn) |
Adds a key-value record to the storage, overwrites if it already exists (public transaction variant) | |
virtual void | changeRecord (const K &key, const V &value, const WriteTransaction &txn) |
Changes key-value record to the storage (public transaction variant) | |
virtual void | removeRecord (const K &key, const WriteTransaction &txn) |
Removes one of the records (transaction variant) | |
virtual bool | checkRecord (const K &key, const Transaction &txn) const |
Chechs if storage has value (public transaction variant) | |
virtual void | getRecord (const K &key, V &value, const Transaction &txn) const |
Gets the record from the database (public transaction, reference variant) | |
virtual V | getRecord (const K &key, const Transaction &txn) const |
Gets the record from the database (public transaction variant) | |
virtual std::map< K, V > | readAll (const Transaction &txn) const |
Reads whole storage into a map (public transaction variant) | |
virtual void | readAll (std::map< K, V > &result, const Transaction &txn) const |
Reads whole storage into a map (public transaction, reference variant) | |
virtual void | replaceAll (const std::map< K, V > &data, const WriteTransaction &txn) |
Replaces the content of the whole storage with the given (public transaction variant) | |
virtual uint32_t | addRecords (const std::map< K, V > &data, const WriteTransaction &txn, bool overwrite=false) |
Adds records in bulk (public transaction variant) | |
Cursor< K, V > | createCursor () |
Creates cursor. | |
void | destroyCursor (Cursor< K, V > &cursor) |
Frees cursor. | |
virtual int | drop (TransactionID transaction) |
Drops content of a storage interface (transaction variant) | |
virtual void | drop () |
Drops content of a storage interface. | |
virtual int | drop (const WriteTransaction &txn) |
Drops content of a storage interface (public transaction variant) | |
Public Member Functions inherited from LMDBAL::iStorage | |
virtual SizeType | count (const Transaction &txn) const |
Storage size (public transaction variant) | |
template<> | |
std::string | toString (const QString &value) |
A method to cast a value (which can be a value or a key) to string. | |
template<> | |
std::string | toString (const std::string &value) |
A method to cast a value (which can be a value or a key) to string. | |
Protected Member Functions | |
Cache (Base *parent, const std::string &name, bool duplicates=false) | |
Creates a cache. | |
~Cache () override | |
Destroys a cache. | |
virtual void | handleDrop () override |
A method where database additionally handles drop. | |
virtual void | transactionStarted (TransactionID txn, bool readOnly) const override |
called on beginning of public transaction | |
virtual void | transactionCommited (TransactionID txn) override |
called on commitment of public transaction | |
virtual void | transactionAborted (TransactionID txn) const override |
called on abortion of public transaction | |
virtual void | discoveredRecord (const K &key, const V &value) const override |
A private virtual method that cursor calls when he reads a record, does nothing here but populates the LMDBAL::Cache. | |
virtual void | discoveredRecord (const K &key, const V &value, TransactionID txn) const override |
A private virtual method that cursor calls when he reads a record, does nothing here but populates the LMDBAL::Cache. | |
virtual SizeType | count (TransactionID txn) const override |
Storage size (private transaction variant) | |
virtual void | addRecord (const K &key, const V &value, TransactionID txn) override |
Adds a key-value record to the storage (private transaction variant) | |
virtual bool | forceRecord (const K &key, const V &value, TransactionID txn) override |
Adds a key-value record to the storage, overwrites if it already exists (private transaction variant) | |
virtual void | changeRecord (const K &key, const V &value, TransactionID txn) override |
Changes key-value record to the storage (private transaction variant) | |
virtual void | removeRecord (const K &key, TransactionID txn) override |
Removes one of the records (private transaction variant) | |
virtual bool | checkRecord (const K &key, TransactionID txn) const override |
Chechs if storage has value (private transaction variant) | |
virtual void | getRecord (const K &key, V &out, TransactionID txn) const override |
Gets the record from the database (private transaction, reference variant) | |
virtual V | getRecord (const K &key, TransactionID txn) const override |
Gets the record from the database (private transaction variant) | |
virtual std::map< K, V > | readAll (TransactionID txn) const override |
Reads whole storage into a map (private transaction variant) | |
virtual void | readAll (std::map< K, V > &out, TransactionID txn) const override |
Reads whole storage into a map (private transaction, reference variant) | |
virtual void | replaceAll (const std::map< K, V > &data, TransactionID txn) override |
Replaces the content of the whole storage with the given (private transaction variant) | |
virtual SizeType | addRecords (const std::map< K, V > &data, TransactionID txn, bool overwrite=false) override |
Adds records in bulk (private transaction variant) | |
Protected Member Functions inherited from LMDBAL::Storage< K, V > | |
Storage (Base *parent, const std::string &name, bool duplicates=false) | |
Creates a storage. | |
~Storage () override | |
Destroys a storage. | |
uint32_t | flags () const |
Reads current storage flags it was opened with. | |
int | open (MDB_txn *transaction) override |
A private virtual method I need to open each storage in the database. | |
void | close () override |
A private virtual method I need to close each storage in the database. | |
Protected Member Functions inherited from LMDBAL::iStorage | |
iStorage (Base *parent, const std::string &name, bool duplicates=false) | |
Constructs a storage interface. | |
virtual | ~iStorage () |
Destroys a storage interface. | |
bool | isDBOpened () const |
Is database opened. | |
const std::string & | dbName () const |
Database name. | |
void | ensureOpened (const std::string &methodName) const |
Helper function, thows exception if the database is not opened. | |
void | throwDuplicateOrUnknown (int rc, const std::string &key) const |
Throws LMDBAL::Exist or LMDBAL::Unknown. | |
void | throwDuplicateOrUnknown (int rc, TransactionID txn, const std::string &key) const |
Throws LMDBAL::Exist or LMDBAL::Unknown (transaction vairiant) | |
void | throwNotFoundOrUnknown (int rc, const std::string &key) const |
Throws LMDBAL::NotFound or LMDBAL::Unknown (transaction variant) | |
void | throwNotFoundOrUnknown (int rc, TransactionID txn, const std::string &key) const |
Throws LMDBAL::NotFound or LMDBAL::Unknown (transaction vairiant) | |
void | throwUnknown (int rc, TransactionID txn) const |
Throws LMDBAL::Unknown (transaction vairiant) | |
void | throwUnknown (int rc) const |
Throws LMDBAL::Unknown. | |
void | throwUnknown (const std::string &message) const |
Throws LMDBAL::Unknown. | |
void | throwDuplicate (const std::string &key) const |
Throws LMDBAL::Exist. | |
void | throwNotFound (const std::string &key) const |
Throws LMDBAL::NotFound. | |
void | throwCursorNotReady (const std::string &method) const |
Throws LMDBAL::CursorNotReady. | |
TransactionID | extractTransactionId (const Transaction &txn, const std::string &action="") const |
Checks if the transaction is still active, returns inner TransactionID. | |
TransactionID | beginReadOnlyTransaction () const |
Begins read-only transaction. | |
TransactionID | beginTransaction () const |
Begins writable transaction. | |
void | commitTransaction (TransactionID id) |
Commits transaction. | |
void | abortTransaction (TransactionID id) const |
Aborts transaction. | |
int | _mdbOpen (MDB_txn *txn, unsigned int flags=0) |
int | _mdbPut (MDB_txn *txn, MDB_val &key, MDB_val &data, unsigned int flags=0) |
int | _mdbGet (MDB_txn *txn, MDB_val &key, MDB_val &data) const |
int | _mdbDel (MDB_txn *txn, MDB_val &key) |
int | _mdbDel (MDB_txn *txn, MDB_val &key, MDB_val &data) |
int | _mdbStat (MDB_txn *txn, MDB_stat &stat) const |
int | _mdbFlags (MDB_txn *txn, uint32_t &flags) const |
int | _mdbCursorOpen (MDB_txn *txn, MDB_cursor **cursor) const |
void | _mdbCursorClose (MDB_cursor *cursor) const |
int | _mdbCursorGet (MDB_cursor *cursor, MDB_val &key, MDB_val &data, MDB_cursor_op operation) const |
int | _mdbCursorSet (MDB_cursor *cursor, MDB_val &key) const |
int | _mdbCursorDel (MDB_cursor *cursor, unsigned int flags=0) |
int | _mdbCursorPut (MDB_cursor *cursor, MDB_val &key, MDB_val &data, unsigned int flags=0) |
int | _mdbCursorRenew (MDB_txn *txn, MDB_cursor *cursor) const |
MDB_txn * | _mdbCursorTxn (MDB_cursor *cursor) const |
template<class K , class V > | |
int | makeStorage (MDB_txn *transaction, bool duplicates=false) |
A functiion to actually open MDB_dbi storage. | |
Protected Attributes | |
Mode | mode |
Cache mode. | |
std::map< K, V > * | cache |
Cached data. | |
std::set< K > * | abscent |
Set of keys that are definitely not in the cache. | |
SizeType | sizeDifference |
Difference of size between cached data and amount of records in the lmdb storage. | |
TransactionCache * | transactionCache |
All changes made under under uncommited transactions. | |
Protected Attributes inherited from LMDBAL::Storage< K, V > | |
Serializer< K > | keySerializer |
internal object that would serialize and deserialize keys | |
Serializer< V > | valueSerializer |
internal object that would serialize and deserialize values | |
std::map< uint32_t, Cursor< K, V > * > | cursors |
a set of cursors that has been created under this storage | |
Protected Attributes inherited from LMDBAL::iStorage | |
MDB_dbi | dbi |
lmdb storage handle | |
Base * | db |
parent database pointer (borrowed) | |
const std::string | name |
this storage name | |
const bool | duplicates |
true if storage supports duplicates | |
Friends | |
class | Base |
Additional Inherited Members | |
Static Protected Member Functions inherited from LMDBAL::iStorage | |
template<class T > | |
static std::string | toString (const T &value) |
A method to cast a value (which can be a value or a key) to string. | |
Static Protected Attributes inherited from LMDBAL::iStorage | |
static const std::string | dropMethodName = "drop" |
member function name, just for exceptions | |
static const std::string | countMethodName = "count" |
member function name, just for exceptions | |
static const std::string | flagsMethodName = "flags" |
member function name, just for exceptions | |
static const std::string | addRecordMethodName = "addRecord" |
member function name, just for exceptions | |
static const std::string | forceRecordMethodName = "forceRecord" |
member function name, just for exceptions | |
static const std::string | changeRecordMethodName = "changeRecord" |
member function name, just for exceptions | |
static const std::string | removeRecordMethodName = "removeRecord" |
member function name, just for exceptions | |
static const std::string | checkRecordMethodName = "checkRecord" |
member function name, just for exceptions | |
static const std::string | getRecordMethodName = "getRecord" |
member function name, just for exceptions | |
static const std::string | readAllMethodName = "readAllRecord" |
member function name, just for exceptions | |
static const std::string | replaceAllMethodName = "replaceAll" |
member function name, just for exceptions | |
static const std::string | addRecordsMethodName = "addRecords" |
member function name, just for exceptions | |
Storage with additional caching in std::map.
K | type of the keys of the cache |
V | type of the values of the cache |
You can receive an instance of this class calling LMDBAL::Base::addCache(const std::string&) if the database is yet closed and you're defining the storages you're going to need. Or you can call LMDBAL::Base::getCache(const std::string&) if you didn't save a pointer to the cache at first
You are not supposed to instantiate or destory instances of this class yourself!
|
protected |
Creates a cache.
[in] | parent | - LMDBAL::Base pointer for the owning database (borrowed) |
[in] | name | - the name of the storage |
[in] | duplicates | - true if key duplicates are allowed (false by default) |
|
overridevirtual |
Adds a key-value record to the storage.
Take a note that if the storage already had a record you want to add LMDBAL::Exist is thrown. If your storage doesn't support duplicates LMDBAL::Exist is thrown if the record with the same key already exists in the database. If your storage supports duplicates LMDBAL::Exist is thrown only if the record with the same key AND already exists in the database.
[in] | key | key of the record |
[in] | value | value of the record |
LMDBAL::Exist | thrown if the storage already has a record with the given key |
LMDBAL::Closed | thrown if the database was not opened |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overrideprotectedvirtual |
Adds a key-value record to the storage (private transaction variant)
Take a note that if the storage already had a record you want to add LMDBAL::Exist is thrown. If your storage doesn't support duplicates LMDBAL::Exist is thrown if the record with the same key already exists in the database. If your storage supports duplicates LMDBAL::Exist is thrown only if the record with the same key AND already exists in the database.
[in] | key | key of the record |
[in] | value | value of the record |
[in] | txn | transaction ID, needs to be a writable transaction! |
LMDBAL::Exist | thrown if the storage already has a record with the given key |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overridevirtual |
Adds records in bulk.
[in] | data | the data to be added |
[in] | overwrite | if false method throws LMDBAL::Exist on repeated key, if true - overwrites it |
LMDBAL::Closed | thrown if the database was not opened |
LMDBAL::Exist | thrown if overwrite==false and at least one of the keys of data already exists in the storage |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overrideprotectedvirtual |
Adds records in bulk (private transaction variant)
This method schedules a data addition, but doesn't immidiately execute it.
[in] | data | the data to be added |
[in] | txn | transaction ID, needs to be a writable transaction! |
[in] | overwrite | if false method throws LMDBAL::Exist on repeated key, if true - overwrites it |
LMDBAL::Exist | thrown if overwrite==false and at least one of the keys of data already exists in the storage |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overridevirtual |
Changes key-value record to the storage.
Take a note that if the storage didn't have a record you want to change LMDBAL::NotFound is thrown
If duplicates mode is enabled this function will find the first entry of the key (which is pretty couterintuitive, see LMDBAL::Storage::getRecord() description) and change it's value to the given one. If the given value matches some of the other values for given key the method will throw LMDBAL::Exist, if no key was found it will still throw LMDBAL::NotFound.
[in] | key | key of the record |
[in] | value | new value of the record |
LMDBAL::NotFound | thrown if the storage doesn't have a record with the given key |
LMDBAL::Exist | thrown in duplicates mode when the given value matches some of existing values for the given key |
LMDBAL::Closed | thrown if the database was not opened |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overrideprotectedvirtual |
Changes key-value record to the storage (private transaction variant)
This method schedules a modification of a key-value record, but doesn't immidiately changes it. Take a note that if the storage didn't have a record you want to change LMDBAL::NotFound is thrown
If duplicates mode is enabled this function will find the first entry of the key (which is pretty couterintuitive, see LMDBAL::Storage::getRecord() description) and change it's value to the given one. If the given value matches some of the other values for given key the method will throw LMDBAL::Exist, if no key was found it will still throw LMDBAL::NotFound.
[in] | key | key of the record |
[in] | value | new value of the record |
[in] | txn | transaction ID, needs to be a writable transaction! |
LMDBAL::NotFound | thrown if the storage doesn't have a record with the given key |
LMDBAL::Exist | thrown in duplicates mode when the given value matches some of existing values for the given key |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overridevirtual |
Chechs if storage has value.
[in] | key | key of the record you look for |
LMDBAL::Closed | thrown if the database was not opened |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overrideprotectedvirtual |
Chechs if storage has value (private transaction variant)
[in] | key | key of the record you look for |
[in] | txn | transaction ID, can be read only transaction |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overridevirtual |
Storage size.
LMDBAL::Closed | thrown if the database was closed |
LMDBAL::Unknown | thrown if something unexpected happened |
Reimplemented from LMDBAL::iStorage.
|
overrideprotectedvirtual |
Storage size (private transaction variant)
[in] | txn | - transaction ID, can be read-only transaction |
LMDBAL::Unknown | thrown if something unexpected happened |
Reimplemented from LMDBAL::iStorage.
|
overrideprotectedvirtual |
A private virtual method that cursor calls when he reads a record, does nothing here but populates the LMDBAL::Cache.
[in] | key | a key of discovered record |
[in] | value | a value of discovered record |
Reimplemented from LMDBAL::Storage< K, V >.
|
overrideprotectedvirtual |
A private virtual method that cursor calls when he reads a record, does nothing here but populates the LMDBAL::Cache.
[in] | key | a key of discovered record |
[in] | value | a value of discovered record |
[in] | txn | TransactionID under which the dicovery happened, to avoid not commited changes collisions |
Reimplemented from LMDBAL::Storage< K, V >.
|
overridevirtual |
Drops content of a storage interface (public transaction variant)
Just performs content drop
[in] | txn | - transaction ID, must be writable transaction! |
LMDBAL::TransactionTerminated | thrown if the transaction was not active |
Reimplemented from LMDBAL::iStorage.
|
overridevirtual |
Adds a key-value record to the storage, overwrites if it already exists.
This method is mostly useless in duplicates mode. In this mode it basically does the same thing LMDBAL::Storage::addRecord() does, but suppresses LMDBAL::Exist exception if the record with the same key-value pair existed in the storage. In this case just false is returned from the method.
[in] | key | key of the record |
[in] | value | value of the record |
LMDBAL::Closed | thrown if the database was not opened |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overrideprotectedvirtual |
Adds a key-value record to the storage, overwrites if it already exists (private transaction variant)
This method schedules an addition of a key-value record, but doesn't immidiately add it.
This method is mostly useless in duplicates mode. In this mode it basically does the same thing LMDBAL::Storage::addRecord() does, but suppresses LMDBAL::Exist exception if the record with the same key-value pair existed in the storage. In this case just false is returned from the method.
[in] | key | key of the record |
[in] | value | value of the record |
[in] | txn | transaction ID, needs to be a writable transaction! |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overridevirtual |
Gets the record from the database.
Take a note that if the storage didn't have a record you want to get LMDBAL::NotFound is thrown
If the storage supports duplicates the exact value returned from it depends on comparison function of lmdb. It's not very straight forward, so, you shouldn't really use this method if you use duplicates and you rely on exact result. Anyway:
[in] | key | key of the record you look for |
LMDBAL::NotFound | thrown if the storage doesn't have a record with the given key |
LMDBAL::Closed | thrown if the database was not opened |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overrideprotectedvirtual |
Gets the record from the database (private transaction variant)
Take a note that if the storage didn't have a record you want to get LMDBAL::NotFound is thrown
If the storage supports duplicates the exact value returned from it depends on comparison function of lmdb. It's not very straight forward, so, you shouldn't really use this method if you use duplicates and you rely on exact result. Anyway:
[in] | key | key of the record you look for |
[in] | txn | transaction ID, can be read only transaction |
LMDBAL::NotFound | thrown if the storage doesn't have a record with the given key |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overridevirtual |
Gets the record from the database (reference variant)
Take a note that if the storage didn't have a record you want to get LMDBAL::NotFound is thrown
If the storage supports duplicates the exact value returned from it depends on comparison function of lmdb. It's not very straight forward, so, you shouldn't really use this method if you use duplicates and you rely on exact result. Anyway:
[in] | key | key of the record you look for |
[out] | value | the value from the storage |
LMDBAL::NotFound | thrown if the storage doesn't have a record with the given key |
LMDBAL::Closed | thrown if the database was not opened |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overrideprotectedvirtual |
Gets the record from the database (private transaction, reference variant)
Take a note that if the storage didn't have a record you want to get LMDBAL::NotFound is thrown
If the storage supports duplicates the exact value returned from it depends on comparison function of lmdb. It's not very straight forward, so, you shouldn't really use this method if you use duplicates and you rely on exact result. Anyway:
[in] | key | key of the record you look for |
[out] | value | the value from the storage |
[in] | txn | transaction ID, can be read only transaction |
LMDBAL::NotFound | thrown if the storage doesn't have a record with the given key |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overrideprotectedvirtual |
A method where database additionally handles drop.
It's a protected method that is called to optimise drop process after the transaction is commited. Used just for optimisations.
Reimplemented from LMDBAL::iStorage.
|
overridevirtual |
Reads whole storage into a map.
Basically just reads all database in an std::map, usefull when you store small storages
In case storage supports duplicates only what lmdb considered to be lowest value (see LMDBAL::Storage::getRecord() description) is returned in the resulting map
LMDBAL::Closed | thrown if the database was not opened |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overridevirtual |
Reads whole storage into a map (reference variant)
Basically just reads all database in an std::map, usefull when you store small storages
In case storage supports duplicates only what lmdb considered to be lowest value (see LMDBAL::Storage::getRecord() description) is returned in the resulting map
[out] | result | a map that is going to contain all data |
LMDBAL::Closed | thrown if the database was not opened |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overrideprotectedvirtual |
Reads whole storage into a map (private transaction, reference variant)
Basically just reads all database in an std::map, usefull when you store small storages In case storage supports duplicates only what lmdb considered to be lowest value (see LMDBAL::Storage::getRecord() description) is returned in the resulting map
[out] | result | a map that is going to contain all data |
[in] | txn | transaction ID, can be read only transaction |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overrideprotectedvirtual |
Reads whole storage into a map (private transaction variant)
Basically just reads all database in an std::map, usefull when you store small storages In case storage supports duplicates only what lmdb considered to be lowest value (see LMDBAL::Storage::getRecord() description) is returned in the resulting map
[in] | txn | transaction ID, can be read only transaction |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overridevirtual |
Removes one of the records.
Take a note that if the storage didn't have a record you want to remove LMDBAL::NotFound is thrown
[in] | key | key of the record you wish to be removed |
LMDBAL::Closed | thrown if the database was not opened |
LMDBAL::NotFound | thrown if the record with given key wasn't found |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overrideprotectedvirtual |
Removes one of the records (private transaction variant)
Take a note that if the storage didn't have a record you want to remove LMDBAL::NotFound is thrown This method schedules a record removal, but doesn't immidiately execute it.
[in] | key | key of the record you wish to be removed |
[in] | txn | transaction ID, needs to be a writable transaction! |
LMDBAL::NotFound | thrown if the record with given key wasn't found |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overridevirtual |
Replaces the content of the whole storage with the given.
Basically this method drops the database and adds all the records from the given map
[in] | data | new data of the storage |
LMDBAL::Closed | thrown if the database was not opened |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overrideprotectedvirtual |
Replaces the content of the whole storage with the given (private transaction variant)
Basically this method drops the database and adds all the records from the given map
[in] | data | new data of the storage |
[in] | txn | transaction ID, needs to be a writable transaction! |
LMDBAL::Unknown | thrown if something unexpected happend within lmdb |
Reimplemented from LMDBAL::Storage< K, V >.
|
overrideprotectedvirtual |
called on abortion of public transaction
This function is called on every storage of the database when user calls LMDBAL::Base::abortTransaction(LMDBAL::TransactionID)
This function is met to be reimplemented in heirs if the heir code requires some transaction custom handling
[in] | txn | - ID of started transaction |
Reimplemented from LMDBAL::iStorage.
|
overrideprotectedvirtual |
called on commitment of public transaction
This function is called on every storage of the database when user calls LMDBAL::Base::commitTransaction(LMDBAL::TransactionID)
This function is met to be reimplemented in heirs if the heir code requires some transaction custom handling
[in] | txn | - ID of started transaction |
Reimplemented from LMDBAL::iStorage.
|
overrideprotectedvirtual |
called on beginning of public transaction
This function is called on every storage of the database when user calls LMDBAL::Base::beginTransaction() or LMDBAL::Base::beginReadOnlyTransaction()
This function is met to be reimplemented in heirs if the heir code requires some transaction custom handling
[in] | txn | - ID of started transaction |
[in] | readOnly | - true if transaction is read-only, false otherwise |
Reimplemented from LMDBAL::iStorage.
|
mutableprotected |
Cache mode.
Sometimes we have a complete information about the content of the database, and we don't even need to call lmdb to fetch or check for data. This member actually shows what is the current state, more about them you can read in Enum descriptions