mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-06 19:02:18 +08:00
refactor(db): include file seq and cpp->inl
Former-commit-id: 970bb6ef009b1806a4f60f6d1f5d62e0aeb1ca5e
This commit is contained in:
parent
73ffe9f796
commit
541692c227
@ -7,8 +7,6 @@
|
||||
#include "DBImpl.h"
|
||||
#include "DBMetaImpl.h"
|
||||
#include "Env.h"
|
||||
/* #include "FaissExecutionEngine.h" */
|
||||
/* #include "Traits.h" */
|
||||
#include "Factories.h"
|
||||
|
||||
namespace zilliz {
|
||||
|
||||
@ -5,15 +5,15 @@
|
||||
******************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include "DB.h"
|
||||
#include "MemManager.h"
|
||||
#include "Types.h"
|
||||
#include "Traits.h"
|
||||
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <memory>
|
||||
#include <atomic>
|
||||
#include "DB.h"
|
||||
#include "MemManager.h"
|
||||
#include "Types.h"
|
||||
#include "FaissExecutionEngine.h"
|
||||
#include "Traits.h"
|
||||
|
||||
namespace zilliz {
|
||||
namespace vecwise {
|
||||
@ -95,4 +95,4 @@ private:
|
||||
} // namespace vecwise
|
||||
} // namespace zilliz
|
||||
|
||||
#include "DBImpl.cpp"
|
||||
#include "DBImpl.inl"
|
||||
|
||||
@ -3,8 +3,11 @@
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
* Proprietary and confidential.
|
||||
******************************************************************************/
|
||||
#ifndef DBIMPL_CPP__
|
||||
#define DBIMPL_CPP__
|
||||
#pragma once
|
||||
|
||||
#include "DBImpl.h"
|
||||
#include "DBMetaImpl.h"
|
||||
#include "Env.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <chrono>
|
||||
@ -14,10 +17,6 @@
|
||||
#include <easylogging++.h>
|
||||
#include <cache/CpuCacheMgr.h>
|
||||
|
||||
#include "DBImpl.h"
|
||||
#include "DBMetaImpl.h"
|
||||
#include "Env.h"
|
||||
|
||||
namespace zilliz {
|
||||
namespace vecwise {
|
||||
namespace engine {
|
||||
@ -435,5 +434,3 @@ DBImpl<EngineT>::~DBImpl() {
|
||||
} // namespace engine
|
||||
} // namespace vecwise
|
||||
} // namespace zilliz
|
||||
|
||||
#endif
|
||||
@ -71,7 +71,7 @@ void DBMetaImpl::GetTableFilePath(TableFileSchema& group_file) {
|
||||
Status DBMetaImpl::NextTableId(std::string& table_id) {
|
||||
std::stringstream ss;
|
||||
SimpleIDGenerator g;
|
||||
ss << g.getNextIDNumber();
|
||||
ss << g.GetNextIDNumber();
|
||||
table_id = ss.str();
|
||||
return Status::OK();
|
||||
}
|
||||
@ -79,7 +79,7 @@ Status DBMetaImpl::NextTableId(std::string& table_id) {
|
||||
Status DBMetaImpl::NextFileId(std::string& file_id) {
|
||||
std::stringstream ss;
|
||||
SimpleIDGenerator g;
|
||||
ss << g.getNextIDNumber();
|
||||
ss << g.GetNextIDNumber();
|
||||
file_id = ss.str();
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
@ -3,6 +3,11 @@
|
||||
// Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
// Proprietary and confidential.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include "Factories.h"
|
||||
#include "DBImpl.h"
|
||||
#include "FaissExecutionEngine.h"
|
||||
#include "Traits.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <sstream>
|
||||
@ -11,12 +16,6 @@
|
||||
#include <assert.h>
|
||||
#include <easylogging++.h>
|
||||
|
||||
#include "Factories.h"
|
||||
#include "DBImpl.h"
|
||||
#include "FaissExecutionEngine.h"
|
||||
#include "Traits.h"
|
||||
|
||||
|
||||
namespace zilliz {
|
||||
namespace vecwise {
|
||||
namespace engine {
|
||||
|
||||
@ -3,15 +3,15 @@
|
||||
// Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
// Proprietary and confidential.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include "DB.h"
|
||||
#include "DBMetaImpl.h"
|
||||
#include "Options.h"
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
namespace zilliz {
|
||||
namespace vecwise {
|
||||
namespace engine {
|
||||
|
||||
@ -3,30 +3,29 @@
|
||||
// Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
// Proprietary and confidential.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include "IDGenerator.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <assert.h>
|
||||
#include <iostream>
|
||||
|
||||
#include "IDGenerator.h"
|
||||
|
||||
|
||||
namespace zilliz {
|
||||
namespace vecwise {
|
||||
namespace engine {
|
||||
|
||||
IDGenerator::~IDGenerator() {}
|
||||
|
||||
IDNumber SimpleIDGenerator::getNextIDNumber() {
|
||||
IDNumber SimpleIDGenerator::GetNextIDNumber() {
|
||||
auto now = std::chrono::system_clock::now();
|
||||
auto micros = std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
now.time_since_epoch()).count();
|
||||
return micros * MAX_IDS_PER_MICRO;
|
||||
}
|
||||
|
||||
void SimpleIDGenerator::nextIDNumbers(size_t n, IDNumbers& ids) {
|
||||
void SimpleIDGenerator::NextIDNumbers(size_t n, IDNumbers& ids) {
|
||||
if (n > MAX_IDS_PER_MICRO) {
|
||||
nextIDNumbers(n-MAX_IDS_PER_MICRO, ids);
|
||||
nextIDNumbers(MAX_IDS_PER_MICRO, ids);
|
||||
NextIDNumbers(n-MAX_IDS_PER_MICRO, ids);
|
||||
NextIDNumbers(MAX_IDS_PER_MICRO, ids);
|
||||
return;
|
||||
}
|
||||
if (n <= 0) {
|
||||
@ -41,12 +40,11 @@ void SimpleIDGenerator::nextIDNumbers(size_t n, IDNumbers& ids) {
|
||||
for (int pos=0; pos<n; ++pos) {
|
||||
ids.push_back(micros+pos);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SimpleIDGenerator::getNextIDNumbers(size_t n, IDNumbers& ids) {
|
||||
void SimpleIDGenerator::GetNextIDNumbers(size_t n, IDNumbers& ids) {
|
||||
ids.clear();
|
||||
nextIDNumbers(n, ids);
|
||||
NextIDNumbers(n, ids);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,17 +5,19 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "Types.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
namespace zilliz {
|
||||
namespace vecwise {
|
||||
namespace engine {
|
||||
|
||||
class IDGenerator {
|
||||
public:
|
||||
virtual IDNumber getNextIDNumber() = 0;
|
||||
virtual void getNextIDNumbers(size_t n, IDNumbers& ids) = 0;
|
||||
virtual IDNumber GetNextIDNumber() = 0;
|
||||
virtual void GetNextIDNumbers(size_t n, IDNumbers& ids) = 0;
|
||||
|
||||
virtual ~IDGenerator();
|
||||
|
||||
@ -24,11 +26,11 @@ public:
|
||||
|
||||
class SimpleIDGenerator : public IDGenerator {
|
||||
public:
|
||||
virtual IDNumber getNextIDNumber() override;
|
||||
virtual void getNextIDNumbers(size_t n, IDNumbers& ids) override;
|
||||
virtual IDNumber GetNextIDNumber() override;
|
||||
virtual void GetNextIDNumbers(size_t n, IDNumbers& ids) override;
|
||||
|
||||
private:
|
||||
void nextIDNumbers(size_t n, IDNumbers& ids);
|
||||
void NextIDNumbers(size_t n, IDNumbers& ids);
|
||||
const size_t MAX_IDS_PER_MICRO = 1000;
|
||||
|
||||
}; // SimpleIDGenerator
|
||||
|
||||
@ -5,15 +5,15 @@
|
||||
******************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include "IDGenerator.h"
|
||||
#include "Status.h"
|
||||
#include "Meta.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <ctime>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include "IDGenerator.h"
|
||||
#include "Status.h"
|
||||
#include "Meta.h"
|
||||
|
||||
|
||||
namespace zilliz {
|
||||
namespace vecwise {
|
||||
@ -96,4 +96,4 @@ private:
|
||||
} // namespace engine
|
||||
} // namespace vecwise
|
||||
} // namespace zilliz
|
||||
#include "MemManager.cpp"
|
||||
#include "MemManager.inl"
|
||||
|
||||
@ -3,18 +3,16 @@
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
* Proprietary and confidential.
|
||||
******************************************************************************/
|
||||
#ifndef MEMMANGE_CPP__
|
||||
#define MEMMANGE_CPP__
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <thread>
|
||||
#include <easylogging++.h>
|
||||
#pragma once
|
||||
|
||||
#include "MemManager.h"
|
||||
#include "Meta.h"
|
||||
#include "MetaConsts.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <thread>
|
||||
#include <easylogging++.h>
|
||||
|
||||
namespace zilliz {
|
||||
namespace vecwise {
|
||||
@ -32,7 +30,7 @@ MemVectors<EngineT>::MemVectors(const std::shared_ptr<meta::Meta>& meta_ptr,
|
||||
|
||||
template<typename EngineT>
|
||||
void MemVectors<EngineT>::add(size_t n_, const float* vectors_, IDNumbers& vector_ids_) {
|
||||
_pIdGenerator->getNextIDNumbers(n_, vector_ids_);
|
||||
_pIdGenerator->GetNextIDNumbers(n_, vector_ids_);
|
||||
pEE_->AddWithIds(n_, vectors_, vector_ids_.data());
|
||||
}
|
||||
|
||||
@ -148,5 +146,3 @@ Status MemManager<EngineT>::serialize(std::vector<std::string>& table_ids) {
|
||||
} // namespace engine
|
||||
} // namespace vecwise
|
||||
} // namespace zilliz
|
||||
|
||||
#endif
|
||||
@ -3,9 +3,9 @@
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
* Proprietary and confidential.
|
||||
******************************************************************************/
|
||||
#include "Utils.h"
|
||||
|
||||
#include <chrono>
|
||||
#include "Utils.h"
|
||||
|
||||
namespace zilliz {
|
||||
namespace vecwise {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user