During my experiment with using LMDB as database I came across these database-agnostic changes to dbwrapper which make it easier to support other databases, or are small common-sense (I think) cleanups at most:
- Pass parent CDBWrapper into CDBBatch and CDBIterator instead of obfuscation key (in the case of lmdb the batch needs to know about the database, to create a write transaction). This also looks cleaner.
- Incrase privacy of methods that are implementation specific by moving them to a namespace: HandleError, GetObfuscateKey.
- Make constructor of CDBIterator private - they rely on implementation details, others have no business instantiating these.
- Remove
GetObfuscateKeyHex- It is an unnecessary method as it is used only two times and only internally, and the whole implementation isHexStr(obfuscate_key). - Remove
throwkeywords in function signatures - Using throw() specifications in function signatures is not only not required in C++, it is considered deprecated for various reasons. It is not implemented by any of the common C++ compilers. Their usage is also inconsistent with the rest of the source code.