zookeeper-cpp
ZooKeeper Client for C++
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends 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

 package_registry ()
 Create an empty registry. More...
 
registration register_classpath_server (std::string version, classpath packages)
 Register a server that can be created via the specified Java classpath. More...
 
size_type size () const
 How many registrations have been registered? More...
 
bool empty () const
 Is this registry empty? More...
 
optional< classpathfind_newest_classpath () const
 Get the classpath for running the newest registered server version. More...
 
bool unregister_server (registration reg)
 
bool unregister_server (const registration_info &reg)
 

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.

Constructor & Destructor Documentation

zk::server::package_registry::package_registry ( )

Create an empty registry.

Definition at line 25 of file package_registry.cpp.

Member Function Documentation

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

Is this registry empty?

Definition at line 62 of file package_registry.hpp.

optional< classpath > zk::server::package_registry::find_newest_classpath ( ) const

Get the classpath for running the newest registered server version.

Definition at line 66 of file package_registry.cpp.

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

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.
packagesThe 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: