MCPcopy Create free account
hub / github.com/MemNixFS/MemNixFS / FileMemorySource

Method FileMemorySource

src/io/file_memory_source.cpp:22–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20class FileMemorySource : public MemorySource {
21public:
22 explicit FileMemorySource(const std::filesystem::path& p)
23 : name_(p.string())
24 {
25 fp_ = LMPFS_FOPEN64(p);
26 if (!fp_) throw_error("Cannot open dump file: {}", p.string());
27 LMPFS_FSEEK64(fp_, 0, SEEK_END);
28 size_ = static_cast<u64>(LMPFS_FTELL64(fp_));
29 LMPFS_FSEEK64(fp_, 0, SEEK_SET);
30 log::debug("Opened dump source '{}' ({} bytes)", name_, size_);
31 }
32 ~FileMemorySource() override { if (fp_) std::fclose(fp_); }
33
34 u64 size() const override { return size_; }

Callers

nothing calls this directly

Calls 2

throw_errorFunction · 0.85
debugFunction · 0.85

Tested by

no test coverage detected