mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 02:41:59 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
44 lines
964 B
C++
44 lines
964 B
C++
#pragma once
|
|
|
|
#include <Core/Types.h>
|
|
#include <Disks/IDisk.h>
|
|
|
|
#include <functional>
|
|
#include <unordered_map>
|
|
#include <boost/noncopyable.hpp>
|
|
#include <Poco/Util/AbstractConfiguration.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
class Context;
|
|
|
|
/**
|
|
* Disk factory. Responsible for creating new disk objects.
|
|
*/
|
|
class DiskFactory final : private boost::noncopyable
|
|
{
|
|
public:
|
|
using Creator = std::function<DiskPtr(
|
|
const String & name,
|
|
const Poco::Util::AbstractConfiguration & config,
|
|
const String & config_prefix,
|
|
const Context & context)>;
|
|
|
|
static DiskFactory & instance();
|
|
|
|
void registerDiskType(const String & disk_type, Creator creator);
|
|
|
|
DiskPtr create(
|
|
const String & name,
|
|
const Poco::Util::AbstractConfiguration & config,
|
|
const String & config_prefix,
|
|
const Context & context) const;
|
|
|
|
private:
|
|
using DiskTypeRegistry = std::unordered_map<String, Creator>;
|
|
DiskTypeRegistry registry;
|
|
};
|
|
|
|
}
|