|
template<typename K , typename V , typename R = V> |
boost::future< boost::optional< R > > | put (const K &key, const V &value, std::chrono::milliseconds ttl) |
|
template<typename K , typename V > |
boost::future< void > | put_all (const std::unordered_map< K, V > &entries) |
| Copies all of the mappings from the specified map to this map (optional operation). More...
|
|
boost::future< boost::uuids::uuid > | add_entry_listener (entry_listener &&listener) |
| Adds an entry listener for this map. More...
|
|
template<typename K > |
std::enable_if<!std::is_base_of< query::predicate, K >::value, boost::future< boost::uuids::uuid > >::type | add_entry_listener (entry_listener &&listener, const K &key) |
| Adds the specified entry listener for the specified key. More...
|
|
template<typename P > |
std::enable_if< std::is_base_of< query::predicate, P >::value, boost::future< boost::uuids::uuid > >::type | add_entry_listener (entry_listener &&listener, const P &predicate) |
| Adds an continuous entry listener for this map. More...
|
|
template<typename K , typename P > |
std::enable_if< std::is_base_of< query::predicate, P >::value, boost::future< boost::uuids::uuid > >::type | add_entry_listener (entry_listener &&listener, const P &predicate, const K &key) |
| Adds an continuous entry listener for this map. More...
|
|
template<typename V > |
boost::future< std::vector< V > > | values () |
| Due to the lazy nature of the returned array, changes to the map (addition, removal, update) might be reflected on the collection. More...
|
|
template<typename K , typename V > |
boost::future< std::vector< std::pair< K, V > > > | entry_set () |
| Returns a view of the mappings contained in this map. More...
|
|
template<typename K > |
boost::future< std::vector< K > > | key_set () |
| Returns a view of the keys contained in this map. More...
|
|
template<typename K > |
boost::future< bool > | contains_key (const K &key) |
|
template<typename V > |
boost::future< bool > | contains_value (const V &value) |
|
template<typename K , typename V > |
boost::future< boost::optional< V > > | get (const K &key) |
|
template<typename K , typename V , typename R = V> |
boost::future< boost::optional< R > > | put (const K &key, const V &value) |
|
template<typename K , typename V > |
boost::future< boost::optional< V > > | remove (const K &key) |
|
A ReplicatedMap is a map-like data structure with weak consistency and values locally stored on every node of the cluster.
Whenever a value is written asynchronously, the new value will be internally distributed to all existing cluster members, and eventually every node will have the new value.
When a new node joins the cluster, the new node initially will request existing values from older nodes and replicate them locally.
Definition at line 46 of file replicated_map.h.
template<typename K >
std::enable_if<!std::is_base_of<query::predicate, K>::value, boost::future<boost::uuids::uuid> >::type hazelcast::client::replicated_map::add_entry_listener |
( |
entry_listener && |
listener, |
|
|
const K & |
key |
|
) |
| |
|
inline |
Adds the specified entry listener for the specified key.
The listener will be notified for all add/remove/update/evict events of the specified key only.
Warning:
This method uses hashCode
and equals
of the binary form of the key
, not the actual implementations of hashCode
.
- Parameters
-
listener | the entry listener to add |
key | the key to listen to |
Definition at line 125 of file replicated_map.h.
127 return proxy::ReplicatedMapImpl::add_entry_listener_to_key(
128 std::shared_ptr<impl::BaseEventHandler>(
129 new EntryEventHandler<
130 protocol::codec::replicatedmap_addentrylistenertokey_handler>(
132 get_context().get_client_cluster_service(),
133 get_context().get_serialization_service(),
135 get_context().get_logger())),
template<typename K , typename P >
std::enable_if<std::is_base_of<query::predicate, P>::value, boost::future<boost::uuids::uuid> >::type hazelcast::client::replicated_map::add_entry_listener |
( |
entry_listener && |
listener, |
|
|
const P & |
predicate, |
|
|
const K & |
key |
|
) |
| |
|
inline |
Adds an continuous entry listener for this map.
The listener will be notified for map add/remove/update/evict events filtered by the given predicate.
- Parameters
-
listener | the entry listener |
predicate | the predicate for filtering entries |
key | the key to listen to |
Definition at line 177 of file replicated_map.h.
181 return proxy::ReplicatedMapImpl::add_entry_listener(
182 std::shared_ptr<impl::BaseEventHandler>(
183 new EntryEventHandler<
185 replicatedmap_addentrylistenertokeywithpredicate_handler>(
187 get_context().get_client_cluster_service(),
188 get_context().get_serialization_service(),
190 get_context().get_logger())),
template<typename K , typename V >
boost::future<std::vector<std::pair<K, V> > > hazelcast::client::replicated_map::entry_set |
( |
| ) |
|
|
inline |
Returns a view of the mappings contained in this map.
Due to the lazy nature of the returned array, changes to the map (addition, removal, update) might be reflected on the array.
Changes on the map are NOT reflected on the set on the CLIENT or vice versa. The order of the elements is not guaranteed due to the internal asynchronous replication behavior.
Changes to any returned object are NOT replicated back to other members.
- Returns
- view of the mappings contained in this map.
Definition at line 227 of file replicated_map.h.
229 return to_entry_object_vector<K, V>(entry_set_data());
template<typename K >
boost::future<std::vector<K> > hazelcast::client::replicated_map::key_set |
( |
| ) |
|
|
inline |
Returns a view of the keys contained in this map.
Due to the lazy nature of the returned array, changes to the map (addition, removal, update) might be reflected on the array.
Changes on the map are NOT reflected on the set on the CLIENT or vice versa. The order of the elements is not guaranteed due to the internal asynchronous replication behavior.
Changes to any returned object are NOT replicated back to other members.
- Returns
- The keys contained in this map.
Definition at line 244 of file replicated_map.h.
246 return to_object_vector<K>(key_set_data());
template<typename K , typename V , typename R = V>
boost::future<boost::optional<R> > hazelcast::client::replicated_map::put |
( |
const K & |
key, |
|
|
const V & |
value, |
|
|
std::chrono::milliseconds |
ttl |
|
) |
| |
|
inline |
Associates a given value to the specified key and replicates it to the cluster. If there is an old value, it will be replaced by the specified one and returned from the call.
In addition, you have to specify a ttl in milliseconds to define when the value is outdated and thus should be removed from the replicated map.
- Parameters
-
key | key with which the specified value is to be associated. |
value | value to be associated with the specified key. |
ttl | ttl to be associated with the specified key-value pair. |
- Returns
- the previous value associated with
key
, or empty
if there was no mapping for key
.
Definition at line 67 of file replicated_map.h.
71 return to_object<R>(put_data(to_data(key), to_data(value), ttl));
template<typename K , typename V >
boost::future<void> hazelcast::client::replicated_map::put_all |
( |
const std::unordered_map< K, V > & |
entries | ) |
|
|
inline |
Copies all of the mappings from the specified map to this map (optional operation).
The effect of this call is equivalent to that of calling put(k, v) on this map once for each mapping from key k
to value v
in the specified map. The behavior of this operation is undefined if the specified map is modified while the operation is in progress.
- Parameters
-
entries | mappings to be stored in this map |
Definition at line 85 of file replicated_map.h.
87 return put_all_data(to_data_entries(entries));
template<typename V >
boost::future<std::vector<V> > hazelcast::client::replicated_map::values |
( |
| ) |
|
|
inline |
Due to the lazy nature of the returned array, changes to the map (addition, removal, update) might be reflected on the collection.
Changes on the map are NOT reflected on the collection on the CLIENT or vice versa. The order of the elements is not guaranteed due to the internal asynchronous replication behavior. If a specific order is needed, use values(Comparator) to force reordering of the elements before returning.
Changes to any returned object are NOT replicated back to other members.
- Returns
- A collection view of the values contained in this map.
Definition at line 210 of file replicated_map.h.
212 return to_object_vector<V>(values_data());