Write/read tar for mldgr
This commit is contained in:
parent
495131efd7
commit
f7b7335d75
@ -24,10 +24,9 @@ inline void readGraph(const boost::filesystem::path &path,
|
|||||||
std::is_same<customizer::MultiLevelEdgeBasedGraph, MultiLevelGraphT>::value,
|
std::is_same<customizer::MultiLevelEdgeBasedGraph, MultiLevelGraphT>::value,
|
||||||
"");
|
"");
|
||||||
|
|
||||||
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
|
storage::tar::FileReader reader{path};
|
||||||
storage::io::FileReader reader{path, fingerprint};
|
|
||||||
|
|
||||||
serialization::read(reader, graph, connectivity_checksum);
|
serialization::read(reader, "/mld/multilevelgraph", graph, connectivity_checksum);
|
||||||
}
|
}
|
||||||
|
|
||||||
// writes .osrm.mldgr file
|
// writes .osrm.mldgr file
|
||||||
@ -40,10 +39,9 @@ inline void writeGraph(const boost::filesystem::path &path,
|
|||||||
std::is_same<customizer::MultiLevelEdgeBasedGraph, MultiLevelGraphT>::value,
|
std::is_same<customizer::MultiLevelEdgeBasedGraph, MultiLevelGraphT>::value,
|
||||||
"");
|
"");
|
||||||
|
|
||||||
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
|
storage::tar::FileWriter writer{path};
|
||||||
storage::io::FileWriter writer{path, fingerprint};
|
|
||||||
|
|
||||||
serialization::write(writer, graph, connectivity_checksum);
|
serialization::write(writer, "/mld/multilevelgraph", graph, connectivity_checksum);
|
||||||
}
|
}
|
||||||
|
|
||||||
// read .osrm.partition file
|
// read .osrm.partition file
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "storage/block.hpp"
|
#include "storage/block.hpp"
|
||||||
#include "storage/io.hpp"
|
#include "storage/io.hpp"
|
||||||
|
#include "storage/tar.hpp"
|
||||||
#include "storage/serialization.hpp"
|
#include "storage/serialization.hpp"
|
||||||
#include "storage/shared_memory_ownership.hpp"
|
#include "storage/shared_memory_ownership.hpp"
|
||||||
|
|
||||||
@ -19,25 +20,27 @@ namespace serialization
|
|||||||
{
|
{
|
||||||
|
|
||||||
template <typename EdgeDataT, storage::Ownership Ownership>
|
template <typename EdgeDataT, storage::Ownership Ownership>
|
||||||
inline void read(storage::io::FileReader &reader,
|
inline void read(storage::tar::FileReader &reader,
|
||||||
|
const std::string& name,
|
||||||
MultiLevelGraph<EdgeDataT, Ownership> &graph,
|
MultiLevelGraph<EdgeDataT, Ownership> &graph,
|
||||||
std::uint32_t &connectivity_checksum)
|
std::uint32_t &connectivity_checksum)
|
||||||
{
|
{
|
||||||
storage::serialization::read(reader, graph.node_array);
|
storage::serialization::read(reader, name + "/node_array", graph.node_array);
|
||||||
storage::serialization::read(reader, graph.edge_array);
|
storage::serialization::read(reader, name + "/edge_array", graph.edge_array);
|
||||||
storage::serialization::read(reader, graph.node_to_edge_offset);
|
storage::serialization::read(reader, name + "/node_to_edge_offset", graph.node_to_edge_offset);
|
||||||
reader.ReadInto(connectivity_checksum);
|
connectivity_checksum = reader.ReadOne<std::uint32_t>(name + "/connectivity_checksum");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename EdgeDataT, storage::Ownership Ownership>
|
template <typename EdgeDataT, storage::Ownership Ownership>
|
||||||
inline void write(storage::io::FileWriter &writer,
|
inline void write(storage::tar::FileWriter &writer,
|
||||||
|
const std::string& name,
|
||||||
const MultiLevelGraph<EdgeDataT, Ownership> &graph,
|
const MultiLevelGraph<EdgeDataT, Ownership> &graph,
|
||||||
const std::uint32_t connectivity_checksum)
|
const std::uint32_t connectivity_checksum)
|
||||||
{
|
{
|
||||||
storage::serialization::write(writer, graph.node_array);
|
storage::serialization::write(writer, name + "/node_array", graph.node_array);
|
||||||
storage::serialization::write(writer, graph.edge_array);
|
storage::serialization::write(writer, name + "/edge_array", graph.edge_array);
|
||||||
storage::serialization::write(writer, graph.node_to_edge_offset);
|
storage::serialization::write(writer, name + "/node_to_edge_offset", graph.node_to_edge_offset);
|
||||||
writer.WriteOne(connectivity_checksum);
|
writer.WriteOne(name + "/connectivity_checksum", connectivity_checksum);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <storage::Ownership Ownership>
|
template <storage::Ownership Ownership>
|
||||||
|
Loading…
Reference in New Issue
Block a user