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

The package registry tracks configuration of classpaths and JARs needed to run various ZooKeeper versions. More...

#include <zk/server/package_registry.hpp>

Classes

struct  registration_info
 

Public Types

using size_type = std::size_t
 
using registration = std::shared_ptr< registration_info >
 

Public Member Functions

registration register_classpath_server (std::string version, std::string classpath)
 Register a server that can be created via the specified Java classpath. More...
 
bool unregister_server (registration reg)
 Attempt to unregister the server associated with the provided registration. More...
 
bool unregister_server (const registration_info &reg)
 
size_type size () const
 How many registrations have been registered? More...
 
bool empty () const
 Is this registry empty? More...
 
optional< std::string > find_newest_classpath () const
 Get the classpath for running the newest registered server version. More...
 

Detailed Description

The package registry tracks configuration of classpaths and JARs needed to run various ZooKeeper versions.

Note
{Thread Safety} Registering and unregistering configurations is thread-safe. However, it is not safe when a package_registry is being destroyed.

Definition at line 25 of file package_registry.hpp.

Member Function Documentation

bool zk::server::package_registry::empty ( ) const
inline

Is this registry empty?

Definition at line 61 of file package_registry.hpp.

optional< std::string > zk::server::package_registry::find_newest_classpath ( ) const

Get the classpath for running the newest registered server version.

Warning
This function is nonsense and will be deprecated. The concept is fine, but returning an std::string as a classpath is terrible. It should be replaced by a dedicated run_settings class.

Definition at line 66 of file package_registry.cpp.

package_registry::registration zk::server::package_registry::register_classpath_server ( std::string  version,
std::string  classpath 
)

Register a server that can be created via the specified Java classpath.

Parameters
versionA version string used to look up the server when creating them. While this can be a lie, it should not be.
classpathThe Java classpath used to run the server. This will be the cp argument to Java.
Returns
a registration that can be used to unregister_server.
Exceptions
std::invalid_argumentif version is already registered.

Definition at line 35 of file package_registry.cpp.

package_registry::size_type zk::server::package_registry::size ( ) const

How many registrations have been registered?

Definition at line 60 of file package_registry.cpp.

bool zk::server::package_registry::unregister_server ( registration  reg)

Attempt to unregister the server associated with the provided registration.

Unregistering will prevent future servers from being created with the particular setup, but will not teardown servers which might be running with it.

Returns
true if this call removed anything; false if otherwise.

Definition at line 52 of file package_registry.cpp.


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