Add nodejs test for dataset name

This commit is contained in:
Patrick Niklaus
2018-04-04 14:05:46 +00:00
committed by Patrick Niklaus
parent 2c80f76004
commit 0e8b8b4901
7 changed files with 42 additions and 14 deletions
+2 -2
View File
@@ -47,7 +47,7 @@ class DataWatchdogImpl<AlgorithmT, datafacade::ContiguousInternalMemoryDataFacad
if (region_id == storage::SharedRegionRegister::INVALID_REGION_ID)
{
throw util::exception(
"Could not find shared memory region. Did you run osrm-datastore?");
"Could not find shared memory region for \"" + dataset_name +"/data\". Did you run osrm-datastore?");
}
shared_region = &shared_register.GetRegion(region_id);
region = *shared_region;
@@ -94,7 +94,7 @@ class DataWatchdogImpl<AlgorithmT, datafacade::ContiguousInternalMemoryDataFacad
facade_factory =
DataFacadeFactory<datafacade::ContiguousInternalMemoryDataFacade, AlgorithmT>(
std::make_shared<datafacade::SharedMemoryAllocator>(region.shm_key));
util::Log() << "updated facade to region " << region.shm_key << " with timestamp "
util::Log() << "updated facade to region " << (int) region.shm_key << " with timestamp "
<< region.timestamp;
}
}
+1 -1
View File
@@ -59,7 +59,7 @@ template <typename Algorithm> class Engine final : public EngineInterface
{
if (config.use_shared_memory)
{
util::Log(logDEBUG) << "Using shared memory with algorithm "
util::Log(logDEBUG) << "Using shared memory with name \"" << config.dataset_name << "\" with algorithm "
<< routing_algorithms::name<Algorithm>();
facade_provider = std::make_unique<WatchingProvider<Algorithm>>(config.dataset_name);
}
+16
View File
@@ -135,6 +135,22 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
*v8::String::Utf8Value(Nan::To<v8::String>(memory_file).ToLocalChecked());
}
auto dataset_name = params->Get(Nan::New("dataset_name").ToLocalChecked());
if (dataset_name.IsEmpty())
return engine_config_ptr();
if (!dataset_name->IsUndefined())
{
if (dataset_name->IsString())
{
engine_config->dataset_name = *v8::String::Utf8Value(Nan::To<v8::String>(dataset_name).ToLocalChecked());
}
else
{
Nan::ThrowError("dataset_name needs to be a string");
return engine_config_ptr();
}
}
if (!path->IsUndefined())
{
engine_config->storage_config =
+1 -1
View File
@@ -63,7 +63,7 @@ class SharedMemory
{
shm = boost::interprocess::xsi_shared_memory(boost::interprocess::open_only, key);
util::Log(logDEBUG) << "opening " << shm.get_shmid() << " from id " << id;
util::Log(logDEBUG) << "opening " << (int) shm.get_shmid() << " from id " << (int) id;
region = boost::interprocess::mapped_region(shm, boost::interprocess::read_only);
}