1 /* 2 database-leveldb.h 3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com> 4 */ 5 6 /* 7 This file is part of Freeminer. 8 9 Freeminer is free software: you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation, either version 3 of the License, or 12 (at your option) any later version. 13 14 Freeminer is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with Freeminer. If not, see <http://www.gnu.org/licenses/>. 21 */ 22 23 #ifndef DATABASE_LEVELDB_HEADER 24 #define DATABASE_LEVELDB_HEADER 25 26 #include "config.h" 27 28 #if USE_LEVELDB 29 30 #include "database.h" 31 #include "key_value_storage.h" 32 #include <string> 33 34 class ServerMap; 35 36 class Database_LevelDB : public Database 37 { 38 public: 39 Database_LevelDB(ServerMap *map, std::string savedir); 40 virtual void beginSave(); 41 virtual void endSave(); 42 virtual bool saveBlock(v3POS blockpos, std::string &data); 43 virtual std::string loadBlock(v3POS blockpos); 44 virtual void listAllLoadableBlocks(std::list<v3POS> &dst); 45 virtual int Initialized(void); 46 ~Database_LevelDB(); 47 open()48 virtual void open() { m_database->open(); }; close()49 virtual void close() { m_database->close(); }; 50 51 private: 52 //ServerMap *srvmap; 53 KeyValueStorage *m_database; 54 //leveldb::DB* m_database; 55 }; 56 #endif 57 #endif 58