blob: 7060995d7b253b086b1bcc9aba15de9dc73f8adf [file] [log] [blame]
Rolf Badorekef2bf512019-08-20 11:17:15 +03001/*
2 Copyright (c) 2018-2019 Nokia.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#include "private/asyncconnection.hpp"
18#include "private/redis/asynchiredisdatabasediscovery.hpp"
19#include "private/engine.hpp"
20#include "private/logger.hpp"
21#include "private/redis/asynccommanddispatcher.hpp"
22#include "private/redis/contentsbuilder.hpp"
23
24using namespace shareddatalayer;
25using namespace shareddatalayer::redis;
26
27AsyncHiredisDatabaseDiscovery::AsyncHiredisDatabaseDiscovery(std::shared_ptr<Engine> engine,
28 const boost::optional<std::string>& ns,
29 DatabaseInfo::Type databaseType,
30 const DatabaseConfiguration::Addresses& databaseAddresses,
31 std::shared_ptr<Logger> logger):
32 engine(engine),
33 ns(ns),
34 databaseType(databaseType),
35 databaseAddresses(databaseAddresses),
36 logger(logger)
37{
38}
39
40void AsyncHiredisDatabaseDiscovery::setStateChangedCb(const StateChangedCb& stateChangedCb)
41{
42 /* Note: Current implementation does not monitor possible database configuration changes.
43 * If that is needed, we would probably need to monitor json configuration file changes.
44 */
45 const DatabaseInfo databaseInfo = { databaseAddresses, databaseType, ns, DatabaseInfo::Discovery::HIREDIS };
46 engine->postCallback(std::bind(stateChangedCb,
47 databaseInfo));
48}
49
50void AsyncHiredisDatabaseDiscovery::clearStateChangedCb()
51{
52}