#pragma once
#include <whiteout/common_types.h>
#include <whiteout/interfaces.h>
#include <span>
#include <string>
#include <vector>
namespace whiteout::storages::casc {
class KeyRing;
struct BlteDecodeResult {
std::vector<u8> data; bool success = false;
std::string error;
};
BlteDecodeResult blteDecode(std::span<const u8> blteData, const KeyRing* keys = nullptr,
interfaces::WorkerPool* pool = nullptr);
struct BlteFrameLayout {
struct Frame {
u32 compressedSize;
u32 uncompressedSize; };
std::vector<Frame> frames;
std::vector<size_t> offsets;
bool valid = false;
std::string error;
};
BlteFrameLayout blteParseFrameLayout(std::span<const u8> blteData);
struct BlteBatchResult;
BlteBatchResult blteDecodeFrame(std::span<const u8> blteData, const BlteFrameLayout& layout,
size_t frameIdx, const KeyRing* keys = nullptr);
struct BlteBatchEntry {
std::span<const u8> blteData; };
struct BlteBatchResult {
std::vector<u8> data;
bool success = false;
std::string error;
};
std::vector<BlteBatchResult> blteDecodeBatch(std::span<const BlteBatchEntry> entries,
const KeyRing* keys = nullptr,
interfaces::WorkerPool* pool = nullptr);
struct BlteEncodeOptions {
u32 frameSize = 0x10000; bool compress = true; };
std::vector<u8> blteEncode(std::span<const u8> rawData, const BlteEncodeOptions& opts = {},
interfaces::WorkerPool* pool = nullptr);
}