Apache Ignite C++ Client
Loading...
Searching...
No Matches
ignite::key_value_view< K, V > Class Template Reference

#include <key_value_view.h>

Public Types

typedef std::decay< K >::type key_type
typedef std::decay< V >::type value_type

Public Member Functions

 key_value_view (const key_value_view &)=delete
key_value_viewoperator= (const key_value_view &)=delete
 key_value_view (key_value_view &&) noexcept=default
key_value_viewoperator= (key_value_view &&) noexcept=default
void get_async (transaction *tx, const key_type &key, ignite_callback< std::optional< value_type > > callback)
std::optional< value_type > get (transaction *tx, const key_type &key)
void get_all_async (transaction *tx, std::vector< key_type > keys, ignite_callback< std::vector< std::optional< value_type > > > callback)
std::vector< std::optional< value_type > > get_all (transaction *tx, std::vector< key_type > keys)
void contains_async (transaction *tx, const key_type &key, ignite_callback< bool > callback)
bool contains (transaction *tx, const key_type &key)
void put_async (transaction *tx, const key_type &key, const value_type &value, ignite_callback< void > callback)
void put (transaction *tx, const key_type &key, const value_type &value)
void put_all_async (transaction *tx, const std::vector< std::pair< key_type, value_type > > &pairs, ignite_callback< void > callback)
void put_all (transaction *tx, const std::vector< std::pair< key_type, value_type > > &pairs)
void get_and_put_async (transaction *tx, const key_type &key, const value_type &value, ignite_callback< std::optional< value_type > > callback)
std::optional< value_type > get_and_put (transaction *tx, const key_type &key, const value_type &value)
void put_if_absent_async (transaction *tx, const key_type &key, const value_type &value, ignite_callback< bool > callback)
bool put_if_absent (transaction *tx, const key_type &key, const value_type &value)
void remove_async (transaction *tx, const key_type &key, ignite_callback< bool > callback)
bool remove (transaction *tx, const key_type &key)
void remove_async (transaction *tx, const key_type &key, const value_type &value, ignite_callback< bool > callback)
bool remove (transaction *tx, const key_type &key, const value_type &value)
void remove_all_async (transaction *tx, std::vector< key_type > keys, ignite_callback< std::vector< key_type > > callback)
std::vector< key_type > remove_all (transaction *tx, std::vector< key_type > keys)
void remove_all_async (transaction *tx, const std::vector< std::pair< key_type, value_type > > &pairs, ignite_callback< std::vector< key_type > > callback)
std::vector< key_type > remove_all (transaction *tx, std::vector< std::pair< key_type, value_type > > pairs)
void get_and_remove_async (transaction *tx, const key_type &key, ignite_callback< std::optional< value_type > > callback)
std::optional< value_type > get_and_remove (transaction *tx, const key_type &key)
void replace_async (transaction *tx, const key_type &key, const value_type &value, ignite_callback< bool > callback)
bool replace (transaction *tx, const key_type &key, const value_type &value)
void replace_async (transaction *tx, const key_type &key, const value_type &old_value, const value_type &new_value, ignite_callback< bool > callback)
bool replace (transaction *tx, const key_type &key, const value_type &old_value, const value_type &new_value)
void get_and_replace_async (transaction *tx, const key_type &key, const value_type &value, ignite_callback< std::optional< value_type > > callback)
std::optional< value_type > get_and_replace (transaction *tx, const key_type &key, const value_type &value)

Friends

class table

Detailed Description

template<typename K, typename V>
class ignite::key_value_view< K, V >

Key-Value view interface provides methods to access table records in form of separate key and value parts.

Member Function Documentation

◆ contains()

template<typename K, typename V>
bool ignite::key_value_view< K, V >::contains ( transaction * tx,
const key_type & key )
inlinenodiscard

Determines if the table contains an entry for the specified key.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
Returns
Value indicating whether value exists or not.

◆ contains_async()

template<typename K, typename V>
void ignite::key_value_view< K, V >::contains_async ( transaction * tx,
const key_type & key,
ignite_callback< bool > callback )
inline

Asynchronously determines if the table contains a value for the specified key.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
callbackCallback which is called on success with value indicating whether value exists or not.

◆ get()

template<typename K, typename V>
std::optional< value_type > ignite::key_value_view< K, V >::get ( transaction * tx,
const key_type & key )
inlinenodiscard

Gets a value by key.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
Returns
Value if exists and std::nullopt otherwise.

◆ get_all()

template<typename K, typename V>
std::vector< std::optional< value_type > > ignite::key_value_view< K, V >::get_all ( transaction * tx,
std::vector< key_type > keys )
inlinenodiscard

Gets multiple values by keys.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keysKeys.
Returns
Resulting records with all columns filled from the table. The order of elements is guaranteed to be the same as the order of keys. If a record does not exist, the resulting element of the corresponding order is std::nullopt.

◆ get_all_async()

template<typename K, typename V>
void ignite::key_value_view< K, V >::get_all_async ( transaction * tx,
std::vector< key_type > keys,
ignite_callback< std::vector< std::optional< value_type > > > callback )
inline

Gets multiple values by keys asynchronously.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keysKeys.
callbackCallback that is called on operation completion. Called with resulting records with all columns filled from the table. The order of elements is guaranteed to be the same as the order of keys. If a record does not exist, the resulting element of the corresponding order is std::nullopt.

◆ get_and_put()

template<typename K, typename V>
std::optional< value_type > ignite::key_value_view< K, V >::get_and_put ( transaction * tx,
const key_type & key,
const value_type & value )
inlinenodiscard

Puts a value with a given key and returns previous value for the key.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
valueValue.
Returns
A replaced value or std::nullopt if it did not exist.

◆ get_and_put_async()

template<typename K, typename V>
void ignite::key_value_view< K, V >::get_and_put_async ( transaction * tx,
const key_type & key,
const value_type & value,
ignite_callback< std::optional< value_type > > callback )
inline

Puts a value with a given key and returns previous value for the key asynchronously.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
valueValue.
callbackCallback. Called with a value which contains replaced value or std::nullopt if it did not exist.

◆ get_and_remove()

template<typename K, typename V>
std::optional< value_type > ignite::key_value_view< K, V >::get_and_remove ( transaction * tx,
const key_type & key )
inline

Gets and removes a value associated with the given key.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keykey.
Returns
A removed record or std::nullopt if it did not exist.

◆ get_and_remove_async()

template<typename K, typename V>
void ignite::key_value_view< K, V >::get_and_remove_async ( transaction * tx,
const key_type & key,
ignite_callback< std::optional< value_type > > callback )
inline

Gets and removes a value associated with the given key asynchronously.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
callbackCallback that is called on operation completion. Called with a removed record or std::nullopt if it did not exist.

◆ get_and_replace()

template<typename K, typename V>
std::optional< value_type > ignite::key_value_view< K, V >::get_and_replace ( transaction * tx,
const key_type & key,
const value_type & value )
inlinenodiscard

Replaces a record with the given key if it exists returning previous value.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
valueValue.
callbackA previous value for the given key, or std::nullopt if it did not exist.

◆ get_and_replace_async()

template<typename K, typename V>
void ignite::key_value_view< K, V >::get_and_replace_async ( transaction * tx,
const key_type & key,
const value_type & value,
ignite_callback< std::optional< value_type > > callback )
inline

Asynchronously replaces a record with the given key if it exists returning previous value.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
valueValue.
callbackCallback. Called with a previous value for the given key, or std::nullopt if it did not exist.

◆ get_async()

template<typename K, typename V>
void ignite::key_value_view< K, V >::get_async ( transaction * tx,
const key_type & key,
ignite_callback< std::optional< value_type > > callback )
inline

Gets a value by key asynchronously.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
callbackCallback which is called on success with value if it exists and std::nullopt otherwise

◆ put()

template<typename K, typename V>
void ignite::key_value_view< K, V >::put ( transaction * tx,
const key_type & key,
const value_type & value )
inline

Puts a value with a given key.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
valueValue.

◆ put_all()

template<typename K, typename V>
void ignite::key_value_view< K, V >::put_all ( transaction * tx,
const std::vector< std::pair< key_type, value_type > > & pairs )
inline

Puts multiple key-value pairs.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
pairsPairs to put.

◆ put_all_async()

template<typename K, typename V>
void ignite::key_value_view< K, V >::put_all_async ( transaction * tx,
const std::vector< std::pair< key_type, value_type > > & pairs,
ignite_callback< void > callback )
inline

Puts multiple key-value pairs asynchronously.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
pairsPairs to put.
callbackCallback that is called on operation completion.

◆ put_async()

template<typename K, typename V>
void ignite::key_value_view< K, V >::put_async ( transaction * tx,
const key_type & key,
const value_type & value,
ignite_callback< void > callback )
inline

Puts a value with a given key asynchronously.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
valueValue.
callbackCallback.

◆ put_if_absent()

template<typename K, typename V>
bool ignite::key_value_view< K, V >::put_if_absent ( transaction * tx,
const key_type & key,
const value_type & value )
inline

Puts a value with a given key if the specified key is not present in the table.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
valueValue.

◆ put_if_absent_async()

template<typename K, typename V>
void ignite::key_value_view< K, V >::put_if_absent_async ( transaction * tx,
const key_type & key,
const value_type & value,
ignite_callback< bool > callback )
inline

Asynchronously puts a value with a given key if the specified key is not present in the table.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
valueValue.
callbackCallback. Called with a value indicating whether the record was inserted. Equals false if a record with the same key already exists.

◆ remove() [1/2]

template<typename K, typename V>
bool ignite::key_value_view< K, V >::remove ( transaction * tx,
const key_type & key )
inline

Removes a value with the specified key.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
Returns
A value indicating whether a record with the specified key was deleted.

◆ remove() [2/2]

template<typename K, typename V>
bool ignite::key_value_view< K, V >::remove ( transaction * tx,
const key_type & key,
const value_type & value )
inline

Removes a value with a given key from the table only if it is equal to the specified value.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
valueValue.
Returns
A value indicating whether a record with the specified key was deleted.

◆ remove_all() [1/2]

template<typename K, typename V>
std::vector< key_type > ignite::key_value_view< K, V >::remove_all ( transaction * tx,
std::vector< key_type > keys )
inline

Removes values with given keys from the table. If one or more keys do not exist, other values are still removed

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keysKeys.
Returns
Records from keys that did not exist.

◆ remove_all() [2/2]

template<typename K, typename V>
std::vector< key_type > ignite::key_value_view< K, V >::remove_all ( transaction * tx,
std::vector< std::pair< key_type, value_type > > pairs )
inline

Removes records with given keys and values from the table. If one or more records do not exist, other records are still removed.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
pairsPairs to remove.
Returns
Records from records that did not exist.

◆ remove_all_async() [1/2]

template<typename K, typename V>
void ignite::key_value_view< K, V >::remove_all_async ( transaction * tx,
const std::vector< std::pair< key_type, value_type > > & pairs,
ignite_callback< std::vector< key_type > > callback )
inline

Removes records with given keys and values from the table asynchronously. If one or more records do not exist, other records are still removed.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
pairsPairs to remove.
callbackCallback that is called on operation completion. Called with records from records that did not exist.

◆ remove_all_async() [2/2]

template<typename K, typename V>
void ignite::key_value_view< K, V >::remove_all_async ( transaction * tx,
std::vector< key_type > keys,
ignite_callback< std::vector< key_type > > callback )
inline

Removes values with given keys from the table asynchronously. If one or more keys do not exist, other values are still removed

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keysKeys.
callbackCallback that is called on operation completion. Called with records from keys that did not exist.

◆ remove_async() [1/2]

template<typename K, typename V>
void ignite::key_value_view< K, V >::remove_async ( transaction * tx,
const key_type & key,
const value_type & value,
ignite_callback< bool > callback )
inline

Asynchronously removes a value with a given key from the table only if it is equal to the specified value.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
valueValue.
callbackCallback that is called on operation completion. Called with a value indicating whether a record with the specified key was deleted.

◆ remove_async() [2/2]

template<typename K, typename V>
void ignite::key_value_view< K, V >::remove_async ( transaction * tx,
const key_type & key,
ignite_callback< bool > callback )
inline

Removes a value with the specified key asynchronously.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
callbackCallback that is called on operation completion. Called with a value indicating whether a record with the specified key was deleted.

◆ replace() [1/2]

template<typename K, typename V>
bool ignite::key_value_view< K, V >::replace ( transaction * tx,
const key_type & key,
const value_type & old_value,
const value_type & new_value )
inline

Replaces a value with a new_value one only if existing value equals to the specified old_value.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
old_valueValue to be replaced.
new_valueNew value.
Returns
A value indicating whether a specified record was replaced.

◆ replace() [2/2]

template<typename K, typename V>
bool ignite::key_value_view< K, V >::replace ( transaction * tx,
const key_type & key,
const value_type & value )
inline

Replaces a record with the same key columns if it exists, otherwise does nothing.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
valueValue.
Returns
A value indicating whether a record with the specified key was replaced.

◆ replace_async() [1/2]

template<typename K, typename V>
void ignite::key_value_view< K, V >::replace_async ( transaction * tx,
const key_type & key,
const value_type & old_value,
const value_type & new_value,
ignite_callback< bool > callback )
inline

Asynchronously replaces a value with a new_value one only if existing value equals to the specified old_value.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
old_valueValue to be replaced.
new_valueNew value.
callbackCallback. Called with a value indicating whether a specified record was replaced.

◆ replace_async() [2/2]

template<typename K, typename V>
void ignite::key_value_view< K, V >::replace_async ( transaction * tx,
const key_type & key,
const value_type & value,
ignite_callback< bool > callback )
inline

Asynchronously replaces a record with the specified key if it exists, otherwise does nothing.

Parameters
txOptional transaction. If nullptr implicit transaction for this single operation is used.
keyKey.
valueValue.
callbackCallback. Called with a value indicating whether a record with the specified key was replaced.

The documentation for this class was generated from the following file: