X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fdatabaseconfigurationimpl.cpp;h=211c53773370da3798ad0fc5a8afe30284947a25;hb=ece67088;hp=909e4e4243efc908ace300fbd37e382aef35247e;hpb=2dcf940b7a815456af601cdc6fd8ebbc57bda161;p=ric-plt%2Fsdl.git diff --git a/src/databaseconfigurationimpl.cpp b/src/databaseconfigurationimpl.cpp index 909e4e4..211c537 100644 --- a/src/databaseconfigurationimpl.cpp +++ b/src/databaseconfigurationimpl.cpp @@ -14,8 +14,14 @@ limitations under the License. */ +/* + * This source code is part of the near-RT RIC (RAN Intelligent Controller) + * platform project (RICP). +*/ + #include "private/databaseconfigurationimpl.hpp" #include +#include using namespace shareddatalayer; @@ -48,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); } @@ -87,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;