Coverage Report

Created: 2026-03-16 16:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/runtime/cdc_client_mgr.h
Line
Count
Source
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 <gen_cpp/internal_service.pb.h>
21
22
#include <atomic>
23
#include <mutex>
24
#include <string>
25
26
#include "common/status.h"
27
28
namespace google::protobuf {
29
class Closure;
30
class RpcController;
31
} // namespace google::protobuf
32
33
namespace doris {
34
35
class CdcClientMgr {
36
public:
37
    CdcClientMgr();
38
    ~CdcClientMgr();
39
40
    void stop();
41
42
    // Request CDC client to handle a request
43
    void request_cdc_client_impl(const PRequestCdcClientRequest* request,
44
                                 PRequestCdcClientResult* result, google::protobuf::Closure* done);
45
46
    Status send_request_to_cdc_client(const std::string& api, const std::string& params_body,
47
                                      std::string* response);
48
49
    Status start_cdc_client(PRequestCdcClientResult* result);
50
51
#ifdef BE_TEST
52
    // For testing only: get current child PID
53
30
    pid_t get_child_pid() const { return _child_pid.load(); }
54
    // For testing only: set child PID directly
55
2
    void set_child_pid_for_test(pid_t pid) { _child_pid.store(pid); }
56
#endif
57
58
private:
59
    std::mutex _start_mutex;
60
    std::atomic<pid_t> _child_pid {0};
61
};
62
63
} // namespace doris