Add Redis Sentinel based database discovery

This is first step to support forthcoming Redis HA (Sentinel) DBaaS
deployment.

If sentinel-based database discovery is used (currently still disabled
by configure option), current master is asked from Sentinel.

In case that Sentinel can't be connected, re-try will be triggered
after one second delay. If reply parsing fails, it is considered as
non-recoverable bug and execution is aborted.

Currently, Sentinel address and Redis master name are still hard coded,
will be made configurable in a separate commit soon. Also ordering
change notifications from Sentinel will be implemented separately.

Added new discovery type "SENTINEL" to 'sdltool test-connectivity'
command output.

Refactoring for 'AsyncStorageImpl' class unit tests, so that those will
use database discovery mock implementation. Earlier implementation did
have assumptions for database discovery behavior, which were not
fulfilled any more when sentinel database discovery is used.

Added option to 'AsyncCommandDispatcher' which defines if commands
will be sent to Redis or to Sentinel. In latter case existence checking
for Redis module extension commands is skipped.

Signed-off-by: Rolf Badorek <rolf.badorek@nokia.com>
Change-Id: Id7507844c9b74115e52d6f8eaf9cb18198c5dc63
diff --git a/src/asyncstorageimpl.cpp b/src/asyncstorageimpl.cpp
index b17fcbd..59d7b22 100644
--- a/src/asyncstorageimpl.cpp
+++ b/src/asyncstorageimpl.cpp
@@ -23,11 +23,24 @@
 #include "private/engine.hpp"
 #include "private/logger.hpp"
 #if HAVE_REDIS
-#include "private/redis/asyncdatabasediscovery.hpp"
 #include "private/redis/asyncredisstorage.hpp"
 #endif
 
 using namespace shareddatalayer;
+using namespace shareddatalayer::redis;
+
+namespace
+{
+        std::shared_ptr<AsyncDatabaseDiscovery> asyncDatabaseDiscoveryCreator(std::shared_ptr<Engine> engine,
+                                                                              const DatabaseConfiguration& databaseConfiguration,
+                                                                              std::shared_ptr<Logger> logger)
+        {
+            return AsyncDatabaseDiscovery::create(engine,
+                                                  boost::none,
+                                                  databaseConfiguration,
+                                                  logger);
+        }
+}
 
 AsyncStorageImpl::AsyncStorageImpl(std::shared_ptr<Engine> engine,
                                    const boost::optional<PublisherId>& pId,
@@ -36,7 +49,8 @@
     databaseConfiguration(std::make_shared<DatabaseConfigurationImpl>()),
     namespaceConfigurations(std::make_shared<NamespaceConfigurationsImpl>()),
     publisherId(pId),
-    logger(logger)
+    logger(logger),
+    asyncDatabaseDiscoveryCreator(::asyncDatabaseDiscoveryCreator)
 {
     ConfigurationReader configurationReader(logger);
     configurationReader.readDatabaseConfiguration(std::ref(*databaseConfiguration));
@@ -48,12 +62,14 @@
                                    const boost::optional<PublisherId>& pId,
                                    std::shared_ptr<DatabaseConfiguration> databaseConfiguration,
                                    std::shared_ptr<NamespaceConfigurations> namespaceConfigurations,
-                                   std::shared_ptr<Logger> logger):
+                                   std::shared_ptr<Logger> logger,
+                                   const AsyncDatabaseDiscoveryCreator& asyncDatabaseDiscoveryCreator):
     engine(engine),
     databaseConfiguration(databaseConfiguration),
     namespaceConfigurations(namespaceConfigurations),
     publisherId(pId),
-    logger(logger)
+    logger(logger),
+    asyncDatabaseDiscoveryCreator(asyncDatabaseDiscoveryCreator)
 {
 }
 
@@ -61,9 +77,8 @@
 {
 #if HAVE_REDIS
     static AsyncRedisStorage redisHandler{engine,
-                                          redis::AsyncDatabaseDiscovery::create(
+                                          asyncDatabaseDiscoveryCreator(
                                               engine,
-                                              boost::none,
                                               std::ref(*databaseConfiguration),
                                               logger),
                                           publisherId,