22 #ifndef Hypertable_Master_RangeServerConnectionManager_h
23 #define Hypertable_Master_RangeServerConnectionManager_h
31 #include <boost/multi_index_container.hpp>
32 #include <boost/multi_index/hashed_index.hpp>
33 #include <boost/multi_index/mem_fun.hpp>
34 #include <boost/multi_index/sequenced_index.hpp>
35 #include <boost/multi_index/member.hpp>
37 #include <condition_variable>
72 bool is_connected(
const String &location);
78 void set_servers_balanced(
const std::vector<RangeServerConnectionPtr> &servers);
79 bool exist_unbalanced_servers();
80 size_t server_count();
81 void get_servers(std::vector<RangeServerConnectionPtr> &servers);
82 void get_valid_connections(
StringSet &locations,
83 std::vector<RangeServerConnectionPtr> &connections);
84 size_t connection_count() { std::lock_guard<std::mutex> lock(m_mutex);
return m_conn_count; }
85 void set_range_server_state(std::vector<RangeServerState> &states);
106 return (std::size_t)(addr.sin_addr.s_addr ^ addr.sin_port);
110 typedef boost::multi_index_container<
111 RangeServerConnectionEntry,
114 hashed_unique<const_mem_fun<RangeServerConnectionEntry,
const String&,
115 &RangeServerConnectionEntry::location> >,
116 hashed_non_unique<const_mem_fun<RangeServerConnectionEntry,
const String&,
117 &RangeServerConnectionEntry::hostname> >,
118 hashed_unique<const_mem_fun<RangeServerConnectionEntry,
InetAddr,
119 &RangeServerConnectionEntry::public_addr>, InetAddrHash>,
120 hashed_non_unique<const_mem_fun<RangeServerConnectionEntry, InetAddr,
121 &RangeServerConnectionEntry::local_addr>, InetAddrHash>
125 typedef ConnectionList::nth_index<0>::type
Sequence;
138 size_t m_conn_count {};
139 int32_t m_disk_threshold {};
146 #endif // Hypertable_Master_RangeServerConnectionManager_h
std::set< String > StringSet
STL Set managing Strings.
std::map< String, uint64_t > HandleMap
ConnectionList::nth_index< 1 >::type LocationIndex
bool next_available_server(ContextPtr &context, String &location, bool urgent)
Gets name of next available server.
std::shared_ptr< RangeServerConnection > RangeServerConnectionPtr
std::string String
A String is simply a typedef to std::string.
std::size_t operator()(InetAddr addr) const
InetAddr local_addr() const
std::mutex m_mutex
Mutex for serializing member access
InetAddr public_addr() const
boost::multi_index_container< RangeServerConnectionEntry, indexed_by< sequenced<>, hashed_unique< const_mem_fun< RangeServerConnectionEntry, const String &,&RangeServerConnectionEntry::location > >, hashed_non_unique< const_mem_fun< RangeServerConnectionEntry, const String &,&RangeServerConnectionEntry::hostname > >, hashed_unique< const_mem_fun< RangeServerConnectionEntry, InetAddr,&RangeServerConnectionEntry::public_addr >, InetAddrHash >, hashed_non_unique< const_mem_fun< RangeServerConnectionEntry, InetAddr,&RangeServerConnectionEntry::local_addr >, InetAddrHash > > > ConnectionList
ConnectionList::iterator m_connections_iter
const String & hostname() const
Encapsulate an internet address.
ConnectionList::nth_index< 0 >::type Sequence
const String & location() const
RangeServerConnectionEntry(RangeServerConnectionPtr &_rsc)
ConnectionList::nth_index< 2 >::type HostnameIndex
ConnectionList::nth_index< 3 >::type PublicAddrIndex
size_t connection_count()
ConnectionList::nth_index< 4 >::type LocalAddrIndex
std::shared_ptr< RangeServerConnectionManager > RangeServerConnectionManagerPtr
ConnectionList m_connections
RangeServerConnectionPtr rsc
String extensions and helpers: sets, maps, append operators etc.