82 std::unique_ptr<State> m_state;
120 bool resetInvalid = true,
SaveFile(SaveFile &&) noexcept
Transfer the source save's process lock without releasing it.
std::optional< std::vector< std::uint8_t > > Read(std::size_t limit) const
Read the locked save with bounded allocation.
~SaveFile()
Release the process lock and its native handle.
bool Remove() const
Delete the locked save while excluding cooperating writers.
static std::optional< SaveFile > Open(const std::filesystem::path &path)
Lock a save for a complete read-modify-write transaction, creating parent directories.
bool Write(std::span< const std::uint8_t > bytes) const
Replace the save atomically after writing and synchronising a unique sibling file.
Definition assetimport.h:11
std::optional< std::vector< std::uint8_t > > ReadSaveFile(const std::filesystem::path &path, std::size_t limit)
Read a complete regular file without allocating beyond a caller-supplied limit.
std::optional< std::vector< std::uint8_t > > ReadVerifiedSaveFile(const std::filesystem::path &path, std::size_t limit, bool resetInvalid=true, const SavePayloadValidator &validate={})
Read an internal binary save with its format signature, payload length, and SHA-1 checksum.
bool WriteVerifiedSaveFile(const std::filesystem::path &path, std::span< const std::uint8_t > bytes)
Atomically write an internal binary save with a format signature, length, and SHA-1 checksum.
bool WriteSaveFile(const std::filesystem::path &path, std::span< const std::uint8_t > bytes)
Lock and atomically replace a binary save.
std::function< bool(std::span< const std::uint8_t >)> SavePayloadValidator
Validate format-specific fields of an internal save's payload under its exclusive process lock.
Definition savefile.h:19