2 Copyright (c) 2018-2019 Nokia.
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
8 http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef SHAREDDATALAYER_DATABASECONFIGURATION_HPP_
18 #define SHAREDDATALAYER_DATABASECONFIGURATION_HPP_
22 #include "private/hostandport.hpp"
24 namespace shareddatalayer
26 class DatabaseConfiguration
30 using Addresses = std::vector<HostAndPort>;
38 virtual ~DatabaseConfiguration() = default;
39 virtual void checkAndApplyDbType(const std::string& type) = 0;
40 virtual void checkAndApplyServerAddress(const std::string& address) = 0;
41 virtual DatabaseConfiguration::DbType getDbType() const = 0;
42 virtual DatabaseConfiguration::Addresses getServerAddresses() const = 0;
43 virtual DatabaseConfiguration::Addresses getDefaultServerAddresses() const = 0;
44 virtual bool isEmpty() const = 0;
46 DatabaseConfiguration(DatabaseConfiguration&&) = delete;
47 DatabaseConfiguration(const DatabaseConfiguration&) = delete;
48 DatabaseConfiguration& operator = (DatabaseConfiguration&&) = delete;
49 DatabaseConfiguration& operator = (const DatabaseConfiguration&) = delete;
52 DatabaseConfiguration() = default;
55 class DatabaseConfiguration::InvalidDbType: public Exception
58 InvalidDbType() = delete;
60 explicit InvalidDbType(const std::string& type);