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.
28 lines
453 B
28 lines
453 B
2 years ago
|
#pragma once
|
||
|
|
||
|
#include <memory>
|
||
|
|
||
|
#include "leveldb/cache.h"
|
||
|
#include "leveldb/db.h"
|
||
|
#include "result.hpp"
|
||
|
|
||
|
namespace database {
|
||
|
|
||
|
class Database {
|
||
|
public:
|
||
|
enum DatabaseError {
|
||
|
FAILED_TO_OPEN,
|
||
|
};
|
||
|
static auto Open() -> cpp::result<Database*, DatabaseError>;
|
||
|
|
||
|
~Database();
|
||
|
|
||
|
private:
|
||
|
std::unique_ptr<leveldb::DB> db_;
|
||
|
std::unique_ptr<leveldb::Cache> cache_;
|
||
|
|
||
|
Database(leveldb::DB* db, leveldb::Cache* cache);
|
||
|
};
|
||
|
|
||
|
} // namespace database
|