Overpass API regression suite coverage (Nova Scotia) / overpass_api/core/settings.h

overpass_api/core/settings.h

2 of 13 instrumented lines run by the suite (15.4%) at 8edf11b0419c (this file on GitHub).

runnever runcolumns: line, executions, queries (click for the queries that run the line)

1/** Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Roland Olbricht et al.
2 *
3 * This file is part of Overpass_API.
4 *
5 * Overpass_API is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as
7 * published by the Free Software Foundation, either version 3 of the
8 * License, or (at your option) any later version.
9 *
10 * Overpass_API is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with Overpass_API. If not, see <http://www.gnu.org/licenses/>.
17 */
19#ifndef DE__OSM3S___OVERPASS_API__CORE__SETTINGS_H
20#define DE__OSM3S___OVERPASS_API__CORE__SETTINGS_H
22#include <limits>
23#include <string>
25#include "../../template_db/types.h"
28struct Basic_Settings
30 std::string DATA_SUFFIX;
31 std::string INDEX_SUFFIX;
32 std::string ID_SUFFIX;
33 std::string SHADOW_SUFFIX;
35 std::string base_directory;
36 std::string db_logfile_name;
37 std::string client_logfile_name;
38 std::string shared_name_base;
40 std::string version;
41 std::string source_hash;
43 uint32 compression_method;
44 uint32 map_compression_method;
46 Basic_Settings();
47};
50struct Osm_Base_Settings
52 File_Properties* NODES;
53 File_Properties* NODE_TAGS_LOCAL;
54 File_Properties* NODE_TAGS_GLOBAL;
55 File_Properties* NODE_TAGS_GLOBAL_756;
56 File_Properties* NODE_KEYS;
57 File_Properties* NODE_FREQUENT_TAGS;
58 File_Properties* WAYS;
59 File_Properties* WAY_TAGS_LOCAL;
60 File_Properties* WAY_TAGS_GLOBAL;
61 File_Properties* WAY_TAGS_GLOBAL_756;
62 File_Properties* WAY_KEYS;
63 File_Properties* WAY_FREQUENT_TAGS;
64 File_Properties* RELATIONS;
65 File_Properties* RELATION_ROLES;
66 File_Properties* RELATION_TAGS_LOCAL;
67 File_Properties* RELATION_TAGS_GLOBAL;
68 File_Properties* RELATION_TAGS_GLOBAL_756;
69 File_Properties* RELATION_KEYS;
70 File_Properties* RELATION_FREQUENT_TAGS;
72 std::string shared_name;
73 uint max_num_processes;
74 uint purge_timeout;
75 uint64 total_available_space;
76 uint64 total_available_time_units;
78 Osm_Base_Settings();
80 const std::vector< File_Properties* >& bin_idxs() const;
81 const std::vector< File_Properties* >& map_idxs() const;
83private:
84 std::vector< File_Properties* > bin_idxs_;
85 std::vector< File_Properties* > map_idxs_;
86};
89struct Area_Settings
91 File_Properties* AREA_BLOCKS;
92 File_Properties* AREAS;
93 File_Properties* AREA_TAGS_LOCAL;
94 File_Properties* AREA_TAGS_GLOBAL;
96 std::string shared_name;
97 uint max_num_processes;
98 uint purge_timeout;
99 uint64 total_available_space;
100 uint64 total_available_time_units;
102 Area_Settings();
103};
106struct Meta_Settings
108 File_Properties* USER_DATA;
109 File_Properties* USER_INDICES;
110 File_Properties* NODES_META;
111 File_Properties* WAYS_META;
112 File_Properties* RELATIONS_META;
114 Meta_Settings();
116 const std::vector< File_Properties* >& bin_idxs() const;
118private:
119 std::vector< File_Properties* > bin_idxs_;
120};
123struct Attic_Settings
125 File_Properties* NODES;
126 File_Properties* NODES_UNDELETED;
127 File_Properties* NODE_IDX_LIST;
128 File_Properties* NODE_TAGS_LOCAL;
129 File_Properties* NODE_TAGS_GLOBAL;
130 File_Properties* NODE_TAGS_GLOBAL_756;
131 File_Properties* NODE_FREQUENT_TAGS;
132 File_Properties* NODES_META;
133 File_Properties* NODE_CHANGELOG;
134 File_Properties* WAYS;
135 File_Properties* WAYS_UNDELETED;
136 File_Properties* WAY_IDX_LIST;
137 File_Properties* WAY_TAGS_LOCAL;
138 File_Properties* WAY_TAGS_GLOBAL;
139 File_Properties* WAY_TAGS_GLOBAL_756;
140 File_Properties* WAY_FREQUENT_TAGS;
141 File_Properties* WAYS_META;
142 File_Properties* WAY_CHANGELOG;
143 File_Properties* RELATIONS;
144 File_Properties* RELATIONS_UNDELETED;
145 File_Properties* RELATION_IDX_LIST;
146 File_Properties* RELATION_TAGS_LOCAL;
147 File_Properties* RELATION_TAGS_GLOBAL;
148 File_Properties* RELATION_TAGS_GLOBAL_756;
149 File_Properties* RELATION_FREQUENT_TAGS;
150 File_Properties* RELATIONS_META;
151 File_Properties* RELATION_CHANGELOG;
153 Attic_Settings();
155 const std::vector< File_Properties* >& bin_idxs() const;
156 const std::vector< File_Properties* >& map_idxs() const;
158private:
159 std::vector< File_Properties* > bin_idxs_;
160 std::vector< File_Properties* > map_idxs_;
161};
164struct Clone_Settings
166 uint32 compression_method;
167 uint32 map_compression_method;
168 std::string single_file_name;
170 Clone_Settings()
1712448612 q : compression_method(File_Blocks_Index_Base::USE_DEFAULT),
1722448612 q map_compression_method(File_Blocks_Index_Base::USE_DEFAULT) {}
173};
176Basic_Settings& basic_settings();
177const Osm_Base_Settings& osm_base_settings();
178const Area_Settings& area_settings();
179const Meta_Settings& meta_settings();
180const Attic_Settings& attic_settings();
182void show_mem_status();
185class Logger
187 public:
188 Logger(const std::string& db_dir, const std::string& filename = "");
189 void annotated_log(const std::string& message);
190 void raw_log(const std::string& message);
192 private:
193 std::string logfile_full_name;
194};
197struct Database_Meta_State
199 enum Mode { only_data, keep_meta, keep_attic };
2010 Database_Meta_State() : mode_valid(false) {}
202 Mode value_or_autodetect(const std::string& db_dir)
2030 {
2040 if (!mode_valid)
2050 mode = from_db_files(db_dir);
2060 mode_valid = true;
2070 return mode;
2080 }
209 void set_mode(Mode mode_)
2100 {
2110 mode = mode_;
2120 mode_valid = true;
2130 }
215private:
216 Mode mode;
217 bool mode_valid;
219 static Mode from_db_files(const std::string& db_dir);
220};
223std::string get_server_name(const std::string& db_dir);
224void set_server_name(const std::string& db_dir, const std::string& server_name);
227extern const uint64 NOW;
230#endif