Maintain storage_config exposed API

This commit is contained in:
Pepijn Schoen
2017-07-07 16:42:07 +02:00
committed by Daniel J. H
parent 0b5c7a97a7
commit 8da40419ee
13 changed files with 52 additions and 34 deletions
+5
View File
@@ -72,6 +72,11 @@ struct ExtractorConfig final : storage::IOConfig
{
}
void UseDefaultOutputNames(const boost::filesystem::path &base)
{
IOConfig::UseDefaultOutputNames(base);
}
boost::filesystem::path input_path;
boost::filesystem::path profile_path;
+4 -6
View File
@@ -97,9 +97,8 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
if (args[0]->IsString())
{
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->storage_config = osrm::StorageConfig(
*v8::String::Utf8Value(Nan::To<v8::String>(args[0]).ToLocalChecked()));
engine_config->use_shared_memory = false;
return engine_config;
}
@@ -122,9 +121,8 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
if (!path->IsUndefined())
{
std::string base_path(*v8::String::Utf8Value(path->ToString()));
engine_config->storage_config = osrm::StorageConfig();
engine_config->storage_config.UseDefaultOutputNames(base_path);
engine_config->storage_config =
osrm::StorageConfig(*v8::String::Utf8Value(Nan::To<v8::String>(path).ToLocalChecked()));
engine_config->use_shared_memory = false;
}
if (!shared_memory->IsUndefined())
+5
View File
@@ -26,6 +26,11 @@ struct PartitionConfig final : storage::IOConfig
{
}
void UseDefaultOutputNames(const boost::filesystem::path &base)
{
IOConfig::UseDefaultOutputNames(base);
}
unsigned requested_num_threads;
double balance;
+15 -14
View File
@@ -23,6 +23,21 @@ struct IOConfig
{
}
bool IsValid() const;
boost::filesystem::path GetPath(const std::string &fileName) const
{
if (!IsConfigured(fileName, required_input_files) &&
!IsConfigured(fileName, optional_input_files) && !IsConfigured(fileName, output_files))
{
throw util::exception("Tried to access file which is not configured: " + fileName);
}
return {base_path.string() + fileName};
}
boost::filesystem::path base_path;
protected:
// Infer the base path from the path of the .osrm file
void UseDefaultOutputNames(const boost::filesystem::path &base)
{
@@ -45,20 +60,6 @@ struct IOConfig
base_path = {path};
}
bool IsValid() const;
boost::filesystem::path GetPath(const std::string &fileName) const
{
if (!IsConfigured(fileName, required_input_files) &&
!IsConfigured(fileName, optional_input_files) && !IsConfigured(fileName, output_files))
{
throw util::exception("Tried to access file which is not configured: " + fileName);
}
return {base_path.string() + fileName};
}
boost::filesystem::path base_path;
private:
static bool IsConfigured(const std::string &fileName,
const std::vector<boost::filesystem::path> &paths)
+5
View File
@@ -44,6 +44,11 @@ namespace storage
*/
struct StorageConfig final : IOConfig
{
StorageConfig(const boost::filesystem::path &base) : StorageConfig()
{
IOConfig::UseDefaultOutputNames(base);
}
StorageConfig()
: IOConfig({".osrm.ramIndex",
".osrm.fileIndex",
+5
View File
@@ -64,6 +64,11 @@ struct UpdaterConfig final : storage::IOConfig
{
}
void UseDefaultOutputNames(const boost::filesystem::path &base)
{
IOConfig::UseDefaultOutputNames(base);
}
double log_edge_updates_factor;
std::time_t valid_now;