mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-16 11:22:12 +00:00
495c6e03aa
* Replace all Context references with std::weak_ptr * Fix shared context captured by value * Fix build * Fix Context with named sessions * Fix copy context * Fix gcc build * Merge with master and fix build * Fix gcc-9 build
46 lines
1.0 KiB
C++
46 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <Disks/DiskFactory.h>
|
|
#include <Disks/IDisk.h>
|
|
|
|
#include <Poco/Util/AbstractConfiguration.h>
|
|
|
|
#include <map>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class DiskSelector;
|
|
using DiskSelectorPtr = std::shared_ptr<const DiskSelector>;
|
|
using DisksMap = std::map<String, DiskPtr>;
|
|
|
|
/// Parse .xml configuration and store information about disks
|
|
/// Mostly used for introspection.
|
|
class DiskSelector
|
|
{
|
|
public:
|
|
DiskSelector(const Poco::Util::AbstractConfiguration & config, const String & config_prefix, ContextConstPtr context);
|
|
DiskSelector(const DiskSelector & from) : disks(from.disks) { }
|
|
|
|
DiskSelectorPtr updateFromConfig(
|
|
const Poco::Util::AbstractConfiguration & config,
|
|
const String & config_prefix,
|
|
ContextPtr context
|
|
) const;
|
|
|
|
/// Get disk by name
|
|
DiskPtr get(const String & name) const;
|
|
|
|
/// Get all disks with names
|
|
const DisksMap & getDisksMap() const { return disks; }
|
|
void addToDiskMap(String name, DiskPtr disk)
|
|
{
|
|
disks.emplace(name, disk);
|
|
}
|
|
|
|
private:
|
|
DisksMap disks;
|
|
};
|
|
|
|
}
|