2015-10-30 13:33:40 +02:00
|
|
|
#pragma once
|
2023-04-01 06:18:41 +03:00
|
|
|
///@file
|
2015-10-30 13:33:40 +02:00
|
|
|
|
2016-04-15 16:11:34 +03:00
|
|
|
#include "ref.hh"
|
2016-04-29 18:02:57 +03:00
|
|
|
#include "types.hh"
|
2016-05-04 16:46:25 +03:00
|
|
|
#include "serialise.hh"
|
2016-04-15 16:11:34 +03:00
|
|
|
|
2015-10-30 13:33:40 +02:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
2019-12-10 10:47:38 +02:00
|
|
|
struct CompressionSink : BufferedSink, FinishSink
|
2016-05-04 16:46:25 +03:00
|
|
|
{
|
2024-03-30 00:29:22 +02:00
|
|
|
using BufferedSink::operator();
|
2023-04-07 10:16:40 +03:00
|
|
|
using BufferedSink::writeUnbuffered;
|
2021-04-15 14:51:00 +03:00
|
|
|
using FinishSink::finish;
|
2016-05-04 16:46:25 +03:00
|
|
|
};
|
|
|
|
|
2022-01-17 23:20:05 +02:00
|
|
|
std::string decompress(const std::string & method, std::string_view in);
|
2018-08-06 16:40:29 +03:00
|
|
|
|
2019-12-10 10:47:38 +02:00
|
|
|
std::unique_ptr<FinishSink> makeDecompressionSink(const std::string & method, Sink & nextSink);
|
2018-08-06 16:40:29 +03:00
|
|
|
|
2022-01-17 23:20:05 +02:00
|
|
|
std::string compress(const std::string & method, std::string_view in, const bool parallel = false, int level = -1);
|
2018-08-06 16:40:29 +03:00
|
|
|
|
2024-03-30 00:29:22 +02:00
|
|
|
ref<CompressionSink>
|
|
|
|
makeCompressionSink(const std::string & method, Sink & nextSink, const bool parallel = false, int level = -1);
|
2016-05-04 16:46:25 +03:00
|
|
|
|
2016-04-29 18:02:57 +03:00
|
|
|
MakeError(UnknownCompressionMethod, Error);
|
2015-10-30 13:33:40 +02:00
|
|
|
|
2017-03-21 20:23:07 +02:00
|
|
|
MakeError(CompressionError, Error);
|
|
|
|
|
2015-10-30 13:33:40 +02:00
|
|
|
}
|