aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/compression.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-08-06 15:40:29 +0200
committerEelco Dolstra <edolstra@gmail.com>2018-08-06 15:40:29 +0200
commitd3761f5f8bce1e4c8dcfdff3fa77c173157c0346 (patch)
tree1dae65410f1977d58ad7aa7741121cbe74c33da3 /src/libutil/compression.hh
parentfa4def3d4675c8b2d6aacb56959dbbf9e52df66a (diff)
Fix Brotli decompression in 'nix log'
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");
Diffstat (limited to 'src/libutil/compression.hh')
-rw-r--r--src/libutil/compression.hh12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libutil/compression.hh b/src/libutil/compression.hh
index f7a3e3fbd..dd666a4e1 100644
--- a/src/libutil/compression.hh
+++ b/src/libutil/compression.hh
@@ -8,17 +8,17 @@
namespace nix {
-ref<std::string> decompress(const std::string & method, const std::string & in);
-
-void decompress(const std::string & method, Source & source, Sink & sink);
-
-ref<std::string> compress(const std::string & method, const std::string & in, const bool parallel = false);
-
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);