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