zookeeper-cpp
ZooKeeper Client for C++
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Groups
zk::server::server_group Class Referencefinal

Create and manage a group of server instances on this local machine (most likely in a single ensemble). More...

#include <zk/server/server_group.hpp>

Classes

struct  info
 

Public Member Functions

 server_group () noexcept
 Create an empty server group. More...
 
 server_group (server_group &&) noexcept
 Move-construct a server group. More...
 
server_groupoperator= (server_group &&) noexcept
 Move-assign a server group. More...
 
const std::string & get_connection_string ()
 Get a connection string which can connect to any the servers in the group. More...
 
void start_all_servers (const classpath &packages)
 Start all servers in the group. More...
 
std::size_t size () const
 How many servers are in this group? More...
 

Static Public Member Functions

static server_group make_ensemble (std::size_t size, const configuration &base_settings)
 Create an ensemble of the given size. More...
 

Detailed Description

Create and manage a group of server instances on this local machine (most likely in a single ensemble).

This is exclusively for testing, as running multiple peers on a single machine is a very bad idea in production.

);
servers.start_all_servers();
auto client = zk::client::connect(servers.get_connection_string()).get();
// do things with client...

Definition at line 34 of file server_group.hpp.

Constructor & Destructor Documentation

zk::server::server_group::server_group ( )
noexcept

Create an empty server group.

Definition at line 34 of file server_group.cpp.

zk::server::server_group::server_group ( server_group &&  )
defaultnoexcept

Move-construct a server group.

Member Function Documentation

const std::string & zk::server::server_group::get_connection_string ( )

Get a connection string which can connect to any the servers in the group.

Definition at line 119 of file server_group.cpp.

server_group zk::server::server_group::make_ensemble ( std::size_t  size,
const configuration base_settings 
)
static

Create an ensemble of the given size.

None of the servers will be started.

Parameters
sizeThe size of the ensemble. This should be an odd number.
base_settingsThe basic settings to use for every server.

Definition at line 63 of file server_group.cpp.

server_group & zk::server::server_group::operator= ( server_group &&  src)
noexcept

Move-assign a server group.

Definition at line 39 of file server_group.cpp.

std::size_t zk::server::server_group::size ( ) const
inline

How many servers are in this group?

Definition at line 60 of file server_group.hpp.

void zk::server::server_group::start_all_servers ( const classpath packages)

Start all servers in the group.

Note that this does not wait for the servers to be up-and-running. Use a client instance to check for connectability.

Definition at line 124 of file server_group.cpp.


The documentation for this class was generated from the following files: