Port .datasource_names to tar format
This commit is contained in:
		
							parent
							
								
									2c5e4e6c02
								
							
						
					
					
						commit
						bced9a5a6d
					
				| @ -107,7 +107,7 @@ void readEdgeBasedGraph(const boost::filesystem::path &path, | ||||
|     connectivity_checksum = reader.ReadOne<std::uint32_t>("/common/connectivity_checksum"); | ||||
| } | ||||
| 
 | ||||
| // reads .osrm.nodes
 | ||||
| // reads .osrm.nbg_nodes
 | ||||
| template <typename CoordinatesT, typename PackedOSMIDsT> | ||||
| inline void readNodes(const boost::filesystem::path &path, | ||||
|                       CoordinatesT &coordinates, | ||||
| @ -123,7 +123,7 @@ inline void readNodes(const boost::filesystem::path &path, | ||||
|     util::serialization::read(reader, "/common/osm_node_ids", osm_node_ids); | ||||
| } | ||||
| 
 | ||||
| // writes .osrm.nodes
 | ||||
| // writes .osrm.nbg_nodes
 | ||||
| template <typename CoordinatesT, typename PackedOSMIDsT> | ||||
| inline void writeNodes(const boost::filesystem::path &path, | ||||
|                        const CoordinatesT &coordinates, | ||||
| @ -142,38 +142,38 @@ inline void writeNodes(const boost::filesystem::path &path, | ||||
| // reads .osrm.cnbg_to_ebg
 | ||||
| inline void readNBGMapping(const boost::filesystem::path &path, std::vector<NBGToEBG> &mapping) | ||||
| { | ||||
|     const auto fingerprint = storage::io::FileReader::VerifyFingerprint; | ||||
|     storage::io::FileReader reader{path, fingerprint}; | ||||
|     const auto fingerprint = storage::tar::FileReader::VerifyFingerprint; | ||||
|     storage::tar::FileReader reader{path, fingerprint}; | ||||
| 
 | ||||
|     storage::serialization::read(reader, mapping); | ||||
|     storage::serialization::read(reader, "/common/cnbg_to_ebg", mapping); | ||||
| } | ||||
| 
 | ||||
| // writes .osrm.cnbg_to_ebg
 | ||||
| inline void writeNBGMapping(const boost::filesystem::path &path, | ||||
|                             const std::vector<NBGToEBG> &mapping) | ||||
| { | ||||
|     const auto fingerprint = storage::io::FileWriter::GenerateFingerprint; | ||||
|     storage::io::FileWriter writer{path, fingerprint}; | ||||
|     const auto fingerprint = storage::tar::FileWriter::GenerateFingerprint; | ||||
|     storage::tar::FileWriter writer{path, fingerprint}; | ||||
| 
 | ||||
|     storage::serialization::write(writer, mapping); | ||||
|     storage::serialization::write(writer, "/common/cnbg_to_ebg", mapping); | ||||
| } | ||||
| 
 | ||||
| // reads .osrm.datasource_names
 | ||||
| inline void readDatasources(const boost::filesystem::path &path, Datasources &sources) | ||||
| { | ||||
|     const auto fingerprint = storage::io::FileReader::VerifyFingerprint; | ||||
|     storage::io::FileReader reader{path, fingerprint}; | ||||
|     const auto fingerprint = storage::tar::FileReader::VerifyFingerprint; | ||||
|     storage::tar::FileReader reader{path, fingerprint}; | ||||
| 
 | ||||
|     serialization::read(reader, sources); | ||||
|     serialization::read(reader, "/common/data_sources_names", sources); | ||||
| } | ||||
| 
 | ||||
| // writes .osrm.datasource_names
 | ||||
| inline void writeDatasources(const boost::filesystem::path &path, Datasources &sources) | ||||
| { | ||||
|     const auto fingerprint = storage::io::FileWriter::GenerateFingerprint; | ||||
|     storage::io::FileWriter writer{path, fingerprint}; | ||||
|     const auto fingerprint = storage::tar::FileWriter::GenerateFingerprint; | ||||
|     storage::tar::FileWriter writer{path, fingerprint}; | ||||
| 
 | ||||
|     serialization::write(writer, sources); | ||||
|     serialization::write(writer, "/common/data_sources_names", sources); | ||||
| } | ||||
| 
 | ||||
| // reads .osrm.geometry
 | ||||
|  | ||||
| @ -64,14 +64,15 @@ inline void write(storage::tar::FileWriter &writer, | ||||
| } | ||||
| 
 | ||||
| // read/write for datasources file
 | ||||
| inline void read(storage::io::FileReader &reader, Datasources &sources) | ||||
| inline void read(storage::tar::FileReader &reader, const std::string& name, Datasources &sources) | ||||
| { | ||||
|     reader.ReadInto(sources); | ||||
|     sources = reader.ReadOne<Datasources>(name); | ||||
| } | ||||
| 
 | ||||
| inline void write(storage::io::FileWriter &writer, Datasources &sources) | ||||
| inline void write(storage::tar::FileWriter &writer, const std::string& name, Datasources &sources) | ||||
| { | ||||
|     writer.WriteFrom(sources); | ||||
|     writer.WriteElementCount64(name, 1); | ||||
|     writer.WriteOne(name, sources); | ||||
| } | ||||
| 
 | ||||
| // read/write for segment data file
 | ||||
|  | ||||
| @ -372,11 +372,6 @@ void Storage::PopulateLayout(DataLayout &layout) | ||||
|                         make_block<DatasourceID>(number_of_compressed_geometries)); | ||||
|     } | ||||
| 
 | ||||
|     // Load datasource name sizes.
 | ||||
|     { | ||||
|         layout.SetBlock(DataLayout::DATASOURCES_NAMES, make_block<extractor::Datasources>(1)); | ||||
|     } | ||||
| 
 | ||||
|     { | ||||
|         // Loading turn lane data
 | ||||
|         io::FileReader lane_data_file(config.GetPath(".osrm.tld"), | ||||
| @ -447,6 +442,7 @@ void Storage::PopulateLayout(DataLayout &layout) | ||||
|         {"/common/properties", DataLayout::PROPERTIES}, | ||||
|         {"/common/coordinates", DataLayout::COORDINATE_LIST}, | ||||
|         {"/common/osm_node_ids/packed", DataLayout::OSM_NODE_ID_LIST}, | ||||
|         {"/common/data_sources_names", DataLayout::DATASOURCES_NAMES}, | ||||
|     }; | ||||
|     std::vector<NamedBlock> blocks; | ||||
| 
 | ||||
| @ -460,7 +456,8 @@ void Storage::PopulateLayout(DataLayout &layout) | ||||
|         {OPTIONAL, config.GetPath(".osrm.hsgr")}, | ||||
|         {REQUIRED, config.GetPath(".osrm.icd")}, | ||||
|         {REQUIRED, config.GetPath(".osrm.properties")}, | ||||
|         {REQUIRED, config.GetPath(".osrm.nbg_nodes")} | ||||
|         {REQUIRED, config.GetPath(".osrm.nbg_nodes")}, | ||||
|         {REQUIRED, config.GetPath(".osrm.datasource_names")} | ||||
|     }; | ||||
| 
 | ||||
|     for (const auto &file : tar_files) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user