16 #ifndef HAZELCAST_CLIENT_MIXEDTYPE_MULTIMAP_H_ 17 #define HAZELCAST_CLIENT_MIXEDTYPE_MULTIMAP_H_ 19 #include "hazelcast/client/proxy/MultiMapImpl.h" 20 #include "hazelcast/client/impl/EntryEventHandler.h" 21 #include "hazelcast/client/protocol/codec/MultiMapAddEntryListenerCodec.h" 36 class HAZELCAST_API
MultiMap :
public proxy::MultiMapImpl {
37 friend class client::impl::HazelcastClientInstanceImpl;;
49 template <
typename K,
typename V>
50 bool put(
const K &key,
const V &value) {
51 return proxy::MultiMapImpl::put(toData(key), toData(value));
61 std::vector<TypedData>
get(
const K &key) {
62 return toTypedDataCollection(proxy::MultiMapImpl::getData(toData(key)));
72 template <
typename K,
typename V>
73 bool remove(
const K &key,
const V &value) {
74 return proxy::MultiMapImpl::remove(toData(key), toData(value));
85 std::vector<TypedData>
remove(
const K &key) {
86 return toTypedDataCollection(proxy::MultiMapImpl::removeData(toData(key)));
95 std::vector<TypedData> keySet();
103 std::vector<TypedData> values();
111 std::vector<std::pair<TypedData, TypedData> > entrySet();
119 template <
typename K>
121 return proxy::MultiMapImpl::containsKey(toData(key));
130 template <
typename V>
132 return proxy::MultiMapImpl::containsValue(toData(value));
142 template <
typename K,
typename V>
144 return proxy::MultiMapImpl::containsEntry(toData(key), toData(value));
166 template <
typename K>
168 return proxy::MultiMapImpl::valueCount(toData(key));
203 template <
typename K>
205 impl::MixedEntryEventHandler<protocol::codec::MultiMapAddEntryListenerCodec::AbstractEventHandler> *entryEventHandler =
206 new impl::MixedEntryEventHandler<protocol::codec::MultiMapAddEntryListenerCodec::AbstractEventHandler>(
207 getName(), context->getClientClusterService(), context->getSerializationService(), listener,
209 serialization::pimpl::Data keyData = toData(key);
210 return proxy::MultiMapImpl::addEntryListener(entryEventHandler, keyData, includeValue);
221 bool removeEntryListener(
const std::string ®istrationId);
237 template <
typename K>
239 proxy::MultiMapImpl::lock(toData(key));
258 template <
typename K>
259 void lock(
const K &key,
long leaseTimeInMillis) {
260 proxy::MultiMapImpl::lock(toData(key), leaseTimeInMillis);
270 template <
typename K>
272 return proxy::MultiMapImpl::isLocked(toData(key));
284 template <
typename K>
286 return proxy::MultiMapImpl::tryLock(toData(key));
305 template <
typename K>
306 bool tryLock(
const K &key,
long timeoutInMillis) {
307 return proxy::MultiMapImpl::tryLock(toData(key), timeoutInMillis);
317 template <
typename K>
319 proxy::MultiMapImpl::unlock(toData(key));
328 template <
typename K>
330 proxy::MultiMapImpl::forceUnlock(toData(key));
334 MultiMap(
const std::string &instanceName, spi::ClientContext *context);
void lock(const K &key, long leaseTimeInMillis)
Acquires the lock for the specified key for the specified lease time.
Definition: MultiMap.h:259
bool containsEntry(const K &key, const V &value)
Returns whether the multimap contains the given key-value pair.
Definition: MultiMap.h:143
void unlock(const K &key)
Releases the lock for the specified key.
Definition: MultiMap.h:318
bool isLocked(const K &key)
Checks the lock for the specified key.
Definition: MultiMap.h:271
void forceUnlock(const K &key)
Releases the lock for the specified key regardless of the lock owner.
Definition: MultiMap.h:329
bool containsKey(const K &key)
Returns whether the multimap contains an entry with the key.
Definition: MultiMap.h:120
Definition: EntryListener.h:108
bool tryLock(const K &key)
Tries to acquire the lock for the specified key.
Definition: MultiMap.h:285
int valueCount(const K &key)
Returns number of values matching to given key in the multimap.
Definition: MultiMap.h:167
bool tryLock(const K &key, long timeoutInMillis)
Tries to acquire the lock for the specified key.
Definition: MultiMap.h:306
bool put(const K &key, const V &value)
Stores a key-value pair in the multimap.
Definition: MultiMap.h:50
std::string addEntryListener(MixedEntryListener &listener, const K &key, bool includeValue)
Adds the specified entry listener for the specified key.
Definition: MultiMap.h:204
A specialized distributed map client whose keys can be associated with multiple values.
Definition: MultiMap.h:36
void lock(const K &key)
Acquires the lock for the specified key.
Definition: MultiMap.h:238
PN (Positive-Negative) CRDT counter.
Definition: MapEntryView.h:32
bool containsValue(const V &value)
Returns whether the multimap contains an entry with the value.
Definition: MultiMap.h:131