X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fdatabaseconfigurationimpl.cpp;h=211c53773370da3798ad0fc5a8afe30284947a25;hb=ece67088ea6c4f67b9d0db74477a9d5c614d7763;hp=a8f64e6cb514197d51641d15b287cb4f6cd4b0c4;hpb=aad0a0b5f51c2abd855aba0a9cb8e99ac5023600;p=ric-plt%2Fsdl.git diff --git a/src/databaseconfigurationimpl.cpp b/src/databaseconfigurationimpl.cpp index a8f64e6..211c537 100644 --- a/src/databaseconfigurationimpl.cpp +++ b/src/databaseconfigurationimpl.cpp @@ -21,6 +21,7 @@ #include "private/databaseconfigurationimpl.hpp" #include +#include using namespace shareddatalayer; @@ -53,6 +54,8 @@ void DatabaseConfigurationImpl::checkAndApplyDbType(const std::string& type) dbType = DatabaseConfiguration::DbType::REDIS_CLUSTER; else if (type == "redis-sentinel") dbType = DatabaseConfiguration::DbType::REDIS_SENTINEL; + else if (type == "sdl-cluster") + dbType = DatabaseConfiguration::DbType::SDL_CLUSTER; else throw DatabaseConfiguration::InvalidDbType(type); } @@ -92,6 +95,14 @@ boost::optional DatabaseConfigurationImpl::getSentinelAddress() con return sentinelAddress; } +boost::optional DatabaseConfigurationImpl::getSentinelAddress(const boost::optional& addressIndex) const +{ + if (addressIndex) + return { HostAndPort(serverAddresses.at(*addressIndex).getHost(), sentinelAddress->getPort()) }; + + return getSentinelAddress(); +} + void DatabaseConfigurationImpl::checkAndApplySentinelMasterName(const std::string& name) { sentinelMasterName = name;