You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.4KB

  1. /*
  2. Minetest
  3. Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU Lesser General Public License as published by
  6. the Free Software Foundation; either version 2.1 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public License along
  13. with this program; if not, write to the Free Software Foundation, Inc.,
  14. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  15. */
  16. #ifndef DATABASE_LEVELDB_HEADER
  17. #define DATABASE_LEVELDB_HEADER
  18. #include "config.h"
  19. #if USE_LEVELDB
  20. #include <string>
  21. #include "database.h"
  22. #include "leveldb/db.h"
  23. class Database_LevelDB : public MapDatabase
  24. {
  25. public:
  26. Database_LevelDB(const std::string &savedir);
  27. ~Database_LevelDB();
  28. bool saveBlock(const v3s16 &pos, const std::string &data);
  29. void loadBlock(const v3s16 &pos, std::string *block);
  30. bool deleteBlock(const v3s16 &pos);
  31. void listAllLoadableBlocks(std::vector<v3s16> &dst);
  32. void beginSave() {}
  33. void endSave() {}
  34. private:
  35. leveldb::DB *m_database;
  36. };
  37. #endif // USE_LEVELDB
  38. #endif