mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 05:32:52 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
50 lines
1.2 KiB
C++
50 lines
1.2 KiB
C++
#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'
|
|
<< "table: " << escape << table << '\n'
|
|
<< "scheme: " << escape << scheme << '\n';
|
|
|
|
}
|
|
|
|
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";
|
|
|
|
if (!in.eof())
|
|
in >> "scheme: " >> escape >> scheme >> "\n";
|
|
else
|
|
scheme = "http";
|
|
}
|
|
|
|
String ReplicatedMergeTreeAddress::toString() const
|
|
{
|
|
WriteBufferFromOwnString out;
|
|
writeText(out);
|
|
return out.str();
|
|
}
|
|
|
|
void ReplicatedMergeTreeAddress::fromString(const String & str)
|
|
{
|
|
ReadBufferFromString in(str);
|
|
readText(in);
|
|
}
|
|
}
|