64b3c2198ccfb83a1fd8ad5b0a5dcb093d431571
[ric-plt/sdl.git] / include / private / databaseconfigurationimpl.hpp
1 /*
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 #ifndef SHAREDDATALAYER_DATABASECONFIGURATIONIMPL_HPP_
18 #define SHAREDDATALAYER_DATABASECONFIGURATIONIMPL_HPP_
19
20 #include "private/databaseconfiguration.hpp"
21
22 namespace shareddatalayer
23 {
24     class DatabaseConfigurationImpl: public DatabaseConfiguration
25     {
26     public:
27         DatabaseConfigurationImpl();
28
29         ~DatabaseConfigurationImpl() override;
30
31         void checkAndApplyDbType(const std::string& type) override;
32
33         void checkAndApplyServerAddress(const std::string& address) override;
34
35         void checkAndApplySentinelAddress(const std::string& address) override;
36
37         void checkAndApplySentinelMasterName(const std::string& name) override;
38
39         DatabaseConfiguration::DbType getDbType() const override;
40
41         DatabaseConfigurationImpl::Addresses getServerAddresses() const override;
42
43         DatabaseConfiguration::Addresses getDefaultServerAddresses() const override;
44
45         boost::optional<HostAndPort> getSentinelAddress() const override;
46
47         std::string getSentinelMasterName() const override;
48
49         bool isEmpty() const override;
50
51     private:
52         DbType dbType;
53         Addresses serverAddresses;
54         boost::optional<HostAndPort> sentinelAddress;
55         std::string sentinelMasterName;
56     };
57 }
58
59 #endif