hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
iroha_conf_loader.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_CONF_LOADER_HPP
7 #define IROHA_CONF_LOADER_HPP
8 
9 #include <string>
10 #include <unordered_map>
11 
12 #include "common/result_fwd.hpp"
15 #include "logger/logger_fwd.hpp"
17 #include "multihash/type.hpp"
18 #include "torii/tls_params.hpp"
19 
20 static const std::string kDbTypeRocksdb = "rocksdb";
21 static const std::string kDbTypePostgres = "postgres";
22 
23 struct IrohadConfig {
24  struct DbConfig {
25  std::string type;
26  std::string path;
27  std::string host;
28  uint16_t port;
29  std::string user;
30  std::string password;
31  std::string working_dbname;
32  std::string maintenance_dbname;
33  };
34 
35  struct InterPeerTls {
36  struct RootCert {
37  std::string path;
38  };
39  struct FromWsv {};
40  struct None {};
41  using PeerCertProvider = boost::variant<RootCert, FromWsv, None>;
42 
43  boost::optional<std::string> my_tls_creds_path;
45  };
46 
47  struct UtilityService {
48  std::string ip;
49  uint16_t port;
50  };
51 
52  // TODO: block_store_path is now optional, change docs IR-576
53  // luckychess 29.06.2019
54  boost::optional<std::string> block_store_path;
55  uint16_t torii_port;
56  boost::optional<iroha::torii::TlsParams> torii_tls_params;
57  boost::optional<InterPeerTls> inter_peer_tls;
58  uint16_t internal_port;
59  boost::optional<std::string>
60  pg_opt; // TODO 2019.06.26 mboldyrev IR-556 remove
61  boost::optional<DbConfig>
62  database_config; // TODO 2019.06.26 mboldyrev IR-556 make required
64  uint32_t proposal_delay;
65  uint32_t vote_delay;
67  boost::optional<uint32_t> mst_expiration_time;
68  boost::optional<uint32_t> max_round_delay_ms;
69  boost::optional<uint32_t> proposal_creation_timeout;
70  boost::optional<uint32_t> stale_stream_max_rounds;
71  boost::optional<logger::LoggerManagerTreePtr> logger_manager;
72  std::optional<shared_model::interface::types::PeerList> initial_peers;
73  boost::optional<UtilityService> utility_service;
74 
75  // This is a part of cryto providers feature:
76  // https://github.com/MBoldyrev/iroha/tree/feature/hsm-utimaco.
77  // This brings unnecessary complexity, but the aim is that this config section
78  // should require no modifications from users when the feature branch is
79  // merged.
80  struct Crypto {
81  struct Default {
82  static char const *kName;
84  std::optional<std::string> private_key;
85  };
86 
87  using ProviderId = std::string;
88  using ProviderList = std::unordered_map<ProviderId, Default>;
89 
92  };
93 
94  boost::optional<Crypto> crypto;
95 
96  std::string metrics_addr_port;
97 };
98 
105  const std::string &conf_path,
106  std::shared_ptr<shared_model::interface::CommonObjectsFactory>
107  common_objects_factory,
108  std::optional<logger::LoggerPtr> log);
109 
110 #endif // IROHA_CONF_LOADER_HPP
std::string maintenance_dbname
Definition: iroha_conf_loader.hpp:32
ProviderList providers
Definition: iroha_conf_loader.hpp:90
uint16_t port
Definition: iroha_conf_loader.hpp:28
Definition: iroha_conf_loader.hpp:81
boost::optional< uint32_t > max_round_delay_ms
Definition: iroha_conf_loader.hpp:68
Type
https://github.com/multiformats/js-multihash/blob/master/src/constants.js
Definition: type.hpp:14
boost::variant< RootCert, FromWsv, None > PeerCertProvider
Definition: iroha_conf_loader.hpp:41
static const std::string kDbTypeRocksdb
Definition: iroha_conf_loader.hpp:20
std::optional< std::string > private_key
Definition: iroha_conf_loader.hpp:84
PeerCertProvider peer_certificates
Definition: iroha_conf_loader.hpp:44
uint16_t port
Definition: iroha_conf_loader.hpp:49
static char const * kName
Definition: iroha_conf_loader.hpp:82
Definition: result_fwd.hpp:27
static const std::string kDbTypePostgres
Definition: iroha_conf_loader.hpp:21
boost::optional< iroha::torii::TlsParams > torii_tls_params
Definition: iroha_conf_loader.hpp:56
Definition: iroha_conf_loader.hpp:47
Definition: iroha_conf_loader.hpp:80
boost::optional< uint32_t > stale_stream_max_rounds
Definition: iroha_conf_loader.hpp:70
boost::optional< InterPeerTls > inter_peer_tls
Definition: iroha_conf_loader.hpp:57
std::string host
Definition: iroha_conf_loader.hpp:27
boost::optional< std::string > my_tls_creds_path
Definition: iroha_conf_loader.hpp:43
Definition: iroha_conf_loader.hpp:39
uint32_t proposal_delay
Definition: iroha_conf_loader.hpp:64
std::string ProviderId
Definition: iroha_conf_loader.hpp:87
Definition: iroha_conf_loader.hpp:36
std::string ip
Definition: iroha_conf_loader.hpp:48
std::unordered_map< ProviderId, Default > ProviderList
Definition: iroha_conf_loader.hpp:88
Definition: iroha_conf_loader.hpp:23
uint16_t internal_port
Definition: iroha_conf_loader.hpp:58
Definition: iroha_conf_loader.hpp:40
std::optional< shared_model::interface::types::PeerList > initial_peers
Definition: iroha_conf_loader.hpp:72
uint32_t max_proposal_size
Definition: iroha_conf_loader.hpp:63
boost::optional< std::string > pg_opt
Definition: iroha_conf_loader.hpp:60
iroha::expected::Result< IrohadConfig, std::string > parse_iroha_config(const std::string &conf_path, std::shared_ptr< shared_model::interface::CommonObjectsFactory > common_objects_factory, std::optional< logger::LoggerPtr > log)
Definition: iroha_conf_loader.cpp:757
boost::optional< Crypto > crypto
Definition: iroha_conf_loader.hpp:94
std::string password
Definition: iroha_conf_loader.hpp:30
ProviderId signer
Definition: iroha_conf_loader.hpp:91
boost::optional< uint32_t > mst_expiration_time
Definition: iroha_conf_loader.hpp:67
iroha::multihash::Type type
Definition: iroha_conf_loader.hpp:83
std::string type
Definition: iroha_conf_loader.hpp:25
boost::optional< uint32_t > proposal_creation_timeout
Definition: iroha_conf_loader.hpp:69
bool mst_support
Definition: iroha_conf_loader.hpp:66
std::string working_dbname
Definition: iroha_conf_loader.hpp:31
boost::optional< std::string > block_store_path
Definition: iroha_conf_loader.hpp:54
std::string path
Definition: iroha_conf_loader.hpp:26
uint32_t vote_delay
Definition: iroha_conf_loader.hpp:65
std::string user
Definition: iroha_conf_loader.hpp:29
boost::optional< logger::LoggerManagerTreePtr > logger_manager
Definition: iroha_conf_loader.hpp:71
boost::optional< DbConfig > database_config
Definition: iroha_conf_loader.hpp:62
Definition: iroha_conf_loader.hpp:24
Definition: iroha_conf_loader.hpp:35
uint16_t torii_port
Definition: iroha_conf_loader.hpp:55
std::string path
Definition: iroha_conf_loader.hpp:37
boost::optional< UtilityService > utility_service
Definition: iroha_conf_loader.hpp:73
std::string metrics_addr_port
Definition: iroha_conf_loader.hpp:96