Lightweight 0.20251202.0
Loading...
Searching...
No Matches
MsgPackChunkFormats.hpp
1// SPDX-License-Identifier: Apache-2.0
2#pragma once
3
4#include "../Api.hpp"
5#include "SqlBackupFormats.hpp"
6
7#include <iosfwd>
8#include <memory>
9
10namespace Lightweight::SqlBackup
11{
12
13/// Factory for creating chunk writers.
14LIGHTWEIGHT_API std::unique_ptr<ChunkWriter> CreateMsgPackChunkWriter(size_t limitBytes = 10 * 1024 * 1024);
15
16/// Factory for creating chunk readers.
17LIGHTWEIGHT_API std::unique_ptr<ChunkReader> CreateMsgPackChunkReader(std::istream& input);
18
19/// Factory for creating chunk readers from an existing buffer (zero-copy).
20///
21/// This variant avoids copying the buffer into the reader, reducing memory usage
22/// during restore operations. The caller must ensure the buffer remains valid
23/// for the lifetime of the reader.
24///
25/// @param buffer The buffer containing MsgPack data to read from.
26/// @return A unique pointer to the chunk reader.
27LIGHTWEIGHT_API std::unique_ptr<ChunkReader> CreateMsgPackChunkReaderFromBuffer(std::span<uint8_t const> buffer);
28
29} // namespace Lightweight::SqlBackup