d3761f5f8b
This didn't work anymore since decompression was only done in the non-coroutine case. Decompressors are now sinks, just like compressors. Also fixed a bug in bzip2 API handling (we have to handle BZ_RUN_OK rather than BZ_OK), which we didn't notice because there was a missing 'throw': if (ret != BZ_OK) CompressionError("error while compressing bzip2 file");
29 lines
670 B
C++
29 lines
670 B
C++
#pragma once
|
|
|
|
#include "ref.hh"
|
|
#include "types.hh"
|
|
#include "serialise.hh"
|
|
|
|
#include <string>
|
|
|
|
namespace nix {
|
|
|
|
struct CompressionSink : BufferedSink
|
|
{
|
|
virtual void finish() = 0;
|
|
};
|
|
|
|
ref<std::string> decompress(const std::string & method, const std::string & in);
|
|
|
|
ref<CompressionSink> 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);
|
|
|
|
MakeError(UnknownCompressionMethod, Error);
|
|
|
|
MakeError(CompressionError, Error);
|
|
|
|
}
|