Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
database-redis.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2014 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5#pragma once
6
7#include "config.h"
8
9#if USE_REDIS
10
11#include <hiredis.h>
12#include <string>
13#include "database.h"
14
15class Settings;
16
18{
19public:
22
23 void beginSave();
24 void endSave();
25
26 bool saveBlock(const v3s16 &pos, std::string_view data);
27 void loadBlock(const v3s16 &pos, std::string *block);
28 bool deleteBlock(const v3s16 &pos);
29 void listAllLoadableBlocks(std::vector<v3s16> &dst);
30
31private:
32 redisContext *ctx = nullptr;
33 std::string hash = "";
34};
35
36#endif // USE_REDIS
Definition database-redis.h:18
~Database_Redis()
Definition database-redis.cpp:66
void listAllLoadableBlocks(std::vector< v3s16 > &dst)
Definition database-redis.cpp:175
void loadBlock(const v3s16 &pos, std::string *block)
Definition database-redis.cpp:115
void endSave()
Definition database-redis.cpp:81
bool saveBlock(const v3s16 &pos, std::string_view data)
Definition database-redis.cpp:91
void beginSave()
Definition database-redis.cpp:71
Database_Redis(Settings &conf)
Definition database-redis.cpp:28
bool deleteBlock(const v3s16 &pos)
Definition database-redis.cpp:155
std::string hash
Definition database-redis.h:33
redisContext * ctx
Definition database-redis.h:32
Definition database.h:23
Definition settings.h:109
core::vector3d< s16 > v3s16
Definition irr_v3d.h:13