CatapultServer  v0.5.0.1 (Elephant)
catapult::mongo::MongoStorageContext Class Reference

Context for creating a mongo storage. More...

Public Member Functions

 MongoStorageContext ()=default
 Creates an empty storage context. More...
 
 MongoStorageContext (const mongocxx::uri &uri, const std::string &databaseName, const std::shared_ptr< MongoBulkWriter > &pBulkWriter, MongoErrorPolicy::Mode errorPolicyMode)
 
MongoDatabase createDatabaseConnection ()
 Creates a mongo database connection. More...
 
MongoErrorPolicy createCollectionErrorPolicy (const std::string &collectionName)
 Creates a mongo error policy for the collection with name collectionName. More...
 
MongoBulkWriterbulkWriter () const
 Gets the bulk writer. More...
 

Private Attributes

mongocxx::pool m_connectionPool
 
std::string m_databaseName
 
std::shared_ptr< MongoBulkWriterm_pBulkWriter
 
MongoErrorPolicy::Mode m_errorPolicyMode
 

Detailed Description

Context for creating a mongo storage.

Constructor & Destructor Documentation

◆ MongoStorageContext() [1/2]

catapult::mongo::MongoStorageContext::MongoStorageContext ( )
default

Creates an empty storage context.

◆ MongoStorageContext() [2/2]

catapult::mongo::MongoStorageContext::MongoStorageContext ( const mongocxx::uri &  uri,
const std::string &  databaseName,
const std::shared_ptr< MongoBulkWriter > &  pBulkWriter,
MongoErrorPolicy::Mode  errorPolicyMode 
)
inline

Creates a storage context for a mongodb-based storage connected to uri storing inside database databaseName with the specified bulk writer (pBulkWriter) and error policy mode (errorPolicyMode).

Member Function Documentation

◆ bulkWriter()

MongoBulkWriter& catapult::mongo::MongoStorageContext::bulkWriter ( ) const
inline

Gets the bulk writer.

◆ createCollectionErrorPolicy()

MongoErrorPolicy catapult::mongo::MongoStorageContext::createCollectionErrorPolicy ( const std::string &  collectionName)
inline

Creates a mongo error policy for the collection with name collectionName.

◆ createDatabaseConnection()

MongoDatabase catapult::mongo::MongoStorageContext::createDatabaseConnection ( )
inline

Creates a mongo database connection.

Member Data Documentation

◆ m_connectionPool

mongocxx::pool catapult::mongo::MongoStorageContext::m_connectionPool
private

◆ m_databaseName

std::string catapult::mongo::MongoStorageContext::m_databaseName
private

◆ m_errorPolicyMode

MongoErrorPolicy::Mode catapult::mongo::MongoStorageContext::m_errorPolicyMode
private

◆ m_pBulkWriter

std::shared_ptr<MongoBulkWriter> catapult::mongo::MongoStorageContext::m_pBulkWriter
private

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