2016-03-22 14:30:18 -04:00
|
|
|
#include "storage/storage_config.hpp"
|
2016-05-25 15:45:22 -04:00
|
|
|
#include "util/simple_logger.hpp"
|
2016-03-22 14:30:18 -04:00
|
|
|
|
|
|
|
#include <boost/filesystem/operations.hpp>
|
|
|
|
|
|
|
|
namespace osrm
|
|
|
|
{
|
|
|
|
namespace storage
|
|
|
|
{
|
|
|
|
|
|
|
|
StorageConfig::StorageConfig(const boost::filesystem::path &base)
|
|
|
|
: ram_index_path{base.string() + ".ramIndex"}, file_index_path{base.string() + ".fileIndex"},
|
|
|
|
hsgr_data_path{base.string() + ".hsgr"}, nodes_data_path{base.string() + ".nodes"},
|
|
|
|
edges_data_path{base.string() + ".edges"}, core_data_path{base.string() + ".core"},
|
|
|
|
geometries_path{base.string() + ".geometry"}, timestamp_path{base.string() + ".timestamp"},
|
|
|
|
datasource_names_path{base.string() + ".datasource_names"},
|
|
|
|
datasource_indexes_path{base.string() + ".datasource_indexes"},
|
2016-04-26 07:27:40 -04:00
|
|
|
names_data_path{base.string() + ".names"}, properties_path{base.string() + ".properties"},
|
2016-06-15 08:38:24 -04:00
|
|
|
intersection_class_path{base.string() + ".icd"}, turn_lane_data_path{base.string() + ".tld"},
|
2016-06-21 04:41:08 -04:00
|
|
|
turn_lane_description_path{base.string() + ".tls"}
|
2016-03-22 14:30:18 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool StorageConfig::IsValid() const
|
|
|
|
{
|
2016-05-25 15:45:22 -04:00
|
|
|
const constexpr auto num_files = 13;
|
2016-05-27 15:05:04 -04:00
|
|
|
const boost::filesystem::path paths[num_files] = {ram_index_path,
|
|
|
|
file_index_path,
|
|
|
|
hsgr_data_path,
|
|
|
|
nodes_data_path,
|
|
|
|
edges_data_path,
|
|
|
|
core_data_path,
|
|
|
|
geometries_path,
|
|
|
|
timestamp_path,
|
|
|
|
datasource_indexes_path,
|
|
|
|
datasource_indexes_path,
|
|
|
|
names_data_path,
|
|
|
|
properties_path,
|
|
|
|
intersection_class_path};
|
2016-05-25 15:45:22 -04:00
|
|
|
|
|
|
|
bool success = true;
|
|
|
|
for (auto path = paths; path != paths + num_files; ++path)
|
|
|
|
{
|
|
|
|
if (!boost::filesystem::is_regular_file(*path))
|
|
|
|
{
|
|
|
|
util::SimpleLogger().Write(logWARNING) << "Missing/Broken File: " << path->string();
|
|
|
|
success = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return success;
|
2016-03-22 14:30:18 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|