Coverage Report

Created: 2024-11-20 21:49

/root/doris/be/src/olap/binlog_config.h
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
#pragma once
19
20
#include <cstdint>
21
#include <limits>
22
#include <string>
23
24
namespace doris {
25
26
class TBinlogConfig;
27
class BinlogConfigPB;
28
29
class BinlogConfig {
30
public:
31
345
    BinlogConfig() = default;
32
    BinlogConfig(bool enable, int64_t ttl_seconds, int64_t max_bytes, int64_t max_history_nums)
33
            : _enable(enable),
34
              _ttl_seconds(ttl_seconds),
35
              _max_bytes(max_bytes),
36
0
              _max_history_nums(max_history_nums) {}
37
    BinlogConfig(const BinlogConfig&) = default;
38
    BinlogConfig& operator=(const BinlogConfig&) = default;
39
    BinlogConfig(BinlogConfig&&) = default;
40
    BinlogConfig& operator=(BinlogConfig&&) = default;
41
    ~BinlogConfig() = default;
42
43
0
    bool is_enable() const { return _enable; }
44
0
    void set_enable(bool enable) { _enable = enable; }
45
46
0
    int64_t ttl_seconds() const { return _ttl_seconds; }
47
0
    void set_ttl_seconds(int64_t ttl_seconds) { _ttl_seconds = ttl_seconds; }
48
49
0
    int64_t max_bytes() const { return _max_bytes; }
50
0
    void set_max_bytes(int64_t max_bytes) { _max_bytes = max_bytes; }
51
52
0
    int64_t max_history_nums() const { return _max_history_nums; }
53
0
    void set_max_history_nums(int64_t max_history_nums) { _max_history_nums = max_history_nums; }
54
55
    BinlogConfig& operator=(const TBinlogConfig& config);
56
    BinlogConfig& operator=(const BinlogConfigPB& config);
57
58
    void to_pb(BinlogConfigPB* config_pb) const;
59
    std::string to_string() const;
60
61
private:
62
    bool _enable {false};
63
    int64_t _ttl_seconds {std::numeric_limits<int64_t>::max()};
64
    int64_t _max_bytes {std::numeric_limits<int64_t>::max()};
65
    int64_t _max_history_nums {std::numeric_limits<int64_t>::max()};
66
};
67
68
} // namespace doris