mempool: persist with XOR

This commit is contained in:
MarcoFalke
2023-08-03 11:48:34 +02:00
parent b3898e946c
commit fa6b053b5c
9 changed files with 49 additions and 15 deletions

View File

@@ -471,7 +471,7 @@ class AutoFile
{
protected:
std::FILE* m_file;
const std::vector<std::byte> m_xor;
std::vector<std::byte> m_xor;
public:
explicit AutoFile(std::FILE* file, std::vector<std::byte> data_xor={}) : m_file{file}, m_xor{std::move(data_xor)} {}
@@ -511,6 +511,9 @@ public:
*/
bool IsNull() const { return m_file == nullptr; }
/** Continue with a different XOR key */
void SetXor(std::vector<std::byte> data_xor) { m_xor = data_xor; }
/** Implementation detail, only used internally. */
std::size_t detail_fread(Span<std::byte> dst);