Hazelcast C++ Client
Hazelcast C++ Client Library
Loading...
Searching...
No Matches
transactional_map.h
1/*
2 * Copyright (c) 2008-2025, 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/TransactionalMapImpl.h"
19
20namespace hazelcast {
21namespace client {
27class HAZELCAST_API transactional_map : public proxy::TransactionalMapImpl
28{
29 friend class transaction_context;
30
31public:
37 template<typename K>
38 boost::future<bool> contains_key(const K& key)
39 {
40 return contains_key_data(to_data(key));
41 }
42
48 template<typename K, typename V>
49 boost::future<boost::optional<V>> get(const K& key)
50 {
51 return to_object<V>(get_data(to_data(key)));
52 }
53
62 template<typename K, typename V, typename R = V>
63 boost::future<boost::optional<R>> put(const K& key, const V& value)
64 {
65 return to_object<R>(put_data(to_data(key), to_data(value)));
66 }
67
76 template<typename K, typename V>
77 boost::future<void> set(const K& key, const V& value)
78 {
79 return set_data(to_data(key), to_data(value));
80 }
81
90 template<typename K, typename V, typename R = V>
91 boost::future<boost::optional<R>> put_if_absent(const K& key,
92 const V& value)
93 {
94 return to_object<R>(put_if_absent_data(to_data(key), to_data(value)));
95 }
96
105 template<typename K, typename V, typename R = V>
106 boost::future<boost::optional<R>> replace(const K& key, const V& value)
107 {
108 return to_object<R>(replace_data(to_data(key), to_data(value)));
109 }
110
119 template<typename K, typename V, typename N>
120 boost::future<bool> replace(const K& key,
121 const V& old_value,
122 const N& new_value)
123 {
124 return replace_data(
125 to_data(key), to_data(old_value), to_data(new_value));
126 }
127
136 template<typename K, typename V>
137 boost::future<boost::optional<V>> remove(const K& key)
138 {
139 return to_object<V>(remove_data(to_data(key)));
140 }
141
150 template<typename K>
151 boost::future<void> delete_entry(const K& key)
152 {
153 return delete_entry_data(to_data(key));
154 }
155
164 template<typename K, typename V>
165 boost::future<bool> remove(const K& key, const V& value)
166 {
167 return remove_data(to_data(key), to_data(value));
168 }
169
176 template<typename K>
177 boost::future<std::vector<K>> key_set()
178 {
179 return to_object_vector<K>(key_set_data());
180 }
181
188 template<typename K, typename P>
189 boost::future<std::vector<K>> key_set(const P& predicate)
190 {
191 return to_object_vector<K>(key_set_data(to_data(predicate)));
192 }
193
200 template<typename V>
201 boost::future<std::vector<V>> values()
202 {
203 return to_object_vector<V>(values_data());
204 }
205
211 template<typename V, typename P>
212 boost::future<std::vector<V>> values(const P& predicate)
213 {
214 return to_object_vector<V>(values_data(to_data(predicate)));
215 }
216
217private:
218 transactional_map(const std::string& name,
219 txn::TransactionProxy& transaction_proxy)
220 : proxy::TransactionalMapImpl(name, transaction_proxy)
221 {}
222};
223} // namespace client
224} // namespace hazelcast
Transactional implementation of imap.
boost::future< void > set(const K &key, const V &value)
Transactional implementation of imap::set(key, value).
boost::future< std::vector< V > > values(const P &predicate)
Transactional implementation of imap::values(Predicate) .
boost::future< boost::optional< V > > get(const K &key)
Transactional implementation of imap::get(Object).
boost::future< std::vector< K > > key_set()
Transactional implementation of imap::keySet().
boost::future< void > delete_entry(const K &key)
Transactional implementation of imap::delete(key).
boost::future< boost::optional< R > > put(const K &key, const V &value)
Transactional implementation of imap::put(Object, Object).
boost::future< bool > contains_key(const K &key)
Transactional implementation of imap::contains_key(Object).
boost::future< bool > remove(const K &key, const V &value)
Transactional implementation of imap::remove(key, value).
boost::future< std::vector< K > > key_set(const P &predicate)
Transactional implementation of imap::keySet(Predicate) .
boost::future< bool > replace(const K &key, const V &old_value, const N &new_value)
Transactional implementation of imap::replace(key, value, oldValue).
boost::future< boost::optional< R > > put_if_absent(const K &key, const V &value)
Transactional implementation of imap::putIfAbsent(key, value)
boost::future< std::vector< V > > values()
Transactional implementation of imap::values().
boost::future< boost::optional< R > > replace(const K &key, const V &value)
Transactional implementation of imap::replace(key, value).
boost::future< boost::optional< V > > remove(const K &key)
Transactional implementation of imap::remove(key).