2015-04-30 12:43:16 +00:00
|
|
|
#pragma once
|
|
|
|
|
2018-07-24 14:28:56 +00:00
|
|
|
#include <DataTypes/DataTypeString.h>
|
|
|
|
#include <DataTypes/DataTypesNumber.h>
|
|
|
|
#include <Storages/System/IStorageSystemOneBlock.h>
|
2015-04-30 12:43:16 +00:00
|
|
|
|
2016-12-08 02:49:04 +00:00
|
|
|
|
2015-04-30 12:43:16 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class Context;
|
2021-02-08 09:14:17 +00:00
|
|
|
class Cluster;
|
2015-04-30 12:43:16 +00:00
|
|
|
|
2016-08-22 20:34:21 +00:00
|
|
|
/** Implements system table 'clusters'
|
|
|
|
* that allows to obtain information about available clusters
|
|
|
|
* (which may be specified in Distributed tables).
|
2015-04-30 12:43:16 +00:00
|
|
|
*/
|
2022-05-03 06:43:28 +00:00
|
|
|
class StorageSystemClusters final : public IStorageSystemOneBlock<StorageSystemClusters>
|
2015-04-30 12:43:16 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-04-01 07:20:54 +00:00
|
|
|
std::string getName() const override { return "SystemClusters"; }
|
|
|
|
|
2018-07-24 14:28:56 +00:00
|
|
|
static NamesAndTypesList getNamesAndTypes();
|
2017-11-04 03:20:18 +00:00
|
|
|
|
2023-08-20 06:47:07 +00:00
|
|
|
static NamesAndAliases getNamesAndAliases();
|
|
|
|
|
2017-11-04 03:20:18 +00:00
|
|
|
protected:
|
2018-07-24 14:28:56 +00:00
|
|
|
using IStorageSystemOneBlock::IStorageSystemOneBlock;
|
2021-02-08 09:14:17 +00:00
|
|
|
using NameAndCluster = std::pair<String, std::shared_ptr<Cluster>>;
|
2018-07-24 14:28:56 +00:00
|
|
|
|
2021-04-10 23:33:54 +00:00
|
|
|
void fillData(MutableColumns & res_columns, ContextPtr context, const SelectQueryInfo & query_info) const override;
|
2023-04-07 16:26:23 +00:00
|
|
|
static void writeCluster(MutableColumns & res_columns, const NameAndCluster & name_and_cluster, const std::vector<UInt8> & is_active);
|
2015-04-30 12:43:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|