mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-01 00:15:30 +08:00
42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
/*******************************************************************************
|
|
* Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
|
|
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
|
* Proprietary and confidential.
|
|
******************************************************************************/
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <memory>
|
|
|
|
#include "resource/Resource.h"
|
|
#include "resource/CpuResource.h"
|
|
#include "resource/GpuResource.h"
|
|
#include "resource/DiskResource.h"
|
|
|
|
|
|
namespace zilliz {
|
|
namespace milvus {
|
|
namespace engine {
|
|
|
|
class ResourceFactory {
|
|
public:
|
|
static std::shared_ptr<Resource>
|
|
Create(const std::string &name, const std::string &alias = "") {
|
|
if (name == "disk") {
|
|
return std::make_shared<CpuResource>(alias);
|
|
} else if (name == "cpu") {
|
|
return std::make_shared<CpuResource>(alias);
|
|
} else if (name == "gpu") {
|
|
return std::make_shared<CpuResource>(alias);
|
|
} else {
|
|
return nullptr;
|
|
}
|
|
}
|
|
};
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
|