lix/src/libutil/compression.hh

33 lines
812 B
C++
Raw Normal View History

#pragma once
#include "ref.hh"
#include "types.hh"
2016-05-04 13:46:25 +00:00
#include "serialise.hh"
#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);
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);
ref<std::string> compress(const std::string & method, const std::string & in, const bool parallel = false);
ref<CompressionSink> makeCompressionSink(const std::string & method, Sink & nextSink, const bool parallel = false);
2016-05-04 13:46:25 +00:00
MakeError(UnknownCompressionMethod, Error);
MakeError(CompressionError, Error);
}