CCF
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
ccf::kv::ReadableSetHandle< K, KSerialiser > Class Template Reference

#include <set_handle.h>

Inherited by ccf::kv::SetHandle< K, KSerialiser, Unit >.

Public Types

using KeyType = K
 

Public Member Functions

 ReadableSetHandle (ccf::kv::untyped::MapHandle &uh)
 
bool contains (const K &key)
 
bool contains_globally_committed (const K &key)
 
std::optional< Versionget_version_of_previous_write (const K &key)
 
template<class F >
void foreach (F &&f)
 
size_t size ()
 

Protected Attributes

ccf::kv::untyped::MapHandleread_handle
 

Detailed Description

template<typename K, typename KSerialiser>
class ccf::kv::ReadableSetHandle< K, KSerialiser >

Grants read access to a ccf::kv::Set, as part of a ccf::kv::Tx.

Member Typedef Documentation

◆ KeyType

template<typename K , typename KSerialiser >
using ccf::kv::ReadableSetHandle< K, KSerialiser >::KeyType = K

Constructor & Destructor Documentation

◆ ReadableSetHandle()

template<typename K , typename KSerialiser >
ccf::kv::ReadableSetHandle< K, KSerialiser >::ReadableSetHandle ( ccf::kv::untyped::MapHandle uh)
inline

Member Function Documentation

◆ contains()

template<typename K , typename KSerialiser >
bool ccf::kv::ReadableSetHandle< K, KSerialiser >::contains ( const K &  key)
inline

Test whether a key is present in the set.

This returns true if the key is present, including if it was added to the set during this transaction.

Parameters
keyKey to test
Returns
Boolean true iff key exists

◆ contains_globally_committed()

template<typename K , typename KSerialiser >
bool ccf::kv::ReadableSetHandle< K, KSerialiser >::contains_globally_committed ( const K &  key)
inline

Test whether a key's presence is globally committed, meaning it has been replciated and acknowledged by consensus protocol.

See also
ccf::kv::ReadableMapHandle::get_globally_committed
Parameters
keyKey to test
Returns
Boolean true iff key exists in globally committed state

◆ foreach()

template<typename K , typename KSerialiser >
template<class F >
void ccf::kv::ReadableSetHandle< K, KSerialiser >::foreach ( F &&  f)
inline

Iterate over all entries in this set.

See also
ccf::kv::ReadableMapHandle::foreach
Template Parameters
FFunctor type. Should usually be derived implicitly from f
Parameters
fFunctor instance, taking (const K& k) and returning a bool. Return value determines whether the iteration should continue (true) or stop (false)

◆ get_version_of_previous_write()

template<typename K , typename KSerialiser >
std::optional< Version > ccf::kv::ReadableSetHandle< K, KSerialiser >::get_version_of_previous_write ( const K &  key)
inline

Get version when this key was last added to the set.

Returns nullopt if the key is not present.

See also
ccf::kv::ReadableMapHandle::get_version_of_previous_write
Parameters
keyKey to read
Returns
Optional containing version of applied transaction which last wrote at this key, or nullopt if such a version does not exist

◆ size()

template<typename K , typename KSerialiser >
size_t ccf::kv::ReadableSetHandle< K, KSerialiser >::size ( )
inline

Returns number of entries in this set.

This is the count of all currently present keys, including both those which were already committed and any modifications (taking into account new additions or removals) that have been made during this transaction.

Returns
Count of entries

Member Data Documentation

◆ read_handle

template<typename K , typename KSerialiser >
ccf::kv::untyped::MapHandle& ccf::kv::ReadableSetHandle< K, KSerialiser >::read_handle
protected

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