OmniSciDB  ca0c39ec8f
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LeafHostInfo.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /*
18  * @file LeafHostInfo.h
19  * @brief Information about leaf nodes and utilities to parse a cluster configuration
20  * file.
21  *
22  */
23 
24 #ifndef LEAFHOSTINFO_H
25 #define LEAFHOSTINFO_H
26 
27 #include <string>
28 #include <vector>
29 
30 enum class NodeRole { NA };
31 
32 class LeafHostInfo {
33  public:
34  LeafHostInfo(const std::string& host, const uint16_t port, const NodeRole role) {}
35 
36  const std::string& getHost() const { return host_; }
37 
38  uint16_t getPort() const { return port_; }
39 
40  NodeRole getRole() const { return role_; }
41 
42  unsigned getConnectTimeout(unsigned connect_timeout) { return 0; }
43  unsigned getRecvTimeout(unsigned recv_timeout) { return 0; }
44  unsigned getSendTimeout() { return 0; }
45  std::string& getSSLCertFile() { return host_; }
46  static std::vector<LeafHostInfo> parseClusterConfig(const std::string& file_path,
47  const unsigned connect_timeout,
48  const unsigned recv_timeout,
49  const unsigned send_timeout,
50  const std::string& ca_cert) {
51  return std::vector<LeafHostInfo>{};
52  };
53 
54  private:
55  std::string host_;
56  uint16_t port_;
58 };
59 
60 #endif // LEAFHOSTINFO_H
unsigned connect_timeout
NodeRole
Definition: LeafHostInfo.h:30
unsigned getConnectTimeout(unsigned connect_timeout)
Definition: LeafHostInfo.h:42
LeafHostInfo(const std::string &host, const uint16_t port, const NodeRole role)
Definition: LeafHostInfo.h:34
unsigned getSendTimeout()
Definition: LeafHostInfo.h:44
unsigned send_timeout
uint16_t port_
Definition: LeafHostInfo.h:56
const std::string & getHost() const
Definition: LeafHostInfo.h:36
std::string & getSSLCertFile()
Definition: LeafHostInfo.h:45
uint16_t getPort() const
Definition: LeafHostInfo.h:38
NodeRole getRole() const
Definition: LeafHostInfo.h:40
static std::vector< LeafHostInfo > parseClusterConfig(const std::string &file_path, const unsigned connect_timeout, const unsigned recv_timeout, const unsigned send_timeout, const std::string &ca_cert)
Definition: LeafHostInfo.h:46
std::string host_
Definition: LeafHostInfo.h:52
unsigned recv_timeout
unsigned getRecvTimeout(unsigned recv_timeout)
Definition: LeafHostInfo.h:43
NodeRole role_
Definition: LeafHostInfo.h:57