MongoDBStorageMixin Class Reference

#include <RobotAPI/libraries/armem/server/ltm/detail/mixins/MongoDBStorageMixin.h>

+ Inheritance diagram for MongoDBStorageMixin:

Public Member Functions

std::optional< mongocxx::collection > collectionExists () const
 
std::optional< mongocxx::database > databaseExists () const
 
std::optional< nlohmann::json > documentExists () const
 
std::optional< nlohmann::json > documentExists (const std::string &id) const
 
mongocxx::collection ensureCollectionExists (bool createIfNotExistent=false)
 
mongocxx::database ensureDatabaseExists (bool createIfNotExistent=false)
 
nlohmann::json ensureDocumentExists (bool createIfNotExistent=false)
 
nlohmann::json ensureDocumentExists (const std::string &id, bool createIfNotExistent=false)
 
mongocxx::collection ensurePreviousCollectionExists (bool createIfNotExistent=false)
 
std::vector< nlohmann::json > getAllDocuments () const
 
std::string getCollectionName () const
 
std::string getDatabaseName () const
 
std::string getDocumentName () const
 
std::string getPreviousCollectionName () const
 
MongoDBSettings getSettings () const
 
 MongoDBStorageMixin ()=default
 
 MongoDBStorageMixin (const MongoDBSettings &settings, const std::string &exportName, const armem::MemoryID &id)
 
std::optional< mongocxx::collection > previousCollectionExists () const
 
nlohmann::json readDataFromDocument () const
 
nlohmann::json readDataFromDocument (const std::string &id) const
 
void writeDataToDocument (const nlohmann::json &data)
 
void writeDataToDocument (const std::string &id, const nlohmann::json &data)
 
void writeForeignKeyToPreviousDocument ()
 
void writeForeignKeyToPreviousDocument (const nlohmann::json &type)
 

Protected Member Functions

void configureMixin (const nlohmann::json &json)
 configuration More...
 
void connect () const
 
bool connected () const
 
void setHost (const std::string &)
 
void setMixinExportName (const std::string &n)
 
void setMixinMemoryID (const armem::MemoryID &)
 setter More...
 
void setPassword (const std::string &)
 
void setPort (const unsigned int)
 
void setUser (const std::string &)
 
void start ()
 start More...
 
void stop ()
 

Static Protected Attributes

static const constexpr char * DATA = "_data"
 
static const constexpr char * FOREIGN_KEY = "_foreign_key"
 
static const constexpr char * ID = "_id"
 
static const constexpr char * METADATA = "_metadata"
 
static const constexpr char * TYPE = "_type"
 

Detailed Description

Definition at line 45 of file MongoDBStorageMixin.h.

Constructor & Destructor Documentation

◆ MongoDBStorageMixin() [1/2]

MongoDBStorageMixin ( )
default

◆ MongoDBStorageMixin() [2/2]

MongoDBStorageMixin ( const MongoDBSettings settings,
const std::string &  exportName,
const armem::MemoryID id 
)

Definition at line 113 of file MongoDBStorageMixin.cpp.

Member Function Documentation

◆ collectionExists()

std::optional< mongocxx::collection > collectionExists ( ) const

Definition at line 269 of file MongoDBStorageMixin.cpp.

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

◆ configureMixin()

void configureMixin ( const nlohmann::json &  json)
protected

configuration

Definition at line 456 of file MongoDBStorageMixin.cpp.

+ Here is the caller graph for this function:

◆ connect()

void connect ( ) const
protected

Definition at line 145 of file MongoDBStorageMixin.cpp.

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

◆ connected()

bool connected ( ) const
protected

Definition at line 217 of file MongoDBStorageMixin.cpp.

◆ databaseExists()

std::optional< mongocxx::database > databaseExists ( ) const

Definition at line 262 of file MongoDBStorageMixin.cpp.

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

◆ documentExists() [1/2]

std::optional< nlohmann::json > documentExists ( ) const

Definition at line 293 of file MongoDBStorageMixin.cpp.

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

◆ documentExists() [2/2]

std::optional< nlohmann::json > documentExists ( const std::string &  id) const

Definition at line 299 of file MongoDBStorageMixin.cpp.

+ Here is the call graph for this function:

◆ ensureCollectionExists()

mongocxx::collection ensureCollectionExists ( bool  createIfNotExistent = false)

Definition at line 320 of file MongoDBStorageMixin.cpp.

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

◆ ensureDatabaseExists()

mongocxx::database ensureDatabaseExists ( bool  createIfNotExistent = false)

Definition at line 313 of file MongoDBStorageMixin.cpp.

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

◆ ensureDocumentExists() [1/2]

nlohmann::json ensureDocumentExists ( bool  createIfNotExistent = false)

Definition at line 335 of file MongoDBStorageMixin.cpp.

+ Here is the call graph for this function:

◆ ensureDocumentExists() [2/2]

nlohmann::json ensureDocumentExists ( const std::string &  id,
bool  createIfNotExistent = false 
)

Definition at line 341 of file MongoDBStorageMixin.cpp.

+ Here is the call graph for this function:

◆ ensurePreviousCollectionExists()

mongocxx::collection ensurePreviousCollectionExists ( bool  createIfNotExistent = false)

Definition at line 327 of file MongoDBStorageMixin.cpp.

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

◆ getAllDocuments()

std::vector< nlohmann::json > getAllDocuments ( ) const

Definition at line 425 of file MongoDBStorageMixin.cpp.

+ Here is the call graph for this function:

◆ getCollectionName()

std::string getCollectionName ( ) const

Definition at line 243 of file MongoDBStorageMixin.cpp.

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

◆ getDatabaseName()

std::string getDatabaseName ( ) const

Definition at line 256 of file MongoDBStorageMixin.cpp.

+ Here is the caller graph for this function:

◆ getDocumentName()

std::string getDocumentName ( ) const

Definition at line 237 of file MongoDBStorageMixin.cpp.

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

◆ getPreviousCollectionName()

std::string getPreviousCollectionName ( ) const

Definition at line 249 of file MongoDBStorageMixin.cpp.

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

◆ getSettings()

MongoDBSettings getSettings ( ) const

Definition at line 436 of file MongoDBStorageMixin.cpp.

+ Here is the caller graph for this function:

◆ previousCollectionExists()

std::optional< mongocxx::collection > previousCollectionExists ( ) const

Definition at line 281 of file MongoDBStorageMixin.cpp.

+ Here is the call graph for this function:

◆ readDataFromDocument() [1/2]

nlohmann::json readDataFromDocument ( ) const

Definition at line 419 of file MongoDBStorageMixin.cpp.

+ Here is the call graph for this function:

◆ readDataFromDocument() [2/2]

nlohmann::json readDataFromDocument ( const std::string &  id) const

Definition at line 392 of file MongoDBStorageMixin.cpp.

+ Here is the call graph for this function:

◆ setHost()

void setHost ( const std::string &  n)
protected

Definition at line 121 of file MongoDBStorageMixin.cpp.

◆ setMixinExportName()

void setMixinExportName ( const std::string &  n)
protected

Definition at line 450 of file MongoDBStorageMixin.cpp.

+ Here is the caller graph for this function:

◆ setMixinMemoryID()

void setMixinMemoryID ( const armem::MemoryID n)
protected

setter

Definition at line 442 of file MongoDBStorageMixin.cpp.

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

◆ setPassword()

void setPassword ( const std::string &  n)
protected

Definition at line 139 of file MongoDBStorageMixin.cpp.

◆ setPort()

void setPort ( const unsigned int  n)
protected

Definition at line 127 of file MongoDBStorageMixin.cpp.

◆ setUser()

void setUser ( const std::string &  n)
protected

Definition at line 133 of file MongoDBStorageMixin.cpp.

◆ start()

void start ( )
protected

start

Definition at line 205 of file MongoDBStorageMixin.cpp.

+ Here is the call graph for this function:

◆ stop()

void stop ( )
protected

Definition at line 212 of file MongoDBStorageMixin.cpp.

+ Here is the caller graph for this function:

◆ writeDataToDocument() [1/2]

void writeDataToDocument ( const nlohmann::json &  data)

Definition at line 413 of file MongoDBStorageMixin.cpp.

+ Here is the call graph for this function:

◆ writeDataToDocument() [2/2]

void writeDataToDocument ( const std::string &  id,
const nlohmann::json &  data 
)

Definition at line 351 of file MongoDBStorageMixin.cpp.

+ Here is the call graph for this function:

◆ writeForeignKeyToPreviousDocument() [1/2]

void writeForeignKeyToPreviousDocument ( )

Definition at line 364 of file MongoDBStorageMixin.cpp.

+ Here is the call graph for this function:

◆ writeForeignKeyToPreviousDocument() [2/2]

void writeForeignKeyToPreviousDocument ( const nlohmann::json &  type)

Definition at line 377 of file MongoDBStorageMixin.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ DATA

const constexpr char* DATA = "_data"
staticconstexprprotected

Definition at line 111 of file MongoDBStorageMixin.h.

◆ FOREIGN_KEY

const constexpr char* FOREIGN_KEY = "_foreign_key"
staticconstexprprotected

Definition at line 109 of file MongoDBStorageMixin.h.

◆ ID

const constexpr char* ID = "_id"
staticconstexprprotected

Definition at line 108 of file MongoDBStorageMixin.h.

◆ METADATA

const constexpr char* METADATA = "_metadata"
staticconstexprprotected

Definition at line 112 of file MongoDBStorageMixin.h.

◆ TYPE

const constexpr char* TYPE = "_type"
staticconstexprprotected

Definition at line 110 of file MongoDBStorageMixin.h.


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