2020-07-20 09:57:17 +00:00
|
|
|
#include <Core/BaseSettings.h>
|
|
|
|
#include <IO/ReadHelpers.h>
|
|
|
|
#include <IO/WriteHelpers.h>
|
2022-04-27 15:05:45 +00:00
|
|
|
#include <Common/logger_useful.h>
|
2020-07-20 09:57:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
namespace ErrorCodes
|
|
|
|
{
|
|
|
|
extern const int UNKNOWN_SETTING;
|
|
|
|
}
|
|
|
|
|
2022-07-14 16:11:35 +00:00
|
|
|
void BaseSettingsHelpers::writeString(std::string_view str, WriteBuffer & out)
|
2020-07-20 09:57:17 +00:00
|
|
|
{
|
|
|
|
writeStringBinary(str, out);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String BaseSettingsHelpers::readString(ReadBuffer & in)
|
|
|
|
{
|
|
|
|
String str;
|
|
|
|
readStringBinary(str, in);
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void BaseSettingsHelpers::writeFlags(Flags flags, WriteBuffer & out)
|
|
|
|
{
|
|
|
|
writeVarUInt(flags, out);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BaseSettingsHelpers::Flags BaseSettingsHelpers::readFlags(ReadBuffer & in)
|
|
|
|
{
|
|
|
|
UInt64 res;
|
|
|
|
readVarUInt(res, in);
|
|
|
|
return static_cast<Flags>(res);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-07-14 16:11:35 +00:00
|
|
|
void BaseSettingsHelpers::throwSettingNotFound(std::string_view name)
|
2020-07-20 09:57:17 +00:00
|
|
|
{
|
|
|
|
throw Exception("Unknown setting " + String{name}, ErrorCodes::UNKNOWN_SETTING);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-07-14 16:11:35 +00:00
|
|
|
void BaseSettingsHelpers::warningSettingNotFound(std::string_view name)
|
2020-07-20 09:57:17 +00:00
|
|
|
{
|
|
|
|
static auto * log = &Poco::Logger::get("Settings");
|
|
|
|
LOG_WARNING(log, "Unknown setting {}, skipping", name);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|