generate boost::program_options object for the routing part
| 103 | |
| 104 | // generate boost::program_options object for the routing part |
| 105 | inline unsigned generateServerProgramOptions(const int argc, |
| 106 | const char *argv[], |
| 107 | std::filesystem::path &base_path, |
| 108 | std::string &ip_address, |
| 109 | int &ip_port, |
| 110 | bool &trial, |
| 111 | EngineConfig &config, |
| 112 | int &requested_thread_num, |
| 113 | short &keepalive_timeout, |
| 114 | unsigned &max_header_size) |
| 115 | { |
| 116 | using boost::program_options::value; |
| 117 | using std::filesystem::path; |
| 118 | |
| 119 | const auto hardware_threads = std::max<int>(1, std::thread::hardware_concurrency()); |
| 120 | |
| 121 | // declare a group of options that will be allowed only on command line |
| 122 | boost::program_options::options_description generic_options("Options"); |
| 123 | generic_options.add_options() // |
| 124 | ("version,v", "Show version") // |
| 125 | ("help,h", "Show this help message") // |
| 126 | ("list-inputs", "List required and optional input file extensions") // |
| 127 | ("verbosity,l", |
| 128 | #ifdef NDEBUG |
| 129 | boost::program_options::value<std::string>(&config.verbosity)->default_value("INFO"), |
| 130 | #else |
| 131 | boost::program_options::value<std::string>(&config.verbosity)->default_value("DEBUG"), |
| 132 | #endif |
| 133 | std::string("Log verbosity level: " + util::LogPolicy::GetLevels()).c_str()) // |
| 134 | ("trial", value<bool>(&trial)->implicit_value(true), "Quit after initialization"); |
| 135 | |
| 136 | // declare a group of options that will be allowed on command line |
| 137 | boost::program_options::options_description config_options("Configuration"); |
| 138 | config_options.add_options() // |
| 139 | ("ip,i", |
| 140 | value<std::string>(&ip_address)->default_value("0.0.0.0"), |
| 141 | "IP address") // |
| 142 | ("port,p", |
| 143 | value<int>(&ip_port)->default_value(5000), |
| 144 | "TCP/IP port") // |
| 145 | ("threads,t", |
| 146 | value<int>(&requested_thread_num)->default_value(hardware_threads), |
| 147 | "Number of threads to use") // |
| 148 | ("keepalive-timeout,k", |
| 149 | value<short>(&keepalive_timeout)->default_value(5), |
| 150 | "Default keepalive-timeout. Default: 5 seconds.") // |
| 151 | ("shared-memory,s", |
| 152 | value<bool>(&config.use_shared_memory)->implicit_value(true)->default_value(false), |
| 153 | "Load data from shared memory") // |
| 154 | ("memory_file", |
| 155 | value<std::filesystem::path>(&config.memory_file), |
| 156 | "DEPRECATED: Will behave the same as --mmap.")( |
| 157 | "mmap,m", |
| 158 | value<bool>(&config.use_mmap)->implicit_value(true)->default_value(false), |
| 159 | "Map datafiles directly, do not use any additional memory.") // |
| 160 | ("dataset-name", |
| 161 | value<std::string>(&config.dataset_name), |
| 162 | "Name of the shared memory dataset to connect to.") // |
no test coverage detected