minetest-mapper-cpp/db-leveldb.h
Rogier 03926420d0 Implement bounded block-list query for postgresql
i.e. allow minetestmapper to query the database for a list of
blocks in a specific range (corresponding to the requested geometry),
instead of always obtaining a full list off all blocks.

As postgresql is the only database which supports this efficiently,
this option is only effective for postgresql.
2016-01-17 10:37:51 +01:00

26 lines
574 B
C++

#ifndef _DB_LEVELDB_H
#define _DB_LEVELDB_H
#include "db.h"
#include <leveldb/db.h>
#include <set>
class DBLevelDB : public DB {
public:
DBLevelDB(const std::string &mapdir);
virtual int getBlocksQueriedCount(void);
virtual int getBlocksReadCount(void);
virtual const BlockPosList &getBlockPosList();
virtual Block getBlockOnPos(const BlockPos &pos);
~DBLevelDB();
private:
int m_blocksReadCount;
int m_blocksQueriedCount;
leveldb::DB *m_db;
BlockPosList m_blockPosList;
unsigned m_keyFormatI64Usage;
unsigned m_keyFormatAXYZUsage;
};
#endif // _DB_LEVELDB_H