提交 e1a5d5ef 编写于 作者: X Xu Peng 提交者: xj.lin

feat(cpp/db): add meta related method in db api


Former-commit-id: d9cab929294aeb154e245e8cdc96b6c3a460af91
上级 771155df
......@@ -21,17 +21,8 @@ public:
GroupSchema& group_info_) = 0;
virtual Status get_group(const std::string& group_id_, GroupSchema& group_info_) = 0;
virtual Status has_group(const std::string& group_id_, bool& has_or_not_) = 0;
virtual Status add_group_file(const std::string& group_id_,
GroupFileSchema& group_file_info_) = 0;
virtual Status has_group_file(const std::string& group_id_,
const std::string& file_id_,
bool& has_or_not_) = 0;
virtual Status get_group_file(const std::string& group_id_,
const std::string& file_id_,
GroupFileSchema& group_file_info_) = 0;
virtual Status get_group_files(const std::string& group_id_,
const int date_delta_,
GroupFilesSchema& group_files_info_) = 0;
DB() = default;
......
......@@ -8,15 +8,32 @@ DBImpl::DBImpl(const Options& options_, const std::string& name_)
_env(options_.env),
_options(options_),
_bg_work_finish_signal(_mutex),
_bg_compaction_scheduled(false) {
_bg_compaction_scheduled(false),
_pMeta(new DBMetaImpl(*(_options.pMetaOptions))) {
}
Status DBImpl::add_group(const GroupOptions& options_,
const std::string& group_id_,
std::string& gid_) {
GroupSchema& group_info_) {
assert((!options_.has_id) ||
(options_.has_id && ("" != group_id_)));
return _pMeta->add_group(options_, group_id, group_info_);
}
Status DBImpl::get_group(const std::string& group_id_, GroupSchema& group_info_) {
return _pMeta->get_group(group_id_, group_info_);
}
Status DBImpl::has_group(const std::string& group_id_, bool& has_or_not_) {
return _pMeta->has_group(group_id_, has_or_not_);
}
Status DBImpl::get_group_files(const std::string& group_id_,
const int date_delta_,
GroupFilesSchema& group_files_info_) {
return _pMeta->get_group_files(group_id_, date_delta_, group_file_info_);
}
void DBImpl::try_schedule_compaction() {
......
......@@ -19,7 +19,13 @@ public:
virtual Status add_group(GroupOptions options_,
const std::string& group_id_,
std::string& gid_) override;
GroupSchema& group_info_) override;
virtual Status get_group(const std::string& group_id_, GroupSchema& group_info_) override;
virtual Status has_group(const std::string& group_id_, bool& has_or_not_) override;
virtual Status get_group_files(const std::string& group_id_,
const int date_delta_,
GroupFilesSchema& group_files_info_) override;
void try_schedule_compaction();
......@@ -43,6 +49,7 @@ private:
Status _bg_error;
MemManager _memMgr;
std::shared_ptr<Meta> _pMeta;
}; // DBImpl
......
......@@ -50,6 +50,7 @@ public:
virtual Status update_group_file(const GroupFileSchema& group_file_) = 0;
virtual Status get_group_files(const std::string& group_id_,
const int date_delta_,
GroupFilesSchema& group_files_info_) = 0;
}; // MetaData
......
......@@ -52,6 +52,7 @@ Status DBMetaImpl::get_group_file(const std::string& group_id_,
}
Status DBMetaImpl::get_group_files(const std::string& group_id_,
const int date_delta_,
GroupFilesSchema& group_files_info_) {
// PXU TODO
return Status.OK();
......
......@@ -29,6 +29,7 @@ public:
virtual Status update_group_file(const GroupFileSchema& group_file_) override;
virtual Status get_group_files(const std::string& group_id_,
const int date_delta_,
GroupFilesSchema& group_files_info_) override;
private:
......
......@@ -2,15 +2,19 @@
#define VECENGINE_OPTIONS_H_
#include <string>
#include <memory>
namespace zilliz {
namespace vecwise {
namespace engine {
class MetaOptions;
struct Options {
uint16_t memory_sync_interval = 10;
uint16_t raw_file_merge_trigger_number = 100;
size_t raw_to_index_trigger_size = 100000;
std::shared_ptr<MetaOptions> pMetaOptions;
}; // Options
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册