OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LeafHostInfo.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 MapD Technologies, 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  * @author Alex Suhan <alex@mapd.com>
20  * @brief Information about leaf nodes and utilities to parse a cluster configuration
21  * file.
22  *
23  * Copyright (c) 2016 MapD Technologies, Inc. All rights reserved.
24  */
25 
26 #ifndef LEAFHOSTINFO_H
27 #define LEAFHOSTINFO_H
28 
29 #include <string>
30 #include <vector>
31 
32 enum class NodeRole { NA };
33 
34 class LeafHostInfo {
35  public:
36  LeafHostInfo(const std::string& host, const uint16_t port, const NodeRole role) {}
37 
38  const std::string& getHost() const { return host_; }
39 
40  uint16_t getPort() const { return port_; }
41 
42  NodeRole getRole() const { return role_; }
43 
44  unsigned getConnectTimeout(unsigned connect_timeout) { return 0; }
45  unsigned getRecvTimeout(unsigned recv_timeout) { return 0; }
46  unsigned getSendTimeout() { return 0; }
47  std::string& getSSLCertFile() { return host_; }
48  static std::vector<LeafHostInfo> parseClusterConfig(const std::string& file_path,
49  const unsigned connect_timeout,
50  const unsigned recv_timeout,
51  const unsigned send_timeout,
52  const std::string& ca_cert) {
53  return std::vector<LeafHostInfo>{};
54  };
55 
56  private:
57  std::string host_;
58  uint16_t port_;
60 };
61 
62 #endif // LEAFHOSTINFO_H
NodeRole
Definition: LeafHostInfo.h:32
unsigned getConnectTimeout(unsigned connect_timeout)
Definition: LeafHostInfo.h:44
LeafHostInfo(const std::string &host, const uint16_t port, const NodeRole role)
Definition: LeafHostInfo.h:36
unsigned getSendTimeout()
Definition: LeafHostInfo.h:46
unsigned connect_timeout
Definition: MapDServer.cpp:70
uint16_t port_
Definition: LeafHostInfo.h:58
const std::string & getHost() const
Definition: LeafHostInfo.h:38
std::string & getSSLCertFile()
Definition: LeafHostInfo.h:47
uint16_t getPort() const
Definition: LeafHostInfo.h:40
NodeRole getRole() const
Definition: LeafHostInfo.h:42
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:48
std::string host_
Definition: LeafHostInfo.h:54
unsigned send_timeout
Definition: MapDServer.cpp:72
unsigned getRecvTimeout(unsigned recv_timeout)
Definition: LeafHostInfo.h:45
unsigned recv_timeout
Definition: MapDServer.cpp:71
NodeRole role_
Definition: LeafHostInfo.h:59