nix-super/src/libutil/compression.hh

32 lines
791 B
C++
Raw Normal View History

#pragma once
///@file
#include "ref.hh"
#include "types.hh"
2016-05-04 16:46:25 +03:00
#include "serialise.hh"
#include <string>
namespace nix {
2019-12-10 10:47:38 +02:00
struct CompressionSink : BufferedSink, FinishSink
2016-05-04 16:46:25 +03:00
{
using BufferedSink::operator ();
using BufferedSink::writeUnbuffered;
using FinishSink::finish;
2016-05-04 16:46:25 +03:00
};
std::string decompress(const std::string & method, std::string_view in);
2019-12-10 10:47:38 +02: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 16:46:25 +03:00
MakeError(UnknownCompressionMethod, Error);
MakeError(CompressionError, Error);
}