From ff215a5b23aec05ad0b30be6ea649e3be22639e4 Mon Sep 17 00:00:00 2001 From: jinhai Date: Wed, 24 Jul 2019 11:17:53 +0800 Subject: [PATCH] MS-273 Add some logs and reformat code, fix compile error Former-commit-id: e427d53589c5f2bb0d7e9feaf38fc06464177ea1 --- cpp/src/db/DB.cpp | 2 + cpp/src/db/IDGenerator.cpp | 2 + cpp/src/db/IDGenerator.h | 11 +++-- cpp/src/db/Meta.cpp | 2 + cpp/src/db/Meta.h | 95 +++++++++++++++++++++++++------------- 5 files changed, 76 insertions(+), 36 deletions(-) diff --git a/cpp/src/db/DB.cpp b/cpp/src/db/DB.cpp index 1365d4e1..3b4f03d2 100644 --- a/cpp/src/db/DB.cpp +++ b/cpp/src/db/DB.cpp @@ -12,6 +12,8 @@ namespace zilliz { namespace milvus { namespace engine { +DB::~DB() = default; + void DB::Open(const Options& options, DB** dbptr) { *dbptr = DBFactory::Build(options); } diff --git a/cpp/src/db/IDGenerator.cpp b/cpp/src/db/IDGenerator.cpp index 70d71817..74d3a143 100644 --- a/cpp/src/db/IDGenerator.cpp +++ b/cpp/src/db/IDGenerator.cpp @@ -13,6 +13,8 @@ namespace zilliz { namespace milvus { namespace engine { +IDGenerator::~IDGenerator() = default; + constexpr size_t SimpleIDGenerator::MAX_IDS_PER_MICRO; IDNumber SimpleIDGenerator::GetNextIDNumber() { diff --git a/cpp/src/db/IDGenerator.h b/cpp/src/db/IDGenerator.h index 502b2865..eb392217 100644 --- a/cpp/src/db/IDGenerator.h +++ b/cpp/src/db/IDGenerator.h @@ -17,9 +17,14 @@ namespace engine { class IDGenerator { public: - virtual IDNumber GetNextIDNumber() = 0; - virtual void GetNextIDNumbers(size_t n, IDNumbers &ids) = 0; - virtual ~IDGenerator() = 0; + virtual + IDNumber GetNextIDNumber() = 0; + + virtual void + GetNextIDNumbers(size_t n, IDNumbers &ids) = 0; + + virtual + ~IDGenerator() = 0; }; // IDGenerator diff --git a/cpp/src/db/Meta.cpp b/cpp/src/db/Meta.cpp index cc752552..a86051a1 100644 --- a/cpp/src/db/Meta.cpp +++ b/cpp/src/db/Meta.cpp @@ -13,6 +13,8 @@ namespace milvus { namespace engine { namespace meta { +Meta::~Meta() = default; + DateT Meta::GetDate(const std::time_t& t, int day_delta) { struct tm ltm; localtime_r(&t, <m); diff --git a/cpp/src/db/Meta.h b/cpp/src/db/Meta.h index b18cea35..52756056 100644 --- a/cpp/src/db/Meta.h +++ b/cpp/src/db/Meta.h @@ -20,57 +20,86 @@ namespace meta { class Meta { -public: + public: using Ptr = std::shared_ptr; - virtual ~Meta() = 0; - virtual Status CreateTable(TableSchema& table_schema) = 0; - virtual Status DescribeTable(TableSchema& table_schema) = 0; - virtual Status HasTable(const std::string& table_id, bool& has_or_not) = 0; - virtual Status AllTables(std::vector& table_schema_array) = 0; + virtual + ~Meta() = 0; - virtual Status DeleteTable(const std::string& table_id) = 0; - virtual Status DeleteTableFiles(const std::string& table_id) = 0; + virtual Status + CreateTable(TableSchema &table_schema) = 0; - virtual Status CreateTableFile(TableFileSchema& file_schema) = 0; - virtual Status DropPartitionsByDates(const std::string& table_id, - const DatesT& dates) = 0; + virtual Status + DescribeTable(TableSchema &table_schema) = 0; - virtual Status GetTableFiles(const std::string& table_id, - const std::vector& ids, - TableFilesSchema& table_files) = 0; + virtual Status + HasTable(const std::string &table_id, bool &has_or_not) = 0; - virtual Status UpdateTableFilesToIndex(const std::string& table_id) = 0; + virtual Status + AllTables(std::vector &table_schema_array) = 0; - virtual Status UpdateTableFile(TableFileSchema& file_schema) = 0; + virtual Status + DeleteTable(const std::string &table_id) = 0; - virtual Status UpdateTableFiles(TableFilesSchema& files) = 0; + virtual Status + DeleteTableFiles(const std::string &table_id) = 0; - virtual Status FilesToSearch(const std::string &table_id, - const DatesT &partition, - DatePartionedTableFilesSchema& files) = 0; + virtual Status + CreateTableFile(TableFileSchema &file_schema) = 0; - virtual Status FilesToMerge(const std::string& table_id, - DatePartionedTableFilesSchema& files) = 0; + virtual Status + DropPartitionsByDates(const std::string &table_id, const DatesT &dates) = 0; - virtual Status Size(uint64_t& result) = 0; + virtual Status + GetTableFiles(const std::string &table_id, const std::vector &ids, TableFilesSchema &table_files) = 0; - virtual Status Archive() = 0; + virtual Status + UpdateTableFilesToIndex(const std::string &table_id) = 0; - virtual Status FilesToIndex(TableFilesSchema&) = 0; + virtual Status + UpdateTableFile(TableFileSchema &file_schema) = 0; - virtual Status HasNonIndexFiles(const std::string& table_id, bool& has) = 0; + virtual Status + UpdateTableFiles(TableFilesSchema &files) = 0; - virtual Status CleanUp() = 0; - virtual Status CleanUpFilesWithTTL(uint16_t) = 0; + virtual Status + FilesToSearch(const std::string &table_id, const DatesT &partition, DatePartionedTableFilesSchema &files) = 0; - virtual Status DropAll() = 0; + virtual Status + FilesToMerge(const std::string &table_id, DatePartionedTableFilesSchema &files) = 0; - virtual Status Count(const std::string& table_id, uint64_t& result) = 0; + virtual Status + Size(uint64_t &result) = 0; - static DateT GetDate(const std::time_t& t, int day_delta = 0); - static DateT GetDate(); - static DateT GetDateWithDelta(int day_delta); + virtual Status + Archive() = 0; + + virtual Status + FilesToIndex(TableFilesSchema &) = 0; + + virtual Status + HasNonIndexFiles(const std::string &table_id, bool &has) = 0; + + virtual Status + CleanUp() = 0; + + virtual Status + CleanUpFilesWithTTL(uint16_t) = 0; + + virtual Status + DropAll() = 0; + + virtual Status + Count(const std::string &table_id, uint64_t &result) = 0; + + static DateT + GetDate(const std::time_t &t, int day_delta = 0); + + static DateT + GetDate(); + + static DateT + GetDateWithDelta(int day_delta); }; // MetaData -- GitLab