Hazelcast C++ Client
Hazelcast C++ Client Library
hazelcast::cp::cp_subsystem Class Reference

CP Subsystem is a component of Hazelcast that builds a strongly consistent layer for a set of distributed data structures. More...

#include <cp.h>

Public Member Functions

boost::future< std::shared_ptr< atomic_long > > get_atomic_long (const std::string &name)
 Returns a proxy for an atomic_long instance created on CP Subsystem. More...
 
boost::future< std::shared_ptr< atomic_reference > > get_atomic_reference (const std::string &name)
 Returns a proxy for an atomic_reference instance created on CP Subsystem. More...
 
boost::future< std::shared_ptr< latch > > get_latch (const std::string &name)
 Returns a proxy for an count_down_latch instance created on CP Subsystem. More...
 
boost::future< std::shared_ptr< fenced_lock > > get_lock (const std::string &name)
 Returns a proxy for an fenced_lock instance created on CP Subsystem. More...
 
boost::future< std::shared_ptr< counting_semaphore > > get_semaphore (const std::string &name)
 Returns a proxy for an semaphore instance created on CP Subsystem. More...
 

Detailed Description

CP Subsystem is a component of Hazelcast that builds a strongly consistent layer for a set of distributed data structures.

Its APIs can be used for implementing distributed coordination use cases, such as leader election, distributed locking, synchronization, and metadata management. It is accessed via hazelcast_client::get_cp_subsystem. Its data structures are CP with respect to the CAP principle, i.e., they always maintain linearizability and prefer consistency over availability during network partitions. Besides network partitions, CP Subsystem withstands server and client failures.

Definition at line 1300 of file cp.h.

Member Function Documentation

◆ get_atomic_long()

boost::future< std::shared_ptr< atomic_long > > hazelcast::cp::cp_subsystem::get_atomic_long ( const std::string &  name)

Returns a proxy for an atomic_long instance created on CP Subsystem.

Hazelcast's atomic_long is a distributed version of java.util.concurrent.atomic.AtomicLong. If no group name is given within the "name" parameter, then the atomic_long instance will be created on the DEFAULT CP group. If a group name is given, like cp_subsystem::get_atomic_long("myint64_t@group1"), the given group will be initialized first, if not initialized already, and then the atomic_long instance will be created on this group. Returned atomic_long instance offers linearizability and behaves as a CP register. When a network partition occurs, proxies that exist on the minority side of its CP group lose availability.

Each call of this method performs a commit to the METADATA CP group. Hence, callers should cache the returned proxy.

Parameters
namename of the atomic_long proxy
Returns
atomic_long proxy for the given name
Exceptions
hazelcast_if CP Subsystem is not enabled

Definition at line 125 of file cp.cpp.

125  {
126  return proxy_factory_.create_proxy<atomic_long>(name);
127  }

◆ get_atomic_reference()

boost::future< std::shared_ptr< atomic_reference > > hazelcast::cp::cp_subsystem::get_atomic_reference ( const std::string &  name)

Returns a proxy for an atomic_reference instance created on CP Subsystem.

Hazelcast's atomic_reference is a distributed version of java.util.concurrent.atomic.AtomicLong. If no group name is given within the "name" parameter, then the atomic_reference instance will be created on the DEFAULT CP group. If a group name is given, like cp_subsystem::get_atomic_reference("myRef@group1"), the given group will be initialized first, if not initialized already, and then the atomic_reference instance will be created on this group. Returned atomic_reference instance offers linearizability and behaves as a CP register. When a network partition occurs, proxies that exist on the minority side of its CP group lose availability.

Each call of this method performs a commit to the METADATA CP group. Hence, callers should cache the returned proxy.

Parameters
namename of the atomic_reference proxy
<E>the type of object referred to by the reference
Returns
atomic_reference proxy for the given name
Exceptions
hazelcast_if CP Subsystem is not enabled

Definition at line 129 of file cp.cpp.

129  {
130  return proxy_factory_.create_proxy<atomic_reference>(name);
131  }

◆ get_latch()

boost::future< std::shared_ptr< latch > > hazelcast::cp::cp_subsystem::get_latch ( const std::string &  name)

Returns a proxy for an count_down_latch instance created on CP Subsystem.

Hazelcast's count_down_latch is a distributed version of java.util.concurrent.CountDownLatch. If no group name is given within the "name" parameter, then the count_down_latch instance will be created on the DEFAULT CP group. If a group name is given, like cp_subsystem::get_atomic_reference("myLatch@group1"), the given group will be initialized first, if not initialized already, and then the count_down_latch instance will be created on this group. Returned count_down_latch instance offers linearizability. When a network partition occurs, proxies that exist on the minority side of its CP group lose availability.

Each call of this method performs a commit to the METADATA CP group. Hence, callers should cache the returned proxy.

Parameters
namename of the count_down_latch proxy
Returns
count_down_latch proxy for the given name
Exceptions
hazelcast_if CP Subsystem is not enabled

Definition at line 133 of file cp.cpp.

133  {
134  return proxy_factory_.create_proxy<latch>(name);
135  }

◆ get_lock()

boost::future< std::shared_ptr< fenced_lock > > hazelcast::cp::cp_subsystem::get_lock ( const std::string &  name)

Returns a proxy for an fenced_lock instance created on CP Subsystem.

Hazelcast's fenced_lock is a distributed version of java.util.concurrent.locks.Lock. If no group name is given within the "name" parameter, then the fenced_lock instance will be created on the DEFAULT CP group. If a group name is given, like cp_subsystem::get_atomic_reference("myLock@group1"), the given group will be initialized first, if not initialized already, and then the fenced_lock instance will be created on this group. Returned fenced_lock instance offers linearizability. When a network partition occurs, proxies that exist on the minority side of its CP group lose availability.

Each call of this method performs a commit to the METADATA CP group. Hence, callers should cache the returned proxy.

Parameters
namename of the fenced_lock proxy
Returns
fenced_lock proxy for the given name
Exceptions
hazelcast_if CP Subsystem is not enabled

Definition at line 137 of file cp.cpp.

137  {
138  return proxy_factory_.create_proxy<fenced_lock>(name);
139  }

◆ get_semaphore()

boost::future< std::shared_ptr< counting_semaphore > > hazelcast::cp::cp_subsystem::get_semaphore ( const std::string &  name)

Returns a proxy for an semaphore instance created on CP Subsystem.

Hazelcast's semaphore is a distributed version of java.util.concurrent.Semaphore. If no group name is given within the "name" parameter, then the semaphore instance will be created on the DEFAULT CP group. If a group name is given, like cp_subsystem::get_semaphore("mySemaphore@group1"), the given group will be initialized first, if not initialized already, and then the semaphore instance will be created on this group. Returned semaphore instance offers linearizability. When a network partition occurs, proxies that exist on the minority side of its CP group lose availability.

Each call of this method performs a commit to the METADATA CP group. Hence, callers should cache the returned proxy.

Parameters
namename of the semaphore proxy
Returns
semaphore proxy for the given name
Exceptions
hazelcast_if CP Subsystem is not enabled

Definition at line 141 of file cp.cpp.

141  {
142  return proxy_factory_.create_proxy<counting_semaphore>(name);
143  }

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