Noise: Prevent unittest crash caused by division by zero
[oweals/minetest.git] / src / database-redis.h
index da76775d409c4530b7c49f081f1c825936a7ac87..1e7909f857b4654fff31302367eb55b932ea0f1e 100644 (file)
@@ -24,27 +24,31 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #if USE_REDIS
 
-#include "database.h"
 #include <hiredis.h>
 #include <string>
+#include "database.h"
 
-class ServerMap;
+class Settings;
 
-class Database_Redis : public Database
+class Database_Redis : public MapDatabase
 {
 public:
-       Database_Redis(ServerMap *map, std::string savedir);
-       virtual void beginSave();
-       virtual void endSave();
-       virtual void saveBlock(MapBlock *block);
-       virtual MapBlock* loadBlock(v3s16 blockpos);
-       virtual void listAllLoadableBlocks(std::list<v3s16> &dst);
-       virtual int Initialized(void);
+       Database_Redis(Settings &conf);
        ~Database_Redis();
+
+       void beginSave();
+       void endSave();
+
+       bool saveBlock(const v3s16 &pos, const std::string &data);
+       void loadBlock(const v3s16 &pos, std::string *block);
+       bool deleteBlock(const v3s16 &pos);
+       void listAllLoadableBlocks(std::vector<v3s16> &dst);
+
 private:
-       ServerMap *srvmap;
-       redisContext *ctx;
-       std::string hash;
+       redisContext *ctx = nullptr;
+       std::string hash = "";
 };
-#endif
+
+#endif // USE_REDIS
+
 #endif