mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-30 07:25:37 +08:00
feat(db): add db factories
Former-commit-id: df8ec1140cc82755e14a739cbb22fb035b3c7d18
This commit is contained in:
parent
3dfdfef07a
commit
c1d40bfb3d
39
cpp/src/db/Factories.cpp
Normal file
39
cpp/src/db/Factories.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
|
||||
// Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
// Proprietary and confidential.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <sstream>
|
||||
|
||||
#include "Factories.h"
|
||||
|
||||
|
||||
namespace zilliz {
|
||||
namespace vecwise {
|
||||
namespace engine {
|
||||
|
||||
DBMetaOptions DBMetaOptionsFactory::Build(const std::string& path) {
|
||||
auto p = path;
|
||||
if(p == "") {
|
||||
srand(time(nullptr));
|
||||
std::stringstream ss;
|
||||
ss << "/tmp/" << rand();
|
||||
p = ss.str();
|
||||
}
|
||||
DBMetaOptions meta;
|
||||
meta.path = p;
|
||||
return meta;
|
||||
}
|
||||
|
||||
Options OptionsFactory::Build() {
|
||||
auto meta = DBMetaOptionsFactory::Build();
|
||||
Options options;
|
||||
options.meta = meta;
|
||||
return options;
|
||||
}
|
||||
|
||||
} // namespace engine
|
||||
} // namespace vecwise
|
||||
} // namespace zilliz
|
||||
27
cpp/src/db/Factories.h
Normal file
27
cpp/src/db/Factories.h
Normal file
@ -0,0 +1,27 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
|
||||
// Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
// Proprietary and confidential.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "db/DB.h"
|
||||
|
||||
namespace zilliz {
|
||||
namespace vecwise {
|
||||
namespace engine {
|
||||
|
||||
struct DBMetaOptionsFactory {
|
||||
static DBMetaOptions Build(const std::string& path = "");
|
||||
};
|
||||
|
||||
struct OptionsFactory {
|
||||
static Options Build();
|
||||
};
|
||||
|
||||
|
||||
} // namespace engine
|
||||
} // namespace vecwise
|
||||
} // namespace zilliz
|
||||
Loading…
x
Reference in New Issue
Block a user