CCF
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
ccf::kv::ReadableValueHandle< V, VSerialiser, Unit > Class Template Reference

#include <value_handle.h>

Inherited by ccf::kv::ValueHandle< V, VSerialiser, Unit >.

Public Types

using ValueType = V
 

Public Member Functions

 ReadableValueHandle (ccf::kv::untyped::MapHandle &uh)
 
std::optional< V > get ()
 
std::optional< V > get_globally_committed ()
 
bool has ()
 
std::optional< Versionget_version_of_previous_write ()
 

Protected Attributes

ccf::kv::untyped::MapHandleread_handle
 

Detailed Description

template<typename V, typename VSerialiser, typename Unit>
class ccf::kv::ReadableValueHandle< V, VSerialiser, Unit >

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

Member Typedef Documentation

◆ ValueType

template<typename V , typename VSerialiser , typename Unit >
using ccf::kv::ReadableValueHandle< V, VSerialiser, Unit >::ValueType = V

Constructor & Destructor Documentation

◆ ReadableValueHandle()

template<typename V , typename VSerialiser , typename Unit >
ccf::kv::ReadableValueHandle< V, VSerialiser, Unit >::ReadableValueHandle ( ccf::kv::untyped::MapHandle uh)
inline

Member Function Documentation

◆ get()

template<typename V , typename VSerialiser , typename Unit >
std::optional< V > ccf::kv::ReadableValueHandle< V, VSerialiser, Unit >::get ( )
inline

Get the stored value.

This will return nullopt of the value has never been set, or has been removed.

Returns
Optional containing associated value, or empty if the value doesn't exist

◆ get_globally_committed()

template<typename V , typename VSerialiser , typename Unit >
std::optional< V > ccf::kv::ReadableValueHandle< V, VSerialiser, Unit >::get_globally_committed ( )
inline

Get globally committed value, which has been replicated and acknowledged by consensus protocol.

Returns
Optional containing associated value, or empty if the value doesn't exist in globally committed state

◆ get_version_of_previous_write()

template<typename V , typename VSerialiser , typename Unit >
std::optional< Version > ccf::kv::ReadableValueHandle< V, VSerialiser, Unit >::get_version_of_previous_write ( )
inline

Get version when this value was last written to, by a previous transaction.

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

◆ has()

template<typename V , typename VSerialiser , typename Unit >
bool ccf::kv::ReadableValueHandle< V, VSerialiser, Unit >::has ( )
inline

Test if value is defined.

This is equivalent to get().has_value(), but is more efficient as it doesn't need to deserialise the value.

Returns
Boolean true iff value is defined

Member Data Documentation

◆ read_handle

template<typename V , typename VSerialiser , typename Unit >
ccf::kv::untyped::MapHandle& ccf::kv::ReadableValueHandle< V, VSerialiser, Unit >::read_handle
protected

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