#pragma once
#include <whiteout/common_types.h>
#include <array>
#include <optional>
#include <span>
#include <vector>
namespace whiteout::storages::casc {
struct IndexLocation {
u32 archiveIndex = 0;
u64 offset = 0;
u32 encodedSize = 0;
bool directBLTE = false; };
class DataSource {
public:
virtual ~DataSource() = default;
virtual std::vector<u8> fetchBlte(const std::array<u8, 16>& eKey) = 0;
virtual std::vector<u8> fetchBlte(u32 archiveIndex, u64 offset, u32 encodedSize) = 0;
virtual std::vector<u8> fetchBlte(const IndexLocation& loc) {
return fetchBlte(loc.archiveIndex, loc.offset, loc.encodedSize);
}
virtual std::optional<IndexLocation> findInIndex(std::span<const u8> eKeyPrefix) const = 0;
};
}