lix-releng-staging/src/libutil/compression.hh

31 lines
772 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
{
using BufferedSink::operator ();
using BufferedSink::write;
using FinishSink::finish;
2016-05-04 13:46:25 +00:00
};
std::string decompress(const std::string & method, std::string_view in);
2019-12-10 08:47:38 +00:00
std::unique_ptr<FinishSink> makeDecompressionSink(const std::string & method, Sink & nextSink);
std::string compress(const std::string & method, std::string_view in, const bool parallel = false, int level = -1);
ref<CompressionSink> makeCompressionSink(const std::string & method, Sink & nextSink, const bool parallel = false, int level = -1);
2016-05-04 13:46:25 +00:00
MakeError(UnknownCompressionMethod, Error);
MakeError(CompressionError, Error);
}