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

feat(db): add db factories


Former-commit-id: df8ec1140cc82755e14a739cbb22fb035b3c7d18
上级 3dfdfef0
////////////////////////////////////////////////////////////////////////////////
// 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
////////////////////////////////////////////////////////////////////////////////
// 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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册