Minor statistics fix to leveldb backend

(And a minor edit to README.rst)
This commit is contained in:
Rogier 2014-05-12 12:08:00 +02:00
parent e097580b3e
commit 98fa76bb6b
3 changed files with 4 additions and 4 deletions

View File

@ -8,6 +8,7 @@ Requirements
* libgd
* sqlite3
* leveldb (optional, set ENABLE_LEVELDB=1 in CMake to enable leveldb support)
Compilation
-----------

View File

@ -18,7 +18,6 @@ inline std::string i64tos(int64_t i) {
DBLevelDB::DBLevelDB(const std::string &mapdir) :
m_blocksReadCount(0),
m_blocksCachedCount(0),
m_blocksUnCachedCount(0)
{
leveldb::Options options;
@ -39,7 +38,7 @@ int DBLevelDB::getBlocksReadCount(void)
int DBLevelDB::getBlocksCachedCount(void)
{
return m_blocksCachedCount;
return 0;
}
int DBLevelDB::getBlocksUnCachedCount(void)
@ -62,9 +61,10 @@ DB::Block DBLevelDB::getBlockOnPos(const BlockPos &pos)
std::string datastr;
leveldb::Status status;
m_blocksReadCount++;
status = m_db->Get(leveldb::ReadOptions(), i64tos(pos.databasePos()), &datastr);
if(status.ok()) {
m_blocksReadCount++;
m_blocksUnCachedCount++;
return Block(pos, ustring(reinterpret_cast<const unsigned char *>(datastr.c_str()), datastr.size()));
}

View File

@ -16,7 +16,6 @@ public:
~DBLevelDB();
private:
int m_blocksReadCount;
int m_blocksCachedCount;
int m_blocksUnCachedCount;
leveldb::DB *m_db;
BlockPosList m_blockPosList;