diff --git a/cpp/src/db.h b/cpp/src/db.h new file mode 100644 index 0000000000..5d8c0cf791 --- /dev/null +++ b/cpp/src/db.h @@ -0,0 +1,23 @@ +#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_ diff --git a/cpp/src/db_impl.cpp b/cpp/src/db_impl.cpp new file mode 100644 index 0000000000..66ee9633ee --- /dev/null +++ b/cpp/src/db_impl.cpp @@ -0,0 +1,11 @@ +include "db_impl.h" + +namespace vecengine { + +DB::DB(const Options& options_, const std::string& name_) + : _dbname(name_), + _env(options_.env), + _options(options_) { +} + +} // namespace vecengine diff --git a/cpp/src/db_impl.h b/cpp/src/db_impl.h new file mode 100644 index 0000000000..7dc55273f1 --- /dev/null +++ b/cpp/src/db_impl.h @@ -0,0 +1,24 @@ +#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_ diff --git a/cpp/src/env.cpp b/cpp/src/env.cpp new file mode 100644 index 0000000000..fd8088cabf --- /dev/null +++ b/cpp/src/env.cpp @@ -0,0 +1,11 @@ +#inlcude "env.h" + +namespace vecengine { + +DBConfig::DBConfig() + : _mem_sync_interval(10), + _file_merge_trigger_number(20), + _index_file_build_trigger_size(100000) { +} + +} // namespace vecengine diff --git a/cpp/src/env.h b/cpp/src/env.h new file mode 100644 index 0000000000..cda7a55397 --- /dev/null +++ b/cpp/src/env.h @@ -0,0 +1,23 @@ +#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_ diff --git a/cpp/src/options.h b/cpp/src/options.h new file mode 100644 index 0000000000..114861104d --- /dev/null +++ b/cpp/src/options.h @@ -0,0 +1,12 @@ +#ifndef VECENGINE_OPTIONS_H_ +#define VECENGINE_OPTIONS_H_ + +namespace vecengine { + +struct Options { + +}; // Options + +} // namespace vecengine + +#endif // VECENGINE_OPTIONS_H_