1
0
Fork 0
forked from blue/lmdbal

big refactoring part 1

This commit is contained in:
Blue 2023-03-20 18:37:13 +03:00
parent 6a8f67ac34
commit 19229f6c26
Signed by untrusted user: blue
GPG key ID: 9B203B252A63EE38
28 changed files with 867 additions and 795 deletions

18
cache.h
View file

@ -14,16 +14,18 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef DATABASE_CACHE_H
#define DATABASE_CACHE_H
#ifndef LMDBDATABASE_CACHE_H
#define LMDBDATABASE_CACHE_H
#include "database.h"
#include "table.h"
#include <map>
#include <set>
#include "storage.h"
namespace LMDBDataBase {
template <class K, class V>
class DataBase::Cache : public DataBase::Table<K, V> {
class Cache : public Storage<K, V> {
friend class DataBase;
enum class Mode { //it's a cache state when we:
nothing, // - know nothing about records in database on disk
@ -46,7 +48,7 @@ public:
virtual V getRecord(const K& key) const override;
virtual uint32_t count() const override;
using DataBase::Table<K, V>::drop;
using Storage<K, V>::drop;
virtual int drop(MDB_txn * transaction) override;
virtual std::map<K, V> readAll() const override;
virtual void replaceAll(const std::map<K, V>& data) override;
@ -59,6 +61,8 @@ protected:
uint32_t* sizeDifference;
};
}
#include "cache.hpp"
#endif // DATABASE_CACHE_H
#endif // LMDBDATABASE_CACHE_H