CatapultServer  v0.5.0.1 (Elephant)
catapult::mongo::storages::MongoFlatCacheStorage< TCacheTraits > Class Template Reference

A mongo cache storage that persists flat cache data using delete and upsert. More...

Inheritance diagram for catapult::mongo::storages::MongoFlatCacheStorage< TCacheTraits >:
Collaboration diagram for catapult::mongo::storages::MongoFlatCacheStorage< TCacheTraits >:

Public Member Functions

 MongoFlatCacheStorage (MongoStorageContext &storageContext, model::NetworkIdentifier networkIdentifier)
 Creates a cache storage around storageContext and networkIdentifier. More...
 
- Public Member Functions inherited from catapult::mongo::ExternalCacheStorageT< TCacheTraits::CacheType >
 ExternalCacheStorageT ()
 Creates an external cache storage. More...
 
void saveDelta (const cache::CacheChanges &changes) final override
 Saves cache changes to external storage. More...
 
- Public Member Functions inherited from catapult::mongo::ExternalCacheStorage
virtual ~ExternalCacheStorage ()=default
 
const std::string & name () const
 Gets the cache name. More...
 
size_t id () const
 Gets the cache id. More...
 

Private Types

using CacheChangesType = cache::SingleCacheChangesT< typename TCacheTraits::CacheDeltaType, typename TCacheTraits::ModelType >
 
using KeyType = typename TCacheTraits::KeyType
 
using ModelType = typename TCacheTraits::ModelType
 
using ElementContainerType = std::unordered_set< const ModelType * >
 

Private Member Functions

void saveDelta (const CacheChangesType &changes) override
 Saves cache changes to external storage. More...
 
void removeAll (const ElementContainerType &elements)
 
void upsertAll (const ElementContainerType &elements)
 

Static Private Member Functions

static bsoncxx::document::value CreateFilter (const ModelType *pModel)
 
static bsoncxx::document::value CreateFilterByKey (const KeyType &key)
 

Private Attributes

MongoDatabase m_database
 
MongoErrorPolicy m_errorPolicy
 
MongoBulkWriterm_bulkWriter
 
model::NetworkIdentifier m_networkIdentifier
 

Additional Inherited Members

- Protected Member Functions inherited from catapult::mongo::ExternalCacheStorage
 ExternalCacheStorage (const std::string &name, size_t id)
 Creates an external cache storage around name and id. More...
 

Detailed Description

template<typename TCacheTraits>
class catapult::mongo::storages::MongoFlatCacheStorage< TCacheTraits >

A mongo cache storage that persists flat cache data using delete and upsert.

Member Typedef Documentation

◆ CacheChangesType

template<typename TCacheTraits >
using catapult::mongo::storages::MongoFlatCacheStorage< TCacheTraits >::CacheChangesType = cache::SingleCacheChangesT<typename TCacheTraits::CacheDeltaType, typename TCacheTraits::ModelType>
private

◆ ElementContainerType

template<typename TCacheTraits >
using catapult::mongo::storages::MongoFlatCacheStorage< TCacheTraits >::ElementContainerType = std::unordered_set<const ModelType*>
private

◆ KeyType

template<typename TCacheTraits >
using catapult::mongo::storages::MongoFlatCacheStorage< TCacheTraits >::KeyType = typename TCacheTraits::KeyType
private

◆ ModelType

template<typename TCacheTraits >
using catapult::mongo::storages::MongoFlatCacheStorage< TCacheTraits >::ModelType = typename TCacheTraits::ModelType
private

Constructor & Destructor Documentation

◆ MongoFlatCacheStorage()

template<typename TCacheTraits >
catapult::mongo::storages::MongoFlatCacheStorage< TCacheTraits >::MongoFlatCacheStorage ( MongoStorageContext storageContext,
model::NetworkIdentifier  networkIdentifier 
)
inline

Creates a cache storage around storageContext and networkIdentifier.

Member Function Documentation

◆ CreateFilter()

template<typename TCacheTraits >
static bsoncxx::document::value catapult::mongo::storages::MongoFlatCacheStorage< TCacheTraits >::CreateFilter ( const ModelType pModel)
inlinestaticprivate

◆ CreateFilterByKey()

template<typename TCacheTraits >
static bsoncxx::document::value catapult::mongo::storages::MongoFlatCacheStorage< TCacheTraits >::CreateFilterByKey ( const KeyType key)
inlinestaticprivate

◆ removeAll()

template<typename TCacheTraits >
void catapult::mongo::storages::MongoFlatCacheStorage< TCacheTraits >::removeAll ( const ElementContainerType elements)
inlineprivate
Here is the call graph for this function:

◆ saveDelta()

template<typename TCacheTraits >
void catapult::mongo::storages::MongoFlatCacheStorage< TCacheTraits >::saveDelta ( const CacheChangesType changes)
inlineoverrideprivatevirtual

Saves cache changes to external storage.

Implements catapult::mongo::ExternalCacheStorageT< TCacheTraits::CacheType >.

Here is the call graph for this function:

◆ upsertAll()

template<typename TCacheTraits >
void catapult::mongo::storages::MongoFlatCacheStorage< TCacheTraits >::upsertAll ( const ElementContainerType elements)
inlineprivate
Here is the call graph for this function:

Member Data Documentation

◆ m_bulkWriter

template<typename TCacheTraits >
MongoBulkWriter& catapult::mongo::storages::MongoFlatCacheStorage< TCacheTraits >::m_bulkWriter
private

◆ m_database

template<typename TCacheTraits >
MongoDatabase catapult::mongo::storages::MongoFlatCacheStorage< TCacheTraits >::m_database
private

◆ m_errorPolicy

template<typename TCacheTraits >
MongoErrorPolicy catapult::mongo::storages::MongoFlatCacheStorage< TCacheTraits >::m_errorPolicy
private

◆ m_networkIdentifier

template<typename TCacheTraits >
model::NetworkIdentifier catapult::mongo::storages::MongoFlatCacheStorage< TCacheTraits >::m_networkIdentifier
private

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