18 #include "hazelcast/client/proxy/MultiMapImpl.h"
19 #include "hazelcast/client/impl/EntryEventHandler.h"
20 #include "hazelcast/client/protocol/codec/codecs.h"
21 #include "hazelcast/client/spi/ClientContext.h"
31 class HAZELCAST_API
multi_map :
public proxy::MultiMapImpl
33 friend class spi::ProxyManager;
36 static constexpr
const char* SERVICE_NAME =
"hz:impl:multiMapService";
47 template<
typename K,
typename V>
48 boost::future<bool>
put(
const K& key,
const V& value)
50 return proxy::MultiMapImpl::put(to_data(key), to_data(value));
59 template<
typename K,
typename V>
60 boost::future<std::vector<V>>
get(
const K& key)
62 return to_object_vector<V>(proxy::MultiMapImpl::get_data(to_data(key)));
73 template<
typename K,
typename V>
74 boost::future<bool>
remove(
const K& key,
const V& value)
76 return proxy::MultiMapImpl::remove(to_data(key), to_data(value));
87 template<
typename K,
typename V>
88 boost::future<std::vector<V>>
remove(
const K& key)
90 return to_object_vector<V>(
91 proxy::MultiMapImpl::remove_data(to_data(key)));
103 return to_object_vector<K>(proxy::MultiMapImpl::key_set_data());
115 return to_object_vector<V>(proxy::MultiMapImpl::values_data());
124 template<
typename K,
typename V>
127 return to_entry_object_vector<K, V>(
128 proxy::MultiMapImpl::entry_set_data());
141 return proxy::MultiMapImpl::contains_key(to_data(key));
154 return proxy::MultiMapImpl::contains_value(to_data(value));
165 template<
typename K,
typename V>
168 return proxy::MultiMapImpl::contains_entry(to_data(key),
182 return proxy::MultiMapImpl::value_count(to_data(key));
203 return proxy::MultiMapImpl::add_entry_listener(
204 std::unique_ptr<impl::BaseEventHandler>(
205 new impl::EntryEventHandler<
206 protocol::codec::multimap_addentrylistener_handler>(
208 get_context().get_client_cluster_service(),
209 get_context().get_serialization_service(),
212 get_context().get_logger())),
238 return proxy::MultiMapImpl::add_entry_listener(
239 std::shared_ptr<impl::BaseEventHandler>(
240 new impl::EntryEventHandler<
241 protocol::codec::multimap_addentrylistenertokey_handler>(
243 get_context().get_client_cluster_service(),
244 get_context().get_serialization_service(),
247 get_context().get_logger())),
268 boost::future<void>
lock(
const K& key)
270 return proxy::MultiMapImpl::lock(to_data(key));
290 boost::future<void>
lock(
const K& key, std::chrono::milliseconds lease_time)
292 return proxy::MultiMapImpl::lock(to_data(key), lease_time);
305 return proxy::MultiMapImpl::is_locked(to_data(key));
320 return proxy::MultiMapImpl::try_lock(to_data(key));
341 std::chrono::milliseconds timeout)
343 return proxy::MultiMapImpl::try_lock(to_data(key), timeout);
365 std::chrono::milliseconds timeout,
366 std::chrono::milliseconds lease_time)
368 return proxy::MultiMapImpl::try_lock(to_data(key), timeout, lease_time);
381 return proxy::MultiMapImpl::unlock(to_data(key));
393 return proxy::MultiMapImpl::force_unlock(to_data(key));
397 multi_map(
const std::string& instance_name, spi::ClientContext* context)
398 : proxy::MultiMapImpl(instance_name, context)
Map entry listener to get notified when a map entry is added, removed, updated, evicted,...
A specialized distributed map client whose keys can be associated with multiple values.
boost::future< bool > try_lock(const K &key)
Tries to acquire the lock for the specified key.
boost::future< bool > remove(const K &key, const V &value)
Removes the given key value pair from the multimap.
boost::future< bool > contains_entry(const K &key, const V &value)
Returns whether the multimap contains the given key-value pair.
boost::future< bool > contains_key(const K &key)
Returns whether the multimap contains an entry with the key.
boost::future< std::vector< std::pair< K, V > > > entry_set()
Returns the set of key-value pairs in the multimap.
boost::future< std::vector< V > > values()
Returns the multimap of values in the multimap.
boost::future< bool > is_locked(const K &key)
Checks the lock for the specified key.
boost::future< boost::uuids::uuid > add_entry_listener(entry_listener &&listener, bool include_value)
Adds an entry listener for this multimap.
boost::future< void > force_unlock(const K &key)
Releases the lock for the specified key regardless of the lock owner.
boost::future< bool > try_lock(const K &key, std::chrono::milliseconds timeout)
Tries to acquire the lock for the specified key.
boost::future< void > unlock(const K &key)
Releases the lock for the specified key.
boost::future< std::vector< K > > key_set()
Returns the set of keys in the multimap.
boost::future< std::vector< V > > remove(const K &key)
Removes all the entries with the given key.
boost::future< bool > contains_value(const V &value)
Returns whether the multimap contains an entry with the value.
boost::future< void > lock(const K &key, std::chrono::milliseconds lease_time)
Acquires the lock for the specified key for the specified lease time.
boost::future< bool > put(const K &key, const V &value)
Stores a key-value pair in the multimap.
boost::future< void > lock(const K &key)
Acquires the lock for the specified key.
boost::future< int > value_count(const K &key)
Returns number of values matching to given key in the multimap.
boost::future< boost::uuids::uuid > add_entry_listener(entry_listener &&listener, const K &key, bool include_value)
Adds the specified entry listener for the specified key.
boost::future< bool > try_lock(const K &key, std::chrono::milliseconds timeout, std::chrono::milliseconds lease_time)
Tries to acquire the lock for the specified key for the specified lease time.
boost::future< std::vector< V > > get(const K &key)
Returns the multimap of values associated with the key.