Client-side Raft-based proxy implementation of atomic long.
More...
#include <cp.h>
|
| atomic_long (const std::string &name, client::spi::ClientContext &context, const raft_group_id &group_id, const std::string &object_name) |
|
boost::future< int64_t > | add_and_get (int64_t delta) |
| Atomically adds the given value to the current value. More...
|
|
boost::future< bool > | compare_and_set (int64_t expect, int64_t update) |
| Atomically sets the value to the given updated value only if the current value. More...
|
|
boost::future< int64_t > | get_and_decrement () |
| Atomically decrements the current value by one. More...
|
|
boost::future< int64_t > | decrement_and_get () |
| Atomically decrements the current value by one. More...
|
|
boost::future< int64_t > | get () |
| Gets the current value. More...
|
|
boost::future< int64_t > | get_and_add (int64_t delta) |
| Atomically adds the given value to the current value. More...
|
|
boost::future< int64_t > | get_and_set (int64_t new_value) |
| Atomically sets the given value and returns the old value. More...
|
|
boost::future< int64_t > | increment_and_get () |
| Atomically increments the current value by one. More...
|
|
boost::future< int64_t > | get_and_increment () |
| Atomically increments the current value by one. More...
|
|
boost::future< void > | set (int64_t new_value) |
| Atomically sets the given value. More...
|
|
template<typename F > |
boost::future< void > | alter (const F &function) |
| Alters the currently stored value by applying a function on it. More...
|
|
template<typename F > |
boost::future< int64_t > | alter_and_get (const F &function) |
| Alters the currently stored value by applying a function on it and gets the result. More...
|
|
template<typename F > |
boost::future< int64_t > | get_and_alter (const F &function) |
| Alters the currently stored value by applying a function on it on and gets the old value. More...
|
|
template<typename F , typename R > |
boost::future< boost::optional< R > > | apply (const F &function) |
| Applies a function on the value, the actual stored value will not change. More...
|
|
| cp_proxy (const std::string &service_name, const std::string &proxy_name, client::spi::ClientContext *context, const raft_group_id &group_id, const std::string &object_name) |
|
const raft_group_id & | get_group_id () const |
|
|
void | on_destroy () |
|
raft_group_id | group_id_ |
|
std::string | object_name_ |
|
Client-side Raft-based proxy implementation of atomic long.
Definition at line 90 of file cp.h.
◆ add_and_get()
boost::future< int64_t > hazelcast::cp::atomic_long::add_and_get |
( |
int64_t |
delta | ) |
|
Atomically adds the given value to the current value.
- Parameters
-
delta | the value to add to the current value |
- Returns
- the updated value, the given value added to the current value
Definition at line 166 of file cp.cpp.
167 auto request = atomiclong_addandget_encode(group_id_, object_name_, delta);
168 return invoke_and_get_future<int64_t>(request);
◆ alter()
template<typename F >
boost::future<void> hazelcast::cp::atomic_long::alter |
( |
const F & |
function | ) |
|
|
inline |
Alters the currently stored value by applying a function on it.
- Parameters
-
function | the function applied to the currently stored value |
Definition at line 178 of file cp.h.
boost::future< int64_t > alter_and_get(const F &function)
Alters the currently stored value by applying a function on it and gets the result.
◆ alter_and_get()
template<typename F >
boost::future<int64_t> hazelcast::cp::atomic_long::alter_and_get |
( |
const F & |
function | ) |
|
|
inline |
Alters the currently stored value by applying a function on it and gets the result.
- Parameters
-
function | the function applied to the currently stored value |
- Returns
- the new value
Definition at line 190 of file cp.h.
191 auto f = to_data(
function);
192 return alter_data(f, alter_result_type::NEW_VALUE);
◆ apply()
template<typename F , typename R >
boost::future<boost::optional<R> > hazelcast::cp::atomic_long::apply |
( |
const F & |
function | ) |
|
|
inline |
Applies a function on the value, the actual stored value will not change.
- Parameters
-
function | the function applied to the value, the value is not changed |
<R> | the result type of the function |
- Returns
- the result of the function application
Definition at line 217 of file cp.h.
218 auto f = to_data(
function);
219 return to_object<R>(apply_data(f));
◆ compare_and_set()
boost::future< bool > hazelcast::cp::atomic_long::compare_and_set |
( |
int64_t |
expect, |
|
|
int64_t |
update |
|
) |
| |
Atomically sets the value to the given updated value only if the current value.
the expected value.
- Parameters
-
expect | the expected value |
update | the new value |
- Returns
- if successful; or if the actual value was not equal to the expected value.
Definition at line 171 of file cp.cpp.
172 auto request = atomiclong_compareandset_encode(group_id_, object_name_, expect, update);
173 return invoke_and_get_future<bool>(request);
◆ decrement_and_get()
boost::future< int64_t > hazelcast::cp::atomic_long::decrement_and_get |
( |
| ) |
|
Atomically decrements the current value by one.
- Returns
- the updated value, the current value decremented by one
Definition at line 180 of file cp.cpp.
boost::future< int64_t > add_and_get(int64_t delta)
Atomically adds the given value to the current value.
◆ get()
boost::future< int64_t > hazelcast::cp::atomic_long::get |
( |
| ) |
|
Gets the current value.
- Returns
- the current value
Definition at line 184 of file cp.cpp.
185 auto request = atomiclong_get_encode(group_id_, object_name_);
186 return invoke_and_get_future<int64_t>(request);
◆ get_and_add()
boost::future< int64_t > hazelcast::cp::atomic_long::get_and_add |
( |
int64_t |
delta | ) |
|
Atomically adds the given value to the current value.
- Parameters
-
delta | the value to add to the current value |
- Returns
- the old value before the add
Definition at line 189 of file cp.cpp.
190 auto request = atomiclong_getandadd_encode(group_id_, object_name_, delta);
191 return invoke_and_get_future<int64_t>(request);
◆ get_and_alter()
template<typename F >
boost::future<int64_t> hazelcast::cp::atomic_long::get_and_alter |
( |
const F & |
function | ) |
|
|
inline |
Alters the currently stored value by applying a function on it on and gets the old value.
- Parameters
-
function | the function applied to the currently stored value |
- Returns
- the old value
- Since
- 3.2
Definition at line 204 of file cp.h.
205 auto f = to_data(
function);
206 return alter_data(f, alter_result_type::OLD_VALUE);
◆ get_and_decrement()
boost::future< int64_t > hazelcast::cp::atomic_long::get_and_decrement |
( |
| ) |
|
Atomically decrements the current value by one.
- Returns
- the old value.
Definition at line 176 of file cp.cpp.
boost::future< int64_t > get_and_add(int64_t delta)
Atomically adds the given value to the current value.
◆ get_and_increment()
boost::future< int64_t > hazelcast::cp::atomic_long::get_and_increment |
( |
| ) |
|
Atomically increments the current value by one.
- Returns
- the old value
Definition at line 203 of file cp.cpp.
◆ get_and_set()
boost::future< int64_t > hazelcast::cp::atomic_long::get_and_set |
( |
int64_t |
new_value | ) |
|
Atomically sets the given value and returns the old value.
- Parameters
-
- Returns
- the old value
Definition at line 194 of file cp.cpp.
195 auto request = atomiclong_getandset_encode(group_id_, object_name_, new_value);
196 return invoke_and_get_future<int64_t>(request);
◆ increment_and_get()
boost::future< int64_t > hazelcast::cp::atomic_long::increment_and_get |
( |
| ) |
|
Atomically increments the current value by one.
- Returns
- the updated value, the current value incremented by one
Definition at line 199 of file cp.cpp.
◆ set()
boost::future< void > hazelcast::cp::atomic_long::set |
( |
int64_t |
new_value | ) |
|
Atomically sets the given value.
- Parameters
-
Definition at line 207 of file cp.cpp.
boost::future< int64_t > get_and_set(int64_t new_value)
Atomically sets the given value and returns the old value.
The documentation for this class was generated from the following files:
- hazelcast/include/hazelcast/cp/cp.h
- hazelcast/src/hazelcast/cp/cp.cpp