![]() |
Hazelcast C++ Client
Hazelcast C++ Client Library
|
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... | |
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.
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.
name | name of the atomic_long proxy |
hazelcast_ | if CP Subsystem is not enabled |
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.
name | name of the atomic_reference proxy |
<E> | the type of object referred to by the reference |
hazelcast_ | if CP Subsystem is not enabled |
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.
name | name of the count_down_latch proxy |
hazelcast_ | if CP Subsystem is not enabled |
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.
name | name of the fenced_lock proxy |
hazelcast_ | if CP Subsystem is not enabled |
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.
name | name of the semaphore proxy |
hazelcast_ | if CP Subsystem is not enabled |