Hazelcast C++ Client
ClientMapProxy.h
1 /*
2  * Copyright (c) 2008-2018, 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 #include "hazelcast/client/spi/impl/ClientClusterServiceImpl.h"
41 
42 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
43 #pragma warning(push)
44 #pragma warning(disable: 4251) //for dll export
45 #endif
46 
47 namespace hazelcast {
48  namespace client {
49  namespace mixedtype {
62  class HAZELCAST_API ClientMapProxy : public proxy::IMapImpl {
63  public:
64  typedef std::map<int, std::vector<boost::shared_ptr<serialization::pimpl::Data> > > PID_TO_KEY_MAP;
65 
66  ClientMapProxy(const std::string &instanceName, spi::ClientContext *context);
67 
74  template<typename K>
75  bool containsKey(const K &key) {
76  serialization::pimpl::Data keyData = toData(key);
77  return containsKeyInternal(keyData);
78  }
79 
86  template<typename V>
87  bool containsValue(const V &value) {
88  return proxy::IMapImpl::containsValue(toData(value));
89  }
90 
98  template<typename K>
99  TypedData get(const K &key) {
100  serialization::pimpl::Data keyData = toData(key);
101  boost::shared_ptr<TypedData> value = getInternal(keyData);
102  TypedData result = *value;
103  return result;
104  }
105 
114  template<typename K, typename V>
115  TypedData put(const K &key, const V &value) {
116  return put(key, value, -1);
117  }
118 
130  template<typename K, typename V>
131  TypedData put(const K &key, const V &value, long ttlInMillis) {
132  serialization::pimpl::Data keyData = toData(key);
133  serialization::pimpl::Data valueData = toData(value);
134 
135  return TypedData(putInternal(keyData, valueData, ttlInMillis), context->getSerializationService());
136  }
137 
145  template<typename K>
146  TypedData remove(const K &key) {
147  serialization::pimpl::Data keyData = toData(key);
148 
149  std::auto_ptr<serialization::pimpl::Data> response = removeInternal(keyData);
150  return TypedData(response, context->getSerializationService());
151  }
152 
160  template<typename K, typename V>
161  bool remove(const K &key, const V &value) {
162  serialization::pimpl::Data keyData = toData(key);
163  serialization::pimpl::Data valueData = toData(value);
164 
165  return removeInternal(keyData, valueData);
166  }
167 
174  void removeAll(const query::Predicate &predicate);
175 
182  template<typename K>
183  void deleteEntry(const K &key) {
184  serialization::pimpl::Data keyData = toData(key);
185 
186  deleteInternal(keyData);
187  }
188 
193  void flush();
194 
205  template<typename K>
206  bool tryRemove(const K &key, long timeoutInMillis) {
207  serialization::pimpl::Data keyData = toData(key);
208 
209  return tryRemoveInternal(keyData, timeoutInMillis);
210  }
211 
224  template<typename K, typename V>
225  bool tryPut(const K &key, const V &value, long timeoutInMillis) {
226  serialization::pimpl::Data keyData = toData(key);
227  serialization::pimpl::Data valueData = toData(value);
228 
229  return tryPutInternal(keyData, valueData, timeoutInMillis);
230  }
231 
241  template<typename K, typename V>
242  void putTransient(const K &key, const V &value, long ttlInMillis) {
243  serialization::pimpl::Data keyData = toData(key);
244  serialization::pimpl::Data valueData = toData(value);
245 
246  tryPutTransientInternal(keyData, valueData, ttlInMillis);
247  }
248 
257  template<typename K, typename V>
258  TypedData putIfAbsent(const K &key, const V &value) {
259  return putIfAbsent(key, value, -1);
260  }
261 
273  template<typename K, typename V>
274  TypedData putIfAbsent(const K &key, const V &value, long ttlInMillis) {
275  serialization::pimpl::Data keyData = toData(key);
276  serialization::pimpl::Data valueData = toData(value);
277 
278  std::auto_ptr<serialization::pimpl::Data> response = putIfAbsentInternal(keyData, valueData,
279  ttlInMillis);
280  return TypedData(response, context->getSerializationService());
281  }
282 
290  template<typename K, typename V, typename NEWTYPE>
291  bool replace(const K &key, const V &oldValue, const NEWTYPE &newValue) {
292  serialization::pimpl::Data keyData = toData(key);
293  serialization::pimpl::Data oldValueData = toData(oldValue);
294  serialization::pimpl::Data newValueData = toData(newValue);
295 
296  return replaceIfSameInternal(keyData, oldValueData, newValueData);
297  }
298 
306  template<typename K, typename V>
307  TypedData replace(const K &key, const V &value) {
308  serialization::pimpl::Data keyData = toData(key);
309  serialization::pimpl::Data valueData = toData(value);
310 
311  return TypedData(replaceInternal(keyData, valueData), context->getSerializationService());
312  }
313 
321  template<typename K, typename V>
322  void set(const K &key, const V &value) {
323  set(key, value, -1);
324  }
325 
335  template<typename K, typename V>
336  void set(const K &key, const V &value, long ttl) {
337  serialization::pimpl::Data keyData = toData(key);
338  serialization::pimpl::Data valueData = toData(value);
339 
340  setInternal(keyData, valueData, ttl);
341  }
342 
357  template<typename K>
358  void lock(const K &key) {
359  lock(key, -1);
360  }
361 
380  template<typename K>
381  void lock(const K &key, long leaseTime) {
382  serialization::pimpl::Data keyData = toData(key);
383 
384  proxy::IMapImpl::lock(toData(key), leaseTime);
385  }
386 
395  template<typename K>
396  bool isLocked(const K &key) {
397  return proxy::IMapImpl::isLocked(toData(key));
398  }
399 
409  template<typename K>
410  bool tryLock(const K &key) {
411  return tryLock(key, 0);
412  }
413 
430  template<typename K>
431  bool tryLock(const K &key, long timeInMillis) {
432  return proxy::IMapImpl::tryLock(toData(key), timeInMillis);
433  }
434 
448  template<typename K>
449  void unlock(const K &key) {
450  proxy::IMapImpl::unlock(toData(key));
451  }
452 
461  template<typename K>
462  void forceUnlock(const K &key) {
463  proxy::IMapImpl::forceUnlock(toData(key));
464  }
465 
477  template<typename MapInterceptor>
478  std::string addInterceptor(MapInterceptor &interceptor) {
479  return proxy::IMapImpl::addInterceptor(interceptor);
480  }
481 
488  void removeInterceptor(const std::string &id);
489 
504  std::string addEntryListener(MixedEntryListener &listener, bool includeValue);
505 
521  std::string
522  addEntryListener(MixedEntryListener &listener, const query::Predicate &predicate, bool includeValue);
523 
533  bool removeEntryListener(const std::string &registrationId);
534 
548  template<typename K>
549  std::string addEntryListener(const K &key, MixedEntryListener &listener, bool includeValue) {
550  serialization::pimpl::Data keyData = toData(key);
551  impl::MixedEntryEventHandler<protocol::codec::MapAddEntryListenerCodec::AbstractEventHandler> *entryEventHandler =
552  new impl::MixedEntryEventHandler<protocol::codec::MapAddEntryListenerCodec::AbstractEventHandler>(
553  getName(), context->getClientClusterService(), context->getSerializationService(),
554  listener,
555  includeValue);
556  return proxy::IMapImpl::addEntryListener(entryEventHandler, keyData, includeValue);
557  }
558 
567  template<typename K>
568  std::auto_ptr<EntryView<TypedData, TypedData> > getEntryView(const K &key) {
569  std::auto_ptr<serialization::pimpl::Data> keyData(new serialization::pimpl::Data(toData(key)));
570  std::auto_ptr<map::DataEntryView> dataEntryView = proxy::IMapImpl::getEntryViewData(*keyData);
571  if ((map::DataEntryView *) NULL == dataEntryView.get()) {
572  return std::auto_ptr<EntryView<TypedData, TypedData> >();
573  }
574  TypedData value(std::auto_ptr<serialization::pimpl::Data>(
575  new serialization::pimpl::Data(dataEntryView->getValue())),
576  context->getSerializationService());
577  const TypedData &keyTypedData = TypedData(keyData, context->getSerializationService());
578  std::auto_ptr<EntryView<TypedData, TypedData> > view(new EntryView<TypedData, TypedData>(
579  keyTypedData, value, *dataEntryView));
580  return view;
581  }
582 
593  template<typename K>
594  bool evict(const K &key) {
595  serialization::pimpl::Data keyData = toData(key);
596 
597  return evictInternal(keyData);
598  }
599 
611  void evictAll();
612 
619  template<typename K>
620  std::vector<std::pair<TypedData, TypedData> > getAll(const std::set<K> &keys) {
621  if (keys.empty()) {
622  return std::vector<std::pair<TypedData, TypedData> >();
623  }
624 
625  PID_TO_KEY_MAP partitionToKeyData;
626 
627  for (typename std::set<K>::const_iterator it = keys.begin(); it != keys.end(); ++it) {
628  const K &key = *it;
629  serialization::pimpl::Data keyData = toData<K>(key);
630 
631  int partitionId = getPartitionId(keyData);
632 
633  partitionToKeyData[partitionId].push_back(toShared(keyData));
634  }
635 
636  return toTypedDataEntrySet(getAllInternal(partitionToKeyData));
637  }
638 
646  std::vector<TypedData> keySet();
647 
660  std::vector<TypedData> keySet(const serialization::IdentifiedDataSerializable &predicate);
661 
673  std::vector<TypedData> keySet(const query::Predicate &predicate);
674 
686  template<typename K, typename V>
687  std::vector<K> keySet(query::PagingPredicate<K, V> &predicate) {
688  predicate.setIterationType(query::KEY);
689 
690  std::vector<serialization::pimpl::Data> dataResult = keySetForPagingPredicateData(predicate);
691 
692  EntryVector entryResult;
693  for (std::vector<serialization::pimpl::Data>::iterator it = dataResult.begin();
694  it != dataResult.end(); ++it) {
695  entryResult.push_back(std::pair<serialization::pimpl::Data, serialization::pimpl::Data>(*it,
696  serialization::pimpl::Data()));
697  }
698 
699  client::impl::EntryArrayImpl<K, V> entries(entryResult, context->getSerializationService());
700  entries.sort(query::KEY, predicate.getComparator());
701 
702  std::pair<size_t, size_t> range = updateAnchor<K, V>(entries, predicate, query::KEY);
703 
704  std::vector<K> result;
705  for (size_t i = range.first; i < range.second; ++i) {
706  result.push_back(*entries.getKey(i));
707  }
708 
709  return result;
710  }
711 
719  std::vector<TypedData> values();
720 
731  std::vector<TypedData> values(const serialization::IdentifiedDataSerializable &predicate);
732 
741  std::vector<TypedData> values(const query::Predicate &predicate);
742 
752  template<typename K, typename V>
753  std::vector<V> values(query::PagingPredicate<K, V> &predicate) {
754  predicate.setIterationType(query::VALUE);
755 
756  EntryVector dataResult = proxy::IMapImpl::valuesForPagingPredicateData(predicate);
757 
758  client::impl::EntryArrayImpl<K, V> entries(dataResult, context->getSerializationService());
759 
760  entries.sort(query::VALUE, predicate.getComparator());
761 
762  std::pair<size_t, size_t> range = updateAnchor<K, V>(entries, predicate, query::VALUE);
763 
764  std::vector<V> result;
765  for (size_t i = range.first; i < range.second; ++i) {
766  result.push_back(*entries.getValue(i));
767  }
768  return result;
769  }
770 
778  std::vector<std::pair<TypedData, TypedData> > entrySet();
779 
792  std::vector<std::pair<TypedData, TypedData> >
793  entrySet(const serialization::IdentifiedDataSerializable &predicate);
794 
805  std::vector<std::pair<TypedData, TypedData> > entrySet(const query::Predicate &predicate);
806 
817  template<typename K, typename V>
818  std::vector<std::pair<K, V> > entrySet(query::PagingPredicate<K, V> &predicate) {
819  std::vector<std::pair<serialization::pimpl::Data, serialization::pimpl::Data> > dataResult =
820  proxy::IMapImpl::entrySetForPagingPredicateData(predicate);
821 
822  client::impl::EntryArrayImpl<K, V> entries(dataResult, context->getSerializationService());
823  entries.sort(query::ENTRY, predicate.getComparator());
824 
825  std::pair<size_t, size_t> range = updateAnchor<K, V>(entries, predicate, query::ENTRY);
826 
827  std::vector<std::pair<K, V> > result;
828  for (size_t i = range.first; i < range.second; ++i) {
829  std::pair<const K *, const V *> entry = entries[i];
830  result.push_back(std::pair<K, V>(*entry.first, *entry.second));
831  }
832  return result;
833  }
834 
867  void addIndex(const std::string &attribute, bool ordered);
868 
883  template<typename K, typename EntryProcessor>
884  TypedData executeOnKey(const K &key, const EntryProcessor &entryProcessor) {
885  serialization::pimpl::Data keyData = toData(key);
886  serialization::pimpl::Data processorData = toData(entryProcessor);
887 
888  std::auto_ptr<serialization::pimpl::Data> response = executeOnKeyInternal(keyData, processorData);
889 
890  return TypedData(response, getSerializationService());
891  }
892 
893  template<typename K, typename EntryProcessor>
894  Future<TypedData> submitToKey(const K &key, const EntryProcessor &entryProcessor) {
895  serialization::pimpl::Data keyData = toData(key);
896  serialization::pimpl::Data processorData = toData(entryProcessor);
897 
898  return submitToKeyInternal<TypedData>(keyData, processorData);
899  }
900 
901  template<typename K, typename EntryProcessor>
902  std::map<K, TypedData> executeOnKeys(const std::set<K> &keys, const EntryProcessor &entryProcessor) {
903  EntryVector entries = executeOnKeysInternal<K, EntryProcessor>(keys, entryProcessor);
904 
905  std::map<K, TypedData> result;
906  serialization::pimpl::SerializationService &serializationService = getSerializationService();
907  for (size_t i = 0; i < entries.size(); ++i) {
908  std::auto_ptr<K> keyObj = toObject<K>(entries[i].first);
909  result[*keyObj] = TypedData(std::auto_ptr<serialization::pimpl::Data>(
910  new serialization::pimpl::Data(entries[i].second)), serializationService);
911  }
912  return result;
913  }
914 
927  template<typename EntryProcessor>
928  std::map<TypedData, TypedData> executeOnEntries(const EntryProcessor &entryProcessor) {
929  EntryVector entries = proxy::IMapImpl::executeOnEntriesData<EntryProcessor>(entryProcessor);
930  std::map<TypedData, TypedData> result;
931  for (size_t i = 0; i < entries.size(); ++i) {
932  std::auto_ptr<serialization::pimpl::Data> keyData(
933  new serialization::pimpl::Data(entries[i].first));
934  std::auto_ptr<serialization::pimpl::Data> valueData(
935  new serialization::pimpl::Data(entries[i].second));
936  serialization::pimpl::SerializationService &serializationService = context->getSerializationService();
937  result[TypedData(keyData, serializationService)] = TypedData(valueData, serializationService);
938  }
939  return result;
940  }
941 
956  template<typename EntryProcessor>
957  std::map<TypedData, TypedData>
958  executeOnEntries(const EntryProcessor &entryProcessor, const query::Predicate &predicate) {
959  EntryVector entries = proxy::IMapImpl::executeOnEntriesData<EntryProcessor>(entryProcessor,
960  predicate);
961  std::map<TypedData, TypedData> result;
962  for (size_t i = 0; i < entries.size(); ++i) {
963  std::auto_ptr<serialization::pimpl::Data> keyData(
964  new serialization::pimpl::Data(entries[i].first));
965  std::auto_ptr<serialization::pimpl::Data> valueData(
966  new serialization::pimpl::Data(entries[i].second));
967  serialization::pimpl::SerializationService &serializationService = context->getSerializationService();
968  result[TypedData(keyData, serializationService)] = TypedData(valueData, serializationService);
969  }
970  return result;
971  }
972 
980  int size();
981 
987  bool isEmpty();
988 
989 
1000  template<typename K, typename V>
1001  void putAll(const std::map<K, V> &entries) {
1002  std::map<int, EntryVector> entryMap;
1003 
1004  for (typename std::map<K, V>::const_iterator it = entries.begin(); it != entries.end(); ++it) {
1005  serialization::pimpl::Data keyData = toData(it->first);
1006  serialization::pimpl::Data valueData = toData(it->second);
1007 
1008  int partitionId = getPartitionId(keyData);
1009 
1010  entryMap[partitionId].push_back(std::make_pair(keyData, valueData));
1011  }
1012 
1013  putAllInternal(entryMap);
1014  }
1015 
1020  void clear();
1021 
1022  serialization::pimpl::SerializationService &getSerializationService() const;
1023 
1024  virtual monitor::LocalMapStats &getLocalMapStats();
1025 
1026  protected:
1027  virtual boost::shared_ptr<TypedData> getInternal(serialization::pimpl::Data &keyData);
1028 
1029  virtual bool containsKeyInternal(const serialization::pimpl::Data &keyData);
1030 
1031  virtual std::auto_ptr<serialization::pimpl::Data> removeInternal(
1032  const serialization::pimpl::Data &keyData);
1033 
1034  virtual bool removeInternal(
1035  const serialization::pimpl::Data &keyData, const serialization::pimpl::Data &valueData);
1036 
1037  virtual void removeAllInternal(const serialization::pimpl::Data &predicateData);
1038 
1039  virtual void deleteInternal(const serialization::pimpl::Data &keyData);
1040 
1041  virtual bool tryRemoveInternal(const serialization::pimpl::Data &keyData, long timeoutInMillis);
1042 
1043  virtual bool tryPutInternal(const serialization::pimpl::Data &keyData,
1044  const serialization::pimpl::Data &valueData, long timeoutInMillis);
1045 
1046  virtual std::auto_ptr<serialization::pimpl::Data> putInternal(const serialization::pimpl::Data &keyData,
1047  const serialization::pimpl::Data &valueData,
1048  long timeoutInMillis);
1049 
1050  virtual void tryPutTransientInternal(const serialization::pimpl::Data &keyData,
1051  const serialization::pimpl::Data &valueData, int ttlInMillis);
1052 
1053  virtual std::auto_ptr<serialization::pimpl::Data>
1054  putIfAbsentInternal(const serialization::pimpl::Data &keyData,
1055  const serialization::pimpl::Data &valueData,
1056  int ttlInMillis);
1057 
1058  virtual bool replaceIfSameInternal(const serialization::pimpl::Data &keyData,
1059  const serialization::pimpl::Data &valueData,
1060  const serialization::pimpl::Data &newValueData);
1061 
1062  virtual std::auto_ptr<serialization::pimpl::Data>
1063  replaceInternal(const serialization::pimpl::Data &keyData,
1064  const serialization::pimpl::Data &valueData);
1065 
1066  virtual void
1067  setInternal(const serialization::pimpl::Data &keyData, const serialization::pimpl::Data &valueData,
1068  int ttlInMillis);
1069 
1070  virtual bool evictInternal(const serialization::pimpl::Data &keyData);
1071 
1072  virtual EntryVector getAllInternal(const PID_TO_KEY_MAP &partitionToKeyData);
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>
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::encodeRequest(getName(),
1086  processor,
1087  keyData,
1088  util::getCurrentThreadId());
1089 
1090  boost::shared_ptr<spi::impl::ClientInvocationFuture> clientInvocationFuture = invokeAndGetFuture(
1091  request, partitionId);
1092 
1093  return client::Future<ResultType>(clientInvocationFuture, getSerializationService(),
1094  submitToKeyDecoder);
1095  }
1096 
1097  static std::auto_ptr<serialization::pimpl::Data> submitToKeyDecoder(protocol::ClientMessage &response);
1098 
1099  template<typename K, typename EntryProcessor>
1100  EntryVector executeOnKeysInternal(const std::set<K> &keys, const EntryProcessor &entryProcessor) {
1101  if (keys.empty()) {
1102  return EntryVector();
1103  }
1104 
1105  std::vector<serialization::pimpl::Data> keysData;
1106  for (typename std::set<K>::const_iterator it = keys.begin(); it != keys.end(); ++it) {
1107  keysData.push_back(toData<K>(*it));
1108  }
1109 
1110  serialization::pimpl::Data entryProcessorData = toData<EntryProcessor>(entryProcessor);
1111 
1112  return proxy::IMapImpl::executeOnKeysData(keysData, entryProcessorData);
1113  }
1114 
1115  virtual void
1116  putAllInternal(const std::map<int, EntryVector> &entries);
1117 
1118  private:
1119  monitor::impl::LocalMapStatsImpl stats;
1120  };
1121  }
1122  }
1123 }
1124 
1125 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
1126 #pragma warning(pop)
1127 #endif
1128 
1129 #endif /* HAZELCAST_CLIENT_MIXEDTYPE_MAP_H_ */
1130 
std::vector< V > values(query::PagingPredicate< K, V > &predicate)
Returns a vector clone of the values contained in this map.
Definition: ClientMapProxy.h:753
bool containsValue(const V &value)
check if this map contains value.
Definition: ClientMapProxy.h:87
std::map< TypedData, TypedData > executeOnEntries(const EntryProcessor &entryProcessor)
Applies the user defined EntryProcessor to the all entries in the map.
Definition: ClientMapProxy.h:928
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:291
void lock(const K &key)
Acquires the lock for the specified key.
Definition: ClientMapProxy.h:358
bool evict(const K &key)
Evicts the specified key from this map.
Definition: ClientMapProxy.h:594
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:131
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:449
TypedData executeOnKey(const K &key, const EntryProcessor &entryProcessor)
Applies the user defined EntryProcessor to the entry mapped by the key.
Definition: ClientMapProxy.h:884
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:115
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:818
bool isLocked(const K &key)
Checks the lock for the specified key.
Definition: ClientMapProxy.h:396
std::auto_ptr< EntryView< TypedData, TypedData > > getEntryView(const K &key)
Returns the EntryView for the specified key.
Definition: ClientMapProxy.h:568
std::string addEntryListener(const K &key, MixedEntryListener &listener, bool includeValue)
Adds the specified entry listener for the specified key.
Definition: ClientMapProxy.h:549
bool containsKey(const K &key)
check if this map contains key.
Definition: ClientMapProxy.h:75
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:225
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:1001
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:687
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:242
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:258
void forceUnlock(const K &key)
Releases the lock for the specified key regardless of the lock owner.
Definition: ClientMapProxy.h:462
Concurrent, distributed, observable and queryable map client.
Definition: ClientMapProxy.h:62
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:274
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:410
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:206
This specialization overwrites the get method to return TypedData.
Definition: Future.h:230
void lock(const K &key, long leaseTime)
Acquires the lock for the specified key for the specified lease time.
Definition: ClientMapProxy.h:381
bool tryLock(const K &key, long timeInMillis)
Tries to acquire the lock for the specified key.
Definition: ClientMapProxy.h:431
std::string addInterceptor(MapInterceptor &interceptor)
Adds an interceptor for this map.
Definition: ClientMapProxy.h:478
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:620
TypedData replace(const K &key, const V &value)
Replaces the entry for a key only if currently mapped to some value.
Definition: ClientMapProxy.h:307
void deleteEntry(const K &key)
removes entry from map.
Definition: ClientMapProxy.h:183
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:958