A fork of attic a self-hostable Nix Binary Cache server
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

server/compression: Don't wrap HashReader output stream in BufReader

Now it implements AsyncBufRead if the inner stream also implements
it.

+3 -3
+3 -3
server/src/compression.rs
··· 2 2 3 3 use digest::Output as DigestOutput; 4 4 use sha2::{Digest, Sha256}; 5 - use tokio::io::{AsyncBufRead, AsyncRead, BufReader}; 5 + use tokio::io::{AsyncBufRead, AsyncRead}; 6 6 use tokio::sync::OnceCell; 7 7 8 8 use attic::io::HashReader; ··· 38 38 39 39 impl CompressionStream { 40 40 /// Creates a new compression stream. 41 - pub fn new<R>(stream: R, compressor: CompressorFn<BufReader<HashReader<R, Sha256>>>) -> Self 41 + pub fn new<R>(stream: R, compressor: CompressorFn<HashReader<R, Sha256>>) -> Self 42 42 where 43 43 R: AsyncBufRead + Unpin + Send + 'static, 44 44 { ··· 46 46 let (stream, nar_compute) = HashReader::new(stream, Sha256::new()); 47 47 48 48 // compress NAR 49 - let stream = compressor(BufReader::new(stream)); 49 + let stream = compressor(stream); 50 50 51 51 // compute file hash and size 52 52 let (stream, file_compute) = HashReader::new(stream, Sha256::new());