blob: d0f4b50fa344d8f73e02c7f53e8358b4a76e0bde (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#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);
}
}
|