Code Review
/
ric-plt
/
sdl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Multiple DBAAS Redis standalone groups
[ric-plt/sdl.git]
/
src
/
databaseconfigurationimpl.cpp
diff --git
a/src/databaseconfigurationimpl.cpp
b/src/databaseconfigurationimpl.cpp
index
211c537
..
4ee548f
100644
(file)
--- a/
src/databaseconfigurationimpl.cpp
+++ b/
src/databaseconfigurationimpl.cpp
@@
-54,8
+54,10
@@
void DatabaseConfigurationImpl::checkAndApplyDbType(const std::string& type)
dbType = DatabaseConfiguration::DbType::REDIS_CLUSTER;
else if (type == "redis-sentinel")
dbType = DatabaseConfiguration::DbType::REDIS_SENTINEL;
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 if (type == "sdl-standalone-cluster")
+ dbType = DatabaseConfiguration::DbType::SDL_STANDALONE_CLUSTER;
+ else if (type == "sdl-sentinel-cluster")
+ dbType = DatabaseConfiguration::DbType::SDL_SENTINEL_CLUSTER;
else
throw DatabaseConfiguration::InvalidDbType(type);
}
else
throw DatabaseConfiguration::InvalidDbType(type);
}
@@
-80,6
+82,14
@@
DatabaseConfiguration::Addresses DatabaseConfigurationImpl::getServerAddresses()
return serverAddresses;
}
return serverAddresses;
}
+DatabaseConfiguration::Addresses DatabaseConfigurationImpl::getServerAddresses(const boost::optional<std::size_t>& addressIndex) const
+{
+ if (addressIndex)
+ return { HostAndPort(serverAddresses.at(*addressIndex)) };
+
+ return serverAddresses;
+}
+
DatabaseConfiguration::Addresses DatabaseConfigurationImpl::getDefaultServerAddresses() const
{
return { HostAndPort(getDefaultHost(), htons(DEFAULT_PORT)) };
DatabaseConfiguration::Addresses DatabaseConfigurationImpl::getDefaultServerAddresses() const
{
return { HostAndPort(getDefaultHost(), htons(DEFAULT_PORT)) };