X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fdatabaseconfigurationimpl.cpp;h=a8f64e6cb514197d51641d15b287cb4f6cd4b0c4;hb=5376dba4cb84f32dc81ed7c6c256f420d224e07b;hp=f1fb2bedf2447e3d88341c2500029e46147e65cc;hpb=ef2bf51d04aaf01fa0cabdcaf905b23423067662;p=ric-plt%2Fsdl.git diff --git a/src/databaseconfigurationimpl.cpp b/src/databaseconfigurationimpl.cpp index f1fb2be..a8f64e6 100644 --- a/src/databaseconfigurationimpl.cpp +++ b/src/databaseconfigurationimpl.cpp @@ -14,6 +14,11 @@ 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 @@ -28,6 +33,7 @@ namespace } const uint16_t DEFAULT_PORT(6379U); + const uint16_t DEFAULT_SENTINEL_PORT(26379U); } DatabaseConfigurationImpl::DatabaseConfigurationImpl(): @@ -45,6 +51,8 @@ void DatabaseConfigurationImpl::checkAndApplyDbType(const std::string& type) dbType = DatabaseConfiguration::DbType::REDIS_STANDALONE; else if (type == "redis-cluster") dbType = DatabaseConfiguration::DbType::REDIS_CLUSTER; + else if (type == "redis-sentinel") + dbType = DatabaseConfiguration::DbType::REDIS_SENTINEL; else throw DatabaseConfiguration::InvalidDbType(type); } @@ -73,3 +81,23 @@ DatabaseConfiguration::Addresses DatabaseConfigurationImpl::getDefaultServerAddr { return { HostAndPort(getDefaultHost(), htons(DEFAULT_PORT)) }; } + +void DatabaseConfigurationImpl::checkAndApplySentinelAddress(const std::string& address) +{ + sentinelAddress = HostAndPort(address, htons(DEFAULT_SENTINEL_PORT)); +} + +boost::optional DatabaseConfigurationImpl::getSentinelAddress() const +{ + return sentinelAddress; +} + +void DatabaseConfigurationImpl::checkAndApplySentinelMasterName(const std::string& name) +{ + sentinelMasterName = name; +} + +std::string DatabaseConfigurationImpl::getSentinelMasterName() const +{ + return sentinelMasterName; +}