dbwrapper: Pass parent CDBWrapper into CDBBatch and CDBIterator

Pass parent wrapper directly instead of obfuscation key. This
makes it possible for other databases which re-use this code
to use other properties from the database.

Add a namespace dbwrapper_private for private functions to be used
only in dbwrapper.h/cpp and dbwrapper_tests.
This commit is contained in:
Wladimir J. van der Laan
2016-04-20 11:46:01 +02:00
parent 878bf480a3
commit b69836d6ff
4 changed files with 44 additions and 30 deletions

View File

@@ -136,12 +136,16 @@ bool CDBWrapper::IsEmpty()
return !(it->Valid());
}
const std::vector<unsigned char>& CDBWrapper::GetObfuscateKey() const
{
return obfuscate_key;
}
CDBIterator::~CDBIterator() { delete piter; }
bool CDBIterator::Valid() { return piter->Valid(); }
void CDBIterator::SeekToFirst() { piter->SeekToFirst(); }
void CDBIterator::Next() { piter->Next(); }
namespace dbwrapper_private {
const std::vector<unsigned char>& GetObfuscateKey(const CDBWrapper &w)
{
return w.obfuscate_key;
}
};