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