提交 c64e8c96 编写于 作者: X Xu Peng

refactor(db): typdef meta ptr


Former-commit-id: 1fcbd80c65a1ee2815a57127f04807ce7d9f23f3
上级 f5b0ec50
......@@ -21,6 +21,8 @@ namespace meta {
template <typename EngineT>
class DBImpl : public DB {
public:
typedef typename meta::Meta::Ptr MetaPtr;
DBImpl(const Options& options);
virtual Status add_group(meta::GroupSchema& group_info) override;
......@@ -78,7 +80,7 @@ private:
bool bg_build_index_started_;
std::condition_variable bg_build_index_finish_signal_;
std::shared_ptr<meta::Meta> _pMeta;
MetaPtr _pMeta;
std::shared_ptr<MemManagerT> _pMemMgr;
}; // DBImpl
......
......@@ -23,6 +23,7 @@ template <typename EngineT>
class MemVectors {
public:
typedef typename EngineT::Ptr EnginePtr;
typedef typename meta::Meta::Ptr MetaPtr;
explicit MemVectors(const std::shared_ptr<meta::Meta>&,
const meta::GroupFileSchema&, const Options&);
......@@ -44,7 +45,7 @@ private:
MemVectors(const MemVectors&) = delete;
MemVectors& operator=(const MemVectors&) = delete;
std::shared_ptr<meta::Meta> pMeta_;
MetaPtr pMeta_;
Options options_;
meta::GroupFileSchema schema_;
IDGenerator* _pIdGenerator;
......@@ -59,6 +60,7 @@ class MemManager {
public:
typedef MemVectors<EngineT> ItemT;
typedef std::shared_ptr<ItemT> VectorsPtr;
typedef typename meta::Meta::Ptr MetaPtr;
MemManager(const std::shared_ptr<meta::Meta>& meta_, const Options& options)
: _pMeta(meta_), options_(options) {}
......@@ -79,7 +81,7 @@ private:
typedef std::vector<VectorsPtr> ImmMemPool;
MemMap _memMap;
ImmMemPool _immMems;
std::shared_ptr<meta::Meta> _pMeta;
MetaPtr _pMeta;
Options options_;
std::mutex _mutex;
std::mutex serialization_mtx_;
......
......@@ -5,6 +5,8 @@
#include <vector>
#include <map>
#include <ctime>
#include <memory>
#include "Options.h"
#include "Status.h"
......@@ -50,8 +52,11 @@ typedef std::vector<GroupFileSchema> GroupFilesSchema;
typedef std::map<DateT, GroupFilesSchema> DatePartionedGroupFilesSchema;
class Meta;
class Meta {
public:
typedef std::shared_ptr<Meta> Ptr;
virtual Status add_group(GroupSchema& group_info) = 0;
virtual Status get_group(GroupSchema& group_info) = 0;
virtual Status has_group(const std::string& group_id_, bool& has_or_not_) = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册