2018-04-17 17:59:42 +00:00
|
|
|
#include "ReplicatedMergeTreeAddress.h"
|
|
|
|
#include <IO/ReadBufferFromString.h>
|
|
|
|
#include <IO/WriteBufferFromString.h>
|
|
|
|
#include <IO/Operators.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
void ReplicatedMergeTreeAddress::writeText(WriteBuffer & out) const
|
|
|
|
{
|
|
|
|
out
|
|
|
|
<< "host: " << escape << host << '\n'
|
|
|
|
<< "port: " << replication_port << '\n'
|
|
|
|
<< "tcp_port: " << queries_port << '\n'
|
|
|
|
<< "database: " << escape << database << '\n'
|
2018-07-31 10:34:35 +00:00
|
|
|
<< "table: " << escape << table << '\n'
|
|
|
|
<< "scheme: " << escape << scheme << '\n';
|
|
|
|
|
2018-04-17 17:59:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ReplicatedMergeTreeAddress::readText(ReadBuffer & in)
|
|
|
|
{
|
|
|
|
in
|
|
|
|
>> "host: " >> escape >> host >> "\n"
|
|
|
|
>> "port: " >> replication_port >> "\n"
|
|
|
|
>> "tcp_port: " >> queries_port >> "\n"
|
|
|
|
>> "database: " >> escape >> database >> "\n"
|
|
|
|
>> "table: " >> escape >> table >> "\n";
|
2018-07-31 10:34:35 +00:00
|
|
|
|
|
|
|
if (!in.eof())
|
|
|
|
in >> "scheme: " >> escape >> scheme >> "\n";
|
|
|
|
else
|
|
|
|
scheme = "http";
|
2018-04-17 17:59:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
String ReplicatedMergeTreeAddress::toString() const
|
|
|
|
{
|
|
|
|
WriteBufferFromOwnString out;
|
|
|
|
writeText(out);
|
|
|
|
return out.str();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ReplicatedMergeTreeAddress::fromString(const String & str)
|
|
|
|
{
|
|
|
|
ReadBufferFromString in(str);
|
|
|
|
readText(in);
|
|
|
|
}
|
|
|
|
}
|