Hazelcast C++ Client
Hazelcast C++ Client Library
transactional_multi_map.h
1 /*
2  * Copyright (c) 2008-2022, 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 #pragma once
17 
18 #include "hazelcast/client/proxy/TransactionalMultiMapImpl.h"
19 
20 namespace hazelcast {
21 namespace client {
28 class HAZELCAST_API transactional_multi_map
29  : public proxy::TransactionalMultiMapImpl
30 {
31  friend class transaction_context;
32 
33 public:
39  template<typename K, typename V>
40  boost::future<bool> put(const K& key, const V& value)
41  {
42  return proxy::TransactionalMultiMapImpl::put_data(to_data(key),
43  to_data(value));
44  }
45 
51  template<typename K, typename V>
52  boost::future<std::vector<V>> get(const K& key)
53  {
54  return to_object_vector<V>(
55  proxy::TransactionalMultiMapImpl::get_data(to_data(key)));
56  }
57 
63  template<typename K, typename V>
64  boost::future<bool> remove(const K& key, const V& value)
65  {
66  return proxy::TransactionalMultiMapImpl::remove(to_data(key),
67  to_data(value));
68  }
69 
75  template<typename K, typename V>
76  boost::future<std::vector<V>> remove(const K& key)
77  {
78  return to_object_vector<V>(
79  proxy::TransactionalMultiMapImpl::remove_data(to_data(key)));
80  }
81 
87  template<typename K>
88  boost::future<int> value_count(const K& key)
89  {
90  return proxy::TransactionalMultiMapImpl::value_count(to_data(key));
91  }
92 
93 private:
94  transactional_multi_map(const std::string& name,
95  txn::TransactionProxy& transaction_proxy)
96  : proxy::TransactionalMultiMapImpl(name, transaction_proxy)
97  {}
98 };
99 } // namespace client
100 } // namespace hazelcast
Provides a context to do transactional operations; so beginning/committing transactions,...
Transactional implementation of MultiMap.
boost::future< std::vector< V > > get(const K &key)
Transactional implementation of multi_map::get(key).
boost::future< bool > put(const K &key, const V &value)
Transactional implementation of multi_map::put(key , value).
boost::future< bool > remove(const K &key, const V &value)
Transactional implementation of multi_map::remove(key , value).
boost::future< int > value_count(const K &key)
Transactional implementation of multi_map::value_count(key).
boost::future< std::vector< V > > remove(const K &key)
Transactional implementation of multi_map::remove(key).