Hazelcast C++ Client
ClientMapProxy.h
1 /*
2  * Copyright (c) 2008-2017, Hazelcast, Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef HAZELCAST_CLIENT_MIXEDTYPE_MAP_H_
17 #define HAZELCAST_CLIENT_MIXEDTYPE_MAP_H_
18 
19 #include <string>
20 #include <map>
21 #include <set>
22 #include <vector>
23 #include <stdexcept>
24 #include <climits>
25 #include <assert.h>
26 
27 #include "hazelcast/client/TypedData.h"
28 #include "hazelcast/client/monitor/LocalMapStats.h"
29 #include "hazelcast/client/monitor/impl/NearCacheStatsImpl.h"
30 #include "hazelcast/client/monitor/impl/LocalMapStatsImpl.h"
31 #include "hazelcast/client/protocol/codec/MapAddEntryListenerWithPredicateCodec.h"
32 #include "hazelcast/client/impl/EntryArrayImpl.h"
33 #include "hazelcast/client/proxy/IMapImpl.h"
34 #include "hazelcast/client/impl/EntryEventHandler.h"
35 #include "hazelcast/client/EntryListener.h"
36 #include "hazelcast/client/EntryView.h"
37 #include "hazelcast/client/serialization/pimpl/SerializationService.h"
38 #include "hazelcast/client/Future.h"
39 #include "hazelcast/client/protocol/codec/MapSubmitToKeyCodec.h"
40 
41 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
42 #pragma warning(push)
43 #pragma warning(disable: 4251) //for dll export
44 #endif
45 
46 namespace hazelcast {
47  namespace client {
48  namespace mixedtype {
61  class HAZELCAST_API ClientMapProxy : public proxy::IMapImpl {
62  public:
63  typedef std::map<int, std::vector<boost::shared_ptr<serialization::pimpl::Data> > > PID_TO_KEY_MAP;
64 
65  ClientMapProxy(const std::string &instanceName, spi::ClientContext *context);
66 
73  template <typename K>
74  bool containsKey(const K &key) {
75  serialization::pimpl::Data keyData = toData(key);
76  return containsKeyInternal(keyData);
77  }
78 
85  template <typename V>
86  bool containsValue(const V &value) {
87  return proxy::IMapImpl::containsValue(toData(value));
88  }
89 
97  template <typename K>
98  TypedData get(const K &key) {
99  serialization::pimpl::Data keyData = toData(key);
100  boost::shared_ptr<TypedData> value = getInternal(keyData);
101  TypedData result = *value;
102  return result;
103  }
104 
113  template <typename K, typename V>
114  TypedData put(const K &key, const V &value) {
115  return put(key, value, -1);
116  }
117 
129  template <typename K, typename V>
130  TypedData put(const K &key, const V &value, long ttlInMillis) {
131  serialization::pimpl::Data keyData = toData(key);
132  serialization::pimpl::Data valueData = toData(value);
133 
134  return TypedData(putInternal(keyData, valueData, ttlInMillis), context->getSerializationService());
135  }
136 
144  template <typename K>
145  TypedData remove(const K &key) {
146  serialization::pimpl::Data keyData = toData(key);
147 
148  std::auto_ptr<serialization::pimpl::Data> response = removeInternal(keyData);
149  return TypedData(response, context->getSerializationService());
150  }
151 
159  template <typename K, typename V>
160  bool remove(const K &key, const V &value) {
161  serialization::pimpl::Data keyData = toData(key);
162  serialization::pimpl::Data valueData = toData(value);
163 
164  return removeInternal(keyData, valueData);
165  }
166 
173  void removeAll(const query::Predicate &predicate);
174 
181  template <typename K>
182  void deleteEntry(const K &key) {
183  serialization::pimpl::Data keyData = toData(key);
184 
185  deleteInternal(keyData);
186  }
187 
192  void flush();
193 
204  template <typename K>
205  bool tryRemove(const K &key, long timeoutInMillis) {
206  serialization::pimpl::Data keyData = toData(key);
207 
208  return tryRemoveInternal(keyData, timeoutInMillis);
209  }
210 
223  template <typename K, typename V>
224  bool tryPut(const K &key, const V &value, long timeoutInMillis) {
225  serialization::pimpl::Data keyData = toData(key);
226  serialization::pimpl::Data valueData = toData(value);
227 
228  return tryPutInternal(keyData, valueData, timeoutInMillis);
229  }
230 
240  template <typename K, typename V>
241  void putTransient(const K &key, const V &value, long ttlInMillis) {
242  serialization::pimpl::Data keyData = toData(key);
243  serialization::pimpl::Data valueData = toData(value);
244 
245  tryPutTransientInternal(keyData, valueData, ttlInMillis);
246  }
247 
256  template <typename K, typename V>
257  TypedData putIfAbsent(const K &key, const V &value) {
258  return putIfAbsent(key, value, -1);
259  }
260 
272  template <typename K, typename V>
273  TypedData putIfAbsent(const K &key, const V &value, long ttlInMillis) {
274  serialization::pimpl::Data keyData = toData(key);
275  serialization::pimpl::Data valueData = toData(value);
276 
277  std::auto_ptr<serialization::pimpl::Data> response = putIfAbsentInternal(keyData, valueData, ttlInMillis);
278  return TypedData(response, context->getSerializationService());
279  }
280 
288  template <typename K, typename V, typename NEWTYPE>
289  bool replace(const K &key, const V &oldValue, const NEWTYPE &newValue) {
290  serialization::pimpl::Data keyData = toData(key);
291  serialization::pimpl::Data oldValueData = toData(oldValue);
292  serialization::pimpl::Data newValueData = toData(newValue);
293 
294  return replaceIfSameInternal(keyData, oldValueData, newValueData);
295  }
296 
304  template <typename K, typename V>
305  TypedData replace(const K &key, const V &value) {
306  serialization::pimpl::Data keyData = toData(key);
307  serialization::pimpl::Data valueData = toData(value);
308 
309  return TypedData(replaceInternal(keyData, valueData), context->getSerializationService());
310  }
311 
319  template <typename K, typename V>
320  void set(const K &key, const V &value) {
321  set(key, value, -1);
322  }
323 
333  template <typename K, typename V>
334  void set(const K &key, const V &value, long ttl) {
335  serialization::pimpl::Data keyData = toData(key);
336  serialization::pimpl::Data valueData = toData(value);
337 
338  setInternal(keyData, valueData, ttl);
339  }
340 
355  template <typename K>
356  void lock(const K &key) {
357  lock(key, -1);
358  }
359 
378  template <typename K>
379  void lock(const K &key, long leaseTime) {
380  serialization::pimpl::Data keyData = toData(key);
381 
382  proxy::IMapImpl::lock(toData(key), leaseTime);
383  }
384 
393  template <typename K>
394  bool isLocked(const K &key) {
395  return proxy::IMapImpl::isLocked(toData(key));
396  }
397 
407  template <typename K>
408  bool tryLock(const K &key) {
409  return tryLock(key, 0);
410  }
411 
428  template <typename K>
429  bool tryLock(const K &key, long timeInMillis) {
430  return proxy::IMapImpl::tryLock(toData(key), timeInMillis);
431  }
432 
446  template <typename K>
447  void unlock(const K &key) {
448  proxy::IMapImpl::unlock(toData(key));
449  }
450 
459  template <typename K>
460  void forceUnlock(const K &key) {
461  proxy::IMapImpl::forceUnlock(toData(key));
462  }
463 
475  template<typename MapInterceptor>
476  std::string addInterceptor(MapInterceptor &interceptor) {
477  return proxy::IMapImpl::addInterceptor(interceptor);
478  }
479 
486  void removeInterceptor(const std::string &id);
487 
502  std::string addEntryListener(MixedEntryListener &listener, bool includeValue);
503 
519  std::string
520  addEntryListener(MixedEntryListener &listener, const query::Predicate &predicate, bool includeValue);
521 
531  bool removeEntryListener(const std::string &registrationId);
532 
546  template <typename K>
547  std::string addEntryListener(const K &key, MixedEntryListener &listener, bool includeValue) {
548  serialization::pimpl::Data keyData = toData(key);
549  impl::MixedEntryEventHandler<protocol::codec::MapAddEntryListenerCodec::AbstractEventHandler> *entryEventHandler =
550  new impl::MixedEntryEventHandler<protocol::codec::MapAddEntryListenerCodec::AbstractEventHandler>(
551  getName(), context->getClusterService(), context->getSerializationService(),
552  listener,
553  includeValue);
554  return proxy::IMapImpl::addEntryListener(entryEventHandler, keyData, includeValue);
555  }
556 
565  template <typename K>
566  std::auto_ptr<EntryView<TypedData, TypedData> > getEntryView(const K &key) {
567  std::auto_ptr<serialization::pimpl::Data>keyData(new serialization::pimpl::Data(toData(key)));
568  std::auto_ptr<map::DataEntryView> dataEntryView = proxy::IMapImpl::getEntryViewData(*keyData);
569  if ((map::DataEntryView *)NULL == dataEntryView.get()) {
570  return std::auto_ptr<EntryView<TypedData, TypedData> >();
571  }
572  TypedData value(std::auto_ptr<serialization::pimpl::Data>(
573  new serialization::pimpl::Data(std::auto_ptr<std::vector<byte> >(
574  new std::vector<byte>(dataEntryView->getValue().toByteArray())))),
575  context->getSerializationService());
576  const TypedData &keyTypedData = TypedData(keyData, context->getSerializationService());
577  std::auto_ptr<EntryView<TypedData, TypedData> > view(new EntryView<TypedData, TypedData>(
578  keyTypedData, value, *dataEntryView));
579  return view;
580  }
581 
592  template <typename K>
593  bool evict(const K &key) {
594  serialization::pimpl::Data keyData = toData(key);
595 
596  return evictInternal(keyData);
597  }
598 
610  void evictAll();
611 
618  template <typename K>
619  std::vector<std::pair<TypedData, TypedData> > getAll(const std::set<K> &keys) {
620  if (keys.empty()) {
621  return std::vector<std::pair<TypedData, TypedData> >();
622  }
623 
624  PID_TO_KEY_MAP partitionToKeyData;
625 
626  for (typename std::set<K>::const_iterator it = keys.begin();it != keys.end();++it) {
627  const K &key = *it;
628  serialization::pimpl::Data keyData = toData<K>(key);
629 
630  int partitionId = getPartitionId(keyData);
631 
632  partitionToKeyData[partitionId].push_back(toShared(keyData));
633  }
634 
635  return toTypedDataEntrySet(getAllInternal(partitionToKeyData));
636  }
637 
645  std::vector<TypedData> keySet();
646 
659  std::vector<TypedData> keySet(const serialization::IdentifiedDataSerializable &predicate);
660 
672  std::vector<TypedData> keySet(const query::Predicate &predicate);
673 
685  template <typename K, typename V>
686  std::vector<K> keySet(query::PagingPredicate <K, V> &predicate) {
687  predicate.setIterationType(query::KEY);
688 
689  std::vector<serialization::pimpl::Data> dataResult = keySetForPagingPredicateData(predicate);
690 
691  EntryVector entryResult;
692  for (std::vector<serialization::pimpl::Data>::iterator it = dataResult.begin();
693  it != dataResult.end(); ++it) {
694  entryResult.push_back(std::pair<serialization::pimpl::Data, serialization::pimpl::Data>(*it,
695  serialization::pimpl::Data()));
696  }
697 
698  client::impl::EntryArrayImpl<K, V> entries(entryResult, context->getSerializationService());
699  entries.sort(query::KEY, predicate.getComparator());
700 
701  std::pair<size_t, size_t> range = updateAnchor<K, V>(entries, predicate, query::KEY);
702 
703  std::vector<K> result;
704  for (size_t i = range.first; i < range.second; ++i) {
705  result.push_back(*entries.getKey(i));
706  }
707 
708  return result;
709  }
710 
718  std::vector<TypedData> values();
719 
730  std::vector<TypedData> values(const serialization::IdentifiedDataSerializable &predicate);
731 
740  std::vector<TypedData> values(const query::Predicate &predicate);
741 
751  template <typename K, typename V>
752  std::vector<V> values(query::PagingPredicate <K, V> &predicate) {
753  predicate.setIterationType(query::VALUE);
754 
755  EntryVector dataResult = proxy::IMapImpl::valuesForPagingPredicateData(predicate);
756 
757  client::impl::EntryArrayImpl<K, V> entries(dataResult, context->getSerializationService());
758 
759  entries.sort(query::VALUE, predicate.getComparator());
760 
761  std::pair<size_t, size_t> range = updateAnchor<K, V>(entries, predicate, query::VALUE);
762 
763  std::vector<V> result;
764  for (size_t i = range.first; i < range.second; ++i) {
765  result.push_back(*entries.getValue(i));
766  }
767  return result;
768  }
769 
777  std::vector<std::pair<TypedData, TypedData> > entrySet();
778 
791  std::vector<std::pair<TypedData, TypedData> > entrySet(const serialization::IdentifiedDataSerializable &predicate);
792 
803  std::vector<std::pair<TypedData, TypedData> > entrySet(const query::Predicate &predicate);
804 
815  template <typename K, typename V>
816  std::vector<std::pair<K, V> > entrySet(query::PagingPredicate <K, V> &predicate) {
817  std::vector<std::pair<serialization::pimpl::Data, serialization::pimpl::Data> > dataResult =
818  proxy::IMapImpl::entrySetForPagingPredicateData(predicate);
819 
820  client::impl::EntryArrayImpl<K, V> entries(dataResult, context->getSerializationService());
821  entries.sort(query::ENTRY, predicate.getComparator());
822 
823  std::pair<size_t, size_t> range = updateAnchor<K, V>(entries, predicate, query::ENTRY);
824 
825  std::vector<std::pair<K, V> > result;
826  for (size_t i = range.first; i < range.second; ++i) {
827  std::pair<const K *, const V *> entry = entries[i];
828  result.push_back(std::pair<K, V>(*entry.first, *entry.second));
829  }
830  return result;
831  }
832 
865  void addIndex(const std::string &attribute, bool ordered);
866 
881  template<typename K, typename EntryProcessor>
882  TypedData executeOnKey(const K &key, const EntryProcessor &entryProcessor) {
883  serialization::pimpl::Data keyData = toData(key);
884  serialization::pimpl::Data processorData = toData(entryProcessor);
885 
886  std::auto_ptr<serialization::pimpl::Data> response = executeOnKeyInternal(keyData, processorData);
887 
888  return TypedData(response, getSerializationService());
889  }
890 
891  template<typename K, typename EntryProcessor>
892  Future<TypedData> submitToKey(const K &key, const EntryProcessor &entryProcessor) {
893  serialization::pimpl::Data keyData = toData(key);
894  serialization::pimpl::Data processorData = toData(entryProcessor);
895 
896  return submitToKeyInternal<TypedData>(keyData, processorData);
897  }
898 
899  template<typename K, typename EntryProcessor>
900  std::map<K, TypedData> executeOnKeys(const std::set<K> &keys, const EntryProcessor &entryProcessor) {
901  EntryVector entries = executeOnKeysInternal<K, EntryProcessor>(keys, entryProcessor);
902 
903  std::map<K, TypedData> result;
904  serialization::pimpl::SerializationService &serializationService = getSerializationService();
905  for (size_t i = 0; i < entries.size(); ++i) {
906  std::auto_ptr<K> keyObj = toObject<K>(entries[i].first);
907  result[*keyObj] = TypedData(std::auto_ptr<serialization::pimpl::Data>(
908  new serialization::pimpl::Data(entries[i].second)), serializationService);
909  }
910  return result;
911  }
912 
925  template<typename EntryProcessor>
926  std::map<TypedData, TypedData > executeOnEntries(const EntryProcessor &entryProcessor) {
927  EntryVector entries = proxy::IMapImpl::executeOnEntriesData<EntryProcessor>(entryProcessor);
928  std::map<TypedData, TypedData> result;
929  for (size_t i = 0; i < entries.size(); ++i) {
930  std::auto_ptr<serialization::pimpl::Data> keyData(new serialization::pimpl::Data(entries[i].first));
931  std::auto_ptr<serialization::pimpl::Data> valueData(new serialization::pimpl::Data(entries[i].second));
932  serialization::pimpl::SerializationService &serializationService = context->getSerializationService();
933  result[TypedData(keyData, serializationService)] = TypedData(valueData, serializationService);
934  }
935  return result;
936  }
937 
952  template<typename EntryProcessor>
953  std::map<TypedData, TypedData>
954  executeOnEntries(const EntryProcessor &entryProcessor, const query::Predicate &predicate) {
955  EntryVector entries = proxy::IMapImpl::executeOnEntriesData<EntryProcessor>(entryProcessor,
956  predicate);
957  std::map<TypedData, TypedData> result;
958  for (size_t i = 0; i < entries.size(); ++i) {
959  std::auto_ptr<serialization::pimpl::Data> keyData(new serialization::pimpl::Data(entries[i].first));
960  std::auto_ptr<serialization::pimpl::Data> valueData(new serialization::pimpl::Data(entries[i].second));
961  serialization::pimpl::SerializationService &serializationService = context->getSerializationService();
962  result[TypedData(keyData, serializationService)] = TypedData(valueData, serializationService);
963  }
964  return result;
965  }
966 
974  int size();
975 
981  bool isEmpty();
982 
983 
994  template<typename K, typename V>
995  void putAll(const std::map<K, V> &entries) {
996  std::map<int, EntryVector> entryMap;
997 
998  for (typename std::map<K, V>::const_iterator it = entries.begin(); it != entries.end(); ++it) {
999  serialization::pimpl::Data keyData = toData(it->first);
1000  serialization::pimpl::Data valueData = toData(it->second);
1001 
1002  int partitionId = getPartitionId(keyData);
1003 
1004  entryMap[partitionId].push_back(std::make_pair(keyData, valueData));
1005  }
1006 
1007  putAllInternal(entryMap);
1008  }
1009 
1014  void clear();
1015 
1016  serialization::pimpl::SerializationService &getSerializationService() const;
1017 
1018  virtual monitor::LocalMapStats &getLocalMapStats();
1019  protected:
1020  virtual boost::shared_ptr<TypedData> getInternal(serialization::pimpl::Data &keyData);
1021 
1022  virtual bool containsKeyInternal(const serialization::pimpl::Data &keyData);
1023 
1024  virtual std::auto_ptr<serialization::pimpl::Data> removeInternal(
1025  const serialization::pimpl::Data &keyData);
1026 
1027  virtual bool removeInternal(
1028  const serialization::pimpl::Data &keyData, const serialization::pimpl::Data &valueData);
1029 
1030  virtual void removeAllInternal(const serialization::pimpl::Data &predicateData);
1031 
1032  virtual void deleteInternal(const serialization::pimpl::Data &keyData);
1033 
1034  virtual bool tryRemoveInternal(const serialization::pimpl::Data &keyData, long timeoutInMillis);
1035 
1036  virtual bool tryPutInternal(const serialization::pimpl::Data &keyData,
1037  const serialization::pimpl::Data &valueData, long timeoutInMillis);
1038 
1039  virtual std::auto_ptr<serialization::pimpl::Data> putInternal(const serialization::pimpl::Data &keyData,
1040  const serialization::pimpl::Data &valueData, long timeoutInMillis);
1041 
1042  virtual void tryPutTransientInternal(const serialization::pimpl::Data &keyData,
1043  const serialization::pimpl::Data &valueData, int ttlInMillis);
1044 
1045  virtual std::auto_ptr<serialization::pimpl::Data> putIfAbsentInternal(const serialization::pimpl::Data &keyData,
1046  const serialization::pimpl::Data &valueData,
1047  int ttlInMillis);
1048 
1049  virtual bool replaceIfSameInternal(const serialization::pimpl::Data &keyData,
1050  const serialization::pimpl::Data &valueData,
1051  const serialization::pimpl::Data &newValueData);
1052 
1053  virtual std::auto_ptr<serialization::pimpl::Data> replaceInternal(const serialization::pimpl::Data &keyData,
1054  const serialization::pimpl::Data &valueData);
1055 
1056  virtual void setInternal(const serialization::pimpl::Data &keyData, const serialization::pimpl::Data &valueData,
1057  int ttlInMillis);
1058 
1059  virtual bool evictInternal(const serialization::pimpl::Data &keyData);
1060 
1061  EntryVector getAllInternal(const PID_TO_KEY_MAP &partitionToKeyData) {
1062  std::map<int, std::vector<serialization::pimpl::Data> > datas;
1063  for (PID_TO_KEY_MAP::const_iterator it = partitionToKeyData.begin();
1064  it != partitionToKeyData.end(); ++it) {
1065  const std::vector<boost::shared_ptr<serialization::pimpl::Data> > &valueDatas = it->second;
1066  for (std::vector<boost::shared_ptr<serialization::pimpl::Data> >::const_iterator valueIt = valueDatas.begin();
1067  valueIt != valueDatas.end(); ++valueIt) {
1068  datas[it->first].push_back(*(*valueIt));
1069  }
1070  }
1071  return proxy::IMapImpl::getAllData(datas);
1072  }
1073 
1074  virtual std::auto_ptr<serialization::pimpl::Data>
1075  executeOnKeyInternal(const serialization::pimpl::Data &keyData,
1076  const serialization::pimpl::Data &processor);
1077 
1078  template <typename ResultType>
1079  Future<ResultType>
1080  submitToKeyInternal(const serialization::pimpl::Data &keyData,
1081  const serialization::pimpl::Data &processor) {
1082  int partitionId = getPartitionId(keyData);
1083 
1084  std::auto_ptr<protocol::ClientMessage> request =
1085  protocol::codec::MapSubmitToKeyCodec::RequestParameters::encode(getName(),
1086  processor,
1087  keyData,
1088  util::getThreadId());
1089 
1090  connection::CallFuture callFuture = invokeAndGetFuture(request, partitionId);
1091 
1092  return client::Future<ResultType>(callFuture, getSerializationService(), submitToKeyDecoder);
1093  }
1094 
1095  static std::auto_ptr<serialization::pimpl::Data> submitToKeyDecoder(protocol::ClientMessage &response);
1096 
1097  template<typename K, typename EntryProcessor>
1098  EntryVector executeOnKeysInternal(const std::set<K> &keys, const EntryProcessor &entryProcessor) {
1099  if (keys.empty()) {
1100  return EntryVector();
1101  }
1102 
1103  std::vector<serialization::pimpl::Data> keysData;
1104  for (typename std::set<K>::const_iterator it = keys.begin(); it != keys.end(); ++it) {
1105  keysData.push_back(toData<K>(*it));
1106  }
1107 
1108  serialization::pimpl::Data entryProcessorData = toData<EntryProcessor>(entryProcessor);
1109 
1110  return proxy::IMapImpl::executeOnKeysData(keysData, entryProcessorData);
1111  }
1112 
1113  virtual void
1114  putAllInternal(const std::map<int, EntryVector> &entries);
1115 
1116  private:
1117  monitor::impl::LocalMapStatsImpl stats;
1118  };
1119  }
1120  }
1121 }
1122 
1123 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
1124 #pragma warning(pop)
1125 #endif
1126 
1127 #endif /* HAZELCAST_CLIENT_MIXEDTYPE_MAP_H_ */
1128 
std::vector< V > values(query::PagingPredicate< K, V > &predicate)
Returns a vector clone of the values contained in this map.
Definition: ClientMapProxy.h:752
bool containsValue(const V &value)
check if this map contains value.
Definition: ClientMapProxy.h:86
bool replace(const K &key, const V &oldValue, const NEWTYPE &newValue)
Replaces the entry for a key only if currently mapped to a given value.
Definition: ClientMapProxy.h:289
void lock(const K &key)
Acquires the lock for the specified key.
Definition: ClientMapProxy.h:356
bool evict(const K &key)
Evicts the specified key from this map.
Definition: ClientMapProxy.h:593
Definition: LocalMapStats.h:31
TypedData put(const K &key, const V &value, long ttlInMillis)
Puts an entry into this map with a given ttl (time to live) value.
Definition: ClientMapProxy.h:130
Definition: EntryListener.h:108
Classes that will be used with hazelcast data structures like IMap, IQueue etc should either inherit ...
Definition: IdentifiedDataSerializable.h:47
void unlock(const K &key)
Releases the lock for the specified key.
Definition: ClientMapProxy.h:447
TypedData executeOnKey(const K &key, const EntryProcessor &entryProcessor)
Applies the user defined EntryProcessor to the entry mapped by the key.
Definition: ClientMapProxy.h:882
NOTE: PagingPredicate can only be used with values(), keySet() and entries() methods!!! ...
Definition: PagingPredicate.h:127
TypedData put(const K &key, const V &value)
put new entry into map.
Definition: ClientMapProxy.h:114
std::vector< std::pair< K, V > > entrySet(query::PagingPredicate< K, V > &predicate)
Queries the map based on the specified predicate and returns the matching entries.
Definition: ClientMapProxy.h:816
bool isLocked(const K &key)
Checks the lock for the specified key.
Definition: ClientMapProxy.h:394
std::auto_ptr< EntryView< TypedData, TypedData > > getEntryView(const K &key)
Returns the EntryView for the specified key.
Definition: ClientMapProxy.h:566
std::string addEntryListener(const K &key, MixedEntryListener &listener, bool includeValue)
Adds the specified entry listener for the specified key.
Definition: ClientMapProxy.h:547
bool containsKey(const K &key)
check if this map contains key.
Definition: ClientMapProxy.h:74
bool tryPut(const K &key, const V &value, long timeoutInMillis)
Tries to put the given key, value into this map within specified timeout value.
Definition: ClientMapProxy.h:224
void set(const K &key, const V &value, long ttl)
Puts an entry into this map.
Definition: ClientMapProxy.h:334
void putAll(const std::map< K, V > &entries)
Copies all of the mappings from the specified map to this map (optional operation).
Definition: ClientMapProxy.h:995
void set(const K &key, const V &value)
Puts an entry into this map.
Definition: ClientMapProxy.h:320
std::vector< K > keySet(query::PagingPredicate< K, V > &predicate)
Queries the map based on the specified predicate and returns the keys of matching entries...
Definition: ClientMapProxy.h:686
std::map< TypedData, TypedData > executeOnEntries(const EntryProcessor &entryProcessor)
Applies the user defined EntryProcessor to the all entries in the map.
Definition: ClientMapProxy.h:926
void putTransient(const K &key, const V &value, long ttlInMillis)
Same as put(K, V, long, TimeUnit) but MapStore, if defined, will not be called to store/persist the e...
Definition: ClientMapProxy.h:241
This is a merker class for Predicate classes.
Definition: Predicate.h:36
EntryView represents a readonly view of a map entry.
Definition: EntryView.h:39
TypedData putIfAbsent(const K &key, const V &value)
Puts an entry into this map, if the specified key is not already associated with a value...
Definition: ClientMapProxy.h:257
void forceUnlock(const K &key)
Releases the lock for the specified key regardless of the lock owner.
Definition: ClientMapProxy.h:460
Concurrent, distributed, observable and queryable map client.
Definition: ClientMapProxy.h:61
TypedData putIfAbsent(const K &key, const V &value, long ttlInMillis)
Puts an entry into this map with a given ttl (time to live) value if the specified key is not already...
Definition: ClientMapProxy.h:273
Definition: MapEntryView.h:32
bool tryLock(const K &key)
Tries to acquire the lock for the specified key.
Definition: ClientMapProxy.h:408
bool tryRemove(const K &key, long timeoutInMillis)
Tries to remove the entry with the given key from this map within specified timeout value...
Definition: ClientMapProxy.h:205
This specialization overwrites the get method to return TypedData.
Definition: Future.h:235
void lock(const K &key, long leaseTime)
Acquires the lock for the specified key for the specified lease time.
Definition: ClientMapProxy.h:379
bool tryLock(const K &key, long timeInMillis)
Tries to acquire the lock for the specified key.
Definition: ClientMapProxy.h:429
std::string addInterceptor(MapInterceptor &interceptor)
Adds an interceptor for this map.
Definition: ClientMapProxy.h:476
TypedData class is a wrapper class for the serialized binary data.
Definition: TypedData.h:40
std::vector< std::pair< TypedData, TypedData > > getAll(const std::set< K > &keys)
Returns the entries for the given keys.
Definition: ClientMapProxy.h:619
TypedData replace(const K &key, const V &value)
Replaces the entry for a key only if currently mapped to some value.
Definition: ClientMapProxy.h:305
void deleteEntry(const K &key)
removes entry from map.
Definition: ClientMapProxy.h:182
std::map< TypedData, TypedData > executeOnEntries(const EntryProcessor &entryProcessor, const query::Predicate &predicate)
Applies the user defined EntryProcessor to the all entries in the map.
Definition: ClientMapProxy.h:954