CatapultServer  v0.5.0.1 (Elephant)
catapult::cache::BasicCache< TCacheDescriptor, TBaseSet, TSubViewArgs > Class Template Reference
Inheritance diagram for catapult::cache::BasicCache< TCacheDescriptor, TBaseSet, TSubViewArgs >:
Collaboration diagram for catapult::cache::BasicCache< TCacheDescriptor, TBaseSet, TSubViewArgs >:

Public Types

using CacheValueType = typename TCacheDescriptor::ValueType
 
using CacheViewType = typename TCacheDescriptor::CacheViewType
 
using CacheDeltaType = typename TCacheDescriptor::CacheDeltaType
 
using CacheReadOnlyType = typename CacheViewType::ReadOnlyView
 

Public Member Functions

 BasicCache (const CacheConfiguration &config, TSubViewArgs &&... subViewArgs)
 Creates an empty cache with config and arguments (subViewArgs). More...
 
CacheViewType createView () const
 Returns a locked view based on this cache. More...
 
CacheDeltaType createDelta ()
 Returns a locked cache delta based on this cache. More...
 
CacheDeltaType createDetachedDelta () const
 
void commit (const CacheDeltaType &delta)
 Commits all pending changes from delta to the underlying storage. More...
 
- Public Member Functions inherited from catapult::utils::MoveOnly
constexpr MoveOnly ()=default
 Default constructor. More...
 
 ~MoveOnly ()=default
 Default destructor. More...
 
 MoveOnly (const NonCopyable &)=delete
 Disabled copy constructor. More...
 
 MoveOnly (MoveOnly &&)=default
 Default move constructor. More...
 
MoveOnlyoperator= (const MoveOnly &)=delete
 Disabled assignment operator. More...
 
MoveOnlyoperator= (MoveOnly &&)=default
 Default move assignment operator. More...
 

Private Member Functions

template<typename TView , typename TSetView >
TView createSubView (const TSetView &setView) const
 

Static Private Member Functions

static void Commit (TBaseSet &m_set, const CacheDeltaType &, std::false_type)
 
static void Commit (TBaseSet &m_set, const CacheDeltaType &delta, std::true_type)
 

Private Attributes

TBaseSet m_set
 
std::tuple< TSubViewArgs... > m_subViewArgs
 

Detailed Description

template<typename TCacheDescriptor, typename TBaseSet, typename... TSubViewArgs>
class catapult::cache::BasicCache< TCacheDescriptor, TBaseSet, TSubViewArgs >

Basic cache implementation that supports multiple views and committing.

Note
Typically, TSubViewArgs will expand to zero or one types.

Member Typedef Documentation

◆ CacheDeltaType

template<typename TCacheDescriptor , typename TBaseSet , typename... TSubViewArgs>
using catapult::cache::BasicCache< TCacheDescriptor, TBaseSet, TSubViewArgs >::CacheDeltaType = typename TCacheDescriptor::CacheDeltaType

◆ CacheReadOnlyType

template<typename TCacheDescriptor , typename TBaseSet , typename... TSubViewArgs>
using catapult::cache::BasicCache< TCacheDescriptor, TBaseSet, TSubViewArgs >::CacheReadOnlyType = typename CacheViewType::ReadOnlyView

◆ CacheValueType

template<typename TCacheDescriptor , typename TBaseSet , typename... TSubViewArgs>
using catapult::cache::BasicCache< TCacheDescriptor, TBaseSet, TSubViewArgs >::CacheValueType = typename TCacheDescriptor::ValueType

◆ CacheViewType

template<typename TCacheDescriptor , typename TBaseSet , typename... TSubViewArgs>
using catapult::cache::BasicCache< TCacheDescriptor, TBaseSet, TSubViewArgs >::CacheViewType = typename TCacheDescriptor::CacheViewType

Constructor & Destructor Documentation

◆ BasicCache()

template<typename TCacheDescriptor , typename TBaseSet , typename... TSubViewArgs>
catapult::cache::BasicCache< TCacheDescriptor, TBaseSet, TSubViewArgs >::BasicCache ( const CacheConfiguration config,
TSubViewArgs &&...  subViewArgs 
)
inline

Creates an empty cache with config and arguments (subViewArgs).

Member Function Documentation

◆ commit()

template<typename TCacheDescriptor , typename TBaseSet , typename... TSubViewArgs>
void catapult::cache::BasicCache< TCacheDescriptor, TBaseSet, TSubViewArgs >::commit ( const CacheDeltaType delta)
inline

Commits all pending changes from delta to the underlying storage.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Commit() [1/2]

template<typename TCacheDescriptor , typename TBaseSet , typename... TSubViewArgs>
static void catapult::cache::BasicCache< TCacheDescriptor, TBaseSet, TSubViewArgs >::Commit ( TBaseSet &  m_set,
const CacheDeltaType ,
std::false_type   
)
inlinestaticprivate
Here is the caller graph for this function:

◆ Commit() [2/2]

template<typename TCacheDescriptor , typename TBaseSet , typename... TSubViewArgs>
static void catapult::cache::BasicCache< TCacheDescriptor, TBaseSet, TSubViewArgs >::Commit ( TBaseSet &  m_set,
const CacheDeltaType delta,
std::true_type   
)
inlinestaticprivate

◆ createDelta()

template<typename TCacheDescriptor , typename TBaseSet , typename... TSubViewArgs>
CacheDeltaType catapult::cache::BasicCache< TCacheDescriptor, TBaseSet, TSubViewArgs >::createDelta ( )
inline

Returns a locked cache delta based on this cache.

◆ createDetachedDelta()

template<typename TCacheDescriptor , typename TBaseSet , typename... TSubViewArgs>
CacheDeltaType catapult::cache::BasicCache< TCacheDescriptor, TBaseSet, TSubViewArgs >::createDetachedDelta ( ) const
inline

Returns a lockable cache delta based on this cache but without the ability to commit any changes to the original cache.

◆ createSubView()

template<typename TCacheDescriptor , typename TBaseSet , typename... TSubViewArgs>
template<typename TView , typename TSetView >
TView catapult::cache::BasicCache< TCacheDescriptor, TBaseSet, TSubViewArgs >::createSubView ( const TSetView &  setView) const
inlineprivate

◆ createView()

template<typename TCacheDescriptor , typename TBaseSet , typename... TSubViewArgs>
CacheViewType catapult::cache::BasicCache< TCacheDescriptor, TBaseSet, TSubViewArgs >::createView ( ) const
inline

Returns a locked view based on this cache.

Member Data Documentation

◆ m_set

template<typename TCacheDescriptor , typename TBaseSet , typename... TSubViewArgs>
TBaseSet catapult::cache::BasicCache< TCacheDescriptor, TBaseSet, TSubViewArgs >::m_set
private

◆ m_subViewArgs

template<typename TCacheDescriptor , typename TBaseSet , typename... TSubViewArgs>
std::tuple<TSubViewArgs...> catapult::cache::BasicCache< TCacheDescriptor, TBaseSet, TSubViewArgs >::m_subViewArgs
private

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