/Users/deen/code/yugabyte-db/src/yb/integration-tests/mini_cluster_base.cc
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright (c) YugaByte, Inc. |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
4 | | // in compliance with the License. You may obtain a copy of the License at |
5 | | // |
6 | | // http://www.apache.org/licenses/LICENSE-2.0 |
7 | | // |
8 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
9 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
10 | | // or implied. See the License for the specific language governing permissions and limitations |
11 | | // under the License. |
12 | | // |
13 | | |
14 | | #include "yb/integration-tests/mini_cluster_base.h" |
15 | | |
16 | | #include "yb/client/client.h" |
17 | | |
18 | | #include "yb/util/net/net_util.h" |
19 | | #include "yb/util/result.h" |
20 | | |
21 | | namespace yb { |
22 | | |
23 | 4 | Result<std::unique_ptr<client::YBClient>> MiniClusterBase::CreateClient(rpc::Messenger* messenger) { |
24 | 4 | client::YBClientBuilder builder; |
25 | 4 | ConfigureClientBuilder(&builder); |
26 | 4 | return builder.Build(messenger); |
27 | 4 | } |
28 | | |
29 | | // Created client will shutdown messenger on client shutdown. |
30 | | Result<std::unique_ptr<client::YBClient>> MiniClusterBase::CreateClient( |
31 | 615 | client::YBClientBuilder* builder) { |
32 | 615 | if (builder == nullptr) { |
33 | 253 | client::YBClientBuilder default_builder; |
34 | 253 | return CreateClient(&default_builder); |
35 | 253 | } |
36 | 362 | ConfigureClientBuilder(builder); |
37 | 362 | return builder->Build(); |
38 | 615 | } |
39 | | |
40 | | // Created client gets messenger ownership and will shutdown messenger on client shutdown. |
41 | | Result<std::unique_ptr<client::YBClient>> MiniClusterBase::CreateClient( |
42 | 0 | std::unique_ptr<rpc::Messenger>&& messenger) { |
43 | 0 | client::YBClientBuilder builder; |
44 | 0 | ConfigureClientBuilder(&builder); |
45 | 0 | return builder.Build(std::move(messenger)); |
46 | 0 | } |
47 | | |
48 | 1.18k | Result<HostPort> MiniClusterBase::GetLeaderMasterBoundRpcAddr() { |
49 | 1.18k | return DoGetLeaderMasterBoundRpcAddr(); |
50 | 1.18k | } |
51 | | |
52 | | } // namespace yb |