| 36 | |
| 37 | template <typename Stream, typename Data> |
| 38 | bool SerializeDB(Stream& stream, const Data& data) |
| 39 | { |
| 40 | // Write and commit header, data |
| 41 | try { |
| 42 | HashedSourceWriter hashwriter{stream}; |
| 43 | hashwriter << Params().MessageStart() << data; |
| 44 | stream << hashwriter.GetHash(); |
| 45 | } catch (const std::exception& e) { |
| 46 | LogError("%s: Serialize or I/O error - %s\n", __func__, e.what()); |
| 47 | return false; |
| 48 | } |
| 49 | |
| 50 | return true; |
| 51 | } |
| 52 | |
| 53 | template <typename Data> |
| 54 | bool SerializeFileDB(const std::string& prefix, const fs::path& path, const Data& data) |
no test coverage detected