Port over profile properties
This commit is contained in:
parent
5d1b4ce71d
commit
c61198b26b
@ -59,20 +59,20 @@ inline void readIntersections(const boost::filesystem::path &path,
|
|||||||
inline void readProfileProperties(const boost::filesystem::path &path,
|
inline void readProfileProperties(const boost::filesystem::path &path,
|
||||||
ProfileProperties &properties)
|
ProfileProperties &properties)
|
||||||
{
|
{
|
||||||
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
|
const auto fingerprint = storage::tar::FileReader::VerifyFingerprint;
|
||||||
storage::io::FileReader reader{path, fingerprint};
|
storage::tar::FileReader reader{path, fingerprint};
|
||||||
|
|
||||||
serialization::read(reader, properties);
|
serialization::read(reader, "/common/properties", properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
// writes .osrm.properties
|
// writes .osrm.properties
|
||||||
inline void writeProfileProperties(const boost::filesystem::path &path,
|
inline void writeProfileProperties(const boost::filesystem::path &path,
|
||||||
const ProfileProperties &properties)
|
const ProfileProperties &properties)
|
||||||
{
|
{
|
||||||
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
|
const auto fingerprint = storage::tar::FileWriter::GenerateFingerprint;
|
||||||
storage::io::FileWriter writer{path, fingerprint};
|
storage::tar::FileWriter writer{path, fingerprint};
|
||||||
|
|
||||||
serialization::write(writer, properties);
|
serialization::write(writer, "/common/properties", properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename EdgeBasedEdgeVector>
|
template <typename EdgeBasedEdgeVector>
|
||||||
|
@ -26,33 +26,41 @@ namespace serialization
|
|||||||
// read/write for bearing data
|
// read/write for bearing data
|
||||||
template <storage::Ownership Ownership>
|
template <storage::Ownership Ownership>
|
||||||
inline void read(storage::tar::FileReader &reader,
|
inline void read(storage::tar::FileReader &reader,
|
||||||
const std::string& name,
|
const std::string &name,
|
||||||
detail::IntersectionBearingsContainer<Ownership> &intersection_bearings)
|
detail::IntersectionBearingsContainer<Ownership> &intersection_bearings)
|
||||||
{
|
{
|
||||||
storage::serialization::read(reader, name + "/bearing_values", intersection_bearings.values);
|
storage::serialization::read(reader, name + "/bearing_values", intersection_bearings.values);
|
||||||
storage::serialization::read(reader, name + "/node_to_class_id", intersection_bearings.node_to_class_id);
|
storage::serialization::read(
|
||||||
util::serialization::read(reader, name + "/class_id_to_ranges", intersection_bearings.class_id_to_ranges_table);
|
reader, name + "/node_to_class_id", intersection_bearings.node_to_class_id);
|
||||||
|
util::serialization::read(
|
||||||
|
reader, name + "/class_id_to_ranges", intersection_bearings.class_id_to_ranges_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <storage::Ownership Ownership>
|
template <storage::Ownership Ownership>
|
||||||
inline void write(storage::tar::FileWriter &writer,
|
inline void write(storage::tar::FileWriter &writer,
|
||||||
const std::string& name,
|
const std::string &name,
|
||||||
const detail::IntersectionBearingsContainer<Ownership> &intersection_bearings)
|
const detail::IntersectionBearingsContainer<Ownership> &intersection_bearings)
|
||||||
{
|
{
|
||||||
storage::serialization::write(writer, name + "/bearing_values", intersection_bearings.values);
|
storage::serialization::write(writer, name + "/bearing_values", intersection_bearings.values);
|
||||||
storage::serialization::write(writer, name + "/node_to_class_id", intersection_bearings.node_to_class_id);
|
storage::serialization::write(
|
||||||
util::serialization::write(writer, name + "/class_id_to_ranges", intersection_bearings.class_id_to_ranges_table);
|
writer, name + "/node_to_class_id", intersection_bearings.node_to_class_id);
|
||||||
|
util::serialization::write(
|
||||||
|
writer, name + "/class_id_to_ranges", intersection_bearings.class_id_to_ranges_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
// read/write for properties file
|
// read/write for properties file
|
||||||
inline void read(storage::io::FileReader &reader, ProfileProperties &properties)
|
inline void
|
||||||
|
read(storage::tar::FileReader &reader, const std::string &name, ProfileProperties &properties)
|
||||||
{
|
{
|
||||||
reader.ReadInto(properties);
|
properties = reader.ReadOne<ProfileProperties>(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void write(storage::io::FileWriter &writer, const ProfileProperties &properties)
|
inline void write(storage::tar::FileWriter &writer,
|
||||||
|
const std::string &name,
|
||||||
|
const ProfileProperties &properties)
|
||||||
{
|
{
|
||||||
writer.WriteFrom(properties);
|
writer.WriteElementCount64(name, 1);
|
||||||
|
writer.WriteOne(name, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
// read/write for datasources file
|
// read/write for datasources file
|
||||||
|
@ -302,10 +302,6 @@ void Storage::PopulateLayout(DataLayout &layout)
|
|||||||
make_block<std::uint64_t>(tree_levels_size));
|
make_block<std::uint64_t>(tree_levels_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
layout.SetBlock(DataLayout::PROPERTIES, make_block<extractor::ProfileProperties>(1));
|
|
||||||
}
|
|
||||||
|
|
||||||
// read timestampsize
|
// read timestampsize
|
||||||
{
|
{
|
||||||
io::FileReader timestamp_file(config.GetPath(".osrm.timestamp"),
|
io::FileReader timestamp_file(config.GetPath(".osrm.timestamp"),
|
||||||
@ -468,6 +464,7 @@ void Storage::PopulateLayout(DataLayout &layout)
|
|||||||
{"/common/intersection_bearings/class_id_to_ranges/block_offsets", DataLayout::BEARING_OFFSETS},
|
{"/common/intersection_bearings/class_id_to_ranges/block_offsets", DataLayout::BEARING_OFFSETS},
|
||||||
{"/common/intersection_bearings/class_id_to_ranges/diff_blocks", DataLayout::BEARING_BLOCKS},
|
{"/common/intersection_bearings/class_id_to_ranges/diff_blocks", DataLayout::BEARING_BLOCKS},
|
||||||
{"/common/entry_classes", DataLayout::ENTRY_CLASS},
|
{"/common/entry_classes", DataLayout::ENTRY_CLASS},
|
||||||
|
{"/common/properties", DataLayout::PROPERTIES},
|
||||||
};
|
};
|
||||||
std::vector<NamedBlock> blocks;
|
std::vector<NamedBlock> blocks;
|
||||||
|
|
||||||
@ -479,7 +476,8 @@ void Storage::PopulateLayout(DataLayout &layout)
|
|||||||
{OPTIONAL, config.GetPath(".osrm.partition")},
|
{OPTIONAL, config.GetPath(".osrm.partition")},
|
||||||
{OPTIONAL, config.GetPath(".osrm.cell_metrics")},
|
{OPTIONAL, config.GetPath(".osrm.cell_metrics")},
|
||||||
{OPTIONAL, config.GetPath(".osrm.hsgr")},
|
{OPTIONAL, config.GetPath(".osrm.hsgr")},
|
||||||
{REQUIRED, config.GetPath(".osrm.icd")}
|
{REQUIRED, config.GetPath(".osrm.icd")},
|
||||||
|
{REQUIRED, config.GetPath(".osrm.properties")}
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const auto &file : tar_files)
|
for (const auto &file : tar_files)
|
||||||
|
@ -594,10 +594,7 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &e
|
|||||||
};
|
};
|
||||||
|
|
||||||
const auto load_profile_properties = [&] {
|
const auto load_profile_properties = [&] {
|
||||||
// Propagate profile properties to contractor configuration structure
|
extractor::files::readProfileProperties(config.GetPath(".osrm.properties"), profile_properties);
|
||||||
storage::io::FileReader profile_properties_file(
|
|
||||||
config.GetPath(".osrm.properties"), storage::io::FileReader::VerifyFingerprint);
|
|
||||||
profile_properties = profile_properties_file.ReadOne<extractor::ProfileProperties>();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
tbb::parallel_invoke(load_node_data,
|
tbb::parallel_invoke(load_node_data,
|
||||||
|
Loading…
Reference in New Issue
Block a user