zookeeper-cpp
ZooKeeper Client for C++
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Groups
server_group.hpp
1 #pragma once
2 
3 #include <zk/config.hpp>
4 
5 #include <cstdint>
6 #include <map>
7 #include <memory>
8 #include <string>
9 #include <vector>
10 
11 #include "configuration.hpp"
12 
13 namespace zk::server
14 {
15 
20 class classpath;
21 class server;
22 
34 class server_group final
35 {
36 public:
38  server_group() noexcept;
39 
41  server_group(server_group&&) noexcept;
42 
44  server_group& operator=(server_group&&) noexcept;
45 
50  static server_group make_ensemble(std::size_t size, const configuration& base_settings);
51 
53  const std::string& get_connection_string();
54 
57  void start_all_servers(const classpath& packages);
58 
60  std::size_t size() const { return _servers.size(); }
61 
62 private:
63  struct info;
64 
65  using server_map_type = std::map<server_id, std::shared_ptr<info>>;
66 
67 private:
68  server_map_type _servers;
69  std::string _conn_string;
70 };
71 
73 
74 }
Create and manage a group of server instances on this local machine (most likely in a single ensemble...
Represents a collection of JARs or other Java entities that should be provided as the --classpath to ...
Definition: classpath.hpp:18
const std::string & get_connection_string()
Get a connection string which can connect to any the servers in the group.
void start_all_servers(const classpath &packages)
Start all servers in the group.
std::size_t size() const
How many servers are in this group?
Represents a configuration which should be run by server instance.
server_group() noexcept
Create an empty server group.
static server_group make_ensemble(std::size_t size, const configuration &base_settings)
Create an ensemble of the given size.
server_group & operator=(server_group &&) noexcept
Move-assign a server group.