提交 02bcac92 编写于 作者: X Xu Peng

feat(cpp): add db and env


Former-commit-id: fc2f7219ff7806ca1f98d402ac5120e6174d5e01
上级 d7f5e351
#ifndef VECENGINE_DB_H_
#define VECENGINE_DB_H_
#include "options.h"
namespace vecengine {
class Env;
class DB {
public:
static DB* Open(const Options& options_, const std::string& name_);
DB() = default;
DB(const DB&) = delete;
DB& operator=(const DB&) = delete;
virtual ~DB();
}; // DB
} // namespace vecengine
#endif // VECENGINE_DB_H_
include "db_impl.h"
namespace vecengine {
DB::DB(const Options& options_, const std::string& name_)
: _dbname(name_),
_env(options_.env),
_options(options_) {
}
} // namespace vecengine
#ifndef VECENGINE_DB_IMPL_H_
#define VECENGINE_DB_IMPL_H_
#include "db.h"
namespace vecengine {
class Env;
class DBImpl : public DB {
public:
DBImpl(const Options& options_, const std::string& name_);
virtual ~DBImpl();
private:
const _dbname;
Env* const _env;
const Options _options;
}; // DBImpl
} // namespace vecengine
#endif // VECENGINE_DB_IMPL_H_
#inlcude "env.h"
namespace vecengine {
DBConfig::DBConfig()
: _mem_sync_interval(10),
_file_merge_trigger_number(20),
_index_file_build_trigger_size(100000) {
}
} // namespace vecengine
#ifndef STORAGE_VECENGINE_ENV_H_
#define STORAGE_VECENGINE_ENV_H_
namespace vecengine {
/* struct Options { */
/* std::string _db_location; */
/* size_t _mem_sync_interval; */
/* size_t _file_merge_trigger_number; */
/* size_t _index_file_build_trigger_size; */
/* }; // Config */
class Env {
public:
Env() = default;
private:
Options _option;
}; // Env
} //namespace vecengine
#endif // STORAGE_VECENGINE_ENV_H_
#ifndef VECENGINE_OPTIONS_H_
#define VECENGINE_OPTIONS_H_
namespace vecengine {
struct Options {
}; // Options
} // namespace vecengine
#endif // VECENGINE_OPTIONS_H_
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册