Coverage Report

Created: 2024-11-21 21:13

/root/doris/be/src/olap/binlog_config.cpp
Line
Count
Source (jump to first uncovered line)
1
// Licensed to the Apache Software Foundation (ASF) under one
2
// or more contributor license agreements.  See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership.  The ASF licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License.  You may obtain a copy of the License at
8
//
9
//   http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied.  See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
#include "olap/binlog_config.h"
19
20
#include <fmt/format.h>
21
22
#include "gen_cpp/AgentService_types.h"
23
#include "gen_cpp/olap_file.pb.h"
24
25
namespace doris {
26
0
BinlogConfig& BinlogConfig::operator=(const TBinlogConfig& config) {
27
0
    if (config.__isset.enable) {
28
0
        _enable = config.enable;
29
0
    }
30
0
    if (config.__isset.ttl_seconds) {
31
0
        _ttl_seconds = config.ttl_seconds;
32
0
    }
33
0
    if (config.__isset.max_bytes) {
34
0
        _max_bytes = config.max_bytes;
35
0
    }
36
0
    if (config.__isset.max_history_nums) {
37
0
        _max_history_nums = config.max_history_nums;
38
0
    }
39
0
    return *this;
40
0
}
41
42
56
BinlogConfig& BinlogConfig::operator=(const BinlogConfigPB& config) {
43
56
    if (config.has_enable()) {
44
56
        _enable = config.enable();
45
56
    }
46
56
    if (config.has_ttl_seconds()) {
47
56
        _ttl_seconds = config.ttl_seconds();
48
56
    }
49
56
    if (config.has_max_bytes()) {
50
56
        _max_bytes = config.max_bytes();
51
56
    }
52
56
    if (config.has_max_history_nums()) {
53
56
        _max_history_nums = config.max_history_nums();
54
56
    }
55
56
    return *this;
56
56
}
57
58
180
void BinlogConfig::to_pb(BinlogConfigPB* config_pb) const {
59
180
    config_pb->set_enable(_enable);
60
180
    config_pb->set_ttl_seconds(_ttl_seconds);
61
180
    config_pb->set_max_bytes(_max_bytes);
62
180
    config_pb->set_max_history_nums(_max_history_nums);
63
180
}
64
65
0
std::string BinlogConfig::to_string() const {
66
0
    return fmt::format(
67
0
            "BinlogConfig enable: {}, ttl_seconds: {}, max_bytes: {}, max_history_nums: {}",
68
0
            _enable, _ttl_seconds, _max_bytes, _max_history_nums);
69
0
}
70
71
} // namespace doris