| 46 | } |
| 47 | |
| 48 | serialization::NvmCacheMetadata loadMetadata(folly::StringPiece fileName) { |
| 49 | folly::File shutDownFile{fileName}; |
| 50 | folly::RecordIOReader rr{std::move(shutDownFile)}; |
| 51 | auto metadataIoBuf = folly::IOBuf::copyBuffer(rr.begin()->first); |
| 52 | if (metadataIoBuf->length() == 0) { |
| 53 | throw std::runtime_error(fmt::format("no content in file: {}", fileName)); |
| 54 | } |
| 55 | Deserializer deserializer{metadataIoBuf->data(), |
| 56 | metadataIoBuf->data() + metadataIoBuf->length()}; |
| 57 | return deserializer.deserialize<serialization::NvmCacheMetadata>(); |
| 58 | } |
| 59 | |
| 60 | void saveMetadata(const folly::File& file, |
| 61 | const serialization::NvmCacheMetadata& metadata) { |
no test coverage detected