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

A mongo cache storage that persists historical cache data using delete and insert. More...

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

Public Member Functions

 MongoHistoricalCacheStorage (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::CacheType::CacheValueType >
 
using ElementContainerType = typename TCacheTraits::ElementContainerType
 
using IdContainerType = typename TCacheTraits::IdContainerType
 

Private Member Functions

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

Static Private Member Functions

static IdContainerType GetIds (const ElementContainerType &elements)
 
static bsoncxx::document::value CreateDeleteFilter (const IdContainerType &ids)
 

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::MongoHistoricalCacheStorage< TCacheTraits >

A mongo cache storage that persists historical cache data using delete and insert.

Member Typedef Documentation

◆ CacheChangesType

template<typename TCacheTraits >
using catapult::mongo::storages::MongoHistoricalCacheStorage< TCacheTraits >::CacheChangesType = cache::SingleCacheChangesT< typename TCacheTraits::CacheDeltaType, typename TCacheTraits::CacheType::CacheValueType>
private

◆ ElementContainerType

template<typename TCacheTraits >
using catapult::mongo::storages::MongoHistoricalCacheStorage< TCacheTraits >::ElementContainerType = typename TCacheTraits::ElementContainerType
private

◆ IdContainerType

template<typename TCacheTraits >
using catapult::mongo::storages::MongoHistoricalCacheStorage< TCacheTraits >::IdContainerType = typename TCacheTraits::IdContainerType
private

Constructor & Destructor Documentation

◆ MongoHistoricalCacheStorage()

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

Creates a cache storage around storageContext and networkIdentifier.

Member Function Documentation

◆ CreateDeleteFilter()

template<typename TCacheTraits >
static bsoncxx::document::value catapult::mongo::storages::MongoHistoricalCacheStorage< TCacheTraits >::CreateDeleteFilter ( const IdContainerType ids)
inlinestaticprivate
Here is the caller graph for this function:

◆ GetIds()

template<typename TCacheTraits >
static IdContainerType catapult::mongo::storages::MongoHistoricalCacheStorage< TCacheTraits >::GetIds ( const ElementContainerType elements)
inlinestaticprivate
Here is the caller graph for this function:

◆ insertAll()

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

◆ removeAll()

template<typename TCacheTraits >
void catapult::mongo::storages::MongoHistoricalCacheStorage< TCacheTraits >::removeAll ( const IdContainerType ids)
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveDelta()

template<typename TCacheTraits >
void catapult::mongo::storages::MongoHistoricalCacheStorage< 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:

Member Data Documentation

◆ m_bulkWriter

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

◆ m_database

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

◆ m_errorPolicy

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

◆ m_networkIdentifier

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

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