Hazelcast C++ Client
ClientMapProxy.h
1 /*
2  * Copyright (c) 2008-2019, 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<K>(key);
76  return containsKeyInternal(keyData);
77  }
78 
85  template<typename V>
86  bool containsValue(const V &value) {
87  return proxy::IMapImpl::containsValue(toData<V>(value));
88  }
89 
97  template<typename K>
98  TypedData get(const K &key) {
99  serialization::pimpl::Data keyData = toData<K>(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<K>(key);
132  serialization::pimpl::Data valueData = toData<V>(value);
133 
134  return TypedData(putInternal(keyData, valueData, ttlInMillis), getContext().getSerializationService());
135  }
136 
144  template<typename K>
145  TypedData remove(const K &key) {
146  serialization::pimpl::Data keyData = toData<K>(key);
147 
148  std::auto_ptr<serialization::pimpl::Data> response = removeInternal(keyData);
149  return TypedData(response, getContext().getSerializationService());
150  }
151 
159  template<typename K, typename V>
160  bool remove(const K &key, const V &value) {
161  serialization::pimpl::Data keyData = toData<K>(key);
162  serialization::pimpl::Data valueData = toData<V>(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<K>(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<K>(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<K>(key);
226  serialization::pimpl::Data valueData = toData<V>(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<K>(key);
243  serialization::pimpl::Data valueData = toData<V>(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<K>(key);
275  serialization::pimpl::Data valueData = toData<V>(value);
276 
277  std::auto_ptr<serialization::pimpl::Data> response = putIfAbsentInternal(keyData, valueData,
278  ttlInMillis);
279  return TypedData(response, getContext().getSerializationService());
280  }
281 
289  template<typename K, typename V, typename NEWTYPE>
290  bool replace(const K &key, const V &oldValue, const NEWTYPE &newValue) {
291  serialization::pimpl::Data keyData = toData<K>(key);
292  serialization::pimpl::Data oldValueData = toData<V>(oldValue);
293  serialization::pimpl::Data newValueData = toData<NEWTYPE>(newValue);
294 
295  return replaceIfSameInternal(keyData, oldValueData, newValueData);
296  }
297 
305  template<typename K, typename V>
306  TypedData replace(const K &key, const V &value) {
307  serialization::pimpl::Data keyData = toData<K>(key);
308  serialization::pimpl::Data valueData = toData<V>(value);
309 
310  return TypedData(replaceInternal(keyData, valueData), getContext().getSerializationService());
311  }
312 
320  template<typename K, typename V>
321  void set(const K &key, const V &value) {
322  set(key, value, -1);
323  }
324 
334  template<typename K, typename V>
335  void set(const K &key, const V &value, long ttl) {
336  serialization::pimpl::Data keyData = toData<K>(key);
337  serialization::pimpl::Data valueData = toData<V>(value);
338 
339  setInternal(keyData, valueData, ttl);
340  }
341 
356  template<typename K>
357  void lock(const K &key) {
358  lock(key, -1);
359  }
360 
379  template<typename K>
380  void lock(const K &key, long leaseTime) {
381  serialization::pimpl::Data keyData = toData<K>(key);
382 
383  proxy::IMapImpl::lock(keyData, leaseTime);
384  }
385 
394  template<typename K>
395  bool isLocked(const K &key) {
396  return proxy::IMapImpl::isLocked(toData<K>(key));
397  }
398 
408  template<typename K>
409  bool tryLock(const K &key) {
410  return tryLock(key, 0);
411  }
412 
429  template<typename K>
430  bool tryLock(const K &key, long timeInMillis) {
431  return proxy::IMapImpl::tryLock(toData<K>(key), timeInMillis);
432  }
433 
447  template<typename K>
448  void unlock(const K &key) {
449  proxy::IMapImpl::unlock(toData<K>(key));
450  }
451 
460  template<typename K>
461  void forceUnlock(const K &key) {
462  proxy::IMapImpl::forceUnlock(toData<K>(key));
463  }
464 
476  template<typename MapInterceptor>
477  std::string addInterceptor(MapInterceptor &interceptor) {
478  return proxy::IMapImpl::addInterceptor(interceptor);
479  }
480 
487  void removeInterceptor(const std::string &id);
488 
503  std::string addEntryListener(MixedEntryListener &listener, bool includeValue);
504 
520  std::string
521  addEntryListener(MixedEntryListener &listener, const query::Predicate &predicate, bool includeValue);
522 
532  bool removeEntryListener(const std::string &registrationId);
533 
547  template<typename K>
548  std::string addEntryListener(const K &key, MixedEntryListener &listener, bool includeValue) {
549  serialization::pimpl::Data keyData = toData<K>(key);
550  impl::MixedEntryEventHandler<protocol::codec::MapAddEntryListenerCodec::AbstractEventHandler> *entryEventHandler =
551  new impl::MixedEntryEventHandler<protocol::codec::MapAddEntryListenerCodec::AbstractEventHandler>(
552  getName(), getContext().getClientClusterService(), getContext().getSerializationService(),
553  listener,
554  includeValue);
555  return proxy::IMapImpl::addEntryListener(entryEventHandler, keyData, includeValue);
556  }
557 
566  template<typename K>
567  std::auto_ptr<EntryView<TypedData, TypedData> > getEntryView(const K &key) {
568  std::auto_ptr<serialization::pimpl::Data> keyData(new serialization::pimpl::Data(toData<K>(key)));
569  std::auto_ptr<map::DataEntryView> dataEntryView = proxy::IMapImpl::getEntryViewData(*keyData);
570  if ((map::DataEntryView *) NULL == dataEntryView.get()) {
571  return std::auto_ptr<EntryView<TypedData, TypedData> >();
572  }
573  TypedData value(std::auto_ptr<serialization::pimpl::Data>(
574  new serialization::pimpl::Data(dataEntryView->getValue())),
575  getContext().getSerializationService());
576  const TypedData &keyTypedData = TypedData(keyData, getContext().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<K>(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, getContext().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, getContext().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> >
792  entrySet(const serialization::IdentifiedDataSerializable &predicate);
793 
804  std::vector<std::pair<TypedData, TypedData> > entrySet(const query::Predicate &predicate);
805 
816  template<typename K, typename V>
817  std::vector<std::pair<K, V> > entrySet(query::PagingPredicate<K, V> &predicate) {
818  std::vector<std::pair<serialization::pimpl::Data, serialization::pimpl::Data> > dataResult =
819  proxy::IMapImpl::entrySetForPagingPredicateData(predicate);
820 
821  client::impl::EntryArrayImpl<K, V> entries(dataResult, getContext().getSerializationService());
822  entries.sort(query::ENTRY, predicate.getComparator());
823 
824  std::pair<size_t, size_t> range = updateAnchor<K, V>(entries, predicate, query::ENTRY);
825 
826  std::vector<std::pair<K, V> > result;
827  for (size_t i = range.first; i < range.second; ++i) {
828  std::pair<const K *, const V *> entry = entries[i];
829  result.push_back(std::pair<K, V>(*entry.first, *entry.second));
830  }
831  return result;
832  }
833 
866  void addIndex(const std::string &attribute, bool ordered);
867 
882  template<typename K, typename EntryProcessor>
883  TypedData executeOnKey(const K &key, const EntryProcessor &entryProcessor) {
884  serialization::pimpl::Data keyData = toData<K>(key);
885  serialization::pimpl::Data processorData = toData<EntryProcessor>(entryProcessor);
886 
887  std::auto_ptr<serialization::pimpl::Data> response = executeOnKeyInternal(keyData, processorData);
888 
889  return TypedData(response, getSerializationService());
890  }
891 
892  template<typename K, typename EntryProcessor>
893  Future<TypedData> submitToKey(const K &key, const EntryProcessor &entryProcessor) {
894  serialization::pimpl::Data keyData = toData<K>(key);
895  serialization::pimpl::Data processorData = toData<EntryProcessor>(entryProcessor);
896 
897  return submitToKeyInternal<TypedData>(keyData, processorData);
898  }
899 
900  template<typename K, typename EntryProcessor>
901  std::map<K, TypedData> executeOnKeys(const std::set<K> &keys, const EntryProcessor &entryProcessor) {
902  EntryVector entries = executeOnKeysInternal<K, EntryProcessor>(keys, entryProcessor);
903 
904  std::map<K, TypedData> result;
905  serialization::pimpl::SerializationService &serializationService = getSerializationService();
906  for (size_t i = 0; i < entries.size(); ++i) {
907  std::auto_ptr<K> keyObj = toObject<K>(entries[i].first);
908  result[*keyObj] = TypedData(std::auto_ptr<serialization::pimpl::Data>(
909  new serialization::pimpl::Data(entries[i].second)), serializationService);
910  }
911  return result;
912  }
913 
926  template<typename EntryProcessor>
927  std::map<TypedData, TypedData> executeOnEntries(const EntryProcessor &entryProcessor) {
928  EntryVector entries = proxy::IMapImpl::executeOnEntriesData<EntryProcessor>(entryProcessor);
929  std::map<TypedData, TypedData> result;
930  for (size_t i = 0; i < entries.size(); ++i) {
931  std::auto_ptr<serialization::pimpl::Data> keyData(
932  new serialization::pimpl::Data(entries[i].first));
933  std::auto_ptr<serialization::pimpl::Data> valueData(
934  new serialization::pimpl::Data(entries[i].second));
935  serialization::pimpl::SerializationService &serializationService = getContext().getSerializationService();
936  result[TypedData(keyData, serializationService)] = TypedData(valueData, serializationService);
937  }
938  return result;
939  }
940 
955  template<typename EntryProcessor>
956  std::map<TypedData, TypedData>
957  executeOnEntries(const EntryProcessor &entryProcessor, const query::Predicate &predicate) {
958  EntryVector entries = proxy::IMapImpl::executeOnEntriesData<EntryProcessor>(entryProcessor,
959  predicate);
960  std::map<TypedData, TypedData> result;
961  for (size_t i = 0; i < entries.size(); ++i) {
962  std::auto_ptr<serialization::pimpl::Data> keyData(
963  new serialization::pimpl::Data(entries[i].first));
964  std::auto_ptr<serialization::pimpl::Data> valueData(
965  new serialization::pimpl::Data(entries[i].second));
966  serialization::pimpl::SerializationService &serializationService = getContext().getSerializationService();
967  result[TypedData(keyData, serializationService)] = TypedData(valueData, serializationService);
968  }
969  return result;
970  }
971 
979  int size();
980 
986  bool isEmpty();
987 
988 
999  template<typename K, typename V>
1000  void putAll(const std::map<K, V> &entries) {
1001  std::map<int, EntryVector> entryMap;
1002 
1003  for (typename std::map<K, V>::const_iterator it = entries.begin(); it != entries.end(); ++it) {
1004  serialization::pimpl::Data keyData = toData<K>(it->first);
1005  serialization::pimpl::Data valueData = toData<V>(it->second);
1006 
1007  int partitionId = getPartitionId(keyData);
1008 
1009  entryMap[partitionId].push_back(std::make_pair(keyData, valueData));
1010  }
1011 
1012  putAllInternal(entryMap);
1013  }
1014 
1019  void clear();
1020 
1021  serialization::pimpl::SerializationService &getSerializationService();
1022 
1023  virtual monitor::LocalMapStats &getLocalMapStats();
1024 
1025  protected:
1026  virtual boost::shared_ptr<TypedData> getInternal(serialization::pimpl::Data &keyData);
1027 
1028  virtual bool containsKeyInternal(const serialization::pimpl::Data &keyData);
1029 
1030  virtual std::auto_ptr<serialization::pimpl::Data> removeInternal(
1031  const serialization::pimpl::Data &keyData);
1032 
1033  virtual bool removeInternal(
1034  const serialization::pimpl::Data &keyData, const serialization::pimpl::Data &valueData);
1035 
1036  virtual void removeAllInternal(const serialization::pimpl::Data &predicateData);
1037 
1038  virtual void deleteInternal(const serialization::pimpl::Data &keyData);
1039 
1040  virtual bool tryRemoveInternal(const serialization::pimpl::Data &keyData, long timeoutInMillis);
1041 
1042  virtual bool tryPutInternal(const serialization::pimpl::Data &keyData,
1043  const serialization::pimpl::Data &valueData, long timeoutInMillis);
1044 
1045  virtual std::auto_ptr<serialization::pimpl::Data> putInternal(const serialization::pimpl::Data &keyData,
1046  const serialization::pimpl::Data &valueData,
1047  long timeoutInMillis);
1048 
1049  virtual void tryPutTransientInternal(const serialization::pimpl::Data &keyData,
1050  const serialization::pimpl::Data &valueData, int64_t ttlInMillis);
1051 
1052  virtual std::auto_ptr<serialization::pimpl::Data>
1053  putIfAbsentInternal(const serialization::pimpl::Data &keyData,
1054  const serialization::pimpl::Data &valueData,
1055  int64_t ttlInMillis);
1056 
1057  virtual bool replaceIfSameInternal(const serialization::pimpl::Data &keyData,
1058  const serialization::pimpl::Data &valueData,
1059  const serialization::pimpl::Data &newValueData);
1060 
1061  virtual std::auto_ptr<serialization::pimpl::Data>
1062  replaceInternal(const serialization::pimpl::Data &keyData,
1063  const serialization::pimpl::Data &valueData);
1064 
1065  virtual void
1066  setInternal(const serialization::pimpl::Data &keyData, const serialization::pimpl::Data &valueData,
1067  int64_t ttlInMillis);
1068 
1069  virtual bool evictInternal(const serialization::pimpl::Data &keyData);
1070 
1071  virtual EntryVector getAllInternal(const PID_TO_KEY_MAP &partitionToKeyData);
1072 
1073  virtual std::auto_ptr<serialization::pimpl::Data>
1074  executeOnKeyInternal(const serialization::pimpl::Data &keyData,
1075  const serialization::pimpl::Data &processor);
1076 
1077  template<typename ResultType>
1079  submitToKeyInternal(const serialization::pimpl::Data &keyData,
1080  const serialization::pimpl::Data &processor) {
1081  int partitionId = getPartitionId(keyData);
1082 
1083  std::auto_ptr<protocol::ClientMessage> request =
1084  protocol::codec::MapSubmitToKeyCodec::encodeRequest(getName(),
1085  processor,
1086  keyData,
1087  util::getCurrentThreadId());
1088 
1089  boost::shared_ptr<spi::impl::ClientInvocationFuture> clientInvocationFuture = invokeAndGetFuture(
1090  request, partitionId);
1091 
1092  return client::Future<ResultType>(clientInvocationFuture, getSerializationService(),
1093  submitToKeyDecoder);
1094  }
1095 
1096  static std::auto_ptr<serialization::pimpl::Data> submitToKeyDecoder(protocol::ClientMessage &response);
1097 
1098  template<typename K, typename EntryProcessor>
1099  EntryVector executeOnKeysInternal(const std::set<K> &keys, const EntryProcessor &entryProcessor) {
1100  if (keys.empty()) {
1101  return EntryVector();
1102  }
1103 
1104  std::vector<serialization::pimpl::Data> keysData;
1105  for (typename std::set<K>::const_iterator it = keys.begin(); it != keys.end(); ++it) {
1106  keysData.push_back(toData<K>(*it));
1107  }
1108 
1109  serialization::pimpl::Data entryProcessorData = toData<EntryProcessor>(entryProcessor);
1110 
1111  return proxy::IMapImpl::executeOnKeysData(keysData, entryProcessorData);
1112  }
1113 
1114  virtual void
1115  putAllInternal(const std::map<int, EntryVector> &entries);
1116 
1117  private:
1118  monitor::impl::LocalMapStatsImpl stats;
1119  };
1120  }
1121  }
1122 }
1123 
1124 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
1125 #pragma warning(pop)
1126 #endif
1127 
1128 #endif /* HAZELCAST_CLIENT_MIXEDTYPE_MAP_H_ */
1129 
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
std::map< TypedData, TypedData > executeOnEntries(const EntryProcessor &entryProcessor)
Applies the user defined EntryProcessor to the all entries in the map.
Definition: ClientMapProxy.h:927
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:290
void lock(const K &key)
Acquires the lock for the specified key.
Definition: ClientMapProxy.h:357
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:448
TypedData executeOnKey(const K &key, const EntryProcessor &entryProcessor)
Applies the user defined EntryProcessor to the entry mapped by the key.
Definition: ClientMapProxy.h:883
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:817
bool isLocked(const K &key)
Checks the lock for the specified key.
Definition: ClientMapProxy.h:395
std::auto_ptr< EntryView< TypedData, TypedData > > getEntryView(const K &key)
Returns the EntryView for the specified key.
Definition: ClientMapProxy.h:567
std::string addEntryListener(const K &key, MixedEntryListener &listener, bool includeValue)
Adds the specified entry listener for the specified key.
Definition: ClientMapProxy.h:548
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 putAll(const std::map< K, V > &entries)
Copies all of the mappings from the specified map to this map (optional operation).
Definition: ClientMapProxy.h:1000
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
This is a unique Future.
Definition: Future.h:105
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 marker class for Predicate classes.
Definition: Predicate.h:36
EntryView represents a readonly view of a map entry.
Definition: EntryView.h:41
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:461
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
PN (Positive-Negative) CRDT counter.
Definition: MapEntryView.h:32
bool tryLock(const K &key)
Tries to acquire the lock for the specified key.
Definition: ClientMapProxy.h:409
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:380
bool tryLock(const K &key, long timeInMillis)
Tries to acquire the lock for the specified key.
Definition: ClientMapProxy.h:430
std::string addInterceptor(MapInterceptor &interceptor)
Adds an interceptor for this map.
Definition: ClientMapProxy.h:477
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:306
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:957