Use GetPath with file names over accessing member variables
This commit is contained in:
parent
e208485c17
commit
d9e8caf369
@ -737,7 +737,7 @@ file(GLOB VariantGlob third_party/variant/include/mapbox/*.hpp)
|
||||
file(GLOB LibraryGlob include/osrm/*.hpp)
|
||||
file(GLOB ParametersGlob include/engine/api/*_parameters.hpp)
|
||||
set(EngineHeader include/engine/status.hpp include/engine/engine_config.hpp include/engine/hint.hpp include/engine/bearing.hpp include/engine/approach.hpp include/engine/phantom_node.hpp)
|
||||
set(UtilHeader include/util/coordinate.hpp include/util/json_container.hpp include/util/typedefs.hpp include/util/alias.hpp include/util/exception.hpp)
|
||||
set(UtilHeader include/util/coordinate.hpp include/util/json_container.hpp include/util/typedefs.hpp include/util/alias.hpp include/util/exception.hpp include/util/log.hpp)
|
||||
set(ExtractorHeader include/extractor/extractor.hpp include/storage/io_config.hpp include/extractor/extractor_config.hpp include/extractor/travel_mode.hpp)
|
||||
set(PartitionerHeader include/partition/partitioner.hpp include/partition/partition_config.hpp)
|
||||
set(ContractorHeader include/contractor/contractor.hpp include/contractor/contractor_config.hpp)
|
||||
|
@ -31,6 +31,6 @@ add_executable(osrm-example example.cpp)
|
||||
|
||||
find_package(LibOSRM REQUIRED)
|
||||
|
||||
target_link_libraries(osrm-example ${LibOSRM_LIBRARIES} ${LibOSRM_DEPENDENT_LIBRARIES})
|
||||
target_link_libraries(osrm-example ${LibOSRM_LIBRARIES} ${LibOSRM_DEPENDENT_LIBRARIES} ${UtilGlob})
|
||||
include_directories(SYSTEM ${LibOSRM_INCLUDE_DIRS})
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LibOSRM_CXXFLAGS}")
|
||||
|
@ -30,7 +30,7 @@ int main(int argc, const char *argv[])
|
||||
|
||||
// Configure based on a .osrm base path, and no datasets in shared mem from osrm-datastore
|
||||
EngineConfig config;
|
||||
config.storage_config = {argv[1]};
|
||||
config.storage_config.UseDefaultOutputNames(argv[1]);
|
||||
config.use_shared_memory = false;
|
||||
|
||||
// Routing machine with several services (such as Route, Table, Nearest, Trip, Match)
|
||||
|
@ -42,23 +42,24 @@ namespace contractor
|
||||
|
||||
struct ContractorConfig final : storage::IOConfig
|
||||
{
|
||||
ContractorConfig() : requested_num_threads(0) {}
|
||||
|
||||
ContractorConfig(const boost::filesystem::path &base) : requested_num_threads(0),
|
||||
IOConfig({".osrm", }, {}, {".osrm.level", ".osrm.core", ".osrm.hsgr", ".osrm.enw"})
|
||||
ContractorConfig()
|
||||
: requested_num_threads(0), IOConfig(
|
||||
{
|
||||
".osrm",
|
||||
},
|
||||
{},
|
||||
{".osrm.level", ".osrm.core", ".osrm.hsgr", ".osrm.enw"})
|
||||
{
|
||||
}
|
||||
|
||||
// Infer the output names from the path of the .osrm file
|
||||
void UseDefaultOutputNames()
|
||||
void UseDefaultOutputNames(const boost::filesystem::path &base)
|
||||
{
|
||||
IOConfig::UseDefaultOutputNames();
|
||||
updater_config.osrm_path = osrm_path;
|
||||
updater_config.UseDefaultOutputNames();
|
||||
IOConfig::UseDefaultOutputNames(base);
|
||||
updater_config.UseDefaultOutputNames(base);
|
||||
}
|
||||
|
||||
// TODO override IsValid to also check updater_config validity
|
||||
// TODO remove direct access to osrm_path to allow passing osrm_path to underlying configs
|
||||
bool IsValid() const { return IOConfig::IsValid() && updater_config.IsValid(); }
|
||||
|
||||
updater::UpdaterConfig updater_config;
|
||||
|
||||
|
@ -16,16 +16,21 @@ namespace customizer
|
||||
|
||||
struct CustomizationConfig final : storage::IOConfig
|
||||
{
|
||||
CustomizationConfig() : requested_num_threads(0),
|
||||
IOConfig({".osrm", }, {}, {".osrm.ebg", ".osrm.partition", ".osrm.cells", ".osrm.mldgr"})
|
||||
CustomizationConfig()
|
||||
: requested_num_threads(0),
|
||||
IOConfig(
|
||||
{
|
||||
".osrm",
|
||||
},
|
||||
{},
|
||||
{".osrm.ebg", ".osrm.partition", ".osrm.cells", ".osrm.mldgr"})
|
||||
{
|
||||
}
|
||||
|
||||
void UseDefaultOutputNames()
|
||||
void UseDefaultOutputNames(const boost::filesystem::path &base)
|
||||
{
|
||||
IOConfig::UseDefaultOutputNames();
|
||||
updater_config.osrm_path = osrm_path;
|
||||
updater_config.UseDefaultOutputNames();
|
||||
IOConfig::UseDefaultOutputNames(base);
|
||||
updater_config.UseDefaultOutputNames(base);
|
||||
}
|
||||
|
||||
unsigned requested_num_threads;
|
||||
|
@ -152,9 +152,9 @@ bool Engine<routing_algorithms::ch::Algorithm>::CheckCompability(const EngineCon
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!boost::filesystem::exists(config.storage_config.hsgr_data_path))
|
||||
if (!boost::filesystem::exists(config.storage_config.GetPath(".osrm.hsgr")))
|
||||
return false;
|
||||
storage::io::FileReader in(config.storage_config.hsgr_data_path,
|
||||
storage::io::FileReader in(config.storage_config.GetPath(".osrm.hsgr"),
|
||||
storage::io::FileReader::VerifyFingerprint);
|
||||
|
||||
auto size = in.GetSize();
|
||||
@ -183,9 +183,9 @@ bool Engine<routing_algorithms::corech::Algorithm>::CheckCompability(const Engin
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!boost::filesystem::exists(config.storage_config.core_data_path))
|
||||
if (!boost::filesystem::exists(config.storage_config.GetPath(".osrm.core")))
|
||||
return false;
|
||||
storage::io::FileReader in(config.storage_config.core_data_path,
|
||||
storage::io::FileReader in(config.storage_config.GetPath(".osrm.core"),
|
||||
storage::io::FileReader::VerifyFingerprint);
|
||||
|
||||
auto size = in.GetSize();
|
||||
@ -208,9 +208,9 @@ bool Engine<routing_algorithms::mld::Algorithm>::CheckCompability(const EngineCo
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!boost::filesystem::exists(config.storage_config.mld_partition_path))
|
||||
if (!boost::filesystem::exists(config.storage_config.GetPath(".osrm.partition")))
|
||||
return false;
|
||||
storage::io::FileReader in(config.storage_config.mld_partition_path,
|
||||
storage::io::FileReader in(config.storage_config.GetPath(".osrm.partition"),
|
||||
storage::io::FileReader::VerifyFingerprint);
|
||||
|
||||
auto size = in.GetSize();
|
||||
|
@ -43,36 +43,35 @@ namespace extractor
|
||||
struct ExtractorConfig final : storage::IOConfig
|
||||
{
|
||||
ExtractorConfig() noexcept : requested_num_threads(0),
|
||||
IOConfig({"", }, {}, {".osrm", ".osrm.restrictions", ".osrm.names", ".osrm.tls", ".osrm.tld", ".osrm.timestamp", ".osrm.geometry"
|
||||
, ".osrm.nbg_nodes", ".osrm.ebg_nodes", ".osrm.edges", ".osrm.ebg", ".osrm.ramIndex", ".osrm.fileIndex", ".osrm.turn_duration_penalties"
|
||||
, ".osrm.turn_weight_penalties", ".osrm.turn_penalties_index", ".osrm.enw", ".osrm.properties", ".osrm.icd", ".osrm.cnbg"
|
||||
, ".osrm.cnbg_to_ebg"})
|
||||
IOConfig(
|
||||
{
|
||||
"",
|
||||
},
|
||||
{},
|
||||
{".osrm",
|
||||
".osrm.restrictions",
|
||||
".osrm.names",
|
||||
".osrm.tls",
|
||||
".osrm.tld",
|
||||
".osrm.timestamp",
|
||||
".osrm.geometry",
|
||||
".osrm.nbg_nodes",
|
||||
".osrm.ebg_nodes",
|
||||
".osrm.edges",
|
||||
".osrm.ebg",
|
||||
".osrm.ramIndex",
|
||||
".osrm.fileIndex",
|
||||
".osrm.turn_duration_penalties",
|
||||
".osrm.turn_weight_penalties",
|
||||
".osrm.turn_penalties_index",
|
||||
".osrm.enw",
|
||||
".osrm.properties",
|
||||
".osrm.icd",
|
||||
".osrm.cnbg",
|
||||
".osrm.cnbg_to_ebg"})
|
||||
{
|
||||
}
|
||||
|
||||
void UseDefaultOutputNames()
|
||||
{
|
||||
std::string basepath = input_path.string();
|
||||
|
||||
// TODO move the known_extensions to IsValid
|
||||
auto pos = std::string::npos;
|
||||
std::array<std::string, 5> known_extensions{
|
||||
{".osm.bz2", ".osm.pbf", ".osm.xml", ".pbf", ".osm"}};
|
||||
for (auto ext : known_extensions)
|
||||
{
|
||||
pos = basepath.find(ext);
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
basepath.replace(pos, ext.size(), "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
osrm_path = basepath + ".osrm";
|
||||
|
||||
IOConfig::UseDefaultOutputNames();
|
||||
}
|
||||
|
||||
boost::filesystem::path input_path;
|
||||
boost::filesystem::path profile_path;
|
||||
|
||||
|
@ -97,8 +97,9 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
|
||||
|
||||
if (args[0]->IsString())
|
||||
{
|
||||
engine_config->storage_config = osrm::StorageConfig(
|
||||
*v8::String::Utf8Value(Nan::To<v8::String>(args[0]).ToLocalChecked()));
|
||||
std::string base_path(*v8::String::Utf8Value(args[0]->ToString()));
|
||||
engine_config->storage_config = osrm::StorageConfig();
|
||||
engine_config->storage_config.UseDefaultOutputNames(base_path);
|
||||
engine_config->use_shared_memory = false;
|
||||
return engine_config;
|
||||
}
|
||||
@ -121,8 +122,9 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
|
||||
|
||||
if (!path->IsUndefined())
|
||||
{
|
||||
engine_config->storage_config =
|
||||
osrm::StorageConfig(*v8::String::Utf8Value(Nan::To<v8::String>(path).ToLocalChecked()));
|
||||
std::string base_path(*v8::String::Utf8Value(path->ToString()));
|
||||
engine_config->storage_config = osrm::StorageConfig();
|
||||
engine_config->storage_config.UseDefaultOutputNames(base_path);
|
||||
engine_config->use_shared_memory = false;
|
||||
}
|
||||
if (!shared_memory->IsUndefined())
|
||||
|
@ -19,9 +19,12 @@ struct PartitionConfig final : storage::IOConfig
|
||||
: requested_num_threads(0), balance(1.2), boundary_factor(0.25), num_optimizing_cuts(10),
|
||||
small_component_size(1000),
|
||||
max_cell_sizes{128, 128 * 32, 128 * 32 * 16, 128 * 32 * 16 * 32},
|
||||
IOConfig({".osrm", }, {}, {".osrm.ebg", ".osrm.cnbg", ".osrm.cnbg_to_ebg", ".osrm.partition", ".osrm.cells"})
|
||||
{
|
||||
}
|
||||
IOConfig(
|
||||
{".osrm", ".osrm.fileIndex", ".osrm.ebg_nodes"},
|
||||
{".osrm.hsgr", ".osrm.cnbg"},
|
||||
{".osrm.ebg", ".osrm.cnbg", ".osrm.cnbg_to_ebg", ".osrm.partition", ".osrm.cells"})
|
||||
{
|
||||
}
|
||||
|
||||
unsigned requested_num_threads;
|
||||
|
||||
|
@ -1,8 +1,14 @@
|
||||
#ifndef OSRM_IO_CONFIG_HPP
|
||||
#define OSRM_IO_CONFIG_HPP
|
||||
|
||||
#include "util/exception.hpp"
|
||||
#include "util/log.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
@ -11,136 +17,82 @@ namespace storage
|
||||
struct IOConfig
|
||||
{
|
||||
IOConfig(std::vector<boost::filesystem::path> _required_input_files,
|
||||
std::vector<boost::filesystem::path> _optional_input_files,
|
||||
std::vector<boost::filesystem::path> _output_files)
|
||||
: required_input_files(_required_input_files),
|
||||
optional_input_files(_optional_input_files),
|
||||
output_files(_output_files)
|
||||
{}
|
||||
std::vector<boost::filesystem::path> _optional_input_files,
|
||||
std::vector<boost::filesystem::path> _output_files)
|
||||
: required_input_files(_required_input_files), optional_input_files(_optional_input_files),
|
||||
output_files(_output_files)
|
||||
{
|
||||
}
|
||||
|
||||
// Infer the base path from the path of the .osrm file
|
||||
void UseDefaultOutputNames(const boost::filesystem::path &base)
|
||||
{
|
||||
// potentially strip off the .osrm extension for
|
||||
// determining the base path
|
||||
const std::string ext = ".osrm";
|
||||
const auto pos = base.find(ext);
|
||||
if (pos != std::string::npos)
|
||||
// potentially strip off the .osrm (or other) extensions for
|
||||
// determining the base path=
|
||||
std::string path = base.string();
|
||||
|
||||
std::array<std::string, 6> known_extensions{
|
||||
{".osm.bz2", ".osm.pbf", ".osm.xml", ".pbf", ".osm", ".osrm"}};
|
||||
for (auto ext : known_extensions)
|
||||
{
|
||||
base.replace(pos, ext.size(), "");
|
||||
}
|
||||
else
|
||||
{
|
||||
// unknown extension or no extension
|
||||
const auto pos = path.find(ext);
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
path.replace(pos, ext.size(), "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
base_path = base;
|
||||
base_path = {path};
|
||||
}
|
||||
|
||||
bool IsValid()
|
||||
bool IsValid() const
|
||||
{
|
||||
bool success = true;
|
||||
for (auto &path : required_input_files)
|
||||
for (auto &fileName : required_input_files)
|
||||
{
|
||||
if (!boost::filesystem::is_regular_file(path))
|
||||
if (!boost::filesystem::is_regular_file({base_path.string() + fileName.string()}))
|
||||
{
|
||||
util::Log(logWARNING) << "Missing/Broken File: " << path.string();
|
||||
util::Log(logWARNING) << "Missing/Broken File: " << base_path.string()
|
||||
<< fileName.string();
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
boost::filesystem::path GetPath(const std::string &fileName)
|
||||
boost::filesystem::path GetPath(const std::string &fileName) const
|
||||
{
|
||||
if(!IsConfigured(fileName, required_input_files)
|
||||
&& !IsConfigured(fileName, optional_input_files)
|
||||
&& !IsConfigured(fileName, output_files)) {
|
||||
util::Log(logERROR) << "Missing File: " << fileName;
|
||||
return 0; // TODO throw
|
||||
if (!IsConfigured(fileName, required_input_files) &&
|
||||
!IsConfigured(fileName, optional_input_files) && !IsConfigured(fileName, output_files))
|
||||
{
|
||||
util::Log(logERROR) << "Tried to access file which is not configured: " << fileName;
|
||||
throw util::exception("Tried to access file which is not configured: " + fileName);
|
||||
}
|
||||
|
||||
return { base_path.string() + fileName };
|
||||
return {base_path.string() + fileName};
|
||||
}
|
||||
|
||||
private:
|
||||
bool IsConfigured(const std::string &fileName, const std::vector<boost::filesystem::path> &paths) {
|
||||
for (auto &path : paths) {
|
||||
if(boost::algorithm::ends_with(path.string(), fileName)) {
|
||||
boost::filesystem::path base_path;
|
||||
|
||||
private:
|
||||
static bool IsConfigured(const std::string &fileName,
|
||||
const std::vector<boost::filesystem::path> &paths)
|
||||
{
|
||||
for (auto &path : paths)
|
||||
{
|
||||
if (boost::algorithm::ends_with(path.string(), fileName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<boost::filesystem::path> required_input_files;
|
||||
std::vector<boost::filesystem::path> optional_input_files;
|
||||
std::vector<boost::filesystem::path> output_files;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
boost::filesystem::path base_path;
|
||||
|
||||
ram_index_path = {osrm_path.string() + ".ramIndex"};
|
||||
file_index_path = {osrm_path.string() + ".fileIndex"};
|
||||
hsgr_data_path = {osrm_path.string() + ".hsgr"};
|
||||
nodes_data_path = {osrm_path.string() + ".nodes"};
|
||||
edges_data_path = {osrm_path.string() + ".edges"};
|
||||
core_data_path = {osrm_path.string() + ".core"};
|
||||
geometries_path = {osrm_path.string() + ".geometry"};
|
||||
timestamp_path = {osrm_path.string() + ".timestamp"};
|
||||
turn_weight_penalties_path = {osrm_path.string() + ".turn_weight_penalties"};
|
||||
turn_duration_penalties_path = {osrm_path.string() + ".turn_duration_penalties"};
|
||||
turn_penalties_index_path = {osrm_path.string() + ".turn_penalties_index"};
|
||||
datasource_names_path = {osrm_path.string() + ".datasource_names"};
|
||||
names_data_path = {osrm_path.string() + ".names"};
|
||||
properties_path = {osrm_path.string() + ".properties"};
|
||||
intersection_class_path = {osrm_path.string() + ".icd"};
|
||||
turn_lane_data_path = {osrm_path.string() + ".tld"};
|
||||
turn_lane_description_path = {osrm_path.string() + ".tls"};
|
||||
mld_partition_path = {osrm_path.string() + ".partition"};
|
||||
mld_storage_path = {osrm_path.string() + ".cells"};
|
||||
mld_graph_path = {osrm_path.string() + ".mldgr"};
|
||||
level_path = {osrm_path.string() + ".level"};
|
||||
node_path = {osrm_path.string() + ".enw"};
|
||||
edge_based_nodes_data_path = {osrm_path.string() + ".ebg_nodes"};
|
||||
node_based_nodes_data_path = {osrm_path.string() + ".nbg_nodes"};
|
||||
edge_based_graph_path = {osrm_path.string() + ".ebg"};
|
||||
compressed_node_based_graph_path = {osrm_path.string() + ".cnbg"};
|
||||
cnbg_ebg_mapping_path = {osrm_path.string() + ".cnbg_to_ebg"};
|
||||
turn_restrictions_path = {osrm_path.string() + ".restrictions"};
|
||||
intersection_class_data_path = {osrm_path.string() + ".icd"};
|
||||
*/
|
||||
|
||||
boost::filesystem::path osrm_path;
|
||||
boost::filesystem::path ram_index_path;
|
||||
boost::filesystem::path file_index_path;
|
||||
boost::filesystem::path hsgr_data_path;
|
||||
boost::filesystem::path nodes_data_path;
|
||||
boost::filesystem::path edges_data_path;
|
||||
boost::filesystem::path core_data_path;
|
||||
boost::filesystem::path geometries_path;
|
||||
boost::filesystem::path timestamp_path;
|
||||
boost::filesystem::path turn_weight_penalties_path;
|
||||
boost::filesystem::path turn_duration_penalties_path;
|
||||
boost::filesystem::path turn_penalties_index_path;
|
||||
boost::filesystem::path datasource_names_path;
|
||||
boost::filesystem::path datasource_indexes_path;
|
||||
boost::filesystem::path names_data_path;
|
||||
boost::filesystem::path properties_path;
|
||||
boost::filesystem::path intersection_class_path;
|
||||
boost::filesystem::path turn_lane_data_path;
|
||||
boost::filesystem::path turn_lane_description_path;
|
||||
boost::filesystem::path mld_partition_path;
|
||||
boost::filesystem::path mld_storage_path;
|
||||
boost::filesystem::path mld_graph_path;
|
||||
boost::filesystem::path level_path;
|
||||
boost::filesystem::path node_path;
|
||||
boost::filesystem::path edge_based_nodes_data_path;
|
||||
boost::filesystem::path node_based_nodes_data_path;
|
||||
boost::filesystem::path edge_based_graph_path;
|
||||
boost::filesystem::path compressed_node_based_graph_path;
|
||||
boost::filesystem::path cnbg_ebg_mapping_path;
|
||||
boost::filesystem::path turn_restrictions_path;
|
||||
boost::filesystem::path intersection_class_data_path;
|
||||
std::vector<boost::filesystem::path> required_input_files;
|
||||
std::vector<boost::filesystem::path> optional_input_files;
|
||||
std::vector<boost::filesystem::path> output_files;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -44,20 +44,31 @@ namespace storage
|
||||
*/
|
||||
struct StorageConfig final : IOConfig
|
||||
{
|
||||
StorageConfig() :
|
||||
IOConfig({".osrm.ramIndex", ".osrm.fileIndex", ".osrm.hsgr", ".osrm.nodes", ".osrm.edges", ".osrm.core",
|
||||
".osrm.geometry", ".osrm.timestamp", ".osrm.turn_weight_penalties", ".osrm.turn_duration_penalties", ".osrm.turn_penalties_index", ".osrm.datasource_names",
|
||||
".osrm.names", ".osrm.properties", ".osrm.icd", ".osrm.tld", ".osrm.tls", ".osrm.partition", ".osrm.cells", ".osrm.mldgr"}, {}, {})
|
||||
StorageConfig()
|
||||
: IOConfig({".osrm.ramIndex",
|
||||
".osrm.fileIndex",
|
||||
".osrm.edges",
|
||||
".osrm.geometry",
|
||||
".osrm.timestamp",
|
||||
".osrm.turn_weight_penalties",
|
||||
".osrm.turn_duration_penalties",
|
||||
".osrm.datasource_names",
|
||||
".osrm.names",
|
||||
".osrm.properties",
|
||||
".osrm.icd"},
|
||||
{".osrm.hsgr",
|
||||
".osrm.nodes",
|
||||
".osrm.nbg_nodes",
|
||||
".osrm.ebg_nodes",
|
||||
".osrm.core",
|
||||
".osrm.cells",
|
||||
".osrm.mldgr",
|
||||
".osrm.tld",
|
||||
".osrm.tls",
|
||||
".osrm.partition"},
|
||||
{})
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a storage configuration setting paths based on a base path.
|
||||
*
|
||||
* \param base The base path (e.g. france.pbf.osrm) to derive auxiliary file suffixes from.
|
||||
*/
|
||||
StorageConfig(const boost::filesystem::path &base) : IOConfig(base) {}
|
||||
bool IsValid() const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -43,11 +43,26 @@ namespace updater
|
||||
|
||||
struct UpdaterConfig final : storage::IOConfig
|
||||
{
|
||||
UpdaterConfig() {}
|
||||
UpdaterConfig(const boost::filesystem::path &base) : IOConfig(
|
||||
{ ".osrm.ebg", ".osrm.turn_weight_penalties", ".osrm.turn_duration_penalties", ".osrm.turn_penalties_index", ".osrm.nbg_nodes", ".osrm.ebg_nodes",
|
||||
".osrm.edges", ".osrm.geometry", ".osrm.fileIndex", ".osrm.datasource_names", ".osrm.properties", ".osrm.restrictions", }, {}, {}
|
||||
) {}
|
||||
UpdaterConfig()
|
||||
: IOConfig(
|
||||
{
|
||||
".osrm.ebg",
|
||||
".osrm.turn_weight_penalties",
|
||||
".osrm.turn_duration_penalties",
|
||||
".osrm.turn_penalties_index",
|
||||
".osrm.nbg_nodes",
|
||||
".osrm.ebg_nodes",
|
||||
".osrm.edges",
|
||||
".osrm.geometry",
|
||||
".osrm.fileIndex",
|
||||
".osrm.datasource_names",
|
||||
".osrm.properties",
|
||||
".osrm.restrictions",
|
||||
},
|
||||
{},
|
||||
{})
|
||||
{
|
||||
}
|
||||
|
||||
double log_edge_updates_factor;
|
||||
std::time_t valid_now;
|
||||
|
@ -30,7 +30,7 @@ int main(int argc, const char *argv[]) try
|
||||
|
||||
// Configure based on a .osrm base path, and no datasets in shared mem from osrm-datastore
|
||||
EngineConfig config;
|
||||
config.storage_config = {argv[1]};
|
||||
config.storage_config.UseDefaultOutputNames(argv[1]);
|
||||
config.use_shared_memory = false;
|
||||
|
||||
// Routing machine with several services (such as Route, Table, Nearest, Trip, Match)
|
||||
|
@ -47,7 +47,7 @@ int Contractor::Run()
|
||||
util::Log() << "Reading node weights.";
|
||||
std::vector<EdgeWeight> node_weights;
|
||||
{
|
||||
storage::io::FileReader reader(config.node_path,
|
||||
storage::io::FileReader reader(config.GetPath(".osrm.enw"),
|
||||
storage::io::FileReader::VerifyFingerprint);
|
||||
storage::serialization::read(reader, node_weights);
|
||||
}
|
||||
@ -67,7 +67,7 @@ int Contractor::Run()
|
||||
std::vector<float> node_levels;
|
||||
if (config.use_cached_priority)
|
||||
{
|
||||
files::readLevels(config.level_path, node_levels);
|
||||
files::readLevels(config.GetPath(".osrm.level"), node_levels);
|
||||
}
|
||||
|
||||
util::DeallocatingVector<QueryEdge> contracted_edge_list;
|
||||
@ -90,15 +90,15 @@ int Contractor::Run()
|
||||
RangebasedCRC32 crc32_calculator;
|
||||
const unsigned checksum = crc32_calculator(contracted_edge_list);
|
||||
|
||||
files::writeGraph(config.hsgr_data_path,
|
||||
files::writeGraph(config.GetPath(".osrm.hsgr"),
|
||||
checksum,
|
||||
QueryGraph{max_edge_id + 1, std::move(contracted_edge_list)});
|
||||
}
|
||||
|
||||
files::writeCoreMarker(config.core_data_path, is_core_node);
|
||||
files::writeCoreMarker(config.GetPath(".osrm.core"), is_core_node);
|
||||
if (!config.use_cached_priority)
|
||||
{
|
||||
files::writeLevels(config.level_path, node_levels);
|
||||
files::writeLevels(config.GetPath(".osrm.level"), node_levels);
|
||||
}
|
||||
|
||||
TIMER_STOP(preparing);
|
||||
|
@ -98,12 +98,12 @@ int Customizer::Run(const CustomizationConfig &config)
|
||||
TIMER_START(loading_data);
|
||||
|
||||
partition::MultiLevelPartition mlp;
|
||||
partition::files::readPartition(config.mld_partition_path, mlp);
|
||||
partition::files::readPartition(config.GetPath(".osrm.partition"), mlp);
|
||||
|
||||
auto edge_based_graph = LoadAndUpdateEdgeExpandedGraph(config, mlp);
|
||||
|
||||
partition::CellStorage storage;
|
||||
partition::files::readCells(config.mld_storage_path, storage);
|
||||
partition::files::readCells(config.GetPath(".osrm.cells"), storage);
|
||||
TIMER_STOP(loading_data);
|
||||
util::Log() << "Loading partition data took " << TIMER_SEC(loading_data) << " seconds";
|
||||
|
||||
@ -114,12 +114,12 @@ int Customizer::Run(const CustomizationConfig &config)
|
||||
util::Log() << "Cells customization took " << TIMER_SEC(cell_customize) << " seconds";
|
||||
|
||||
TIMER_START(writing_mld_data);
|
||||
partition::files::writeCells(config.mld_storage_path, storage);
|
||||
partition::files::writeCells(config.GetPath(".osrm.cells"), storage);
|
||||
TIMER_STOP(writing_mld_data);
|
||||
util::Log() << "MLD customization writing took " << TIMER_SEC(writing_mld_data) << " seconds";
|
||||
|
||||
TIMER_START(writing_graph);
|
||||
partition::files::writeGraph(config.mld_graph_path, *edge_based_graph);
|
||||
partition::files::writeGraph(config.GetPath(".osrm.mldgr"), *edge_based_graph);
|
||||
TIMER_STOP(writing_graph);
|
||||
util::Log() << "Graph writing took " << TIMER_SEC(writing_graph) << " seconds";
|
||||
|
||||
|
@ -7,15 +7,9 @@ namespace engine
|
||||
|
||||
bool EngineConfig::IsValid() const
|
||||
{
|
||||
const bool all_path_are_empty =
|
||||
storage_config.ram_index_path.empty() && storage_config.file_index_path.empty() &&
|
||||
storage_config.hsgr_data_path.empty() &&
|
||||
storage_config.node_based_nodes_data_path.empty() &&
|
||||
storage_config.edge_based_nodes_data_path.empty() &&
|
||||
storage_config.edges_data_path.empty() && storage_config.core_data_path.empty() &&
|
||||
storage_config.geometries_path.empty() && storage_config.timestamp_path.empty() &&
|
||||
storage_config.datasource_names_path.empty() &&
|
||||
storage_config.datasource_indexes_path.empty() && storage_config.names_data_path.empty();
|
||||
// check whether a base_bath has been defined by verifying an empty extension
|
||||
// leads to an empty path
|
||||
const bool all_path_are_empty = storage_config.GetPath("").empty();
|
||||
|
||||
const auto unlimited_or_more_than = [](const int v, const int limit) {
|
||||
return v == -1 || v > limit;
|
||||
|
@ -134,7 +134,7 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
|
||||
node_is_startpoint,
|
||||
edge_based_node_weights,
|
||||
edge_based_edge_list,
|
||||
config.intersection_class_path.string(),
|
||||
config.GetPath(".osrm.icd").string(),
|
||||
turn_restrictions,
|
||||
turn_lane_map);
|
||||
|
||||
@ -146,7 +146,7 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
|
||||
util::Log() << "Saving edge-based node weights to file.";
|
||||
TIMER_START(timer_write_node_weights);
|
||||
{
|
||||
storage::io::FileWriter writer(config.node_path,
|
||||
storage::io::FileWriter writer(config.GetPath(".osrm.enw"),
|
||||
storage::io::FileWriter::GenerateFingerprint);
|
||||
storage::serialization::write(writer, edge_based_node_weights);
|
||||
}
|
||||
@ -164,12 +164,12 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
|
||||
TIMER_STOP(rtree);
|
||||
|
||||
util::Log() << "Writing nodes for nodes-based and edges-based graphs ...";
|
||||
files::writeNodes(config.node_based_nodes_data_path, coordinates, osm_node_ids);
|
||||
files::writeNodeData(config.edge_based_nodes_data_path, edge_based_nodes_container);
|
||||
files::writeNodes(config.GetPath(".osrm.nbg_nodes"), coordinates, osm_node_ids);
|
||||
files::writeNodeData(config.GetPath(".osrm.ebg_nodes"), edge_based_nodes_container);
|
||||
|
||||
util::Log() << "Writing edge-based-graph edges ... " << std::flush;
|
||||
TIMER_START(write_edges);
|
||||
files::writeEdgeBasedGraph(config.edge_graph_output_path, max_edge_id, edge_based_edge_list);
|
||||
files::writeEdgeBasedGraph(config.GetPath(".osrm.ebg"), max_edge_id, edge_based_edge_list);
|
||||
TIMER_STOP(write_edges);
|
||||
util::Log() << "ok, after " << TIMER_SEC(write_edges) << "s";
|
||||
|
||||
@ -183,7 +183,7 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
|
||||
util::Log() << "Expansion: " << nodes_per_second << " nodes/sec and " << edges_per_second
|
||||
<< " edges/sec";
|
||||
util::Log() << "To prepare the data for routing, run: "
|
||||
<< "./osrm-contract " << config.osrm_path;
|
||||
<< "./osrm-contract " << config.GetPath(".osrm");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -239,7 +239,7 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
|
||||
}
|
||||
util::Log() << "timestamp: " << timestamp;
|
||||
|
||||
storage::io::FileWriter timestamp_file(config.timestamp_path,
|
||||
storage::io::FileWriter timestamp_file(config.GetPath(".osrm.timestamp"),
|
||||
storage::io::FileWriter::GenerateFingerprint);
|
||||
|
||||
timestamp_file.WriteFrom(timestamp.c_str(), timestamp.length());
|
||||
@ -330,13 +330,13 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
|
||||
}
|
||||
|
||||
extraction_containers.PrepareData(scripting_environment,
|
||||
config.osrm_path.string(),
|
||||
config.turn_restrictions_path.string(),
|
||||
config.names_data_path.string());
|
||||
config.GetPath(".osrm").string(),
|
||||
config.GetPath(".osrm.restrictions").string(),
|
||||
config.GetPath(".osrm.names").string());
|
||||
|
||||
auto profile_properties = scripting_environment.GetProfileProperties();
|
||||
SetClassNames(classes_map, profile_properties);
|
||||
files::writeProfileProperties(config.properties_path.string(), profile_properties);
|
||||
files::writeProfileProperties(config.GetPath(".osrm.properties").string(), profile_properties);
|
||||
|
||||
TIMER_STOP(extracting);
|
||||
util::Log() << "extraction finished after " << TIMER_SEC(extracting) << "s";
|
||||
@ -411,7 +411,7 @@ Extractor::LoadNodeBasedGraph(std::unordered_set<NodeID> &barriers,
|
||||
std::vector<util::Coordinate> &coordiantes,
|
||||
extractor::PackedOSMIDs &osm_node_ids)
|
||||
{
|
||||
storage::io::FileReader file_reader(config.osrm_path,
|
||||
storage::io::FileReader file_reader(config.GetPath(".osrm"),
|
||||
storage::io::FileReader::VerifyFingerprint);
|
||||
|
||||
auto barriers_iter = inserter(barriers, end(barriers));
|
||||
@ -428,7 +428,7 @@ Extractor::LoadNodeBasedGraph(std::unordered_set<NodeID> &barriers,
|
||||
|
||||
if (edge_list.empty())
|
||||
{
|
||||
throw util::exception("Node-based-graph (" + config.osrm_path.string() +
|
||||
throw util::exception("Node-based-graph (" + config.GetPath(".osrm").string() +
|
||||
") contains no edges." + SOURCE_REF);
|
||||
}
|
||||
|
||||
@ -466,7 +466,7 @@ Extractor::BuildEdgeExpandedGraph(ScriptingEnvironment &scripting_environment,
|
||||
*node_based_graph,
|
||||
compressed_edge_container);
|
||||
|
||||
util::NameTable name_table(config.names_data_path.string());
|
||||
util::NameTable name_table(config.GetPath(".osrm.names").string());
|
||||
|
||||
EdgeBasedGraphFactory edge_based_graph_factory(
|
||||
node_based_graph,
|
||||
@ -481,12 +481,12 @@ Extractor::BuildEdgeExpandedGraph(ScriptingEnvironment &scripting_environment,
|
||||
turn_lane_map);
|
||||
|
||||
edge_based_graph_factory.Run(scripting_environment,
|
||||
config.edges_data_path.string(),
|
||||
config.turn_lane_data_path.string(),
|
||||
config.turn_weight_penalties_path.string(),
|
||||
config.turn_duration_penalties_path.string(),
|
||||
config.turn_penalties_index_path.string(),
|
||||
config.cnbg_ebg_mapping_path.string());
|
||||
config.GetPath(".osrm.edges").string(),
|
||||
config.GetPath(".osrm.tld").string(),
|
||||
config.GetPath(".osrm.turn_weight_penalties").string(),
|
||||
config.GetPath(".osrm.turn_duration_penalties").string(),
|
||||
config.GetPath(".osrm.turn_penalties_index").string(),
|
||||
config.GetPath(".osrm.cnbg_to_ebg").string());
|
||||
|
||||
compressed_edge_container.PrintStatistics();
|
||||
|
||||
@ -509,7 +509,7 @@ Extractor::BuildEdgeExpandedGraph(ScriptingEnvironment &scripting_environment,
|
||||
|
||||
compressed_node_based_graph_writing = std::async(std::launch::async, [&] {
|
||||
WriteCompressedNodeBasedGraph(
|
||||
config.compressed_node_based_graph_path.string(), *node_based_graph, coordinates);
|
||||
config.GetPath(".osrm.cnbg").string(), *node_based_graph, coordinates);
|
||||
});
|
||||
|
||||
{
|
||||
@ -518,9 +518,9 @@ Extractor::BuildEdgeExpandedGraph(ScriptingEnvironment &scripting_environment,
|
||||
std::tie(turn_lane_offsets, turn_lane_masks) =
|
||||
guidance::transformTurnLaneMapIntoArrays(turn_lane_map);
|
||||
files::writeTurnLaneDescriptions(
|
||||
config.turn_lane_description_path, turn_lane_offsets, turn_lane_masks);
|
||||
config.GetPath(".osrm.tls"), turn_lane_offsets, turn_lane_masks);
|
||||
}
|
||||
files::writeSegmentData(config.geometries_path,
|
||||
files::writeSegmentData(config.GetPath(".osrm.geometry"),
|
||||
*compressed_edge_container.ToSegmentData());
|
||||
|
||||
edge_based_graph_factory.GetEdgeBasedEdges(edge_based_edge_list);
|
||||
@ -583,8 +583,8 @@ void Extractor::BuildRTree(std::vector<EdgeBasedNodeSegment> edge_based_node_seg
|
||||
|
||||
TIMER_START(construction);
|
||||
util::StaticRTree<EdgeBasedNodeSegment> rtree(edge_based_node_segments,
|
||||
config.ram_index_path.string(),
|
||||
config.file_index_path.string(),
|
||||
config.GetPath(".osrm.ramIndex").string(),
|
||||
config.GetPath(".osrm.fileIndex").string(),
|
||||
coordinates);
|
||||
|
||||
TIMER_STOP(construction);
|
||||
|
@ -98,7 +98,7 @@ void LogGeojson(const std::string &filename, const std::vector<std::uint32_t> &b
|
||||
auto getGraphBisection(const PartitionConfig &config)
|
||||
{
|
||||
auto compressed_node_based_graph =
|
||||
LoadCompressedNodeBasedGraph(config.compressed_node_based_graph_path.string());
|
||||
LoadCompressedNodeBasedGraph(config.GetPath(".osrm.cnbg").string());
|
||||
|
||||
util::Log() << "Loaded compressed node based graph: "
|
||||
<< compressed_node_based_graph.edges.size() << " edges, "
|
||||
@ -137,10 +137,10 @@ int Partitioner::Run(const PartitionConfig &config)
|
||||
// For details see #3205
|
||||
|
||||
std::vector<extractor::NBGToEBG> mapping;
|
||||
extractor::files::readNBGMapping(config.cnbg_ebg_mapping_path.string(), mapping);
|
||||
extractor::files::readNBGMapping(config.GetPath(".osrm.cnbg_to_ebg").string(), mapping);
|
||||
util::Log() << "Loaded node based graph to edge based graph mapping";
|
||||
|
||||
auto edge_based_graph = LoadEdgeBasedGraph(config.edge_based_graph_path);
|
||||
auto edge_based_graph = LoadEdgeBasedGraph(config.GetPath(".osrm.ebg").string());
|
||||
util::Log() << "Loaded edge based graph for mapping partition ids: "
|
||||
<< edge_based_graph.GetNumberOfEdges() << " edges, "
|
||||
<< edge_based_graph.GetNumberOfNodes() << " nodes";
|
||||
@ -185,21 +185,21 @@ int Partitioner::Run(const PartitionConfig &config)
|
||||
renumber(partitions, permutation);
|
||||
{
|
||||
boost::iostreams::mapped_file segment_region;
|
||||
auto segments =
|
||||
util::mmapFile<extractor::EdgeBasedNodeSegment>(config.file_index_path, segment_region);
|
||||
auto segments = util::mmapFile<extractor::EdgeBasedNodeSegment>(
|
||||
config.GetPath(".osrm.fileIndex"), segment_region);
|
||||
renumber(segments, permutation);
|
||||
}
|
||||
{
|
||||
extractor::EdgeBasedNodeDataContainer node_data;
|
||||
extractor::files::readNodeData(config.node_data_path, node_data);
|
||||
extractor::files::readNodeData(config.GetPath(".osrm.ebg_nodes"), node_data);
|
||||
renumber(node_data, permutation);
|
||||
extractor::files::writeNodeData(config.node_data_path, node_data);
|
||||
extractor::files::writeNodeData(config.GetPath(".osrm.ebg_nodes"), node_data);
|
||||
}
|
||||
if (boost::filesystem::exists(config.hsgr_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.hsgr")))
|
||||
{
|
||||
util::Log(logWARNING) << "Found existing .osrm.hsgr file, removing. You need to re-run "
|
||||
"osrm-contract after osrm-partition.";
|
||||
boost::filesystem::remove(config.hsgr_path);
|
||||
boost::filesystem::remove(config.GetPath(".osrm.hsgr"));
|
||||
}
|
||||
TIMER_STOP(renumber);
|
||||
util::Log() << "Renumbered data in " << TIMER_SEC(renumber) << " seconds";
|
||||
@ -215,9 +215,9 @@ int Partitioner::Run(const PartitionConfig &config)
|
||||
util::Log() << "CellStorage constructed in " << TIMER_SEC(cell_storage) << " seconds";
|
||||
|
||||
TIMER_START(writing_mld_data);
|
||||
files::writePartition(config.partition_path, mlp);
|
||||
files::writeCells(config.storage_path, storage);
|
||||
extractor::files::writeEdgeBasedGraph(config.edge_based_graph_path,
|
||||
files::writePartition(config.GetPath(".osrm.partition"), mlp);
|
||||
files::writeCells(config.GetPath(".osrm.cells"), storage);
|
||||
extractor::files::writeEdgeBasedGraph(config.GetPath(".osrm.ebg"),
|
||||
edge_based_graph.GetNumberOfNodes() - 1,
|
||||
graphToEdges(edge_based_graph));
|
||||
TIMER_STOP(writing_mld_data);
|
||||
|
@ -206,21 +206,22 @@ int Storage::Run(int max_wait)
|
||||
void Storage::PopulateLayout(DataLayout &layout)
|
||||
{
|
||||
{
|
||||
auto absolute_file_index_path = boost::filesystem::absolute(config.file_index_path);
|
||||
auto absolute_file_index_path =
|
||||
boost::filesystem::absolute(config.GetPath(".osrm.fileIndex"));
|
||||
|
||||
layout.SetBlockSize<char>(DataLayout::FILE_INDEX_PATH,
|
||||
absolute_file_index_path.string().length() + 1);
|
||||
}
|
||||
|
||||
{
|
||||
util::Log() << "load names from: " << config.names_data_path;
|
||||
util::Log() << "load names from: " << config.GetPath(".osrm.names");
|
||||
// number of entries in name index
|
||||
io::FileReader name_file(config.names_data_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader name_file(config.GetPath(".osrm.names"), io::FileReader::VerifyFingerprint);
|
||||
layout.SetBlockSize<char>(DataLayout::NAME_CHAR_DATA, name_file.GetSize());
|
||||
}
|
||||
|
||||
{
|
||||
io::FileReader reader(config.turn_lane_description_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader reader(config.GetPath(".osrm.tls"), io::FileReader::VerifyFingerprint);
|
||||
auto num_offsets = reader.ReadVectorSize<std::uint32_t>();
|
||||
auto num_masks = reader.ReadVectorSize<extractor::guidance::TurnLaneType::Mask>();
|
||||
|
||||
@ -231,7 +232,7 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
|
||||
// Loading information for original edges
|
||||
{
|
||||
io::FileReader edges_file(config.edges_data_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader edges_file(config.GetPath(".osrm.edges"), io::FileReader::VerifyFingerprint);
|
||||
const auto number_of_original_edges = edges_file.ReadElementCount64();
|
||||
|
||||
// note: settings this all to the same size is correct, we extract them from the same struct
|
||||
@ -246,7 +247,7 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
}
|
||||
|
||||
{
|
||||
io::FileReader nodes_data_file(config.edge_based_nodes_data_path,
|
||||
io::FileReader nodes_data_file(config.GetPath(".osrm.ebg_nodes"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
const auto nodes_number = nodes_data_file.ReadElementCount64();
|
||||
|
||||
@ -257,9 +258,9 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
layout.SetBlockSize<extractor::ClassData>(DataLayout::CLASSES_LIST, nodes_number);
|
||||
}
|
||||
|
||||
if (boost::filesystem::exists(config.hsgr_data_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.hsgr")))
|
||||
{
|
||||
io::FileReader reader(config.hsgr_data_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader reader(config.GetPath(".osrm.hsgr"), io::FileReader::VerifyFingerprint);
|
||||
|
||||
reader.Skip<std::uint32_t>(1); // checksum
|
||||
auto num_nodes = reader.ReadVectorSize<contractor::QueryGraph::NodeArrayEntry>();
|
||||
@ -282,7 +283,8 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
|
||||
// load rsearch tree size
|
||||
{
|
||||
io::FileReader tree_node_file(config.ram_index_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader tree_node_file(config.GetPath(".osrm.ramIndex"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
|
||||
const auto tree_size = tree_node_file.ReadElementCount64();
|
||||
layout.SetBlockSize<RTreeNode>(DataLayout::R_SEARCH_TREE, tree_size);
|
||||
@ -297,15 +299,17 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
|
||||
// read timestampsize
|
||||
{
|
||||
io::FileReader timestamp_file(config.timestamp_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader timestamp_file(config.GetPath(".osrm.timestamp"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
const auto timestamp_size = timestamp_file.GetSize();
|
||||
layout.SetBlockSize<char>(DataLayout::TIMESTAMP, timestamp_size);
|
||||
}
|
||||
|
||||
// load core marker size
|
||||
if (boost::filesystem::exists(config.core_data_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.core")))
|
||||
{
|
||||
io::FileReader core_marker_file(config.core_data_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader core_marker_file(config.GetPath(".osrm.core"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
const auto number_of_core_markers = core_marker_file.ReadElementCount64();
|
||||
layout.SetBlockSize<unsigned>(DataLayout::CH_CORE_MARKER, number_of_core_markers);
|
||||
}
|
||||
@ -316,7 +320,7 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
|
||||
// load turn weight penalties
|
||||
{
|
||||
io::FileReader turn_weight_penalties_file(config.turn_weight_penalties_path,
|
||||
io::FileReader turn_weight_penalties_file(config.GetPath(".osrm.turn_weight_penalties"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
const auto number_of_penalties = turn_weight_penalties_file.ReadElementCount64();
|
||||
layout.SetBlockSize<TurnPenalty>(DataLayout::TURN_WEIGHT_PENALTIES, number_of_penalties);
|
||||
@ -324,7 +328,7 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
|
||||
// load turn duration penalties
|
||||
{
|
||||
io::FileReader turn_duration_penalties_file(config.turn_duration_penalties_path,
|
||||
io::FileReader turn_duration_penalties_file(config.GetPath(".osrm.turn_duration_penalties"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
const auto number_of_penalties = turn_duration_penalties_file.ReadElementCount64();
|
||||
layout.SetBlockSize<TurnPenalty>(DataLayout::TURN_DURATION_PENALTIES, number_of_penalties);
|
||||
@ -332,7 +336,7 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
|
||||
// load coordinate size
|
||||
{
|
||||
io::FileReader node_file(config.node_based_nodes_data_path,
|
||||
io::FileReader node_file(config.GetPath(".osrm.nbg_nodes"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
const auto coordinate_list_size = node_file.ReadElementCount64();
|
||||
layout.SetBlockSize<util::Coordinate>(DataLayout::COORDINATE_LIST, coordinate_list_size);
|
||||
@ -348,7 +352,7 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
|
||||
// load geometries sizes
|
||||
{
|
||||
io::FileReader reader(config.geometries_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader reader(config.GetPath(".osrm.geometry"), io::FileReader::VerifyFingerprint);
|
||||
|
||||
const auto number_of_geometries_indices = reader.ReadVectorSize<unsigned>();
|
||||
layout.SetBlockSize<unsigned>(DataLayout::GEOMETRIES_INDEX, number_of_geometries_indices);
|
||||
@ -389,7 +393,7 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
}
|
||||
|
||||
{
|
||||
io::FileReader reader(config.intersection_class_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader reader(config.GetPath(".osrm.icd"), io::FileReader::VerifyFingerprint);
|
||||
|
||||
auto num_discreate_bearings = reader.ReadVectorSize<DiscreteBearing>();
|
||||
layout.SetBlockSize<DiscreteBearing>(DataLayout::BEARING_VALUES, num_discreate_bearings);
|
||||
@ -413,7 +417,7 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
|
||||
{
|
||||
// Loading turn lane data
|
||||
io::FileReader lane_data_file(config.turn_lane_data_path,
|
||||
io::FileReader lane_data_file(config.GetPath(".osrm.tld"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
const auto lane_tuple_count = lane_data_file.ReadElementCount64();
|
||||
layout.SetBlockSize<util::guidance::LaneTupleIdPair>(DataLayout::TURN_LANE_DATA,
|
||||
@ -422,9 +426,10 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
|
||||
{
|
||||
// Loading MLD Data
|
||||
if (boost::filesystem::exists(config.mld_partition_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.partition")))
|
||||
{
|
||||
io::FileReader reader(config.mld_partition_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader reader(config.GetPath(".osrm.partition"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
|
||||
reader.Skip<partition::MultiLevelPartition::LevelData>(1);
|
||||
layout.SetBlockSize<partition::MultiLevelPartition::LevelData>(
|
||||
@ -442,9 +447,9 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
layout.SetBlockSize<CellID>(DataLayout::MLD_CELL_TO_CHILDREN, 0);
|
||||
}
|
||||
|
||||
if (boost::filesystem::exists(config.mld_storage_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.cells")))
|
||||
{
|
||||
io::FileReader reader(config.mld_storage_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader reader(config.GetPath(".osrm.cells"), io::FileReader::VerifyFingerprint);
|
||||
|
||||
const auto weights_count = reader.ReadVectorSize<EdgeWeight>();
|
||||
layout.SetBlockSize<EdgeWeight>(DataLayout::MLD_CELL_WEIGHTS, weights_count);
|
||||
@ -472,9 +477,9 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
layout.SetBlockSize<char>(DataLayout::MLD_CELL_LEVEL_OFFSETS, 0);
|
||||
}
|
||||
|
||||
if (boost::filesystem::exists(config.mld_graph_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.mldgr")))
|
||||
{
|
||||
io::FileReader reader(config.mld_graph_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader reader(config.GetPath(".osrm.mldgr"), io::FileReader::VerifyFingerprint);
|
||||
|
||||
const auto num_nodes =
|
||||
reader.ReadVectorSize<customizer::MultiLevelEdgeBasedGraph::NodeArrayEntry>();
|
||||
@ -509,7 +514,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
// read actual data into shared memory object //
|
||||
|
||||
// Load the HSGR file
|
||||
if (boost::filesystem::exists(config.hsgr_data_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.hsgr")))
|
||||
{
|
||||
auto graph_nodes_ptr = layout.GetBlockPtr<contractor::QueryGraphView::NodeArrayEntry, true>(
|
||||
memory_ptr, storage::DataLayout::CH_GRAPH_NODE_LIST);
|
||||
@ -523,7 +528,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
graph_edges_ptr, layout.num_entries[storage::DataLayout::CH_GRAPH_EDGE_LIST]);
|
||||
|
||||
contractor::QueryGraphView graph_view(std::move(node_list), std::move(edge_list));
|
||||
contractor::files::readGraph(config.hsgr_data_path, *checksum, graph_view);
|
||||
contractor::files::readGraph(config.GetPath(".osrm.hsgr"), *checksum, graph_view);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -543,7 +548,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
file_index_path_ptr + layout.GetBlockSize(DataLayout::FILE_INDEX_PATH),
|
||||
0);
|
||||
const auto absolute_file_index_path =
|
||||
boost::filesystem::absolute(config.file_index_path).string();
|
||||
boost::filesystem::absolute(config.GetPath(".osrm.fileIndex")).string();
|
||||
BOOST_ASSERT(static_cast<std::size_t>(layout.GetBlockSize(DataLayout::FILE_INDEX_PATH)) >=
|
||||
absolute_file_index_path.size());
|
||||
std::copy(
|
||||
@ -552,7 +557,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
|
||||
// Name data
|
||||
{
|
||||
io::FileReader name_file(config.names_data_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader name_file(config.GetPath(".osrm.names"), io::FileReader::VerifyFingerprint);
|
||||
std::size_t name_file_size = name_file.GetSize();
|
||||
|
||||
BOOST_ASSERT(name_file_size == layout.GetBlockSize(DataLayout::NAME_CHAR_DATA));
|
||||
@ -564,7 +569,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
|
||||
// Turn lane data
|
||||
{
|
||||
io::FileReader lane_data_file(config.turn_lane_data_path,
|
||||
io::FileReader lane_data_file(config.GetPath(".osrm.tld"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
|
||||
const auto lane_tuple_count = lane_data_file.ReadElementCount64();
|
||||
@ -590,8 +595,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
util::vector_view<extractor::guidance::TurnLaneType::Mask> masks(
|
||||
masks_ptr, layout.num_entries[storage::DataLayout::LANE_DESCRIPTION_MASKS]);
|
||||
|
||||
extractor::files::readTurnLaneDescriptions(
|
||||
config.turn_lane_description_path, offsets, masks);
|
||||
extractor::files::readTurnLaneDescriptions(config.GetPath(".osrm.tls"), offsets, masks);
|
||||
}
|
||||
|
||||
// Load edge-based nodes data
|
||||
@ -627,7 +631,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
std::move(travel_modes),
|
||||
std::move(classes));
|
||||
|
||||
extractor::files::readNodeData(config.edge_based_nodes_data_path, node_data);
|
||||
extractor::files::readNodeData(config.GetPath(".osrm.ebg_nodes"), node_data);
|
||||
}
|
||||
|
||||
// Load original edge data
|
||||
@ -664,7 +668,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
std::move(pre_turn_bearings),
|
||||
std::move(post_turn_bearings));
|
||||
|
||||
extractor::files::readTurnData(config.edges_data_path, turn_data);
|
||||
extractor::files::readTurnData(config.GetPath(".osrm.edges"), turn_data);
|
||||
}
|
||||
|
||||
// load compressed geometry
|
||||
@ -729,13 +733,14 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
std::move(geometry_rev_duration_list),
|
||||
std::move(datasources_list)};
|
||||
|
||||
extractor::files::readSegmentData(config.geometries_path, segment_data);
|
||||
extractor::files::readSegmentData(config.GetPath(".osrm.geometry"), segment_data);
|
||||
}
|
||||
|
||||
{
|
||||
const auto datasources_names_ptr = layout.GetBlockPtr<extractor::Datasources, true>(
|
||||
memory_ptr, DataLayout::DATASOURCES_NAMES);
|
||||
extractor::files::readDatasources(config.datasource_names_path, *datasources_names_ptr);
|
||||
extractor::files::readDatasources(config.GetPath(".osrm.datasource_names"),
|
||||
*datasources_names_ptr);
|
||||
}
|
||||
|
||||
// Loading list of coordinates
|
||||
@ -752,12 +757,12 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
osmnodeid_ptr, layout.num_entries[DataLayout::OSM_NODE_ID_LIST]),
|
||||
layout.num_entries[DataLayout::COORDINATE_LIST]);
|
||||
|
||||
extractor::files::readNodes(config.node_based_nodes_data_path, coordinates, osm_node_ids);
|
||||
extractor::files::readNodes(config.GetPath(".osrm.nbg_nodes"), coordinates, osm_node_ids);
|
||||
}
|
||||
|
||||
// load turn weight penalties
|
||||
{
|
||||
io::FileReader turn_weight_penalties_file(config.turn_weight_penalties_path,
|
||||
io::FileReader turn_weight_penalties_file(config.GetPath(".osrm.turn_weight_penalties"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
const auto number_of_penalties = turn_weight_penalties_file.ReadElementCount64();
|
||||
const auto turn_weight_penalties_ptr =
|
||||
@ -767,7 +772,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
|
||||
// load turn duration penalties
|
||||
{
|
||||
io::FileReader turn_duration_penalties_file(config.turn_duration_penalties_path,
|
||||
io::FileReader turn_duration_penalties_file(config.GetPath(".osrm.turn_duration_penalties"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
const auto number_of_penalties = turn_duration_penalties_file.ReadElementCount64();
|
||||
const auto turn_duration_penalties_ptr =
|
||||
@ -777,7 +782,8 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
|
||||
// store timestamp
|
||||
{
|
||||
io::FileReader timestamp_file(config.timestamp_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader timestamp_file(config.GetPath(".osrm.timestamp"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
const auto timestamp_size = timestamp_file.GetSize();
|
||||
|
||||
const auto timestamp_ptr =
|
||||
@ -788,7 +794,8 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
|
||||
// store search tree portion of rtree
|
||||
{
|
||||
io::FileReader tree_node_file(config.ram_index_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader tree_node_file(config.GetPath(".osrm.ramIndex"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
// perform this read so that we're at the right stream position for the next
|
||||
// read.
|
||||
tree_node_file.Skip<std::uint64_t>(1);
|
||||
@ -805,21 +812,22 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
layout.num_entries[DataLayout::R_SEARCH_TREE_LEVELS]);
|
||||
}
|
||||
|
||||
if (boost::filesystem::exists(config.core_data_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.core")))
|
||||
{
|
||||
auto core_marker_ptr =
|
||||
layout.GetBlockPtr<unsigned, true>(memory_ptr, storage::DataLayout::CH_CORE_MARKER);
|
||||
util::vector_view<bool> is_core_node(
|
||||
core_marker_ptr, layout.num_entries[storage::DataLayout::CH_CORE_MARKER]);
|
||||
|
||||
contractor::files::readCoreMarker(config.core_data_path, is_core_node);
|
||||
contractor::files::readCoreMarker(config.GetPath(".osrm.core"), is_core_node);
|
||||
}
|
||||
|
||||
// load profile properties
|
||||
{
|
||||
const auto profile_properties_ptr = layout.GetBlockPtr<extractor::ProfileProperties, true>(
|
||||
memory_ptr, DataLayout::PROPERTIES);
|
||||
extractor::files::readProfileProperties(config.properties_path, *profile_properties_ptr);
|
||||
extractor::files::readProfileProperties(config.GetPath(".osrm.properties"),
|
||||
*profile_properties_ptr);
|
||||
}
|
||||
|
||||
// Load intersection data
|
||||
@ -856,12 +864,12 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
entry_class_ptr, layout.num_entries[storage::DataLayout::ENTRY_CLASS]);
|
||||
|
||||
extractor::files::readIntersections(
|
||||
config.intersection_class_path, intersection_bearings_view, entry_classes);
|
||||
config.GetPath(".osrm.icd"), intersection_bearings_view, entry_classes);
|
||||
}
|
||||
|
||||
{
|
||||
// Loading MLD Data
|
||||
if (boost::filesystem::exists(config.mld_partition_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.partition")))
|
||||
{
|
||||
BOOST_ASSERT(layout.GetBlockSize(storage::DataLayout::MLD_LEVEL_DATA) > 0);
|
||||
BOOST_ASSERT(layout.GetBlockSize(storage::DataLayout::MLD_CELL_TO_CHILDREN) > 0);
|
||||
@ -885,10 +893,10 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
|
||||
partition::MultiLevelPartitionView mlp{
|
||||
std::move(level_data), std::move(partition), std::move(cell_to_children)};
|
||||
partition::files::readPartition(config.mld_partition_path, mlp);
|
||||
partition::files::readPartition(config.GetPath(".osrm.partition"), mlp);
|
||||
}
|
||||
|
||||
if (boost::filesystem::exists(config.mld_storage_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.cells")))
|
||||
{
|
||||
BOOST_ASSERT(layout.GetBlockSize(storage::DataLayout::MLD_CELLS) > 0);
|
||||
BOOST_ASSERT(layout.GetBlockSize(storage::DataLayout::MLD_CELL_LEVEL_OFFSETS) > 0);
|
||||
@ -936,10 +944,10 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
std::move(destination_boundary),
|
||||
std::move(cells),
|
||||
std::move(level_offsets)};
|
||||
partition::files::readCells(config.mld_storage_path, storage);
|
||||
partition::files::readCells(config.GetPath(".osrm.cells"), storage);
|
||||
}
|
||||
|
||||
if (boost::filesystem::exists(config.mld_graph_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.mldgr")))
|
||||
{
|
||||
|
||||
auto graph_nodes_ptr =
|
||||
@ -962,7 +970,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
|
||||
customizer::MultiLevelEdgeBasedGraphView graph_view(
|
||||
std::move(node_list), std::move(edge_list), std::move(node_to_offset));
|
||||
partition::files::readGraph(config.mld_graph_path, graph_view);
|
||||
partition::files::readGraph(config.GetPath(".osrm.mldgr"), graph_view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ return_code parseArguments(int argc, char *argv[], contractor::ContractorConfig
|
||||
boost::program_options::options_description hidden_options("Hidden options");
|
||||
hidden_options.add_options()(
|
||||
"input,i",
|
||||
boost::program_options::value<boost::filesystem::path>(&contractor_config.osrm_path),
|
||||
boost::program_options::value<boost::filesystem::path>(&contractor_config.base_path),
|
||||
"Input file in .osm, .osm.bz2 or .osm.pbf format");
|
||||
|
||||
// positional option
|
||||
@ -153,7 +153,7 @@ int main(int argc, char *argv[]) try
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
contractor_config.UseDefaultOutputNames();
|
||||
contractor_config.UseDefaultOutputNames(contractor_config.base_path);
|
||||
|
||||
if (1 > contractor_config.requested_num_threads)
|
||||
{
|
||||
@ -169,14 +169,14 @@ int main(int argc, char *argv[]) try
|
||||
<< "! This setting may have performance side-effects.";
|
||||
}
|
||||
|
||||
if (!boost::filesystem::is_regular_file(contractor_config.osrm_path))
|
||||
if (!boost::filesystem::is_regular_file(contractor_config.GetPath(".osrm")))
|
||||
{
|
||||
util::Log(logERROR) << "Input file " << contractor_config.osrm_path.string()
|
||||
util::Log(logERROR) << "Input file " << contractor_config.GetPath(".osrm").string()
|
||||
<< " not found!";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
util::Log() << "Input file: " << contractor_config.osrm_path.filename().string();
|
||||
util::Log() << "Input file: " << contractor_config.GetPath(".osrm").filename().string();
|
||||
util::Log() << "Threads: " << contractor_config.requested_num_threads;
|
||||
|
||||
tbb::task_scheduler_init init(contractor_config.requested_num_threads);
|
||||
|
@ -72,7 +72,7 @@ parseArguments(int argc, char *argv[], customizer::CustomizationConfig &customiz
|
||||
boost::program_options::options_description hidden_options("Hidden options");
|
||||
hidden_options.add_options()(
|
||||
"input,i",
|
||||
boost::program_options::value<boost::filesystem::path>(&customization_config.osrm_path),
|
||||
boost::program_options::value<boost::filesystem::path>(&customization_config.base_path),
|
||||
"Input file in .osrm format");
|
||||
|
||||
// positional option
|
||||
@ -145,7 +145,7 @@ int main(int argc, char *argv[]) try
|
||||
}
|
||||
|
||||
// set the default in/output names
|
||||
customization_config.UseDefaultOutputNames();
|
||||
customization_config.UseDefaultOutputNames(customization_config.base_path);
|
||||
|
||||
if (1 > customization_config.requested_num_threads)
|
||||
{
|
||||
@ -153,9 +153,9 @@ int main(int argc, char *argv[]) try
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (!boost::filesystem::is_regular_file(customization_config.osrm_path))
|
||||
if (!boost::filesystem::is_regular_file(customization_config.GetPath(".osrm")))
|
||||
{
|
||||
util::Log(logERROR) << "Input file " << customization_config.osrm_path.string()
|
||||
util::Log(logERROR) << "Input file " << customization_config.GetPath(".osrm").string()
|
||||
<< " not found!";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ int main(int argc, char *argv[]) try
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
extractor_config.UseDefaultOutputNames();
|
||||
extractor_config.UseDefaultOutputNames(extractor_config.input_path);
|
||||
|
||||
if (1 > extractor_config.requested_num_threads)
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ return_code parseArguments(int argc, char *argv[], partition::PartitionConfig &c
|
||||
boost::program_options::options_description hidden_options("Hidden options");
|
||||
hidden_options.add_options()(
|
||||
"input,i",
|
||||
boost::program_options::value<boost::filesystem::path>(&config.osrm_path),
|
||||
boost::program_options::value<boost::filesystem::path>(&config.base_path),
|
||||
"Input file in .osrm format");
|
||||
|
||||
// positional option
|
||||
@ -199,7 +199,7 @@ int main(int argc, char *argv[]) try
|
||||
}
|
||||
|
||||
// set the default in/output names
|
||||
partition_config.UseDefaultOutputNames();
|
||||
partition_config.UseDefaultOutputNames(partition_config.base_path);
|
||||
|
||||
if (1 > partition_config.requested_num_threads)
|
||||
{
|
||||
@ -219,9 +219,9 @@ int main(int argc, char *argv[]) try
|
||||
}
|
||||
};
|
||||
|
||||
if (!check_file(partition_config.edge_based_graph_path) ||
|
||||
!check_file(partition_config.cnbg_ebg_mapping_path) ||
|
||||
!check_file(partition_config.compressed_node_based_graph_path))
|
||||
if (!check_file(partition_config.GetPath(".osrm.ebg")) ||
|
||||
!check_file(partition_config.GetPath(".osrm.cnbg_to_ebg")) ||
|
||||
!check_file(partition_config.GetPath(".osrm.cnbg")))
|
||||
{
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ int main(int argc, const char *argv[]) try
|
||||
}
|
||||
if (!base_path.empty())
|
||||
{
|
||||
config.storage_config = storage::StorageConfig(base_path);
|
||||
config.storage_config.UseDefaultOutputNames(base_path);
|
||||
}
|
||||
if (!config.use_shared_memory && !config.storage_config.IsValid())
|
||||
{
|
||||
|
@ -163,7 +163,8 @@ int main(const int argc, const char *argv[]) try
|
||||
{
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
storage::StorageConfig config(base_path);
|
||||
storage::StorageConfig config;
|
||||
config.UseDefaultOutputNames(base_path);
|
||||
if (!config.IsValid())
|
||||
{
|
||||
util::Log(logERROR) << "Config contains invalid file paths. Exiting!";
|
||||
|
@ -105,13 +105,13 @@ void checkWeightsConsistency(
|
||||
const std::vector<osrm::extractor::EdgeBasedEdge> &edge_based_edge_list)
|
||||
{
|
||||
extractor::SegmentDataContainer segment_data;
|
||||
extractor::files::readSegmentData(config.geometries_path, segment_data);
|
||||
extractor::files::readSegmentData(config.GetPath(".osrm.geometry"), segment_data);
|
||||
|
||||
extractor::EdgeBasedNodeDataContainer node_data;
|
||||
extractor::files::readNodeData(config.edge_based_nodes_data_path, node_data);
|
||||
extractor::files::readNodeData(config.GetPath(".osrm.ebg_nodes"), node_data);
|
||||
|
||||
extractor::TurnDataContainer turn_data;
|
||||
extractor::files::readTurnData(config.edges_data_path, turn_data);
|
||||
extractor::files::readTurnData(config.GetPath(".osrm.edges"), turn_data);
|
||||
|
||||
for (auto &edge : edge_based_edge_list)
|
||||
{
|
||||
@ -388,7 +388,7 @@ void saveDatasourcesNames(const UpdaterConfig &config)
|
||||
source++;
|
||||
}
|
||||
|
||||
extractor::files::writeDatasources(config.datasource_names_path, sources);
|
||||
extractor::files::writeDatasources(config.GetPath(".osrm.datasource_names"), sources);
|
||||
}
|
||||
|
||||
std::vector<std::uint64_t>
|
||||
@ -404,7 +404,7 @@ updateTurnPenalties(const UpdaterConfig &config,
|
||||
// Mapped file pointer for turn indices
|
||||
boost::iostreams::mapped_file_source turn_index_region;
|
||||
auto turn_index_blocks = util::mmapFile<extractor::lookup::TurnIndexBlock>(
|
||||
config.turn_penalties_index_path, turn_index_region);
|
||||
config.GetPath(".osrm.turn_penalties_index"), turn_index_region);
|
||||
|
||||
// Get the turn penalty and update to the new value if required
|
||||
std::vector<std::uint64_t> updated_turns;
|
||||
@ -490,7 +490,7 @@ updateConditionalTurns(const UpdaterConfig &config,
|
||||
// Mapped file pointer for turn indices
|
||||
boost::iostreams::mapped_file_source turn_index_region;
|
||||
auto turn_index_blocks = util::mmapFile<extractor::lookup::TurnIndexBlock>(
|
||||
config.turn_penalties_index_path, turn_index_region);
|
||||
config.GetPath(".osrm.turn_penalties_index"), turn_index_region);
|
||||
|
||||
std::vector<std::uint64_t> updated_turns;
|
||||
if (conditional_turns.size() == 0)
|
||||
@ -566,11 +566,11 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &e
|
||||
extractor::PackedOSMIDs osm_node_ids;
|
||||
|
||||
extractor::files::readEdgeBasedGraph(
|
||||
config.edge_based_graph_path, max_edge_id, edge_based_edge_list);
|
||||
extractor::files::readNodes(config.node_based_nodes_data_path, coordinates, osm_node_ids);
|
||||
config.GetPath(".osrm.ebg"), max_edge_id, edge_based_edge_list);
|
||||
extractor::files::readNodes(config.GetPath(".osrm.nbg_nodes"), coordinates, osm_node_ids);
|
||||
|
||||
const bool update_conditional_turns =
|
||||
!config.turn_restrictions_path.empty() && config.valid_now;
|
||||
!config.GetPath(".osrm.restrictions").empty() && config.valid_now;
|
||||
const bool update_edge_weights = !config.segment_speed_lookup_paths.empty();
|
||||
const bool update_turn_penalties = !config.turn_penalty_lookup_paths.empty();
|
||||
|
||||
@ -593,33 +593,35 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &e
|
||||
if (update_edge_weights || update_turn_penalties || update_conditional_turns)
|
||||
{
|
||||
const auto load_segment_data = [&] {
|
||||
extractor::files::readSegmentData(config.geometries_path, segment_data);
|
||||
extractor::files::readSegmentData(config.GetPath(".osrm.geometry"), segment_data);
|
||||
};
|
||||
|
||||
const auto load_node_data = [&] {
|
||||
extractor::files::readNodeData(config.edge_based_nodes_data_path, node_data);
|
||||
extractor::files::readNodeData(config.GetPath(".osrm.ebg_nodes"), node_data);
|
||||
};
|
||||
|
||||
const auto load_edge_data = [&] {
|
||||
extractor::files::readTurnData(config.edges_data_path, turn_data);
|
||||
extractor::files::readTurnData(config.GetPath(".osrm.edges"), turn_data);
|
||||
};
|
||||
|
||||
const auto load_turn_weight_penalties = [&] {
|
||||
using storage::io::FileReader;
|
||||
FileReader reader(config.turn_weight_penalties_path, FileReader::VerifyFingerprint);
|
||||
FileReader reader(config.GetPath(".osrm.turn_weight_penalties"),
|
||||
FileReader::VerifyFingerprint);
|
||||
storage::serialization::read(reader, turn_weight_penalties);
|
||||
};
|
||||
|
||||
const auto load_turn_duration_penalties = [&] {
|
||||
using storage::io::FileReader;
|
||||
FileReader reader(config.turn_duration_penalties_path, FileReader::VerifyFingerprint);
|
||||
FileReader reader(config.GetPath(".osrm.turn_duration_penalties"),
|
||||
FileReader::VerifyFingerprint);
|
||||
storage::serialization::read(reader, turn_duration_penalties);
|
||||
};
|
||||
|
||||
const auto load_profile_properties = [&] {
|
||||
// Propagate profile properties to contractor configuration structure
|
||||
storage::io::FileReader profile_properties_file(
|
||||
config.properties_path, storage::io::FileReader::VerifyFingerprint);
|
||||
config.GetPath(".osrm.properties"), storage::io::FileReader::VerifyFingerprint);
|
||||
profile_properties = profile_properties_file.ReadOne<extractor::ProfileProperties>();
|
||||
};
|
||||
|
||||
@ -635,7 +637,7 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &e
|
||||
if (update_conditional_turns)
|
||||
{
|
||||
using storage::io::FileReader;
|
||||
FileReader reader(config.turn_restrictions_path, FileReader::VerifyFingerprint);
|
||||
FileReader reader(config.GetPath(".osrm.restrictions"), FileReader::VerifyFingerprint);
|
||||
extractor::serialization::read(reader, conditional_turns);
|
||||
}
|
||||
|
||||
@ -652,7 +654,7 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &e
|
||||
coordinates,
|
||||
osm_node_ids);
|
||||
// Now save out the updated compressed geometries
|
||||
extractor::files::writeSegmentData(config.geometries_path, segment_data);
|
||||
extractor::files::writeSegmentData(config.GetPath(".osrm.geometry"), segment_data);
|
||||
TIMER_STOP(segment);
|
||||
util::Log() << "Updating segment data took " << TIMER_MSEC(segment) << "ms.";
|
||||
}
|
||||
@ -845,8 +847,14 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &e
|
||||
};
|
||||
|
||||
tbb::parallel_invoke(
|
||||
[&] { save_penalties(config.turn_weight_penalties_path, turn_weight_penalties); },
|
||||
[&] { save_penalties(config.turn_duration_penalties_path, turn_duration_penalties); });
|
||||
[&] {
|
||||
save_penalties(config.GetPath(".osrm.turn_weight_penalties"),
|
||||
turn_weight_penalties);
|
||||
},
|
||||
[&] {
|
||||
save_penalties(config.GetPath(".osrm.turn_duration_penalties"),
|
||||
turn_duration_penalties);
|
||||
});
|
||||
}
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
|
@ -20,6 +20,7 @@ BOOST_AUTO_TEST_CASE(test_extract_with_valid_config)
|
||||
{
|
||||
osrm::ExtractorConfig config;
|
||||
config.input_path = OSRM_TEST_DATA_DIR "/monaco.osm.pbf";
|
||||
config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/monaco.osm.pbf");
|
||||
config.requested_num_threads = tbb::task_scheduler_init::default_num_threads();
|
||||
BOOST_CHECK_NO_THROW(osrm::extract(config));
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ getOSRM(const std::string &base_path,
|
||||
osrm::EngineConfig::Algorithm algorithm = osrm::EngineConfig::Algorithm::CH)
|
||||
{
|
||||
osrm::EngineConfig config;
|
||||
config.storage_config = {base_path};
|
||||
config.storage_config.UseDefaultOutputNames(base_path);
|
||||
config.use_shared_memory = false;
|
||||
config.algorithm = algorithm;
|
||||
|
||||
|
@ -28,7 +28,7 @@ BOOST_AUTO_TEST_CASE(test_trip_limits)
|
||||
using namespace osrm;
|
||||
|
||||
EngineConfig config;
|
||||
config.storage_config = {OSRM_TEST_DATA_DIR "/ch/monaco.osrm"};
|
||||
config.storage_config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
config.use_shared_memory = false;
|
||||
config.max_locations_trip = 2;
|
||||
|
||||
@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(test_route_limits)
|
||||
using namespace osrm;
|
||||
|
||||
EngineConfig config;
|
||||
config.storage_config = {OSRM_TEST_DATA_DIR "/ch/monaco.osrm"};
|
||||
config.storage_config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
config.use_shared_memory = false;
|
||||
config.max_locations_viaroute = 2;
|
||||
|
||||
@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE(test_table_limits)
|
||||
using namespace osrm;
|
||||
|
||||
EngineConfig config;
|
||||
config.storage_config = {OSRM_TEST_DATA_DIR "/ch/monaco.osrm"};
|
||||
config.storage_config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
config.use_shared_memory = false;
|
||||
config.max_locations_distance_table = 2;
|
||||
|
||||
@ -109,7 +109,7 @@ BOOST_AUTO_TEST_CASE(test_match_limits)
|
||||
using namespace osrm;
|
||||
|
||||
EngineConfig config;
|
||||
config.storage_config = {OSRM_TEST_DATA_DIR "/ch/monaco.osrm"};
|
||||
config.storage_config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
config.use_shared_memory = false;
|
||||
config.max_locations_map_matching = 2;
|
||||
|
||||
@ -136,7 +136,7 @@ BOOST_AUTO_TEST_CASE(test_nearest_limits)
|
||||
using namespace osrm;
|
||||
|
||||
EngineConfig config;
|
||||
config.storage_config = {OSRM_TEST_DATA_DIR "/ch/monaco.osrm"};
|
||||
config.storage_config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
config.use_shared_memory = false;
|
||||
config.max_results_nearest = 2;
|
||||
|
||||
|
@ -14,7 +14,7 @@ BOOST_AUTO_TEST_CASE(test_ch)
|
||||
using namespace osrm;
|
||||
EngineConfig config;
|
||||
config.use_shared_memory = false;
|
||||
config.storage_config = storage::StorageConfig(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
config.storage_config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/ch/monaco.osrm");
|
||||
config.algorithm = EngineConfig::Algorithm::CH;
|
||||
OSRM osrm{config};
|
||||
}
|
||||
@ -24,7 +24,7 @@ BOOST_AUTO_TEST_CASE(test_corech)
|
||||
using namespace osrm;
|
||||
EngineConfig config;
|
||||
config.use_shared_memory = false;
|
||||
config.storage_config = storage::StorageConfig(OSRM_TEST_DATA_DIR "/corech/monaco.osrm");
|
||||
config.storage_config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/corech/monaco.osrm");
|
||||
config.algorithm = EngineConfig::Algorithm::CoreCH;
|
||||
OSRM osrm{config};
|
||||
}
|
||||
@ -34,7 +34,7 @@ BOOST_AUTO_TEST_CASE(test_mld)
|
||||
using namespace osrm;
|
||||
EngineConfig config;
|
||||
config.use_shared_memory = false;
|
||||
config.storage_config = storage::StorageConfig(OSRM_TEST_DATA_DIR "/mld/monaco.osrm");
|
||||
config.storage_config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/mld/monaco.osrm");
|
||||
config.algorithm = EngineConfig::Algorithm::MLD;
|
||||
OSRM osrm{config};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user