Enable leveldb on travis
This commit is contained in:
parent
4f12a2b983
commit
ef63050152
@ -7,11 +7,12 @@ addons:
|
|||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- libgd2-noxpm-dev
|
- libgd2-noxpm-dev
|
||||||
|
- libleveldb-dev
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
- cmake ..
|
- cmake .. -DENABLE_LEVELDB=true
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- cmake --build . --config Release
|
- cmake --build . --config Release
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include "db-leveldb.h"
|
#include "db-leveldb.h"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
inline int64_t stoi64(const std::string &s) {
|
inline int64_t stoi64(const std::string &s) {
|
||||||
std::stringstream tmp(s);
|
std::stringstream tmp(s);
|
||||||
@ -66,7 +65,7 @@ const DB::BlockPosList &DBLevelDB::getBlockPosList() {
|
|||||||
return m_blockPosList;
|
return m_blockPosList;
|
||||||
}
|
}
|
||||||
|
|
||||||
DB::Block DBLevelDB::getBlockOnPos(const BlockPos &pos)
|
const DB::Block DBLevelDB::getBlockOnPos(const BlockPos &pos)
|
||||||
{
|
{
|
||||||
std::string datastr;
|
std::string datastr;
|
||||||
leveldb::Status status;
|
leveldb::Status status;
|
||||||
@ -109,10 +108,10 @@ DB::Block DBLevelDB::getBlockOnPos(const BlockPos &pos)
|
|||||||
|
|
||||||
if(status.ok()) {
|
if(status.ok()) {
|
||||||
m_blocksReadCount++;
|
m_blocksReadCount++;
|
||||||
return Block(pos, ustring(reinterpret_cast<const unsigned char *>(datastr.c_str()), datastr.size()));
|
return Block(pos, reinterpret_cast<const unsigned char *>(datastr.c_str()), datastr.size());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return Block(pos, ustring(reinterpret_cast<const unsigned char *>("")));
|
return Block(pos, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ public:
|
|||||||
virtual int getBlocksQueriedCount(void);
|
virtual int getBlocksQueriedCount(void);
|
||||||
virtual int getBlocksReadCount(void);
|
virtual int getBlocksReadCount(void);
|
||||||
virtual const BlockPosList &getBlockPosList();
|
virtual const BlockPosList &getBlockPosList();
|
||||||
virtual Block getBlockOnPos(const BlockPos &pos);
|
virtual const Block getBlockOnPos(const BlockPos &pos);
|
||||||
~DBLevelDB();
|
~DBLevelDB();
|
||||||
private:
|
private:
|
||||||
int m_blocksReadCount;
|
int m_blocksReadCount;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user