MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / PopulateUpdatableData

Method PopulateUpdatableData

src/storage/storage.cpp:507–602  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

505}
506
507void Storage::PopulateUpdatableData(const SharedDataIndex &index)
508{
509 // load compressed geometry
510 {
511 auto segment_data = make_segment_data_view(index, "/common/segment_data");
512 extractor::files::readSegmentData(config.GetPath(".osrm.geometry"), segment_data);
513 }
514
515 {
516 const auto datasources_names_ptr =
517 index.GetBlockPtr<extractor::Datasources>("/common/data_sources_names");
518 extractor::files::readDatasources(config.GetPath(".osrm.datasource_names"),
519 *datasources_names_ptr);
520 }
521
522 // load turn weight penalties
523 {
524 auto turn_duration_penalties = make_turn_weight_view(index, "/common/turn_penalty");
525 extractor::files::readTurnWeightPenalty(config.GetPath(".osrm.turn_weight_penalties"),
526 turn_duration_penalties);
527 }
528
529 // load turn duration penalties
530 {
531 auto turn_duration_penalties = make_turn_duration_view(index, "/common/turn_penalty");
532 extractor::files::readTurnDurationPenalty(config.GetPath(".osrm.turn_duration_penalties"),
533 turn_duration_penalties);
534 }
535
536 // FIXME we only need to get the weight name
537 std::string metric_name;
538 // load profile properties
539 {
540 extractor::ProfileProperties properties;
541 extractor::files::readProfileProperties(config.GetPath(".osrm.properties"), properties);
542
543 metric_name = properties.GetWeightName();
544 }
545
546 if (std::filesystem::exists(config.GetPath(".osrm.hsgr")))
547 {
548 const std::string metric_prefix = "/ch/metrics/" + metric_name;
549 auto contracted_metric = make_contracted_metric_view(index, metric_prefix);
550 std::unordered_map<std::string, contractor::ContractedMetricView> metrics = {
551 {metric_name, std::move(contracted_metric)}};
552
553 std::uint32_t graph_connectivity_checksum = 0;
554 contractor::files::readGraph(
555 config.GetPath(".osrm.hsgr"), metrics, graph_connectivity_checksum);
556
557 if (config.IsRequiredConfiguredInput("osrm.edges"))
558 {
559 auto turns_connectivity_checksum =
560 *index.GetBlockPtr<std::uint32_t>("/common/connectivity_checksum");
561 if (turns_connectivity_checksum != graph_connectivity_checksum)
562 {
563 throw util::exception(
564 "Connectivity checksum " + std::to_string(graph_connectivity_checksum) +

Callers 1

Calls 15

make_segment_data_viewFunction · 0.85
readSegmentDataFunction · 0.85
readDatasourcesFunction · 0.85
make_turn_weight_viewFunction · 0.85
readTurnWeightPenaltyFunction · 0.85
make_turn_duration_viewFunction · 0.85
readTurnDurationPenaltyFunction · 0.85
readProfilePropertiesFunction · 0.85
exceptionClass · 0.85
to_stringFunction · 0.85
make_cell_metric_viewFunction · 0.85

Tested by

no test coverage detected