#ifndef TILE_BASE_COMPRESSION_H
#define TILE_BASE_COMPRESSION_H

#pragma once

#include "tile/base/compression/compression.h"
#include "tile/base/optional.h"
#include "tile/base/slice.h"

namespace tile {
std::unique_ptr<Decompressor> MakeDecompressor(Slice name);
std::unique_ptr<Compressor> MakeCompressor(Slice name);

std::optional<NoncontiguousBuffer> Compress(Compressor *compressor, const NoncontiguousBuffer &nb);
std::optional<NoncontiguousBuffer> Compress(Compressor *compressor, Slice body);

bool Compress(Compressor *compressor, const NoncontiguousBuffer &nb, NoncontiguousBufferBuilder *builder);

bool Compress(Compressor *compressor, Slice body, NoncontiguousBufferBuilder *builder);

std::optional<NoncontiguousBuffer> Decompress(Decompressor *decompressor, const NoncontiguousBuffer &body);
std::optional<NoncontiguousBuffer> Decompress(Decompressor *decompressor, Slice body);

bool Decompress(Decompressor *decompressor, const NoncontiguousBuffer &nb, NoncontiguousBufferBuilder *builder);
bool Decompress(Decompressor *decompressor, Slice body, NoncontiguousBufferBuilder *builder);

}// namespace tile

#endif// TILE_BASE_COMPRESSION_H
