ClickHouse/src/Server/CloudPlacementInfo.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
801 B
C++
Raw Normal View History

2024-02-13 09:40:20 +00:00
#pragma once
#include <string>
#include <boost/core/noncopyable.hpp>
#include <Poco/Util/AbstractConfiguration.h>
#include <Common/Logger.h>
namespace DB
{
namespace PlacementInfo
{
static constexpr auto PLACEMENT_CONFIG_PREFIX = "placement";
static constexpr auto DEFAULT_AZ_FILE_PATH = "/run/instance-metadata/node-zone";
/// A singleton providing information on where in cloud server is running.
class PlacementInfo : private boost::noncopyable
{
public:
2024-02-14 11:51:14 +00:00
static PlacementInfo & instance();
2024-02-13 09:40:20 +00:00
void initialize(const Poco::Util::AbstractConfiguration & config);
std::string getAvailabilityZone() const;
private:
PlacementInfo() = default;
LoggerPtr log = getLogger("CloudPlacementInfo");
bool initialized;
bool use_imds;
std::string availability_zone;
};
}
}